Date: Sat, 26 Oct 2002 22:15:40 +0100 (BST) From: Mark Valentine <mark@thuvia.demon.co.uk> To: Garrett Wollman <wollman@lcs.mit.edu> Cc: freebsd-standards@freebsd.org Subject: Re: /usr/posix: a first cut Message-ID: <200210262115.g9QLFeCw014715@dotar.thuvia.org> In-Reply-To: <200210262036.g9QKadk2025534@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> From: Garrett Wollman <wollman@lcs.mit.edu>
> Date: Sat 26 Oct, 2002
> Subject: Re: /usr/posix: a first cut
> Actually, portable scripts do the following:
>
> PATH=$(command -p getconf PATH)
>
> and should never supply explicit paths to the Standard Utilities
> (unless it cares to go to the effort of emulating execve() all by
> itself).
Eek!
Portable != POSIX (despite all the good POSIX does for steering everyone
in the same direction eventually).
My portable scripts use neither $(anything) nor getconf. Maybe next
century...
Sheesh, FreeBSD 4.7 doesn't even _have_ getconf(1), and Solaris 9 /bin/sh
still doesn't support $(foo).
> So any move to create a ghetto for Standard-compliant utilities must
> perforce update the Standard Path to put the directory containing the
> Standard utilities first.
OK, you're right that there should be a way to get a Standard environment
(as opposed the default as-near-as-possible-but-still-BSD-when-it-comes-
to-the-crunch environment).
So posix(7) should state something like:
The default FreeBSD command environment is as close as possible
to POSIX.1 without introducing backwards compatibility issues.
In order to set up a more complete POSIX-compliant environment,
it is sufficient to place /usr/posix at the start of your PATH
(or at least before /bin and /usr/bin).
NOTE: placing /usr/posix early in your PATH may adversely effect
any non-POSIX utilities you cause to run, and is not intended for
general use.
EXAMPLES
% env PATH=/bin:/usr/bin expr -1 + 2
1
% env PATH=/bin:/usr/bin expr -- hello : '.*'
expr: syntax error
% env PATH=/usr/posix:/bin:/usr/bin expr -1 + 2
expr: illegal option -- 1
usage: expr [-e] expression
% env PATH=/usr/posix:/bin:/usr/bin expr -- hello : '.*'
5
SEE ALSO
environ(7)
Cheers,
Mark.
--
Mark Valentine, Thuvia Labs <mark@thuvia.co.uk> <http://www.thuvia.co.uk>
"Tigers will do ANYTHING for a tuna fish sandwich." Mark Valentine uses
"We're kind of stupid that way." *munch* *munch* and endorses FreeBSD
-- <http://www.calvinandhobbes.com> <http://www.freebsd.org>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210262115.g9QLFeCw014715>
