]> Savannah Git Hosting - gnulib.git/commitdiff
test-framework-sh: work around AIX 7.2 diff bugs
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 15 Jan 2023 00:47:41 +0000 (16:47 -0800)
committerBruno Haible <bruno@clisp.org>
Fri, 20 Jan 2023 10:18:46 +0000 (11:18 +0100)
* tests/init.sh (compare_dev_null_): Run diff in the C locale.
AIX 7.2 diff messes up in UTF-8 locales; for example,
‘printf '\360\220\200\200\n' | diff - /dev/null’ incorrectly
outputs nothing and exits with status 0 when LC_ALL=en_US.UTF-8.

ChangeLog
tests/init.sh

index 05c0d3db0b21ea09bc3c6c2e4cd456bfa52a0506..c4257fe81014b265602dec9dddbcd3e296bdb4ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-01-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       test-framework-sh: work around AIX 7.2 diff bugs
+       * tests/init.sh (compare_dev_null_): Run diff in the C locale.
+       AIX 7.2 diff messes up in UTF-8 locales; for example,
+       ‘printf '\360\220\200\200\n' | diff - /dev/null’ incorrectly
+       outputs nothing and exits with status 0 when LC_ALL=en_US.UTF-8.
+
 2023-01-13  Paul Eggert  <eggert@cs.ucla.edu>
 
        verify: work around xlclang 16.1 compiler bug
index 6c09392867784382fb42b9dfe8d79c9b242e42ee..0494097e9f5cbda10d7d4abbdb1114de1fc0747c 100644 (file)
@@ -646,18 +646,19 @@ compare_dev_null_ ()
 
 for diff_opt_ in -u -U3 -c '' no; do
   test "$diff_opt_" != no &&
-    diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` &&
+    diff_out_=`exec 2>/dev/null
+      LC_ALL=C diff $diff_opt_ "$0" "$0" < /dev/null` &&
     break
 done
 if test "$diff_opt_" != no; then
   if test -z "$diff_out_"; then
-    compare_ () { diff $diff_opt_ "$@"; }
+    compare_ () { LC_ALL=C diff $diff_opt_ "$@"; }
   else
     compare_ ()
     {
       # If no differences were found, AIX and HP-UX 'diff' produce output
       # like "No differences encountered".  Hide this output.
-      diff $diff_opt_ "$@" > diff.out
+      LC_ALL=C diff $diff_opt_ "$@" > diff.out
       diff_status_=$?
       test $diff_status_ -eq 0 || cat diff.out || diff_status_=2
       rm -f diff.out || diff_status_=2