+2024-01-11 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Reject broken 'join' program as seen in macOS, FreeBSD etc.
+ Reported by Avinash Sonawane <rootkea@gmail.com> in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00028.html>.
+ * gnulib-tool: Move the func_gnulib_dir and func_tmpdir invocations
+ ahead. If the 'join' program exists but does not handle missing fields,
+ bail out.
+
2024-01-10 Bruno Haible <bruno@clisp.org>
jit/cache tests: Fix for powerpc64le CPUs.
}
}
-# The 'join' program does not exist on all platforms. Where it exists,
-# we can use it. Where not, bail out.
-if (type join) >/dev/null 2>&1; then
- :
-else
- echo "$progname: 'join' program not found. Consider installing GNU coreutils." >&2
- func_exit 1
-fi
-
# Ensure an 'echo' command that
# 1. does not interpret backslashes and
# 2. does not print an error message "broken pipe" when writing into a pipe
shift
fi
+func_gnulib_dir
+func_tmpdir
+trap 'exit_status=$?
+ if test "$signal" != EXIT; then
+ echo "caught signal SIG$signal" >&2
+ fi
+ rm -rf "$tmp"
+ exit $exit_status' EXIT
+for signal in HUP INT QUIT PIPE TERM; do
+ trap '{ signal='$signal'; func_exit 1; }' $signal
+done
+signal=EXIT
+
+# The 'join' program does not exist on all platforms, and
+# on macOS 12.6, FreeBSD 14.0, NetBSD 9.3 it is buggy, see
+# <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232405>.
+# In these cases, bail out. Otherwise, we can use it.
+if (type join) >/dev/null 2>&1; then
+ echo a > "$tmp"/join-input-1
+ { echo; echo a; } > "$tmp"/join-input-2
+ if LC_ALL=C join "$tmp"/join-input-1 "$tmp"/join-input-2 | grep a >/dev/null \
+ && LC_ALL=C join "$tmp"/join-input-2 "$tmp"/join-input-1 | grep a >/dev/null; then
+ :
+ else
+ echo "$progname: 'join' program is buggy. Consider installing GNU coreutils." >&2
+ func_exit 1
+ fi
+else
+ echo "$progname: 'join' program not found. Consider installing GNU coreutils." >&2
+ func_exit 1
+fi
+
# Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
esac
}
-func_gnulib_dir
-func_tmpdir
-trap 'exit_status=$?
- if test "$signal" != EXIT; then
- echo "caught signal SIG$signal" >&2
- fi
- rm -rf "$tmp"
- exit $exit_status' EXIT
-for signal in HUP INT QUIT PIPE TERM; do
- trap '{ signal='$signal'; func_exit 1; }' $signal
-done
-signal=EXIT
-
# Note: The 'eval' silences stderr output in dash.
if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
# Zsh 4 and Bash 4 have associative arrays.