[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] Port better to Alpine Linux
From: |
Paul Eggert |
Subject: |
[PATCH 2/2] Port better to Alpine Linux |
Date: |
Fri, 25 Mar 2016 00:20:53 -0700 |
Its diff implementation does not support -c, but does support -U3.
Problem reported by Assaf Gordon in: http://bugs.gnu.org/23107#13
* tests/init.sh (diff_opt_): New var.
(compare_): Prefer diff -U3 to diff -c to plain diff.
---
ChangeLog | 8 ++++++++
tests/init.sh | 12 +++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8ddd59b..d01a62d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-03-25 Paul Eggert <address@hidden>
+
+ Port better to Alpine Linux
+ Its diff implementation does not support -c, but does support -U3.
+ Problem reported by Assaf Gordon in: http://bugs.gnu.org/23107#13
+ * tests/init.sh (diff_opt_): New var.
+ (compare_): Prefer diff -U3 to diff -c to plain diff.
+
2016-03-24 Paul Eggert <address@hidden>
test-framework-sh: port to NetBSD 7.0
diff --git a/tests/init.sh b/tests/init.sh
index cb2a4fc..99d4d0b 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -308,13 +308,19 @@ if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" <
/dev/null` \
fi
}
fi
-elif diff_out_=`exec 2>/dev/null; diff -c "$0" "$0" < /dev/null`; then
+elif
+ for diff_opt_ in -U3 -c '' no; do
+ test "$diff_opt_" = no && break
+ diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" </dev/null` && break
+ done
+ test "$diff_opt_" != no
+then
if test -z "$diff_out_"; then
- compare_ () { diff -c "$@"; }
+ compare_ () { diff $diff_opt_ "$@"; }
else
compare_ ()
{
- if diff -c "$@" > diff.out; then
+ if diff $diff_opt_ "$@" > diff.out; then
# No differences were found, but AIX and HP-UX 'diff' produce output
# "No differences encountered" or "There are no differences between the
# files.". Hide this output.
--
2.5.5