| delorie.com/archives/browse.cgi | search |
| From: | fjh AT cs DOT mu DOT OZ DOT AU (Fergus Henderson) |
| Subject: | Re: why does /bin have to be *first* in the PATH? |
| 5 Dec 1996 14:20:14 -0800 : | |
| Sender: | daemon AT cygnus DOT com |
| Approved: | cygnus DOT gnu-win32 AT cygnus DOT com |
| Distribution: | cygnus |
| Message-ID: | <199612052051.HAA27235.cygnus.gnu-win32@murlibobo.cs.mu.OZ.AU> |
| Original-To: | dje AT cygnus DOT com (Doug Evans) |
| Original-Cc: | gnu-win32 AT cygnus DOT com (gnu-win32) |
| In-Reply-To: | <199612052026.MAA19781@canuck.cygnus.com> from "Doug Evans" at Dec 5, 96 12:26:28 pm |
| X-Mailer: | ELM [version 2.4 PL24] |
| Original-Sender: | owner-gnu-win32 AT cygnus DOT com |
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 <fjh AT cs DOT mu DOT oz DOT au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh AT 128 DOT 250 DOT 37 DOT 3 | -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |