neurobin / shc

Shell script compiler
https://neurobin.org/projects/softwares/unix/shc/
GNU General Public License v3.0
2.04k stars 349 forks source link

Argument list too long (maybe caused by a bunch of commented lines) #149

Open MdeLv opened 1 year ago

MdeLv commented 1 year ago

debian11 bash 5.1.4(1) The program (in bash) is 3500 lines.

Error message: Argument list too long: /bin/bash

Cause detected: approx 100 bash commented lines (#) Once deleted, shc works again.

Is any limitation reached? (just 3500 lines) Or is there another cause?

I suppose that shc drop all comments when building the executable, so there may be another cause. What is weird is that shc has been working for weeks before that with these commented lines. I tried to delete added functions but that's only deleting these 100 commented lines that fixed the trouble.

Thanks.

MdeLv commented 1 year ago

Once again, I got the error message: "Argument list too long: /bin/bash", also solved with deleting commented lines. However, this was not added commented lines. I just added normal loc.

What triggers the error message is still unknown.

Any idea for finding the root cause?

MdeLv commented 1 year ago

Well... In order to not getting this "Argument list too long: /bin/bash" error, you need not too many commented lines in your bash script. The exact number and place of these comments that trigger this error are unknown...

Can the author give hints about how to avoid this error? Thanks.

anandslab commented 1 year ago

@MdeLv Hi, did you ever find a fix for this? I am having the same problem. Tried deleting all comments but no dice.

MdeLv commented 1 year ago

I don't know what can cause "Argument list too long". Deleting enough comments (but not all) was enough in my case.

Maybe you have also some syntax error? Have you tried to use some lint tool to check that? Or you can "compile" parts/modules of your program for detecting which part may trigger that error?

chenzhch commented 6 months ago

This is because sh c cannot exceed the ARG-MAX value. You need to try shellc to solve the problem of script file size

mdeweerd commented 3 months ago

A new option -Pis proposed in #153 which pipes the script and solves the limit of size.