Article View: gnu.bash.bug
Article #678bash 1.03 will not execute valid shell script, w/fix
From: piggy
Date: Wed, 25 Oct 1989 15:07
Date: Wed, 25 Oct 1989 15:07
53 lines
2150 bytes
2150 bytes
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
Technical Details
Message-ID:
<8910251507.AA07161@gargoyle.uchicago.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!GARGOYLE.UCHICAGO.EDU!piggyShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!GARGOYLE.UCHICAGO.EDU!piggy From: piggy@GARGOYLE.UCHICAGO.EDU Newsgroups: gnu.bash.bug Subject: bash 1.03 will not execute valid shell script, w/fix Message-ID: <8910251507.AA07161@gargoyle.uchicago.edu> Date: 25 Oct 89 15:07:40 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 53