]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool: In sh+py mode, don't fail because of dangling symlinks.
authorBruno Haible <bruno@clisp.org>
Sat, 20 Apr 2024 22:27:18 +0000 (00:27 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 20 Apr 2024 22:27:18 +0000 (00:27 +0200)
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00318.html>
and Pádraig Brady in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00321.html>.

* gnulib-tool: In sh+py mode, use diff option '--no-dereference' if
available.

ChangeLog
gnulib-tool

index cbc2a83f75884496294e6e274d013b20a71c0404..acc7a3ea42fd2a819669f5e6c872191d22abe552 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-04-20  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool: In sh+py mode, don't fail because of dangling symlinks.
+       Reported by Paul Eggert in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00318.html>
+       and Pádraig Brady in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00321.html>.
+       * gnulib-tool: In sh+py mode, use diff option '--no-dereference' if
+       available.
+
 2024-04-20  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Remove duplicate per-module definitions.
index d7b6d3391257f494dc237f34c12a0c3c3ed4be1d..6d430e56e634a36c6b4b2883fa7f99725db59f0c 100755 (executable)
@@ -192,7 +192,14 @@ case "$GNULIB_TOOL_IMPL" in
           func_fatal_error "gnulib-tool.sh succeeded but gnulib-tool.py failed! Inspect $tmp/ and $tmp-py-err."
         fi
         # Compare the two results on the file system.
-        diff -r -q . "$tmp" >/dev/null ||
+        # GNU diffutils 3.3 or newer support option --no-dereference. This
+        # option avoids errors on dangling links.
+        if LC_ALL=C diff --help 2>/dev/null | grep no-dereference >/dev/null; then
+          diff_options='--no-dereference'
+        else
+          diff_options=
+        fi
+        diff -r $diff_options -q . "$tmp" >/dev/null ||
           func_fatal_error "gnulib-tool.py produced different files than gnulib-tool.sh! Compare `pwd` and $tmp."
         # Compare the two outputs.
         diff -q "$tmp-sh-out" "$tmp-py-out" >/dev/null ||
@@ -235,7 +242,14 @@ case "$GNULIB_TOOL_IMPL" in
           func_fatal_error "gnulib-tool.sh succeeded but gnulib-tool.py failed! Inspect $tmp/ and $tmp-py-err."
         fi
         # Compare the two results on the file system.
-        diff -r -q "$dir" "$tmp" >/dev/null ||
+        # GNU diffutils 3.3 or newer support option --no-dereference. This
+        # option avoids errors on dangling links.
+        if LC_ALL=C diff --help 2>/dev/null | grep no-dereference >/dev/null; then
+          diff_options='--no-dereference'
+        else
+          diff_options=
+        fi
+        diff -r $diff_options -q "$dir" "$tmp" >/dev/null ||
           func_fatal_error "gnulib-tool.py produced different files than gnulib-tool.sh! Compare $dir and $tmp."
         # Compare the two outputs.
         diff -q "$tmp-sh-out" "$tmp-py-out" >/dev/null ||