Apparent bug in 'make': hyphen treated as delimiter in $PATH

Fred Yankowski fcy at iham1.UUCP
Fri Jan 18 01:52:47 AEST 1985


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



More information about the Net.bugs.usg mailing list