-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
running shc compiled binary in different shell #36
Comments
Thanks, it is fixed now. |
Is it fixed ? Unfortunately this "fix" causes a regression on my system (Fedora). When running a script with "sudo", then I'll be getting this kind of errors: -bash-4.4$ sudo toucher.sh I had to revert to the shc version before this "fix" to have shc behave normally again. |
@Patronos : can you provide a little more details? |
Puhhh..... Where to start.... Ok! I have an automated script, that shc compiles my bash scripts and stores them into /etc/bin (bash and sudo configs are extended to search (PATH) in this folder). After that I use UPX (an executable packer) to pack the resulting executables to save some space (while space is not the true argument here). Please accept the fact that I do this. One of my scripts (called toucher.sh) ran into the issue as show above, when using shc 3.9.5 (the one that has the swapped argv[0] and getenv patch applied)... By the way, shc has been compiled and stripped (strip shc) and placed into /bin/ (overwriting the old 3.9.4 one). I ran my script again to re-create all the bash scripts again and ran into the same issue again! Then I switched back to shc 3.9.4 and the issues has been gone. Everything worked like a charm... All scripts properly execute... Now after you responed to me to give you more feedback I started trying to re-produce everything step by step to isolate the issue... This time the script worked. shc has produced a working version.. Then I re-created it again and figured out that sometimes the script works and executes and sometimes it returns the exec (null) issue... Then I left the upx packing process out... So only shc processes the file... But it is quite late right now and I don't feel to continue testing today... All I can offer so far is a small snipplet of my bash script that generates the shc file and upx crunches them. This also includes the GCC flags I've been using... Unfortunately I've not been able to reproduce the issue with this example script... Still interesting why the toucher.sh one fails with the error above... The only thing I can say right now is: that if I go back to 3.9.4 the issues are all gone... I will investigate more tomorrow and report back... For now have a look at the attachment... Please rename test.txt to test.sh |
Yes this did the trick! Thanks! shc 3.9.5 -bash-4.4$ sudo toucher.sh shc 3.9.4 -bash-4.4$ sudo toucher.sh Both scripts has been compiled using the same arguments gcc opts, shc flags, upx flags as shown in the test script above. |
I'm having problem running shc compiled binary in a different shell. Here's my simple example shell script. The compiled binary runs fine in bash and zsh, but doesn't produce any output in other shell, such as csh.
I wonder if this is a known limitation of shc approach. Here's more output with debug option turned on.
The text was updated successfully, but these errors were encountered: