GNU bug report logs - #16380
Failing tests on Solaris in 2.16

Previous Next

Package: grep;

Reported by: Dagobert Michelsen <dam <at> opencsw.org>

Date: Tue, 7 Jan 2014 08:31:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16380 in the body.
You can then email your comments to 16380 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Tue, 07 Jan 2014 08:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dagobert Michelsen <dam <at> opencsw.org>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Tue, 07 Jan 2014 08:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dagobert Michelsen <dam <at> opencsw.org>
To: bug-grep <at> gnu.org
Subject: Failing tests on Solaris in 2.16
Date: Tue, 7 Jan 2014 09:29:25 +0100
[Message part 1 (text/plain, inline)]
Hi,

I have two failing tests for GNU grep 2.16 on Solaris 10 Sparc with Sun Studio 12:
  http://buildfarm.opencsw.org/~dam/grep-2.16-test-suite.log

Both boil down to the error

  + /bin/sh ere.script
  ere.script: syntax error at line 3: `status=$’ unexpected

generated from bre.awk using the bashism

  printf ("status=$(echo '%s' | { grep -e '%s' > /dev/null 2>&1; echo $? ; })\n",$3, $2);


Best regards

  — Dago

-- 
"You don't become great by trying to be great, you become great by wanting to do something,
and then doing it so hard that you become great in the process." - xkcd #896

[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Tue, 07 Jan 2014 18:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Dagobert Michelsen <dam <at> opencsw.org>
Cc: 16380 <at> debbugs.gnu.org
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Tue, 7 Jan 2014 10:20:49 -0800
[Message part 1 (text/plain, inline)]
On Tue, Jan 7, 2014 at 12:29 AM, Dagobert Michelsen <dam <at> opencsw.org> wrote:
> Hi,
>
> I have two failing tests for GNU grep 2.16 on Solaris 10 Sparc with Sun Studio 12:
>   http://buildfarm.opencsw.org/~dam/grep-2.16-test-suite.log
>
> Both boil down to the error
>
>   + /bin/sh ere.script
>   ere.script: syntax error at line 3: `status=$’ unexpected
>
> generated from bre.awk using the bashism
>
>   printf ("status=$(echo '%s' | { grep -e '%s' > /dev/null 2>&1; echo $? ; })\n",$3, $2);

Hi Dago,
Thanks for the report.
Does the attached patch fix it for you?
[k.txt (text/plain, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Tue, 07 Jan 2014 18:39:01 GMT) Full text and rfc822 format available.

Message #11 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: arnold <at> skeeve.com
To: jim <at> meyering.net, dam <at> opencsw.org
Cc: 16380 <at> debbugs.gnu.org
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Tue, 07 Jan 2014 11:31:01 -0700
I suspect that the Solaris sh doesn't understand $(...), but
rather only `...`

Arnold




Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Tue, 07 Jan 2014 18:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Aharon Robbins <arnold <at> skeeve.com>
Cc: Dagobert Michelsen <dam <at> opencsw.org>, 16380 <16380 <at> debbugs.gnu.org>
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Tue, 7 Jan 2014 10:53:06 -0800
On Tue, Jan 7, 2014 at 10:31 AM,  <arnold <at> skeeve.com> wrote:
> I suspect that the Solaris sh doesn't understand $(...), but
> rather only `...`

Hi Arnold,

Yes, that is the problem, but the sourced init.sh code works around it...
usually. By sourcing the generated shell code rather than invoking
$SHELL, we benefit from the environment set up by init.sh.

Dago, also, using $(...) is not a bashism, and imho, nothing to be
avoided.  It has been supported by all POSIX-confirming shells for
many years.  `...` is the syntax that should be avoided.  *It* causes
needless obfuscation because you cannot nest one `...` expression inside
another like you can with $(...), and worse, use of `...` has resulted
in at least one hard-to-diagnose bug in coreutils tests, where a missing
backtick led to a multi-line if-else block being silently snarfed by
the parser, as it looked for a matching backtick.




Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Tue, 07 Jan 2014 19:03:02 GMT) Full text and rfc822 format available.

