From 37a7671494e1ffe25fc2058ba122bb85ae824090 Mon Sep 17 00:00:00 2001 From: Jim Meyering 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(+) diff --git a/ChangeLog b/ChangeLog index f36acb6d5..9a51377eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-09-08 Jim Meyering + + 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 gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'. diff --git a/tests/init.sh b/tests/init.sh index fe2c22401..9886a8da6 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" -- 2.11.0