if hush reaches EOF on an invalid script, it does not throw an error but rather exits quietly i imagine this is because it wants to be nice when running in interactive mode, but bash will throw up on you in this case, so we might as well too example: $ echo '(' > test.sh $ bash ./test.sh ; echo $? ./test.sh: line 2: syntax error: unexpected end of file 2 $ hush ./test.sh ; echo $? 0 same behavior can be seen in interactive mode even worse, we segfault when using -c: $ hush -c '(' Segmentation fault i think this is the fix for that case: --- shell/hush.c (revision 25863) +++ shell/hush.c (working copy) @@ -1024,7 +1024,9 @@ */ static int static_get(struct in_str *i) { - int ch = *i->p++; + int ch; + if (!i->p) return EOF; + ch = *i->p++; if (ch == '\0') return EOF; return ch; }
Created attachment 285 [details] Fix Try attached patch please
Pushed to git: [master b1cfc45] hush: fix handling of unterminated subshell: (<eof>. Fixes bug 229.