Subject: Re: why does /bin have to be *first* in the PATH?
From: [email-masked] (Fergus Henderson)

5 Dec 1996 14:20:14 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Content-Type: text
Original-To: [email-masked] (Doug Evans)
Original-Cc: [email-masked] (gnu-win32)
In-Reply-To: <[email-masked]> from "Doug Evans" at Dec 5, 96 12:26:28 pm
X-Mailer: ELM [version 2.4 PL24]
Original-Sender: [email-masked]

Doug Evans wrote:
> 
> [Fergus wrote:]
>    I have programs that rely on the ability to do
> 
> 	   PATH=../scripts:$PATH some_script
> 
>    This breaks in gnu-win32 version b16.
> 
> Having /bin be first in PATH was a workaround to a
> bug that has since been fixed [or at least was fixed at one point].

Well, b16 still requires /bin be first.

Here's how to reproduce the bug:

	$ cd /tmp
	$ cat > foo <<EOF
	> #!/bin/sh
	> echo "this is foo"
	> EOF
	$ cat > Makefile <<EOF
	> do_foo:
	> ./foo
	> EOF
	$ PATH=/bin:$PATH make do_foo
	this is foo
	$ PATH=/blah:/bin:$PATH make do_foo
	./foo
	make: ./foo: Command not found
	make: *** [do_foo] Error 127

Specifically, if `/bin' is not first, and you invoke execve() on a
shell script (as `make' does in the above example) then the call to
`find_exec ("sh", ...)' in spawn.cc fails to expand "sh" to
"/bin/sh".

-- 
Fergus Henderson <[email-masked]>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger [email-masked]         |     -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".