texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Check for diff --strip-trailing-cr.


From: Gavin D. Smith
Subject: branch master updated: Check for diff --strip-trailing-cr.
Date: Sun, 18 Aug 2024 11:44:30 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 8148141ec7 Check for diff --strip-trailing-cr.
8148141ec7 is described below

commit 8148141ec7df10d20d3ede06082a715b416d3eba
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Aug 18 16:44:19 2024 +0100

    Check for diff --strip-trailing-cr.
    
    * configure.ac (DIFF_OPTIONS, DIFF_U_OPTION, DIFF_A_OPTION):
    Do not AC_SUBST DIFF_U_OPTION or DIFF_A_OPTION, using DIFF_OPTIONS
    instead.
    (DIFF_CR_OPTION) [mingw]: Check if --strip-trailing-cr option
    works and include it in DIFF_OPTIONS if so.
    
    * tp/tests/run_parser_all.sh,
    * tp/defs.in,
    * tp/tests/many_input_files/different_encodings.sh,
    * tp/tests/many_input_files/different_languages_gen_master_menu.sh,
    * tp/tests/many_input_files/input_dir_non_ascii.sh,
    * tp/tests/many_input_files/output_dir_file_non_ascii.sh,
    * tp/tests/many_input_files/output_dir_non_ascii.sh,
    * tp/tests/many_input_files/tex_l2h.sh,
    * tp/tests/many_input_files/tex_l2h_output_dir_non_ascii.sh,
    * tp/tests/many_input_files/tex_t4ht.sh,
    * tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii.sh,
    * Pod-Simple-Texinfo/test_scripts/manual_sectioning_gap_test.sh,
    * Pod-Simple-Texinfo/test_scripts/test_empty_head2.sh,
    * Pod-Simple-Texinfo/test_scripts/test_ref_to_unknown.sh:
    Use DIFF_OPTIONS instead of DIFF_A_OPTION and/or DIFF_U_OPTION
    in order to have --strip-trailing-cr possibly included.
    
    * install-info/defs.in: Remove handling of --strip-trailing-cr,
    using DIFF_OPTIONS instead.
    
    Test failures due to carriage returns on mingw reported by
    Bruno Haible, bug-texinfo 2024-06-09.
---
 ChangeLog                                          | 33 ++++++++++++++++++++++
 .../test_scripts/manual_sectioning_gap_test.sh     | 10 +++----
 .../test_scripts/test_empty_head2.sh               |  4 +--
 .../test_scripts/test_ref_to_unknown.sh            |  4 +--
 configure.ac                                       | 24 ++++++++++++++--
 install-info/tests/defs.in                         |  5 +---
 tp/defs.in                                         |  3 +-
 tp/tests/many_input_files/different_encodings.sh   |  2 +-
 .../different_languages_gen_master_menu.sh         |  2 +-
 tp/tests/many_input_files/input_dir_non_ascii.sh   |  2 +-
 .../many_input_files/output_dir_file_non_ascii.sh  |  2 +-
 tp/tests/many_input_files/output_dir_non_ascii.sh  |  2 +-
 tp/tests/many_input_files/tex_l2h.sh               |  2 +-
 .../tex_l2h_output_dir_non_ascii.sh                |  2 +-
 tp/tests/many_input_files/tex_t4ht.sh              |  2 +-
 .../tex_t4ht_output_dir_non_ascii.sh               |  2 +-
 tp/tests/run_parser_all.sh                         |  2 +-
 17 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4f979e2914..9fd7e0894a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2024-08-18  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Check for diff --strip-trailing-cr.
+
+       * configure.ac (DIFF_OPTIONS, DIFF_U_OPTION, DIFF_A_OPTION):
+       Do not AC_SUBST DIFF_U_OPTION or DIFF_A_OPTION, using DIFF_OPTIONS
+       instead.
+       (DIFF_CR_OPTION) [mingw]: Check if --strip-trailing-cr option
+       works and include it in DIFF_OPTIONS if so.
+
+       * tp/tests/run_parser_all.sh,
+       * tp/defs.in,
+       * tp/tests/many_input_files/different_encodings.sh,
+       * tp/tests/many_input_files/different_languages_gen_master_menu.sh,
+       * tp/tests/many_input_files/input_dir_non_ascii.sh,
+       * tp/tests/many_input_files/output_dir_file_non_ascii.sh,
+       * tp/tests/many_input_files/output_dir_non_ascii.sh,
+       * tp/tests/many_input_files/tex_l2h.sh,
+       * tp/tests/many_input_files/tex_l2h_output_dir_non_ascii.sh,
+       * tp/tests/many_input_files/tex_t4ht.sh,
+       * tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii.sh,
+       * Pod-Simple-Texinfo/test_scripts/manual_sectioning_gap_test.sh,
+       * Pod-Simple-Texinfo/test_scripts/test_empty_head2.sh,
+       * Pod-Simple-Texinfo/test_scripts/test_ref_to_unknown.sh:
+       Use DIFF_OPTIONS instead of DIFF_A_OPTION and/or DIFF_U_OPTION
+       in order to have --strip-trailing-cr possibly included.
+
+       * install-info/defs.in: Remove handling of --strip-trailing-cr,
+       using DIFF_OPTIONS instead.
+
+       Test failures due to carriage returns on mingw reported by
+       Bruno Haible, bug-texinfo 2024-06-09.
+
 2024-08-17  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Structuring.pm (new_node_menu_entry),
