NetBSD-Bugs archive

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

Re: standards/56663: Disable RANDOM variable in sh(1) POSIX mode



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

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: standards/56663: Disable RANDOM variable in sh(1) POSIX mode
Date: Mon, 24 Jan 2022 23:02:10 +0700

     Date:        Mon, 24 Jan 2022 07:35:00 +0000 (UTC)
     From:        yetoohappy%gmail.com@localhost
     Message-ID:  <20220124073500.6D46D1A923D%mollari.NetBSD.org@localhost>
 
   | The RANDOM environment variable is not POSIX compliant
 
 This would be extraordinary were it true, as the posix shell is
 based upon ksh88 (that's the canonical sh for posix) and ksh88
 supports the RANDOM variable in essentially the same way that
 the NetBSD shell does (as do several other shells, including
 /bin/ksh on NetBSD - aka some ancient version of pdksh, with
 some local fixes).
 
 POSIX did not require all of ksh88 be implemented in the standard
 shell (eg: select is not required) and RANDOM is in that set of
 "not required" features, but nothing that is in ksh88 is prohibited
 (as that would have made the canonical shell non-compliant) except
 where it was (at the time regarded as a bug in ksh88 - there were
 just a couple of those things, RANDOM is not one).
 
 What POSIX does say is:
 
 From the current standard (this is not changed in current drafts of
 the forthcoming version) in XBD (Basic Definitions) Section 8.1:
 
 	It is unwise to conflict with certain variables that are
 	frequently exported by widely used command interpreters and
 	applications:
 
 Then it gives a (lengthy) list of variables that applications should
 void using, included in which is RANDOM.   (That is, avoid using in
 a conflicting manner, it is obviously OK to use these vars in the way
 they are intended, though not all of them exist everywhere.)
 
 The section of POSIX related to the shell XCU (commands and utilities)
 doesn't mention RANDOM at all (that I can see anyway) - it does however
 reference XBD chapter 8.
 
 There are differences in the details of how various implementations
 deal with RANDOM in various cases, but in none of them does turning on
 posix mode (or its equivalent, where it exists - ksh implementations,
 unsurprisingly, have no such concept) cause RANDOM to cease providing
 random numbers (though in some shells there are ways to make that happen).
 
 There is no bug here, and certainly no standards related issue.
 
 


Home | Main Index | Thread Index | Old Index