[net.bugs.usg] bug in Sys V 2.0 /bin/sh

aegl@root44.UUCP (Tony Luck) (12/11/84)

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