diff --git a/Pod-Simple-Texinfo/test_scripts/manual_sectioning_gap_test.sh 
b/Pod-Simple-Texinfo/test_scripts/manual_sectioning_gap_test.sh
index 6d4f1890bf..5230573912 100755
--- a/Pod-Simple-Texinfo/test_scripts/manual_sectioning_gap_test.sh
+++ b/Pod-Simple-Texinfo/test_scripts/manual_sectioning_gap_test.sh
@@ -13,7 +13,7 @@ if test z"$srcdir" = "z"; then
   srcdir=.
 fi
 
-# for DIFF_U_OPTION and PERL
+# for DIFF_OPTIONS and PERL
 . $testdir/../tp/defs || exit 1
 
 mkdir -p out_tests
@@ -27,7 +27,7 @@ if [ $ret != 0 ]; then
   return_code=1
 fi
 
-diff $DIFF_U_OPTION ${srcdir}/tests/reference_sectioning_gap.texi 
out_tests/sectioning_gap.texi
+diff $DIFF_OPTIONS ${srcdir}/tests/reference_sectioning_gap.texi 
out_tests/sectioning_gap.texi
 diff_ret=$?
 if [ $diff_ret != 0 ]; then
   return_code=1
@@ -35,7 +35,7 @@ elif [ $return_code = 0 ]; then
   rm -f out_tests/sectioning_gap.texi
 fi
 
-diff $DIFF_U_OPTION ${srcdir}/tests/reference_Th1.texi out_tests/Th1.texi
+diff $DIFF_OPTIONS ${srcdir}/tests/reference_Th1.texi out_tests/Th1.texi
 if [ $diff_ret != 0 ]; then
   return_code=1
 elif [ $return_code = 0 ]; then
@@ -48,7 +48,7 @@ if [ $ret != 0 ]; then
   return_code=1
 fi
 
-diff $DIFF_U_OPTION ${srcdir}/tests/reference_modules_main.texi 
out_tests/modules_main.texi
+diff $DIFF_OPTIONS ${srcdir}/tests/reference_modules_main.texi 
out_tests/modules_main.texi
 diff_ret=$?
 if [ $diff_ret != 0 ]; then
   return_code=1
@@ -56,7 +56,7 @@ elif [ $return_code = 0 ]; then
   rm -f out_tests/modules_main.texi
 fi
 
-diff $DIFF_U_OPTION -r ${srcdir}/tests/reference_includes out_tests/includes
+diff $DIFF_OPTIONS -r ${srcdir}/tests/reference_includes out_tests/includes
 diff_ret=$?
 if [ $diff_ret != 0 ]; then
   return_code=1
diff --git a/Pod-Simple-Texinfo/test_scripts/test_empty_head2.sh 
b/Pod-Simple-Texinfo/test_scripts/test_empty_head2.sh
index f4785f3354..1b8a7f4ac0 100755
--- a/Pod-Simple-Texinfo/test_scripts/test_empty_head2.sh
+++ b/Pod-Simple-Texinfo/test_scripts/test_empty_head2.sh
@@ -11,7 +11,7 @@ if test z"$srcdir" = "z"; then
   srcdir=.
 fi
 
-# for DIFF_U_OPTION and PERL
+# for DIFF_OPTIONS and PERL
 . $testdir/../tp/defs || exit 1
 
 mkdir -p out_tests_empty_head2
@@ -28,7 +28,7 @@ if [ $ret != 0 ]; then
   return_code=1
 fi
 
