* tests/init.cfg (require_timeout_): New function, from grep.
(require_valgrind_): Use it, to kill -9 after 3 seconds, because the
default SIGINT was insufficient.
* tests/init.cfg (require_utf8_locale_): Solaris 10's /usr/bin/tr
silently malfunctions with multibyte input, so attempt to find a
better one, trying /usr/xpg4/bin/tr and "gtr".
Failing that, skip the test. Reported by Collin Funk in
https://lists.gnu.org/r/diffutils-devel/2025-02/msg00004.html
* bootstrap.conf: Some gnulib modules are now deprecated, in
favor of new names with a "-h" suffix (and stdbool->bool).
Induce this change with the following:
re='inttypes|signal|stdckdint|stdint|sys_types|sys_wait|unistd'
perl -pi -e 's{^('"$re"')$}{$1-h};s{^stdbool$}{bool}' bootstrap.conf
Then, sort the module names.
* doc/diffutils.texi (Unusual File Names): Rewrite to reflect
that file names with e.g., NL and TAB are now quoted.
Reported by Matěj Cepl in <https://bugs.gnu.org/68695>.
* configure.ac: Move system-related tests closer together. Define
O_PATH_SUPPORTS_FSTAT if O_PATH exists and is supported by fstat().
* src/diff.c (O_PATHSEARCH): Don't use O_PATH if it is defined but not
supported by fstat().
* man/help2man: Update to help2man-1.48.5, but merging in the
latest #!/usr/bin/env change. Bruno Haible reported that it
failed a new gnulib syntax-check due to an old FSF mailing
address in https://bugs.gnu.org/73139
Problem reported by Jun T <https://bugs.gnu.org/48062>.
* tests/diff3: Use --diff-program=diff since --program-transform-name
is applied after install.
* tests/help-version (sdiff_setup, diff3_setup): Likewise.
Problem found indirectly by Coverity, reported by Wasser Mai
(Bug#71535). Although the Coverity report was wrong, there was a
different potential memory leak nearby. Fix the problem by
modifying the string in place, avoiding the need to call malloc.
* src/util.c (color_ext_list, struct color_ext_type):
Remove. Not needed, as the list wasn’t used.
All uses removed.
(get_funky_string): Omit last argument output_count, as it’s
easily calculated by caller. This lets us call this function
when we don’t care about the count.
(color_palette): Now char *, not char const *, since we
now update through it.
(set_color_palette): Likewise.
(parse_diff_color): Process color palette into itself, to avoid
unnecessary malloc and free calls. This pacifies Coverity, saves
a bit of space in the normal case, and avoids a memory leak in
some cases. Do not process the palette twice, as its memory
has been modified and this function had no effect on the
color indicators the second time.
Problem reported by Bruno Haible <https://bugs.gnu.org/71486>.
* src/diff.c (NOFOLLOW_SYMLINK_ERRNO): New constant.
(compare_files): Use it instead of ELOOP. When it is not ELOOP,
treat ELOOP as a failure in resolving the parent directory;
this saves a syscall in some situation.
* tests/ignore-case: Don't compare 'Ⓐ' with 'ⓐ'; this doesn't work on
NetBSD 10.0 and Solaris 11.4. Don't compare 'Ꞻ' with 'ꞻ'; this doesn't
work on CentOS 7, macOS, and Solaris 11 OmniOS.
* configure.ac: Don’t use -Wsystem-headers, as <stdbit.h>
uses static functions that couldn’t be called from
extern inline functions if they were in user code.
Now that we have a system.c, there’s little point to these
being extern inline functions.
* src/system.c (same_file, stat_size): Move here from system.h,
and make them ordinary extern functions.
(proc_dev, symlink_size_ok): Now static, and private to their
functions.
* src/system.h (same_file, stat_size): Now just decls.
Bug reported by Bruno Haible in <https://bugs.gnu.org/70951>.
I never did like the XTERN macro and its descendants, as this
“extension” to C causes more confusion than it cures, so let’s
just get rid of it and use plain ‘extern’.
* cfg.mk (_gl_TS_extern): Remove XTERN, SYSTEM_EXTERN.
* src/Makefile.am (cmp_SOURCES, diff3_SOURCES, sdiff_SOURCES)
(diff_SOURCES): Add system.c.
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (SYSTEM_INLINE):
Remove.
* src/diff.c: Define vars declared in diff.h.
* src/diff.h (DIFF_EXTERN): Remove. All uses removed.
Just use ‘extern’ when declaring extern vars.
* src/system.h (SYSTEM_EXTERN): Likewise.
* src/system.c: New file.
* src/Makefile.am (version.c): Have it include version.h,
so that it checks its own interface.
* src/diff.c (DIFF_INLINE): Define this instead of GDIFF_MAIN,
for consistency with SYSTEM_INLINE.
* src/diff.h (DIFF_EXTERN): New macro, replacing XTERN.
All uses changed. Adjust to GDIFF_MAIN→DIFF_INLINE change.
* src/system.h (SYSTEM_EXTERN): Now takes an argument.
All uses changed.
stdbit.h is standardized in C23, so use that instead of
the GNU-specific count-leading-zeros module.
* bootstrap.conf (gnulib_modules): Remove count-leading-zeros.
Add stdbit.
* src/system.h: Include stdbit.h instead of count-leading-zeros.h.
(floor_log2): Implement via stdc_bit_width instead of via
count_leading_zeros_ll.
Gleb Fotengauer-Malinovskiy reported <https://bugs/gnu/org/66095>
that the recent change to quoting style broke GNU patch.
* src/util.c: Include quotearg.h.
(current_name): New static var, replacing the the old
current_name0 and current_name1. All uses changed.
(begin_output): Go back to quoting file names for C,
not for the shell, when they contain troublesome characters.
This is not a simple revert, as the revised code handles
multi-byte characters even in non-UTF-8 locales.
* tests/filename-quoting: Revert previous change to this file.
* src/util.c (output_1_line): Append a semicolon to "default:"
label, now that the following line is a declaration. Avoids this:
error: a label can only be part of a statement and a declaration is\
not a statement
* src/diff.c (compare_files): If openat (..., "a/b/.../e/f",
O_PATH | ...) fails with ELOOP, one of a, a/b, ..., a/b/.../e
must be a symlink loop; a/b/.../e/f cannot itself be a symlink loop.
So in this case fail immediately rather than following up with
fstatat (..., "a/b/.../e/f", ..., AT_SYMLINK_NOFOLLOW).