]> Savannah Git Hosting - gnulib.git/commitdiff
Port better to Alpine Linux
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 25 Mar 2016 07:04:02 +0000 (00:04 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 25 Mar 2016 07:20:37 +0000 (00:20 -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
tests/init.sh

index 8ddd59b33871dedafd176c72ee8b620fd22acdd3..d01a62d015be87875727407c981f8b17079b6a54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-03-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <eggert@cs.ucla.edu>
 
        test-framework-sh: port to NetBSD 7.0
index cb2a4fcc91cee9cb576e77c99bfb8fbe35c7a48f..99d4d0b6513a46308a913f1f7400a598272ef912 100644 (file)
@@ -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.