-diff $DIFF_U_OPTION ${srcdir}/tests/reference_test_empty_head2.texi 
out_tests_empty_head2/empty_head2.texi
+diff $DIFF_OPTIONS ${srcdir}/tests/reference_test_empty_head2.texi 
out_tests_empty_head2/empty_head2.texi
 diff_ret=$?
 if [ $diff_ret != 0 ]; then
   return_code=1
diff --git a/Pod-Simple-Texinfo/test_scripts/test_ref_to_unknown.sh 
b/Pod-Simple-Texinfo/test_scripts/test_ref_to_unknown.sh
index b13f02362e..0dbba0b2df 100755
--- a/Pod-Simple-Texinfo/test_scripts/test_ref_to_unknown.sh
+++ b/Pod-Simple-Texinfo/test_scripts/test_ref_to_unknown.sh
@@ -11,7 +11,7 @@ if test z"$srcdir" = "z"; then
   srcdir=.
 fi
 
-# for DIFF_U_OPTION and PERL
+# for DIFF_OPTIONS and PERL
 . $testdir/../tp/defs || exit 1
 
 mkdir -p out_tests_ref_to_unknown
@@ -28,7 +28,7 @@ if [ $ret != 0 ]; then
   return_code=1
 fi
 
-diff $DIFF_U_OPTION ${srcdir}/tests/reference_ref_to_unknown.texi 
out_tests_ref_to_unknown/ref_to_unknown.texi
+diff $DIFF_OPTIONS ${srcdir}/tests/reference_ref_to_unknown.texi 
out_tests_ref_to_unknown/ref_to_unknown.texi
 diff_ret=$?
 if [ $diff_ret != 0 ]; then
   return_code=1
diff --git a/configure.ac b/configure.ac
index 5b1fffb5d5..8245035b8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,7 +196,6 @@ DIFF_U_OPTION=
 if test "z$diff_accepts_u_option" = 'zyes' ; then
   DIFF_U_OPTION=-u
 fi
-AC_SUBST([DIFF_U_OPTION])
 
 # check whether diff accepts the -a option (only needed for GNU diff).
 AC_MSG_CHECKING(whether diff accepts -a)
@@ -214,7 +213,28 @@ DIFF_A_OPTION=
 if test "z$diff_accepts_a_option" = 'zyes' ; then
   DIFF_A_OPTION=-a
 fi
