piggy@GARGOYLE.UCHICAGO.EDU (10/25/89)
Bash refuses to execute the following script:
#!/bin/sh
echo "[1r" > /dev/console
It terminates with this error message:
/usr/local/bin/bash: Cannot execute binary file
It gave the same error without the #!/bin/sh, but this was not
unexpected. I made the following changes to execute_cmd.c:
838,847c838,854
< for (i = 0; i < sample_len; i++)
< {
< if (sample[i] == '\n')
< break;
< if (sample[i] > 128 || sample[i] < ' ')
< {
< report_error ("%s: Cannot execute binary file", shell_name);
< exit (EXECUTION_FAILURE);
< }
< }
---
> /* Don't bother if this file has an */
> /* explicit shell. Note that if we */
> /* get a binary that starts with */
> /* "#!bash" we will catch it later. */
>
> if(strncmp(sample, "#!", 2) != 0){
> for (i = 0; i < sample_len; i++)
> {
> if (sample[i] == '\n')
> break;
> if (sample[i] > 128)
> {
> report_error ("%s: Cannot execute binary file", shell_name);
> exit (EXECUTION_FAILURE);
> }
> }
> }
I'm not too clear on how #! is handled. Is it really true that we
will catch a binary file starting with "#!/whatever/bash" later? In
any case, I think dropping the check for sample[i] < ' ' is warented.
There are also a few small bugs in the Makefile. In the rule for
clean: there was a $(LIBSRC) where I think a $(RLIBSRC) should have
been. The Makefile assumes that "." is in the current path (which in
my case is most certainly NOT the case). Invocations of
newversion.aux need to be written ./newversion.aux.
-- La Monte H. Yarroll
Preferred: piggy@gargoyle.uchicago.edu