bug-gnulib
[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: Bruno Haible
Subject: Re: coreutils-8.14.116-1e18d on HP-UX 11.00
Date: Fri, 06 Jan 2012 03:44:49 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Jim Meyering wrote:
> My test expected diff -u output.
> compare may generate diff -c output or even cmp output.
> 
> This should fix it:
> +2012-01-05  Jim Meyering  <address@hidden>
> +
> +     test-init.sh: avoid failure on HP-UX 11.00
> +     * tests/test-init.sh: Skip "diff -u"-comparing step when compare
> +     resolves to diff -c or cmp.  Reported by Bruno Haible.
> +
>  2012-01-04  Jim Meyering  <address@hidden>
> 
>       test-init.sh: accommodate Solaris 5.10's different diff -u output
> diff --git a/tests/test-init.sh b/tests/test-init.sh
> index ee1c798..1ed1b79 100755
> --- a/tests/test-init.sh
> +++ b/tests/test-init.sh
> @@ -61,7 +61,11 @@ EOF
>  +xyz
>  EOF
>    sed 's/    .*//;/^@@/d' out > k && mv k out
> -  compare exp out || fail=1
> +
> +  # Check the expected output only if compare is using diff -u.
> +  if $(exec 2>/dev/null; diff -u out out < /dev/null); then
> +    compare exp out || fail=1
> +  fi
>    case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; 
> esac
>  }

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
     compare exp out || fail=1
   fi
   case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac

Please apply it if you agree.

Bruno




reply via email to

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