Subject: Re: bug#8846: coreutils-8.12 on HP-UX 11.31: 3 of 365 tests failed

From: Jim Meyering <[email-masked]>
Date: Tue, 14 Jun 2011 10:16:15 +0200

Jim Meyering wrote:

> Bruno Haible wrote:
>> On HP-UX 11.31, built with cc, coreutils-8.12 gives 3 test suite failures:
>>
>> FAIL: misc/printf-surprise (exit: 1)
>> FAIL: dd/nocache (exit: 1)
>> FAIL: du/inaccessible-cwd (exit: 1)
>>
>> Find attached the log file.
>>
> ...
>> FAIL: misc/printf-surprise (exit: 1)
>> ====================================
>>
>> ./init.sh: line 77: 1: Bad file number
>> printf (GNU coreutils) 8.12
>> Copyright (C) 2011 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.
> ...
>
> Hi Bruno
>
> Thank you for the testing and report.
> That "bad file number" error comes from this code in init.sh:
>
>     : ${stderr_fileno_=2}
>     warn_ () { echo "$@" 1>&$stderr_fileno_; }
>
> Because of that, the log contains less information than usual.
> If you can easily apply this patch and rerun the failing tests,
> I'd appreciate it.  It should avoid the error and let us see
> more details about what is failing.
>
>
>>>From 25e7bded3f2abff58540b0fcead2ba110d344bb0 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <[email-masked]>
> Date: Mon, 13 Jun 2011 12:07:14 +0200
> Subject: [PATCH] init.sh: accommodate shells for which 1>&$stderr_fileno_
>  fails
>
> * tests/init.sh (warn_): Use eval to work around a bug in some shells,
> like those of Solaris 10 and HP-UX 11.11.

That change did not help, so I've reverted it.
That's the first patch.
The second one syncs from gnulib's init.sh.

>From 83e424e7319e8ef2e3398aefbaade972770a6f97 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Mon, 13 Jun 2011 18:20:14 +0200
Subject: [PATCH 1/2] maint: revert previous commit

Revert "init.sh: accommodate shells for which 1>&$stderr_fileno_ fails"
This reverts commit 6fb9aeedd1b858a61d5cbf7f15782adf29ff733a.
That change did not solve the problem.  For details, see
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846#74
---
 tests/init.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/init.sh b/tests/init.sh
index 25850af..14f2e26 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -74,7 +74,7 @@ Exit () { set +e; (exit $1); exit $1; }
 # the reason for skip/failure to console, rather than to the .log files.
 : ${stderr_fileno_=2}

-warn_ () { eval 'echo "$@" 1>&'"$stderr_fileno_"; }
+warn_ () { echo "$@" 1>&$stderr_fileno_; }
 fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; }
 skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; }
 framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; }
--
1.7.6.rc0.293.g40857

>From ef6e57b24b51f247119a83be6c81c6a8a30b87a4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Mon, 13 Jun 2011 12:49:10 +0200
Subject: [PATCH 2/2] init.sh: sync from gnulib

* tests/init.sh: Sync recent changes from gnulib.
---
 tests/init.sh |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/init.sh b/tests/init.sh
index 14f2e26..60d1bc1 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -77,6 +77,7 @@ Exit () { set +e; (exit $1); exit $1; }
 warn_ () { echo "$@" 1>&$stderr_fileno_; }
 fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; }
 skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; }
+fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; }
 framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; }

 # Sanitize this shell to POSIX mode, if possible.
@@ -167,7 +168,10 @@ else
     st_=$?

     # $re_shell_ works just fine.  Use it.
-    test $st_ = 10 && break
+    if test $st_ = 10; then
+      gl_set_x_corrupts_stderr_=false
+      break
+    fi

     # If this is our first marginally acceptable shell, remember it.
     if test "$st_:$marginal_" = 9: ; then
@@ -400,7 +404,7 @@ mktempd_ ()
 {
   case $# in
   2);;
-  *) fail_ "Usage: $ME DIR TEMPLATE";;
+  *) fail_ "Usage: mktempd_ DIR TEMPLATE";;
   esac

   destdir_=$1
--
1.7.6.rc0.293.g40857