🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by piggy Wed, 25 Oct 1989 15:07
bash 1.03 will not execute valid shell script, w/fix
#678
Author: piggy
Date: Wed, 25 Oct 1989 15:07
53 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads