Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!gamma!exodus!mhtsa!mh3bs!eagle!harpo!seismo!hao!hplabs!sri-unix!gwyn@brl-vld
From: gwyn%brl-vld@sri-unix.UUCP
Newsgroups: net.unix-wizards
Subject: Gross bug in System V make
Message-ID: <17548@sri-arpa.UUCP>
Date: Wed, 14-Mar-84 12:18:06 EST
Article-I.D.: sri-arpa.17548
Posted: Wed Mar 14 12:18:06 1984
Date-Received: Sun, 18-Mar-84 08:19:00 EST
Lines: 27

From:      Doug Gwyn (VLD/VMB) 

In UNIX System V (Release 1.0) "make" there is a horrible bug that is
masked by a freak accident.  The bug surfaced as a side-effect of
de-linting the source code.  Ron Natalie was the first victim of the
newly-awakened bug.

Source file dosys.c, in routine doexec(), allocates auto variables:
	CHARSTAR argv[200];
	int status;
where `status' is not actually used and `argv' is used to assemble
arguments to be passed in a call to execvp().  In source file misc.c,
"make" provides its own version of execvp() in order to handle execv()
errors; in particular, when an ENOEXEC occurs make's execvp() does
something like
	*--argv = "sh";
	execv(shell, argv);
to run the (assumed) shell script.  HOWEVER, note that decrementing
argv is really stupid.  On the PDP-11 and the VAX the result is to
stuff a pointer to "sh" into `status' in doexec()!  If it weren't
for the coincidence that `status' wasn't being used for anything
worthwhile anyway, this bug would have turned up long ago.

I have a quick patch for this bug and several others.  Would the
USG "make" maintainers please get in touch with me.

Yuck!