Message #17 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>, Aharon Robbins <arnold <at> skeeve.com>
Cc: Dagobert Michelsen <dam <at> opencsw.org>, 16380-done <16380 <at> debbugs.gnu.org>
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Tue, 07 Jan 2014 11:02:17 -0800
On 01/07/2014 10:53 AM, Jim Meyering wrote:
> the sourced init.sh code works around it...
> usually. 

Usually, but not here.  I fixed the problem this way;
tested on Solaris 10.

From e965a293cf7816ee1deb6d2a1c6fe3690b2a37c1 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Tue, 7 Jan 2014 10:59:07 -0800
Subject: [PATCH] Port to Solaris 10 /bin/sh.

Problem reported by Dagobert Michelsen in <http://bugs.gnu.org/16380>.
* tests/bre, tests/ere, tests/spencer1-locale:
Prefer re_shell_ to SHELL, if re_shell_ is set.
* tests/init.sh (re_shell_): Export if it's used.
---
 tests/bre             | 2 +-
 tests/ere             | 2 +-
 tests/init.sh         | 1 +
 tests/spencer1-locale | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/bre b/tests/bre
index 817957f..4a00af4 100755
--- a/tests/bre
+++ b/tests/bre
@@ -16,6 +16,6 @@ fail=0
 ${AWK-awk} -f $abs_top_srcdir/tests/bre.awk $abs_top_srcdir/tests/bre.tests \
     > bre.script || fail=1
 
-. ./bre.script || fail=1
+${re_shell_-${SHELL-sh}} ./bre.script || fail=1
 
 Exit $fail
diff --git a/tests/ere b/tests/ere
index 04e6a75..03aec36 100755
--- a/tests/ere
+++ b/tests/ere
@@ -16,6 +16,6 @@ fail=0
 ${AWK-awk} -f $abs_top_srcdir/tests/ere.awk $abs_top_srcdir/tests/ere.tests \
   > ere.script || fail=1
 
-${SHELL-sh} ere.script || fail=1
+${re_shell_-${SHELL-sh}} ere.script || fail=1
 
 Exit $fail
diff --git a/tests/init.sh b/tests/init.sh
index b5c2e3f..e07c39c 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -201,6 +201,7 @@ else
       *x*) opts_=-x ;;
       *) opts_= ;;
     esac
+    export re_shell_
     exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
     echo "$ME_: exec failed" 1>&2
     exit 127
diff --git a/tests/spencer1-locale b/tests/spencer1-locale
index 11000fe..6484490 100755
--- a/tests/spencer1-locale
+++ b/tests/spencer1-locale
@@ -18,6 +18,6 @@ ${AWK-awk} -v extra_locale=$LOCALE_FR_UTF8 \
     -f "$abs_srcdir/spencer1-locale.awk" "$abs_srcdir/spencer1.tests" \
   > spencer1-locale.script || fail=1
 
-${SHELL-sh} spencer1-locale.script || fail=1
+${re_shell_-${SHELL-sh}} spencer1-locale.script || fail=1
 
 Exit $fail
-- 
1.8.3.1






Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Tue, 07 Jan 2014 19:38:05 GMT) Full text and rfc822 format available.

