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/ -
---



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

2018-03-28 Thread Bruno Haible
Hi Jim,

> But that would violate my "don't use backticks" rule, of necessity,
> since $(...) probably doesn't work in such an old interpreter.

In my recent experience with Solaris 10, HP-UX 11.31, AIX 7, IRIX 6.5,
it was only the IRIX /bin/sh that did not grok $(...).

Personally I prefer backticks because with `...` I don't need to think
about which shell is used to execute the script.

Bruno




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

2018-03-28 Thread Bruno Haible
Paul Eggert wrote:
>+2018-03-27  Paul Eggert  
>+
>+  havelib: port to Solaris 10 /bin/sh
>+  * m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Use 'test ! EXPR'
>+  instead of '! test EXPR'.
>+

Thanks Paul!




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

2018-03-27 Thread Jim Meyering
On Tue, Mar 27, 2018 at 6:38 PM, Paul Eggert  wrote:
> On 03/27/2018 05:27 PM, Nelson H. F. Beebe wrote:
>>
>> 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 would strongly urge not to remove such constructs, but rather to
begin your script with the sourcing of init.sh, which ensures the
remainder of the script is interpreted by a sensible shell.
Alternatively, I could have done this:

  test=`echo "$1" |sed 's,.*/,,'`

But that would violate my "don't use backticks" rule, of necessity,
since $(...) probably doesn't work in such an old interpreter. So at
first, I was inclined to include this line at the top:

  . "${srcdir=.}/testsuite/init.sh"

But there's an even better solution:


sed-sol10-vs-runtest.diff
Description: Binary data


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

2018-03-27 Thread Paul Eggert

On 03/27/2018 05:27 PM, Nelson H. F. Beebe wrote:

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.