-AC_SUBST([DIFF_A_OPTION])
+
+# check whether diff should have --strip-trailing-cr (may be needed on MinGW)
+diff_accepts_cr_option=no
+if echo $host_os | grep mingw >/dev/null ; then
+  AC_MSG_CHECKING(whether diff accepts --strip-trailing-cr)
+  echo foo >conftest.dtx
+  echo foo | diff --strip-trailing-cr - conftest.dtx >/dev/null 2>&1
+  error_status_diff_cr=$?
+  if test $error_status_diff_cr = 0; then
+    diff_accepts_cr_option=yes
+  fi
+  AC_MSG_RESULT($diff_accepts_cr_option)
+  rm -f conftest.dtx
+fi
+
+DIFF_CR_OPTION=
+if test "z$diff_accepts_cr_option" = 'zyes' ; then
+  DIFF_CR_OPTION='--strip-trailing-cr'
+fi
+
+DIFF_OPTIONS="$DIFF_A_OPTION $DIFF_U_OPTION $DIFF_CR_OPTION"
+AC_SUBST([DIFF_OPTIONS])
 
 # Checks for header files.
 AC_CHECK_HEADERS(io.h pwd.h \
diff --git a/install-info/tests/defs.in b/install-info/tests/defs.in
index c05f871947..0424313566 100644
--- a/install-info/tests/defs.in
+++ b/install-info/tests/defs.in
@@ -72,10 +72,7 @@ else
   path_sep=":"
 fi
 
-diff=diff
-if echo '@host_os@' | $EGREP 'mingw' >/dev/null; then
-  diff='diff --strip-trailing-cr'
-fi
+diff="diff @DIFF_OPTIONS@"
 
 # Return true if PROG is somewhere in PATH, else false.
 findprog ()
diff --git a/tp/defs.in b/tp/defs.in
index 51b0202667..d620b23082 100644
--- a/tp/defs.in
+++ b/tp/defs.in
@@ -1,6 +1,5 @@
 PERL="@PERL@"
-DIFF_U_OPTION="@DIFF_U_OPTION@"
-DIFF_A_OPTION="@DIFF_A_OPTION@"
+DIFF_OPTIONS="@DIFF_OPTIONS@"
 HOST_IS_WINDOWS_VARIABLE="@HOST_IS_WINDOWS_VARIABLE@"
 PERL_UNICODE_COLLATE_OK="@PERL_UNICODE_COLLATE_OK@"
 if [ "z$srcdir" = 'z' ]; then
diff --git a/tp/tests/many_input_files/different_encodings.sh 
b/tp/tests/many_input_files/different_encodings.sh
index 28fab0a8c1..7aef68b930 100755
--- a/tp/tests/many_input_files/different_encodings.sh
+++ b/tp/tests/many_input_files/different_encodings.sh
@@ -61,7 +61,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/different_languages_gen_master_menu.sh 
b/tp/tests/many_input_files/different_languages_gen_master_menu.sh
index 5c9749c5d5..a49411f0c1 100755
--- a/tp/tests/many_input_files/different_languages_gen_master_menu.sh
+++ b/tp/tests/many_input_files/different_languages_gen_master_menu.sh
@@ -55,7 +55,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/input_dir_non_ascii.sh 
b/tp/tests/many_input_files/input_dir_non_ascii.sh
index 0fc4895b0d..81133075db 100755
--- a/tp/tests/many_input_files/input_dir_non_ascii.sh
+++ b/tp/tests/many_input_files/input_dir_non_ascii.sh
@@ -62,7 +62,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/output_dir_file_non_ascii.sh 
b/tp/tests/many_input_files/output_dir_file_non_ascii.sh
index 562c0eb7ab..a35ce03e5a 100755
--- a/tp/tests/many_input_files/output_dir_file_non_ascii.sh
+++ b/tp/tests/many_input_files/output_dir_file_non_ascii.sh
@@ -64,7 +64,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/output_dir_non_ascii.sh 
b/tp/tests/many_input_files/output_dir_non_ascii.sh
index 413830b505..85a2725151 100755
--- a/tp/tests/many_input_files/output_dir_non_ascii.sh
+++ b/tp/tests/many_input_files/output_dir_non_ascii.sh
@@ -64,7 +64,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/tex_l2h.sh 
b/tp/tests/many_input_files/tex_l2h.sh
index 395114289d..c5e25c42ec 100755
--- a/tp/tests/many_input_files/tex_l2h.sh
+++ b/tp/tests/many_input_files/tex_l2h.sh
@@ -92,7 +92,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii.sh 
b/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii.sh
index 6b64759e9c..c87a698082 100755
--- a/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii.sh
+++ b/tp/tests/many_input_files/tex_l2h_output_dir_non_ascii.sh
@@ -101,7 +101,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "$outdir" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/tex_t4ht.sh 
b/tp/tests/many_input_files/tex_t4ht.sh
index 21897bd6dd..9d5f89257f 100755
--- a/tp/tests/many_input_files/tex_t4ht.sh
+++ b/tp/tests/many_input_files/tex_t4ht.sh
@@ -57,7 +57,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "${outdir}" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "${outdir}" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii.sh 
b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii.sh
index e272176990..d94850af30 100755
--- a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii.sh
+++ b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii.sh
@@ -67,7 +67,7 @@ else
     rm -rf $staging_dir/${dir}_res
     cp -pr "$srcdir/${dir}_res" $staging_dir
     chmod -R u+w "$staging_dir/${dir}_res"
-    diff $DIFF_U_OPTION -r "$staging_dir/${dir}_res" "${outdir}" 2>>$logfile > 
"$diffs_dir/$dir.diff"
+    diff $DIFF_OPTIONS -r "$staging_dir/${dir}_res" "${outdir}" 2>>$logfile > 
"$diffs_dir/$dir.diff"
     dif_ret=$?
     if [ $dif_ret != 0 ]; then
       echo "D: $diffs_dir/$dir.diff"
diff --git a/tp/tests/run_parser_all.sh b/tp/tests/run_parser_all.sh
index 070ce74cad..a25562002b 100755
--- a/tp/tests/run_parser_all.sh
+++ b/tp/tests/run_parser_all.sh
@@ -445,7 +445,7 @@ while read line; do
       post_process_output
 
       if test "z$res_dir_used" != 'z' ; then
-        diff $DIFF_A_OPTION $DIFF_U_OPTION -r "$res_dir_used" "${outdir}$dir" 
2>>$logfile > "$testdir/$diffs_dir/$diff_base.diff"
+        diff $DIFF_OPTIONS -r "$res_dir_used" "${outdir}$dir" 2>>$logfile > 
"$testdir/$diffs_dir/$diff_base.diff"
         dif_ret=$?
         if [ $dif_ret != 0 ]; then
           echo "D: $testdir/$diffs_dir/$diff_base.diff (printed below)"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]