Pádraig Brady wrote:
> On 09/02/2011 01:37 AM, Bruno Haible wrote:
>> It looks like your check in tests/init.sh is too pessimistic:
>>
>> if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
>> compare () { diff -u "$@"; }
>>
>> Change that to
>>
>> if ( diff -u "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
>> compare () { diff -u "$@"; }
>>
>> and you should receive better output.
>
> I think the source of that is gnulib/tests/init.sh
> So feel free to apply the above change there
> and all projects can then sync from that as required.
Right.
I'm applying this in coreutils, and will eventually propagate it to gnulib:
>From 31d1ccdd6d148013a0a405c9af4fd93dc0f1ec69 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 2 Sep 2011 10:51:52 +0200
Subject: [PATCH] tests: init.sh: work also with any non-GNU diff that
supports -u
* tests/init.sh: Relax check for diff -u support.
Rather than checking for GNU diff via --version, simply check
for support for -u itself. Useful at least on OpenBSD 4.9.
---
tests/init.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/init.sh b/tests/init.sh
index 460937d..12b3ca3 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -221,7 +221,7 @@ export MALLOC_PERTURB_
# a partition, or to undo any other global state changes.
cleanup_ () { :; }
-if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
+if ( diff -u "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
compare () { diff -u "$@"; }
elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
compare () { cmp -s "$@"; }
--
1.7.7.rc0.362.g5a14