coreutils
[Top][All Lists]
Advanced

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

Re: coreutils-8.14.116-1e18d on HP-UX 11.00


From: Jim Meyering
Subject: Re: coreutils-8.14.116-1e18d on HP-UX 11.00
Date: Fri, 06 Jan 2012 09:24:22 +0100

Bruno Haible wrote:
> Jim Meyering wrote:
...
> Thanks, this fixed the failures of this test on several platforms.
>
> But it introduced a minor problem: spurious output of the test.
>
> On AIX 6.1:
>
> ./test-init.sh[42]: There:  not found.
> PASS: test-init.sh
>
> On Solaris 10/x86:
>
> ./test-init.sh: line 66: No: command not found
> PASS: test-init.sh
>
> The reason is some output from 'diff -u out out'.
>
> On AIX 6.1:
>
> $ diff -u out out < /dev/null
> There are no differences between the files.
> $ diff -u out out < /dev/null 2>/dev/null
> There are no differences between the files.
> $ diff -u out out < /dev/null >/dev/null
>
> On Solaris 10/x86:
>
> $ diff -u out out < /dev/null
> No differences encountered
> $ diff -u out out < /dev/null 2>/dev/null
> No differences encountered
> $ diff -u out out < /dev/null >/dev/null
>
> I don't understand the purpose of the $(...). Were you trying to copy
> from that line in init.sh?
>
>   if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" < /dev/null`; then
>
> It uses a variable assignment, not needed here. But without the variable
> assignment the output is executed as a command. What we need is just the
> return code of the diff -u command.
>
> This patch fixes it for me:
>
> --- test-init.sh.bak    Fri Jan  6 02:41:26 2012
> +++ test-init.sh        Fri Jan  6 02:43:17 2012
> @@ -63,7 +63,7 @@
>    sed 's/      .*//;/^@@/d' out > k && mv k out
>
>    # Check the expected output only if compare is using diff -u.
> -  if $(exec 2>/dev/null; diff -u out out < /dev/null); then
> +  if (diff -u out out < /dev/null > /dev/null) 2>/dev/null; then

Thank you!
How about this?

     if (diff -u out out < /dev/null) > /dev/null 2>&1; then

As usual, since your name is on it, I'll wait for an ACK
before pushing it.

>From ed38db516c3a5c6698f507f685105a62c762714c Mon Sep 17 00:00:00 2001
From: Bruno Haible <address@hidden>
Date: Fri, 6 Jan 2012 09:21:29 +0100
Subject: [PATCH] test-init.sh: correct the test for diff -u

* tests/test-init.sh: Also redirect stdout to /dev/null.
---
 ChangeLog          |    5 +++++
 tests/test-init.sh |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f1b744b..4a146cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-06  Bruno Haible  <address@hidden>
+
+       test-init.sh: correct the test for diff -u
+       * tests/test-init.sh: Also redirect stdout to /dev/null.
+
 2012-01-05  Bruno Haible  <address@hidden>

        strtoimax: Don't force a replacement on systems where intmax_t is int.
diff --git a/tests/test-init.sh b/tests/test-init.sh
index 1ed1b79..3368a99 100755
--- a/tests/test-init.sh
+++ b/tests/test-init.sh
@@ -62,8 +62,8 @@ EOF
 EOF
   sed 's/      .*//;/^@@/d' out > k && mv k out

-  # Check the expected output only if compare is using diff -u.
-  if $(exec 2>/dev/null; diff -u out out < /dev/null); then
+  # Compare against expected output only if compare is using diff -u.
+  if (diff -u out out < /dev/null) > /dev/null 2>&1; then
     compare exp out || fail=1
   fi
   case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
--
1.7.8.2.334.gd4e886



reply via email to

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