That being said, I too have a soft spot in my heart for Solaris, and 
regularly check portability to the Solaris 10 server that is still the 
central server in our department. If it's easy to port to Solaris 10, 
which I think is still the case, we might as well do it. I'll see if I 
can pry some time free to fix the glitches. The first thing I noticed, I 
fixed as per the attached (cc'ing bug-gnulib).


>From dd27ae2a74ceb26fc70c4a15b299b68c5b33899e Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Tue, 27 Mar 2018 18:20:18 -0700
Subject: [PATCH] havelib: port to Solaris 10 /bin/sh

* m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Use 'test ! EXPR'
instead of '! test EXPR'.
---
 ChangeLog  | 6 ++
 m4/lib-link.m4 | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 99f219c26..74f3bfc71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-27  Paul Eggert  
+
+	havelib: port to Solaris 10 /bin/sh
+	* m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Use 'test ! EXPR'
+	instead of '! test EXPR'.
+
 2018-03-26  Paul Eggert  
 
 	time_rz: work around Mac OS X 10.6 infloop
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
index 4a4a185e3..df77db982 100644
--- a/m4/lib-link.m4
+++ b/m4/lib-link.m4
@@ -211,7 +211,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 additional_includedir="$withval/include"
 additional_libdir="$withval/$acl_libdirstem"
 if test "$acl_libdirstem2" != "$acl_libdirstem" \
-   && ! test -d "$withval/$acl_libdirstem"; then
+   && test ! -d "$withval/$acl_libdirstem"; then
   additional_libdir="$withval/$acl_libdirstem2"
 fi
   fi
-- 
2.14.3



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

2018-03-24 Thread Jim Meyering
On Sat, Mar 24, 2018 at 3:53 AM, Eric Blake  wrote:
> On 03/23/2018 06:53 PM, Jim Meyering wrote:
>>
>> On Fri, Mar 23, 2018 at 4:23 PM, Assaf Gordon 
>> wrote:
>>>
>>> (adding bug-gnulib@ because of 'test-localename' failure)
>>>
>
>>> Additionally, on Alpine linux which uses busybox's diff(1),
>>> the following fails:
>>>FAIL: test-version-etc.sh
>>>=
>>>
>>>diff: unrecognized option: c
>>>FAIL test-version-etc.sh (exit status: 1)
>>
>>
>> Wow. Thank you for all that prompt testing.
>
>
>>
>> @@ -36,7 +36,7 @@ EOT
>>/^Packaged by/d
>>2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
>>   tr -d '\015' |
>> - diff -c $TMP - || ERR=1
>> + diff $TMP - || ERR=1
>
> Is 'diff -u' portable to busybox?  ed script diffs are a pain to read in
> comparison to context or unified diffs, so I think this change is a
> reduction in quality if something better is available.

Thanks. It can be better, indeed: use our very own init.sh, with its
compare function. Done in the attached.


test-version-etc-use-init.sh.diff
Description: Binary data


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

2018-03-24 Thread Eric Blake

On 03/23/2018 06:53 PM, Jim Meyering wrote:

On Fri, Mar 23, 2018 at 4:23 PM, Assaf Gordon  wrote:

(adding bug-gnulib@ because of 'test-localename' failure)




Additionally, on Alpine linux which uses busybox's diff(1),
the following fails:
   FAIL: test-version-etc.sh
   =

   diff: unrecognized option: c
   FAIL test-version-etc.sh (exit status: 1)


Wow. Thank you for all that prompt testing.




@@ -36,7 +36,7 @@ EOT
   /^Packaged by/d
   2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
  tr -d '\015' |
- diff -c $TMP - || ERR=1
+ diff $TMP - || ERR=1


Is 'diff -u' portable to busybox?  ed script diffs are a pain to read in 
comparison to context or unified diffs, so I think this change is a 
reduction in quality if something better is available.


POSIX requires diff to support both -u and -c; you may want to also 
report the missing support for -c to the busybox maintainers.


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



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

2018-03-23 Thread Jim Meyering
On Fri, Mar 23, 2018 at 4:23 PM, Assaf Gordon  wrote:
> (adding bug-gnulib@ because of 'test-localename' failure)
>
> Hello Jim,
>
> On Fri, Mar 23, 2018 at 02:15:05PM -0700, Jim Meyering wrote:
>> sed snapshot:
>>   https://meyering.net/sed/sed-4.4.104-290c.tar.xz
>
> No sed test failures on these platforms:
>   AIX 2 (00FA74164C00,CC=xlc)
>   Alpine Linux 3.6 (with musl libc)
>   Darwin 16.7.0 (x86_64)
>   Debian 8.10 (i686)
>   Debian 8.9 (mips64)
>   Debian unstable (sparc64)
>   FreeBSD 11.1-RELEASE-p7 (amd64)
>   Linux 3.10.0-514.10.2.el7.ppc64le (ppc64le)
>   Linux 3.10.0-514.26.2.el7.ppc64 (ppc64)
>   NetBSD 7.1 (amd64)
>   OpenBSD 6.2 (amd64)
>   Raspbian 8.0 (armv7l)
>   Ubuntu 14.04 (aarch64)
>   Ubuntu 16.04 (x86_64,CC=clang-3.8)
>   Ubuntu 16.04 (x86_64,CC=clang-4.0)
>   Ubuntu 16.04 (x86_64,CC=clang-5.0)
>   Ubuntu 16.04 (x86_64,CC=gcc)
>   Ubuntu 16.04 (x86_64,CC=gcc-4.9)
>   Ubuntu 16.04 (x86_64,CC=gcc-5.4)
>   Ubuntu 16.04 (x86_64,CC=gcc-6.4)
>   Ubuntu 16.04 (x86_64,CC=gcc-7.2)
>   Ubuntu 16.04 (x86_64,CC=tcc)
>
>
> However, on OpenBSD, AIX and Alpine Linux
> the gnulib 'test-localename' failed.
> This is somewhat strange, because gnulib's updates
> already contain Bruno's fix:
>
>> Changes in gnulib since v4.4:
>>
>> * gnulib b6acb8d...66ae2f3 (676):
>>   [...]
>>   > localename: Add support for musl libc.
>
> from here:
> https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00071.html
>
> I'm not sure why it still failed on Alpine linux (which uses musl).
>
> OpenBSD 6.2 log:
>
>   FAIL: test-localename
>   =
>
>   test-localename.c:183: assertion 'strcmp (name, "fr_FR.UTF-8") == 0' failed
>   Abort trap (core dumped)
>   FAIL test-localename (exit status: 134)
>
>
> AIX log:
>
>   FAIL: test-localename
>   =
>
>   FAIL test-localename (exit status: 132)
>
> Alpine Log:
>
>   FAIL: test-localename
>   =
>
>   test-localename.c:183: assertion 'strcmp (name, "fr_FR.UTF-8") == 0' failed
>   Aborted
>   FAIL test-localename (exit status: 134)
>
>
>
> Additionally, on Alpine linux which uses busybox's diff(1),
> the following fails:
>   FAIL: test-version-etc.sh
>   =
>
>   diff: unrecognized option: c
>   FAIL test-version-etc.sh (exit status: 1)

Wow. Thank you for all that prompt testing.

I've just addressed the test-version-etc.sh issue by pushing the
attached to gnulib. I agree that the other gnulib/test failures appear
unrelated to sed, but will wait at least a day before making the
release.


version-etc-diff-c.diff
Description: Binary data