From 7347cbf5a4ff953384f5b86aef485cf5666435b5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 25 Mar 2016 00:04:02 -0700 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ tests/init.sh | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ddd59b338..d01a62d015 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-03-25 Paul Eggert + + 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 test-framework-sh: port to NetBSD 7.0 diff --git a/tests/init.sh b/tests/init.sh index cb2a4fcc91..99d4d0b651 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" 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.39.5