init.sh: disqualify shells for which set -x corrupts stderr
authorJim Meyering <meyering@redhat.com>
Wed, 8 Sep 2010 13:18:46 +0000 (15:18 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 8 Sep 2010 13:20:56 +0000 (15:20 +0200)
* 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
tests/init.sh

index f36acb6..9a51377 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-08  Jim Meyering  <meyering@redhat.com>
+
+       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  <bruno@clisp.org>
 
        gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
index fe2c224..9886a8d 100644 (file)
@@ -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"