Mercurial > hg > octave-kai > gnulib-hg
changeset 13651:a87ee375533d
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:
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Wed, 08 Sep 2010 15:18:46 +0200 |
parents | 10c072121fd2 |
children | 63612cd2a9b1 |
files | ChangeLog tests/init.sh |
diffstat | 2 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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'.
--- a/tests/init.sh +++ b/tests/init.sh @@ -103,11 +103,15 @@ # 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"