[net.bugs.usg] Apparent bug in 'make': hyphen treated as delimiter in $PATH

fcy@iham1.UUCP (Fred Yankowski) (01/17/85)

The standard SVR2 'make' command ("/bin/make") has a bug/misfeature
that arises when directories in ones $PATH contain a hyphen '-' in
their name.  When 'make' attempts to execute a command that does not
contain any /bin/sh constructs (e.g., '|', '>', '`') and does not
have a '/' in the command name, it calls a built-in version
of 'execvp()' which attempts to execute the command (via 'exec(2)')
by constructing a full pathname from successive elements in $PATH
and the supplied basename.  The problem is that both ':' and '-' are
treated as separators in $PATH; consequently a
$PATH like
	/bin:/user1/foo-bar/bin
is treated as if it contains three directories --
	/bin
	/user1/foo
	bar/bin
-- and any commands in /user1/foo-bar/bin are unreachable by 'make'.

This is particularly annoying since the local administrators have
taken to putting non-standard software (such as that for the DMD
5620) under the "/usr/add-on" directory, which contains the deadly
hyphen.

The offending code can be found in "/usr/src/cmd/make/misc.c" in the
functions 'execvp()' and 'execat()'.


    Fred Yankowski ::: AT&T Bell Laboratories ::: ihnp4!iham1!fcy

guy@rlgvax.UUCP (Guy Harris) (01/18/85)

> (A mention of the SVR2's "make" having a version of "execvp" which treats
> '-' as well as ':' as separators in $PATH, which causes nasty problems
> with directories whose names contain hyphens)

This problem also exists in the 4.2BSD version of "execvp" in the standard
C library.  I suspect it's a holdover from some old (pre-V7) system which
used '-' instead of ':' as a separator, and hasn't been completely expunged
from the system yet.  Beware - it may still be hiding somewhere...

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy

henry@utzoo.UUCP (Henry Spencer) (01/19/85)

Actually, this odd behavior in exec[vl]p was there in V7 (not just in
make, but in the C-library exec[vl]p), although it was undocumented.
One wonders whether SysVr2 "make" is persisting in this because somebody
within AT&T has become dependent on it.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry