bug-coreutils
[Top][All Lists]
Advanced

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

openbsd5.4: spurious ls/infloop test failure: due to bug in /bin/sh


From: Jim Meyering
Subject: openbsd5.4: spurious ls/infloop test failure: due to bug in /bin/sh
Date: Wed, 13 Jan 2010 10:56:20 +0100

Nelson Beebe build coreutils-8.3 on OpenBSD4.5 and reported this:

  FAIL: ls/infloop (exit: 1)

Investigating, I found that openbsd4.5's sh has a bug that makes
it malfunction like this:

    $ sh -c 'set -x; (echo s; echo e 1>&2) 2>err >/dev/null'; cat err
    + 2> err
    + > /dev/null
    + echo s
    + echo e
    + >&2
    e

Contrast with bash:

    $ bash -c 'set -x; (echo s; echo e 1>&2) 2>err >/dev/null'; cat err
    + echo s
    + echo e
    e

Here's the fix:

>From f28c7d959be30be0b216880878e8b0909d810a18 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 13 Jan 2010 10:53:32 +0100
Subject: [PATCH] tests: work around spurious test failure with OpenBSD4.5's 
/bin/sh

* tests/ls/infloop: OpenBSD4.5's /bin/sh would mistakenly include
"set -x"-output in an application's stderr stream when stderr is
redirected before stdout.  This was causing one spurious test failure.
The work-around: redirect stdout first.
Reported by Nelson Beebe.
---
 tests/ls/infloop |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tests/ls/infloop b/tests/ls/infloop
index 7d19b13..2ab486d 100755
--- a/tests/ls/infloop
+++ b/tests/ls/infloop
@@ -36,8 +36,7 @@ cat <<\EOF > exp-err || framework_failure
 ls: loop/sub: not listing already-listed directory
 EOF

-
-timeout 1 ls -RL loop 2>err > out
+timeout 1 ls -RL loop >out 2>err
 # Ensure that ls exits with status 2 upon detecting a cycle
 test $? = 2 || fail=1

--
1.6.6.511.gf46c4




reply via email to

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