Message #20 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Dagobert Michelsen <dam <at> opencsw.org>, 16380-done <16380 <at> debbugs.gnu.org>,
 Aharon Robbins <arnold <at> skeeve.com>
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Tue, 7 Jan 2014 11:37:34 -0800
On Tue, Jan 7, 2014 at 11:02 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> On 01/07/2014 10:53 AM, Jim Meyering wrote:
>> the sourced init.sh code works around it...
>> usually.
>
> Usually, but not here.  I fixed the problem this way;
> tested on Solaris 10.
>
> >From e965a293cf7816ee1deb6d2a1c6fe3690b2a37c1 Mon Sep 17 00:00:00 2001
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Tue, 7 Jan 2014 10:59:07 -0800
> Subject: [PATCH] Port to Solaris 10 /bin/sh.
>
> Problem reported by Dagobert Michelsen in <http://bugs.gnu.org/16380>.
> * tests/bre, tests/ere, tests/spencer1-locale:
> Prefer re_shell_ to SHELL, if re_shell_ is set.
> * tests/init.sh (re_shell_): Export if it's used.

Your patch looks fine.  Thanks.  Please be sure to propagate your
init.sh change back to the master version in gnulib/tests.  Otherwise,
the next time we sync from there, we may accidentally revert that part
of the fix.




Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Tue, 07 Jan 2014 19:50:01 GMT) Full text and rfc822 format available.

Message #23 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: Dagobert Michelsen <dam <at> opencsw.org>, 16380-done <16380 <at> debbugs.gnu.org>,
 Bug-gnulib <bug-gnulib <at> gnu.org>
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Tue, 07 Jan 2014 11:48:58 -0800
On 01/07/2014 11:37 AM, Jim Meyering wrote:
> Please be sure to propagate your
> init.sh change back to the master version in gnulib/tests.

Yeowch!  Thanks, I'd forgotten we'd stolen that from gnulib.
I pushed the following patch into gnulib.

---
 ChangeLog     | 8 ++++++++
 tests/init.sh | 1 +
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ff71c97..c4246aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-01-07  Paul Eggert  <eggert <at> cs.ucla.edu>
+
+    tests: simplify porting to Solaris 10 /bin/sh
+    Some test cases in 'grep' need a shell that groks '$(';
+    export re_shell_ for their benefit.  Problem reported for 'grep'
+    by Dagobert Michelsen in <http://bugs.gnu.org/16380>.
+    * tests/init.sh (re_shell_): Export if it's used.
+
 2014-01-06  Eric Blake  <eblake <at> redhat.com>
 
     md5, sha1, sha256, sha512: support older autoconf
diff --git a/tests/init.sh b/tests/init.sh
index b5c2e3f..e07c39c 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -201,6 +201,7 @@ else
       *x*) opts_=-x ;;
       *) opts_= ;;
     esac
+    export re_shell_
     exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
     echo "$ME_: exec failed" 1>&2
     exit 127
-- 
1.8.3.1






Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Wed, 08 Jan 2014 05:50:02 GMT) Full text and rfc822 format available.

Message #26 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: Dagobert Michelsen <dam <at> opencsw.org>, 16380-done <16380 <at> debbugs.gnu.org>,
 Bug-gnulib <bug-gnulib <at> gnu.org>
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Tue, 07 Jan 2014 21:49:31 -0800
And Jim pointed out a bug in that patch, so I pushed the following
further patch into grep (with the init.sh part pushed to gnulib).

From 79b186f715b3a7a4622a3b90aa30b0c62de0549a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Tue, 7 Jan 2014 21:47:04 -0800
Subject: [PATCH] tests: port Solaris 10 /bin/sh patch back to GNU/Linux

Problem reported by Jim Meyering.
* tests/bre, tests/ere, tests/spencer1-locale:
Prefer re_shell, not re_shell_.
* tests/init.sh (re_shell): New var, which is exported instead of
re_shell_.
---
 tests/bre             | 2 +-
 tests/ere             | 2 +-
 tests/init.sh         | 3 ++-
 tests/spencer1-locale | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/bre b/tests/bre
index 4a00af4..4c0eb13 100755
--- a/tests/bre
+++ b/tests/bre
@@ -16,6 +16,6 @@ fail=0
 ${AWK-awk} -f $abs_top_srcdir/tests/bre.awk $abs_top_srcdir/tests/bre.tests \
     > bre.script || fail=1
 
