Date: Sun, 27 Oct 2002 09:17:11 GMT 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: <200210270917.g9R9HBas028752@dotar.thuvia.org> In-Reply-To: <200210262224.g9QMO4pw026010@khavrinen.lcs.mit.edu>
index | next in thread | previous in thread | raw e-mail
> From: Garrett Wollman <wollman@lcs.mit.edu> > Date: Sat 26 Oct, 2002 > Subject: Re: /usr/posix: a first cut > <<On Sat, 26 Oct 2002 22:15:40 +0100 (BST), Mark Valentine <mark@thuvia.demon.co.uk> said: > > > Portable != POSIX (despite all the good POSIX does for steering everyone > > in the same direction eventually). > > Quite to the contraty. POSIX, and other formal standards, define the > behavior portable applications can expect. No, POSIX defines the behaviour POSIX applications can expect. It also defines some of the common ground which can be expected by *portable* applications, increasingly so as time goes by (we hope). > An application which > contains work-arounds for non-standard systems is merely ported, not > necessary portable. _Every_ system is non-standard. I'd sure like my scripts to run on at least some of them. Portability to me is increasing the likelihood that a script will work on diverse platforms with little or no modification. It takes a very perverse vendor to make my scripts have less chance of running on the next release of their system than it has of running on a system I've never tried before (as is most definitely the case for FreeBSD 5.0 in its current state). > > Sheesh, FreeBSD 4.7 doesn't even _have_ getconf(1), > > FreeBSD 4.7 doesn't claim compliance to POSIX.2, so all bets are off. > A script can only hope that the PATH includes utilities which do the > right thing. I think that's what I said earlier... > > and Solaris 9 /bin/sh > > still doesn't support $(foo). > > That's because the only POSIX-compliant shell on Solaris is called > `/usr/xpg4/bin/sh'. Yes, and a "portable" script which has not been "ported" to Solaris can't know how to get that environment. Once getconf is more widely available this will be easier (but a portable #!/bin/sh script still has to exec a new shell to get the standard environment). > The Standard defines a self-consistent environment, and a way > (`getconf -p PATH') for any script to ensure that it gets it. Ah, thanks. My changes now add /usr/posix[/bin] to the start of _PATH_STDPATH in <paths.h>. I'll also update posix(7) to include this information. > > % env PATH=/bin:/usr/bin expr -1 + 2 > > 1 > > Examples should be given in Standard (i.e., Bourne Shell) syntax. OK, ta. I'll use "PATH=/bin/usr/bin expr ..." and "PATH=$(getconf PATH) expr ..." (or should the former just be "expr ..."?). > In any case, this is a red herring, since the expr(1) manual page gives > generous advice as to how to use the `expr' command in a way which > will work identically on both pre-POSIX and POSIX-standard `expr' > implementations. The intention is not to document expr(1), but to illustrate the difference between the POSIX and default environments. Can you suggest a better example? > Rather than pile kluge on top of hack on top of > bogus workaround, just fix your scripts. My scripts work just fine, even on ancient systems such as FreeBSD 4.7. I will port them to FreeBSD 5.0 as needed (but it would be nice if they just worked like they did on old FreeBSD systems, modulo real portability bugs). 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 messagehelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210270917.g9R9HBas028752>
