NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: standards/42828: Almquist shell always evaluates the contents of ${ENV} even if non-interactive



The following reply was made to PR standards/42828; it has been noted by GNATS.

From: "Greg A. Woods" <woods%planix.ca@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: standards-manager%netbsd.org@localhost,
        rhansen%bbn.com@localhost
Subject: Re: standards/42828: Almquist shell always evaluates the contents of 
${ENV} even if non-interactive
Date: Wed, 03 Mar 2010 14:41:25 -0500

 --pgp-sign-Multipart_Wed_Mar__3_14:41:25_2010-1
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: quoted-printable
 
 At Wed,  3 Mar 2010 19:20:03 +0000 (UTC), "Greg A. Woods" 
<woods%planix.ca@localhost>=
  wrote:
 Subject: Re: standards/42828: Almquist shell always evaluates the contents =
 of ${ENV} even if non-interactive
 >=20
 >  Unfortunately this does not, or at least did not, work with /bin/sh (due
 >  to lack of support for arrays), but perhaps it should (support arrays,
 >  that is, despite them not being required by POSIX).  In fact I think the
 >  failure of POSIX to also include arrays in the shell is one of the
 >  reasons why the definition of ENV got bunged up, since without arrays
 >  the shell cannot support the de facto standard way of managing
 >  interactive vs. non-interactive ENV variants.
 
 Perhaps I should be more clear that the advantage to the trick using
 arrays in KSH is the following:
 
 >      # This magic expression prevents a non-interactive Ksh
 >      # instance from even trying to open and read any file.
 
 This same advantage is preserved with the strict POSIX requirements for
 $ENV, but it is lost entirely in NetBSD (at least without the recent fix
 and without POSIXLY_CORRECT being set).
 
 Worse, with default NetBSD behaviour not only must the shell try to open
 the file referenced by $ENV, it must also read possibly the entire
 contents and, if I'm not mistaken, parse much of what it reads as well.
 
 At least the POSIX requirement maintained the efficiency of not using
 $ENV for non-interactive shells, though it also destroys the possibility
 of using $ENV for non-interactive shells.
 
 With arrays both possibilities are easily and compatibly (to KSH at
 least, and perhaps Bash too) maintained without any necessary sacrifice
 to efficiency.
 
 --=20
                                                Greg A. Woods
                                                Planix, Inc.
 
 <woods%planix.com@localhost>       +1 416 218 0099        
http://www.planix.com/
 
 --pgp-sign-Multipart_Wed_Mar__3_14:41:25_2010-1
 Content-Type: application/pgp-signature
 Content-Transfer-Encoding: 7bit
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (NetBSD)
 
 iD8DBQBLjrtlZn1xt3i/9H8RAlWBAKDTF24+npxK2O74K2JPfLNui8/cgACfblIb
 7TikiT8LTIakGBLzW4gwYRs=
 =6l6y
 -----END PGP SIGNATURE-----
 
 --pgp-sign-Multipart_Wed_Mar__3_14:41:25_2010-1--
 


Home | Main Index | Thread Index | Old Index