-${re_shell_-${SHELL-sh}} ./bre.script || fail=1
+${re_shell-${SHELL-sh}} ./bre.script || fail=1
 
 Exit $fail
diff --git a/tests/ere b/tests/ere
index 03aec36..6ad7982 100755
--- a/tests/ere
+++ b/tests/ere
@@ -16,6 +16,6 @@ fail=0
 ${AWK-awk} -f $abs_top_srcdir/tests/ere.awk $abs_top_srcdir/tests/ere.tests \
   > ere.script || fail=1
 
-${re_shell_-${SHELL-sh}} ere.script || fail=1
+${re_shell-${SHELL-sh}} ere.script || fail=1
 
 Exit $fail
diff --git a/tests/init.sh b/tests/init.sh
index e07c39c..fbd293d 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -201,7 +201,8 @@ else
       *x*) opts_=-x ;;
       *) opts_= ;;
     esac
-    export re_shell_
+    re_shell=$re_shell_
+    export re_shell
     exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
     echo "$ME_: exec failed" 1>&2
     exit 127
diff --git a/tests/spencer1-locale b/tests/spencer1-locale
index 6484490..e8deeac 100755
--- a/tests/spencer1-locale
+++ b/tests/spencer1-locale
@@ -18,6 +18,6 @@ ${AWK-awk} -v extra_locale=$LOCALE_FR_UTF8 \
     -f "$abs_srcdir/spencer1-locale.awk" "$abs_srcdir/spencer1.tests" \
   > spencer1-locale.script || fail=1
 
-${re_shell_-${SHELL-sh}} spencer1-locale.script || fail=1
+${re_shell-${SHELL-sh}} spencer1-locale.script || fail=1
 
 Exit $fail
-- 
1.8.3.1





Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Wed, 08 Jan 2014 15:14:02 GMT) Full text and rfc822 format available.

Message #29 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Dagobert Michelsen <dam <at> opencsw.org>
To: Jim Meyering <jim <at> meyering.net>
Cc: 16380 <at> debbugs.gnu.org
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Wed, 8 Jan 2014 16:13:01 +0100
[Message part 1 (text/plain, inline)]
Hi Jim,

Am 07.01.2014 um 19:20 schrieb Jim Meyering <jim <at> meyering.net>:
> On Tue, Jan 7, 2014 at 12:29 AM, Dagobert Michelsen <dam <at> opencsw.org> wrote:
>> I have two failing tests for GNU grep 2.16 on Solaris 10 Sparc with Sun Studio 12:
>>  http://buildfarm.opencsw.org/~dam/grep-2.16-test-suite.log
>> 
>> Both boil down to the error
>> 
>>  + /bin/sh ere.script
>>  ere.script: syntax error at line 3: `status=$’ unexpected
>> 
>> generated from bre.awk using the bashism
>> 
>>  printf ("status=$(echo '%s' | { grep -e '%s' > /dev/null 2>&1; echo $? ; })\n",$3, $2);
> 
> Hi Dago,
> Thanks for the report.
> Does the attached patch fix it for you?
> <k.txt>

This solves one of the errors, the other one persists:

+ /bin/sh spencer1-locale.script
spencer1-locale.script: syntax error at line 2: `status=$' unexpected


Best regards

  — Dago


-- 
"You don't become great by trying to be great, you become great by wanting to do something,
and then doing it so hard that you become great in the process." - xkcd #896

