bug-coreutils
[Top][All Lists]
Advanced

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

i-link-no test triggers HP-UX shell tracing (set -x) problem


From: Bob Proulx
Subject: i-link-no test triggers HP-UX shell tracing (set -x) problem
Date: Tue, 27 Jun 2006 17:57:50 -0600
User-agent: Mutt/1.5.9i

The HP-UX /bin/sh using command tracing (set -x) and stderr
redirection behaves badly when stderr is redirected before stdout.  I
tested on HP-UX 10.20, 11.0, 11.11, and 11.23 and all had this
problem.  Here is an example:

  $ /bin/sh -xc ': 2>/tmp/err >/dev/null'
  + :
  + 2> /tmp/err $ ...hanging prompt without previous newline...
  $ cat /tmp/err
  1> /tmp/out

This causes the i-link-no test to always fail on HP-UX when run with
VERBOSE=yes which sets 'set -x'.  This test passes otherwise.

  + fail=0
  + mv --reply=no a/bar a/foo b
  + 2> err + cat
  + 0< /var/tmp/sh9830.2 1> exp
  + cat
  + 0< /var/tmp/sh9830.3 1> exp_err
  + cmp err exp_err
  err exp_err differ: char 1, line 1
  + fail=1
  + test 1 = 1
  + diff err exp_err
  + 2> /dev/null
  1d0
  < 1> out
  + cmp out exp

But the other file redirection ordering works.  Fortunately this is
the more typical ordering.

  /bin/sh -xc ': >/tmp/out 2>/tmp/err'
  cat /tmp/err

The trivial workaround for this HP-UX /bin/sh problem causing this
test failure when VERBOSE=yes is to reorder the redirections.  If
stderr is redirected last then everything works.

Bob

        * Work around HP-UX /bin/sh tracing problem (set -x when
        VERBOSE=yes) when stderr is redirected before stdout causing
        shell tracing of the stdout redirection to be written to the
        stderr file.  Avoid problem and test failure on HP-UX by
        redirecting stderr last.

Index: I-link-no
===================================================================
RCS file: /sources/coreutils/coreutils/tests/mv/i-link-no,v
retrieving revision 1.7
diff -u -r1.7 i-link-no
--- i-link-no   3 Jul 2005 16:54:37 -0000       1.7
+++ i-link-no   27 Jun 2006 23:32:55 -0000
@@ -31,7 +31,7 @@
 
 fail=0
 
-mv --reply=no a/bar a/foo b 2> err > out || fail=1
+mv --reply=no a/bar a/foo b > out 2> err || fail=1
 cat <<EOF > exp
 EOF
 




reply via email to

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