bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] init.sh: disqualify shells for which set -x corrupts stderr


From: Jim Meyering
Subject: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr
Date: Wed, 08 Sep 2010 15:20:51 +0200

grep portability testing has exposed some unwarranted test failures.
Using a better SHELL was the quick work-around.
Fixing init.sh is the real fix:

>From d79a9c27419cc4679620b9283351566ba6085cd2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 8 Sep 2010 15:18:46 +0200
Subject: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr

* tests/init.sh: Add a test to disqualify /bin/sh from SunOS 5.11
and OpenBSD 4.7.  They make it so with "set -x", environment settings
appear in stderr output.  For example, this command:
    /bin/sh -c 'set -x; P=1 true 2> err' 2>/dev/null; cat err
prints "P=1" on those two systems:
---
 ChangeLog     |    9 +++++++++
 tests/init.sh |    4 ++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f36acb6..9a51377 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-08  Jim Meyering  <address@hidden>
+
+       test.sh: disqualify shells for which set -x corrupts stderr
+       * tests/init.sh: Add a test to disqualify /bin/sh from SunOS 5.11
+       and OpenBSD 4.7.  They make it so with "set -x", environment settings
+       appear in stderr output.  For example, this command:
+           /bin/sh -c 'set -x; P=1 true 2> err' 2>/dev/null; cat err
+       prints "P=1" on those two systems:
+
 2010-09-08  Bruno Haible  <address@hidden>

        gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
diff --git a/tests/init.sh b/tests/init.sh
index fe2c224..9886a8d 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -103,11 +103,15 @@ fi
 # shells until we find one that passes.  If one is found, re-exec it.
 # If no acceptable shell is found, skip the current test.
 #
+# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that
+# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do.
+#
 # Use "9" to indicate success (rather than 0), in case some shell acts
 # like Solaris 10's /bin/sh but exits successfully instead of with status 2.

 gl_shell_test_script_='
 test $(echo y) = y || exit 1
+test -z "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" || exit 1
 test -z "$EXEEXT" && exit 9
 shopt -s expand_aliases
 alias a-b="echo zoo"
--
1.7.3.rc0.174.g69763



reply via email to

[Prev in Thread] Current Thread [Next in Thread]