Path: utzoo!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
From: bfox@AUREL.CALTECH.EDU (Brian Fox)
Newsgroups: gnu.bash.bug
Subject: Does anyone have bash working on System V?
Message-ID: <8909221504.AA01392@aurel.caltech.edu>
Date: 22 Sep 89 15:04:18 GMT
References: <512@banyan.UUCP>
Reply-To: bfox@aurel.caltech.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 64


   Date: 20 Sep 89 18:04:45 GMT
   From: spdcc!merk!xylogics!cloud9!banyan!tim@bu-cs.bu.edu  (Tim Henrion@Eng@Banyan)
   References: <1055@polari.UUCP>
   Sender: bug-bash-request@prep.ai.mit.edu

   I've got bash 1.03 to work, for the most part, on our SYSV.3.2
   implementation. There are a few problems (a lot of them non-SYSV
   dependent).

	   1) A lot of the source files that have conditional (#ifdef)
	      code DON'T INCLUDE "config.h" (like parse.y)! You have to
	      fix this for files that need it

Huh?  Parse.y includes shell.h, which includes config.h.

   The only remaining problem I have is that it barfs sometimes trying
   to execute shell scripts. I think the error message is:
	   bash: can't execute binary file
   or something like that. I'll see if I can find that one soon.

It could be that the scripts have a TAB within the first line.  I
examine the script to see if it is executable or not, but I had
forgotten this case.

execute_cmd.c: execute_simple_command ()


		      /* This file is executable.
			 Check to see if it is a binary file by seeing
			 if the first line (or upto 30 characters) are
			 in the ASCII set.
			 Execute the contents as shell commands. */
		      extern char *shell_name;
		      int larry = array_len (args) + 1;
		      int i;

		      {
			int fd = open (command, O_RDONLY);
			if (fd != -1)
			  {
			    unsigned char sample[30];
			    int sample_len = read (fd, &sample[0], 29);

			    if (sample_len != -1)
			      {
				for (i = 0; i < sample_len; i++)
				  {
				    if (sample[i] == '\n')
				      break;
				    if (sample[i] > 128 || sample[i] < ' ')
				      {
					if (sample[i] == '\t')
					  continue;

					report_error ("%s: Cannot execute binary file", shell_name);
					exit (EXECUTION_FAILURE);
				      }
				  }
			      }
			    close (fd);
			  }
		      }
Brian Fox