* 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).
* src/diff.c (compare_files): If find_dir_file_pathname tells
us the file type, use that info to avoid unnecessary calls
to openat.
* src/dir.c (find_dir_file_pathname): New arg DETYPE. All uses changed.
This regression was introduced on 2023-05-22 in commit
v3.10-9-gda1697dcb6 ("diff: C99 decl style in context.c") during a code
style change.
This regression was discovered using the GNU patch testsuite:
FAIL: preserve-c-function-names
FAIL: reject-format
* src/context.c (minus_prefix_lines): Initialize with a reversed value.
Tiny-change: yes
Include <ctype.h> and <c-ctype.h> only in modules where needed.
* src/cmp.c, src/context.c, src/diff.c, src/diff3.c, src/ifdef.c:
* src/sdiff.c: Include <c-ctype.h>.
* src/io.c: Include <ctype.h>.
* src/system.h: Do not include either <ctype.h> or <c-ctype.h>.
* bootstrap.conf (gnulib_modules): Add c32isprint.
* src/util.c: Include mcel.h.
(output_1_line): Return immediately on output error.
Scan multi-byte characters and count their widths.
(analyze_hunk): Ignore multi-byte white space too.
This fixes a recently-introduced portability bug
when running on platforms like Solaris 10 that lack O_PATH.
* src/diff.c (compare_files): On platforms without O_PATH,
when running 'diff --no-dereference symlink dir' do not
report an error merely because dir/symlink is a symbolic link
and cannot be opened for reading.
Drop diffutils-specific library code that has been moved into Gnulib.
* gl/lib/exclude.c, gl/lib/mbscasecmp.c, gl/lib/mcel.c:
* gl/lib/mcel.h, gl/modules/mcel, gl/modules/mcel-prefer:
* gl/modules/mcel-tests, gl/tests/test-mcel.c:
Remove; now taken from Gnulib.