[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#16380; Package grep. (Wed, 08 Jan 2014 15:21:01 GMT) Full text and rfc822 format available.

Message #32 received at 16380 <at> debbugs.gnu.org (full text, mbox):

From: Dagobert Michelsen <dam <at> opencsw.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 16380-done <16380 <at> debbugs.gnu.org>, Bug-gnulib <bug-gnulib <at> gnu.org>,
 Jim Meyering <jim <at> meyering.net>
Subject: Re: bug#16380: Failing tests on Solaris in 2.16
Date: Wed, 8 Jan 2014 16:20:36 +0100
[Message part 1 (text/plain, inline)]
Hi,

sorry for the early post, I should be reading the whole thread first.
This fixed all open issues for me.


Best regards

  — Dago

Am 08.01.2014 um 06:49 schrieb Paul Eggert <eggert <at> cs.ucla.edu>:
> And Jim pointed out a bug in that patch, so I pushed the following
> further patch into grep (with the init.sh part pushed to gnulib).
> 
> From 79b186f715b3a7a4622a3b90aa30b0c62de0549a Mon Sep 17 00:00:00 2001
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Tue, 7 Jan 2014 21:47:04 -0800
> Subject: [PATCH] tests: port Solaris 10 /bin/sh patch back to GNU/Linux
> 
> Problem reported by Jim Meyering.
> * tests/bre, tests/ere, tests/spencer1-locale:
> Prefer re_shell, not re_shell_.
> * tests/init.sh (re_shell): New var, which is exported instead of
> re_shell_.
> ---
> tests/bre             | 2 +-
> tests/ere             | 2 +-
> tests/init.sh         | 3 ++-
> tests/spencer1-locale | 2 +-
> 4 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/bre b/tests/bre
> index 4a00af4..4c0eb13 100755
> --- a/tests/bre
> +++ b/tests/bre
> @@ -16,6 +16,6 @@ fail=0
> ${AWK-awk} -f $abs_top_srcdir/tests/bre.awk $abs_top_srcdir/tests/bre.tests \
>     > bre.script || fail=1
> -${re_shell_-${SHELL-sh}} ./bre.script || fail=1
> +${re_shell-${SHELL-sh}} ./bre.script || fail=1
>  Exit $fail
> diff --git a/tests/ere b/tests/ere
> index 03aec36..6ad7982 100755
> --- a/tests/ere
> +++ b/tests/ere
> @@ -16,6 +16,6 @@ fail=0
> ${AWK-awk} -f $abs_top_srcdir/tests/ere.awk $abs_top_srcdir/tests/ere.tests \
>   > ere.script || fail=1
> -${re_shell_-${SHELL-sh}} ere.script || fail=1
> +${re_shell-${SHELL-sh}} ere.script || fail=1
>  Exit $fail
> diff --git a/tests/init.sh b/tests/init.sh
> index e07c39c..fbd293d 100644
> --- a/tests/init.sh
> +++ b/tests/init.sh
> @@ -201,7 +201,8 @@ else
>       *x*) opts_=-x ;;
>       *) opts_= ;;
>     esac
> -    export re_shell_
> +    re_shell=$re_shell_
> +    export re_shell
>     exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
>     echo "$ME_: exec failed" 1>&2
>     exit 127
> diff --git a/tests/spencer1-locale b/tests/spencer1-locale
> index 6484490..e8deeac 100755
> --- a/tests/spencer1-locale
> +++ b/tests/spencer1-locale
> @@ -18,6 +18,6 @@ ${AWK-awk} -v extra_locale=$LOCALE_FR_UTF8 \
>     -f "$abs_srcdir/spencer1-locale.awk" "$abs_srcdir/spencer1.tests" \
>   > spencer1-locale.script || fail=1
> -${re_shell_-${SHELL-sh}} spencer1-locale.script || fail=1
> +${re_shell-${SHELL-sh}} spencer1-locale.script || fail=1
>  Exit $fail
> -- 
> 1.8.3.1
> 

-- 
"You don't become great by trying to be great, you become great by wanting to do something,
and then doing it so hard that you become great in the process." - xkcd #896

[smime.p7s (application/pkcs7-signature, attachment)]

bug closed, send any further explanations to 16380 <at> debbugs.gnu.org and Dagobert Michelsen <dam <at> opencsw.org> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Sat, 08 Mar 2014 18:13:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Apr 2014 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.