bug in Sys V 2.0 /bin/sh

Tony Luck aegl at root44.UUCP
Wed Dec 12 06:04:47 AEST 1984


The system V release 2.0 shell has introduced a bug that means that the
following:
		$ zzzzz ; echo hello
produces the message:
		zzzzz: not found
rather than the expected:
		zzzzz: not found
		hello
The problem is that after deciding that the command does not exist 'failed()'
is called which after printing diagnostics calls 'exitsh()' which 'longjmp()'s
back to main() without attempting to execute the rest of the current list.

In xec.c at about line 112 change:
-------------------------------------------------------------------------------
					if (comtype == NOTFOUND)
					{
						pos = hashdata(cmdhash);
						if (pos == 1)
							failed(*com, notfound);
						else if (pos == 2)
							failed(*com, badexec);
						else
							failed(*com, badperm);
						break;
					}
-------------------------------------------------------------------------------

to read:
-------------------------------------------------------------------------------
					if (comtype == NOTFOUND)
					{
						char *errstr;

						pos = hashdata(cmdhash);
						if (pos == 1)
							errstr = notfound;
						else if (pos == 2)
							errstr = badexec;
						else
							errstr = badperm;
						prp();
						prs_cntl(*com);
						prs(colon);
						prs(errstr);
						newline();
						exitval = 1;
						break;
					}
-------------------------------------------------------------------------------

Tony Luck	{ucbvax!unisoft,mcvax!ukc}!root44!aegl



More information about the Net.bugs.usg mailing list