[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr
From: |
Bruno Haible |
Subject: |
Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr |
Date: |
Wed, 8 Sep 2010 23:44:52 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Jim,
> 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:
This test disqualifies also 'ksh', which is considered the "good"
shell on Solaris, AIX, and a number of other systems:
I executed the command
(set -x; P=1 true > inner-out 2> inner-err) > outer-out 2> outer-err
with a number of shells. Results: inner-out and outer-out were always
empty, and
| inner-err | outer-err |
---------------------+----------------+------------------------------+
Solaris 10 /bin/sh | P=1 | + true |
---------------------+----------------+------------------------------+
ksh-93s | + P=1 | + true |
Solaris 10 /bin/ksh | | + 1> inner-out 2> inner-err |
---------------------+----------------+------------------------------+
bash 3.2.39 | | + P=1 |
| | + true |
---------------------+----------------+------------------------------+
dash | | + P=1 true |
---------------------+----------------+------------------------------+
zsh 4.3.6 | | +zsh:3> P=1 +zsh:3> true |
---------------------+----------------+------------------------------+
> the result will be that each init.sh-using test
> will be skipped.
I don't find this a good result.
Observe this:
- Looking at the stderr output of some programs started with environment
variables happens in some tests, but is not very frequent.
- When you analyze the stderr output of programs, you need to filter out
all lines that start with '==' also, because these are the marks emitted
by valgrind.
- When you are at it, you can also filter out all lines that start with
'+'.
- The only remaining problematic shell is then Solaris 10 /bin/sh,
which is already disqualified by
test $(echo y) = y
So, instead of skipping all init.sh based tests on some platforms, I would
propose
- either to skip only if 'set -x' is enabled; this can be tested by
test -z "$( (P=1 true 2>&1) 2> /dev/null)"
- or to handle this problem in each test that analyzes the stderr output
of some program.
Bruno
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, (continued)
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Eric Blake, 2010/09/08
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Ralf Wildenhues, 2010/09/08
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Jim Meyering, 2010/09/08
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Jim Meyering, 2010/09/08
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Eric Blake, 2010/09/08
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Jim Meyering, 2010/09/08
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Jim Meyering, 2010/09/09
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Eric Blake, 2010/09/09
- Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Bruce Korb, 2010/09/08
Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr, Stefano Lattarini, 2010/09/08
Re: [PATCH] init.sh: disqualify shells for which set -x corrupts stderr,
Bruno Haible <=