Gentoo Archives: gentoo-dev

From: Peter Volkov <pva@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] /{"", usr/}bin path changed. What is the right solution for scripts?
Date: Mon, 02 Apr 2007 10:47:28
Message-Id: 1175510546.23726.53.camel@localhost
In Reply to: Re: [gentoo-dev] /{"", usr/}bin path changed. What is the right solution for scripts? by Alec Warner
1 On Sun, 2007-04-01 at 16:21 +0100, Ciaran McCreesh wrote:
2 > env not being in /usr/bin will break an awful lot of stuff. It's listed
3 > in many textbooks as being the safe way of doing things.
4
5 On Sun, 2007-04-01 at 08:46 -0700, Alec Warner wrote:
6 > However using env really only makes sense in the
7 >
8 > #!/usr/bin/env foo
9 >
10 > case. Pretty much every other case you should be setting PATH to
11 > something proper in your script.
12
13 Thank you for remarks.
14
15 BTW. Looking into sources I found that env itself does not have default
16 PATH but calls execvp () which have VERY reduced PATH=":/bin:/usr/bin" .
17
18 command -p by default in bash uses the following
19 PATH /bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc
20
21 So I think as there is no standard on what is the default PATH the most
22 viable solution is to set default PATH in the script itself.
23
24 --
25 Peter.

Attachments

File name MIME type
signature.asc application/pgp-signature