Re: [platform-testers] new snapshot available: sed-4.4.104-290c

2018-03-30 Thread Paul Eggert

On 03/30/2018 07:20 AM, Nelson H. F. Beebe wrote:

I just looked up that standard (page 37) and tried its several
examples with /bin/sh on Solaris 10.  To my surprise, some of them
produced errors, and not the output shown in those examples.

I then repeated the experiment with /usr/xpg4/bin/sh, and they
worked as shown in POSIX.


Yes, and this is why scripts like 'configure' automatically reexecute 
themselves with bash or ksh or whatever, if they find themselves running 
on Solaris 10 /bin/sh. Although it's a bit awkward, it's better than 
trying to live within the intersection of the old SunOS sh and a POSIX 
shell. In 'sed' you found one script that wasn't doing that, but Jim has 
fixed that now (by removing the script!).


I just now checked and ./configure still tries sh5, an Ultrix-based 
POSIXish shell that was last released in 1995! We have the late Fred 
Canter to thank for that, I imagine. See:


Hall J. The last farkle. Linux J. 2007-12-02. 
https://www.linuxjournal.com/node/1005779





Re: [platform-testers] new snapshot available: sed-4.4.104-290c

2018-03-30 Thread Nelson H. F. Beebe
Paul Eggert writes on Tue, 27 Mar 2018 18:38:54 -0700:

>> ...
>> >   test=${1##*/}
>> >
>> > I would strongly urge removal of such shell extensions.
>> 
>> That syntax has been standard ever since POSIX formalized the shell in
>> IEEE Std 1003.2-1992 (I just pulled out my trusty printed copy and
>> checked). It's a bit of a stretch to call it an "extension" 26 years
>> after standardization.
>> ...

I just looked up that standard (page 37) and tried its several
examples with /bin/sh on Solaris 10.  To my surprise, some of them
produced errors, and not the output shown in those examples.

I then repeated the experiment with /usr/xpg4/bin/sh, and they
worked as shown in POSIX.

Next, I looked at the manual page for sh:

DESCRIPTION
   The /usr/bin/sh utility is a command programming language that executes
   commands read from a terminal or a file.

   The /usr/xpg4/bin/sh utility is a standards compliant shell. This util-
   ity provides all the functionality of ksh(1), except in cases discussed
   in ksh(1) where differences in behavior exist.

So, Solaris 10 /bin/sh is not fully in accord with POSIX, and thus
remains the most `primitive' shell that we have to deal with in
practice.  I suspect that we'll be running Solaris 10 systems for at
least another five or so years at my site.

I've always found the shell's ${parameterword} expansion
rules hard to remember, and so, instead of

$ x=/one/two/three
$ echo ${x##*/}
three

I normally use

$ basename $x
three


---
- Nelson H. F. BeebeTel: +1 801 581 5254  -
- University of UtahFAX: +1 801 581 4148  -
- Department of Mathematics, 110 LCBInternet e-mail: be...@math.utah.edu  -
- 155 S 1400 E RM 233   be...@acm.org  be...@computer.org -
- Salt Lake City, UT 84112-0090, USAURL: http://www.math.utah.edu/~beebe/ -
---