From 3840ce4a72d0f3fd58e2596298334964616ff025 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 21 Apr 2024 00:27:18 +0200 Subject: [PATCH] gnulib-tool: In sh+py mode, don't fail because of dangling symlinks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Paul Eggert in and Pádraig Brady in . * gnulib-tool: In sh+py mode, use diff option '--no-dereference' if available. --- ChangeLog | 10 ++++++++++ gnulib-tool | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cbc2a83f75..acc7a3ea42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2024-04-20 Bruno Haible + + gnulib-tool: In sh+py mode, don't fail because of dangling symlinks. + Reported by Paul Eggert in + + and Pádraig Brady in + . + * gnulib-tool: In sh+py mode, use diff option '--no-dereference' if + available. + 2024-04-20 Collin Funk gnulib-tool.py: Remove duplicate per-module definitions. diff --git a/gnulib-tool b/gnulib-tool index d7b6d33912..6d430e56e6 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -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 || -- 2.39.5