From owner-freebsd-standards Sun Oct 27 1:17:19 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A9FE37B401 for ; Sun, 27 Oct 2002 01:17:16 -0800 (PST) Received: from thuvia.demon.co.uk (thuvia.demon.co.uk [193.237.34.248]) by mx1.FreeBSD.org (Postfix) with ESMTP id A9D8043E6A for ; Sun, 27 Oct 2002 01:17:14 -0800 (PST) (envelope-from mark@thuvia.demon.co.uk) Received: from dotar.thuvia.org (dotar.thuvia.org [10.0.0.4]) by phaidor.thuvia.org (8.12.3/8.12.3) with ESMTP id g9R9HCcF055922; Sun, 27 Oct 2002 09:17:12 GMT (envelope-from mark@thuvia.demon.co.uk) Received: from dotar.thuvia.org (localhost [IPv6:::1]) by dotar.thuvia.org (8.12.6/8.12.6) with ESMTP id g9R9HBH5028753; Sun, 27 Oct 2002 09:17:11 GMT (envelope-from mark@dotar.thuvia.org) Received: (from mark@localhost) by dotar.thuvia.org (8.12.6/8.12.6/Submit) id g9R9HBas028752; Sun, 27 Oct 2002 09:17:11 GMT Date: Sun, 27 Oct 2002 09:17:11 GMT From: Mark Valentine Message-Id: <200210270917.g9R9HBas028752@dotar.thuvia.org> In-Reply-To: <200210262224.g9QMO4pw026010@khavrinen.lcs.mit.edu> X-Mailer: Mail User's Shell (7.2.6 beta(5) 10/07/98) To: Garrett Wollman Subject: Re: /usr/posix: a first cut Cc: freebsd-standards@freebsd.org Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > From: Garrett Wollman > Date: Sat 26 Oct, 2002 > Subject: Re: /usr/posix: a first cut > < 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 . 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 "Tigers will do ANYTHING for a tuna fish sandwich." Mark Valentine uses "We're kind of stupid that way." *munch* *munch* and endorses FreeBSD -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message