2025-04-08  Jim Meyering  <meyering@meta.com>

	version 3.12
	* NEWS: Record release date.

	tests: cmp: increase timeout to avoid failure on a very busy-IO system
	* tests/cmp: Increase timeout from 0.1 to 0.4s, to avoid false-failure
	on a system with lots of IO congestion. Reported by Nelson Beebe
	in https://lists.gnu.org/r/diffutils-devel/2025-04/msg00007.html

2025-04-04  Jim Meyering  <meyering@meta.com>

	build: update gnulib to latest; and update bootstrap

2025-03-28  Jim Meyering  <meyering@meta.com>

	maint: ensure that new "make syntax-check"-run sc_codespell passes
	* cfg.mk (codespell_ignore_words_list): Ignore false-positive "words".

2025-03-27  Jim Meyering  <meyering@meta.com>

	maint: rather than exempt "hight" as a spelling false-positive...
	* src/diff3.c (output_diff3): Rename lowt,hight to low_t,high_t.

2025-02-28  Paul Eggert  <eggert@cs.ucla.edu>

	tests: test for diff -y crash
	* tests/side-by-side-seq: New test.
	* tests/Makefile.am (TESTS): Add it.

	diff: fix allocation typo leading to crashes
	But reported by Nick Smallbone, with one-line fix by
	Collin Funk <https://bugs.gnu.org/76613>.
	* src/io.c (find_and_hash_each_line): Fix size computation.

	tests: make seq replacement more available
	This refactoring should let other future tests use ‘seq’.
	* tests/diff3 (seq): Move from here ...
	* tests/init.cfg: ... to here.

2025-02-21  Paul Eggert  <eggert@cs.ucla.edu>

	maint: mention bug#76452 in NEWS

2025-02-21  Collin Funk  <collin.funk1@gmail.com>

	diff: add a test case for the recent empty file bug
	* tests/empty-file: New file.
	* tests/Makefile.am (TESTS): Add the test.

2025-02-21  Paul Eggert  <eggert@cs.ucla.edu>

	diff: don't treat empty files as a different file type
	Reported by Kate Deplaix <kit-ty-kate@outlook.com> in
	<https://lists.gnu.org/r/bug-diffutils/2025-02/msg00005.html>.

	* src/diff.c (compare_prepped_files): Don't rely on string
	file type, as that might not agree with our idea of a file type.

2025-02-03  Simon Josefsson  <simon@josefsson.org>

	cmp, diff, diff3, sdiff: support gnulib-l10n
	* src/cmp.c (main): Call bindtextdomain for gnulib-l10n.
	* src/diff.c (main): Likewise.
	* src/diff3.c (main): Likewise.
	* src/sdiff.c (main): Likewise.

2025-02-02  Jim Meyering  <meyering@meta.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.11
	* NEWS: Record release date.

	maint: continue writing base64-encoded checksums to announcement
	* cfg.mk (announce_gen_args): Set to --cksum-checksums.

	tests: avoid "make check" hang on CentOS Stream 9 with valgrind-3.19.0
	* 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: avoid test failure due to inadequate Solaris 10 tr
	* 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

	maint: once again distribute .tar.gz files
	* configure.ac: Reenable distribution of gzip-compressed tarballs,
	to help reduce the size of the Guix seed, as discussed at
	https://lists.gnu.org/r/coreutils/2020-02/msg00042.html and
	https://lists.gnu.org/r/sed-devel/2020-01/msg00013.html
	* NEWS (Release): Mention this.
	Requested by Nicolas Boos

2025-02-01  Jim Meyering  <meyering@meta.com>

	maint: reflect gnulib module renamings
	* 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.

	build: update gnulib to latest; and update bootstrap

2025-01-05  Jim Meyering  <meyering@meta.com>

	doc: rewrite the "Unusual File Names" section
	* 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>.

2025-01-05  Bruno Haible  <bruno@clisp.org>

	diff: Fix failure of --no-dereference option (regression 2023-07-01)
	* 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().

	doc: reference continuous integration URLs
	* README-hacking (Continuous integration): New section:
	list the gitlab and github CI links.

2025-01-03  Jim Meyering  <meyering@meta.com>

	maint: update all copyright dates via "make update-copyright"

	build: update gnulib to latest

2024-10-13  Collin Funk  <collin.funk1@gmail.com>

	maint: use Gnulib's stat-time over our own version
	* bootstrap.conf (gnulib_modules): Add stat-time.
	* configure.ac: Remove check for the st_blksize in struct stat.
	* src/system.h: Include stat-time.h.
	(STAT_BLOCKSIZE): Remove definition.
	* src/analyze.c (diff_2_files):
	* src/cmp.c (main):
	* src/diff3.c (read_diff):
	* src/io.c (sip): Use ST_BLKSIZE instead of STAT_BLOCKSIZE.

2024-09-10  Jim Meyering  <meyering@meta.com>

	maint: avoid old-FSF-address syntax-check failure
	* 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

2024-07-22  Bruno Haible  <bruno@clisp.org>

	build: Fix use of perl on Guix, FreeBSD, NetBSD
	* man/help2man: Search for perl in $PATH.

	build: Generate programs' man pages in the source directory, per GCS
	* man/Makefile.am ($(dist_man1_MANS)): Generate the *.1 files in
	$(srcdir), not in the build dir.

2024-07-21  Bruno Haible  <bruno@clisp.org>

	build: Fix a build failure in a VPATH build
	* src/Makefile.am (cmp.$(OBJEXT) etc.): Depend on version.h.

2024-07-15  Paul Eggert  <eggert@cs.ucla.edu>

	maint: adjust to Gnulib -Wsystem-headers change
	* configure.ac (WERROR_CFLAGS): No need to disable
	-Wsystem-headers as Gnulib no longer enables it by default.

	build: update gnulib submodule to latest

2024-07-04  Jim Meyering  <meyering@meta.com>

	build: update gnulib to latest; and update bootstrap

2024-07-04  Collin Funk  <collin.funk1@gmail.com>

	maint: import tests/init.sh from Gnulib during bootstrap
	* bootstrap.conf (bootstrap_post_import_hook): Use gnulib-tool
	--copy-file to import tests/init.sh.
	* tests/init.sh: Remove file.
	* .gitignore (/tests/init.sh): Add entry.

2024-06-23  Collin Funk  <collin.funk1@gmail.com>

	tests: don't fail when --program-transform-name is used
	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.

2024-06-19  Paul Eggert  <eggert@cs.ucla.edu>

	diff: avoid memory leak with --color-palette
	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.

	maint: update .gitignore to add lib/stdbit.h

2024-06-11  Paul Eggert  <eggert@cs.ucla.edu>

	diff: port to FreeBSD, NetBSD
	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.

2024-06-11  Bruno Haible  <bruno@clisp.org>

	tests: Fix ignore-case failure on several platforms
	* 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.

2024-06-11  Paul Eggert  <eggert@cs.ucla.edu>

	maint: port ‘make distcheck’ to Ubuntu 24.04
	* 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.

	maint: pacify ‘make sc_tight_scope’
	Problem reported by Bruno Haible <https://bugs.gnu.org/71455>.
	* src/system.h (same_file, stat_size): Add ‘extern’.

	maint: port to birthtime platforms
	Problem reported by Bruno Haible <https://bugs.gnu.org/71456>.
	* src/system.c (same_file): Fix typo on platforms with birthtime.

2024-05-21  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2024-05-16  Paul Eggert  <eggert@cs.ucla.edu>

	maint: adjust to Gnulib stdbit splitup
	* bootstrap.conf (gnulib_modules): Remove stdbit; add stdc_bit_width.

	build: update gnulib submodule to latest

2024-05-15  Paul Eggert  <eggert@cs.ucla.edu>

	maint: move same_file and stat_size into system.c
	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.

	build: update gnulib submodule to latest

2024-05-14  Paul Eggert  <eggert@cs.ucla.edu>

	maint: be less fancy when defining extern vars
	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.

	build: update gnulib submodule to latest

2024-05-12  Paul Eggert  <eggert@cs.ucla.edu>

	maint: pacify GCC 14 -Wmissing-variable-declarations
	* 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.

2024-05-11  Paul Eggert  <eggert@cs.ucla.edu>

	diff: prefer stdbit to count-leading-zeros
	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.

	maint: update bootstrap to Gnulib version

	build: update gnulib submodule to latest

2024-05-09  Paul Eggert  <eggert@cs.ucla.edu>

	diff: improve GCC 13.3’s static checking
	* src/io.c (slurp): GCC bug 110014 should be fixed in GCC 13.3.

2024-02-18  Paul Eggert  <eggert@cs.ucla.edu>

	diff: restrict scope of GCC bug 110014 workaround
	* src/io.c (slurp): Work around GCC bug 110014 only if GCC 13,
	since it’s reportedly fixed in GCC 14.

2024-01-05  Jim Meyering  <meyering@meta.com>

	maint: make update-copyright

	build: update gnulib to latest; also update bootstrap

	build: suppress -Wmaybe-uninitialized for one function
	* src/sdiff.c (edit): Suppress gcc's -Wmaybe-uninitialized warning
	for this function. Whenever "cmd1 == 'e'", cmd2 **is** initialized.

2023-09-20  Paul Eggert  <eggert@cs.ucla.edu>

	diff: go back to C quoting for diff -c/-u headers
	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.

	build: update gnulib submodule to latest

2023-09-16  Jim Meyering  <meyering@meta.com>

	build: avoid new build failure
	* 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

2023-09-16  Paul Eggert  <eggert@cs.ucla.edu>

	maint: fix NEWS typos

	diff: tune when O_PATH fails with ELOOP
	* 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).

	diff: tune 'diff --no-dereference --no-file-name-case SYMLINK DIR'
	* 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.

2023-09-15  Paul Eggert  <eggert@cs.ucla.edu>

	maint: fix comment typo

2023-09-15  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>  (tiny change)

	diff: fix regression affecting the counting of diff context lines
	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.

2023-09-15  Paul Eggert  <eggert@cs.ucla.edu>

	diff: publish attributes
	* src/diff.h (translate_line_number, find_change):
	Move attribute here ...
	* src/util.c: ... from here.

2023-09-13  Paul Eggert  <eggert@cs.ucla.edu>

	diff: respond faster to write failures
	* src/util.c (output_1_line): Check for signals even
	if there is a write failure, for faster response when
	hammering on /dev/full etc.

	maint: be clearer about when ctype is needed
	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>.

	maint: diff no longer uses isblank directly
	* bootstrap.conf (gnulib_modules): Remove isblank.

2023-09-12  Paul Eggert  <eggert@cs.ucla.edu>

	diff: improve util.c multi-byte handling
	* 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.

	sdiff: port to odd isspace locales
	* src/sdiff.c (skip_white): Use c_isspace, not isspace.
	We are parsing diff output, and c_isspace is better here.

2023-09-07  Paul Eggert  <eggert@cs.ucla.edu>

	diff: port --no-dereference changes to non-O_PATH
	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.

	maint: switch to gnulib mcel
	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.

	build: update gnulib submodule to latest

2023-08-30  Paul Eggert  <eggert@cs.ucla.edu>

	maint: define GNULIB_MBRTOC32_REGULAR
	* configure.ac (GNULIB_MBRTOC32_REGULAR): Define.
	diffutils itself already assumes this, so it might as well
	assume it in Gnulib code as well.

2023-08-24  Paul Eggert  <eggert@cs.ucla.edu>

	diff: port mcel.h designated initializers to C99
	* gl/lib/mcel.h (mcel_ch, mcel_err): Use C-standard notation
	for designated initializers, instead of a GNU extension.

2023-08-22  Paul Eggert  <eggert@cs.ucla.edu>

	maint: pacify ‘make syntax-check’
	* cfg.mk: Update exclude_file_name_regexp lists.

2023-08-21  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

	diff: avoid mbuiter
	* bootstrap.conf (avoided_gnulib_modules):
	Avoid mbuiter.
	* gl/lib/exclude.c: New file, with an mcel option.

	diff: modularize and tune mcel code
	Go back to a single mcel module, instead of trying to break it up
	into ucore and mcel pieces, as breaking it up hurt performance.
	Use gnulib-tool’s --local-dir to create diffutils-specific modules
	for mcel; the idea is that this will eventually migrate into Gnulib.
	* bootstrap.conf (avoided_gnulib_modules): Add mbuiterf.
	(gnulib_modules): Add mbscasecmp, mcel-prefer.
	(gnulib_tool_option_extras): Add --local-dir=gl to pick up new files.
	* cfg.mk (exclude_file_name_regexp--sc_prohibit_doubled_word):
	Do not exclude now-removed files lib/ucore.c, lib/ucore.h.
	* lib/Makefile.am: Adjust to use of modules.
	(noinst_HEADERS): Remove mcel.h, ucore.h.
	(libdiffutils_a_SOURCES): Remove mcel.c, mcel-casecmp.c, ucore.c
	* lib/mcel-casecmp.c, lib/ucore.c, lib/ucore.h: Remove.
	* lib/mcel.h: Switch to LGPLv2.1+.  Do not include ucore.h.
	All uses of ucore_t changed back to using char32_t.
	Do what ucore.h used to do: include verify.h, limits.h, stddef.h,
	uchar.h; require config.h, define _GL_LIKELY, _GL_UNLIKELY.
	(MCEl_CHAR_MAX, MCEL_ERR_MIN, MCEL_ERR_MAX): New constants.
	(mcel_t): Switch from single ucore_t c to a char32_t ch and
	unsigned char err.  This has significantly better performance on
	Fedora 38 x86-64.  All uses changed.  Check that unsigned char
	promotes to int.
	(mcel_ch, mcel_err, mcel_cmp, mcel_tocmp): New functions.
	(MCEL_ERR_SHIFT): Rename from MCEL_ENCODING_ERROR_SHIFT.
	All uses changed.
	(mcel_isbasic): Add a _GL_LIKELY to help compilers.  All uses changed.
	(mcel_scan, mcel_scant): Simplify by using mcel_ch, mcel_err.
	(mcel_casecmp): Remove decl.  Callers changed to use mbscasecmp.
	* gl/lib/mcel.c, gl/lib/mcel.h: Rename from lib/mcel.c, lib/mcel.h.
	* gl/lib/mbscasecmp.c: New file.
	* gl/modules/mcel, gl/modules/mcel-prefer, gl/modules/mcel-tests:
	* gl/tests/test-mcel.c:
	New files.
	* src/io.c: Revert use of ucore API.  Use plain c32isspace etc.
	instead of ucore_is.  Use .err instead of ucore_iserr.
	(same_ch_err): Bring back, and use it instead of ucore_cmp.
	* src/side.c (print_half_line):  Use .err instead of ucore_iserr.

	diff: omit ignore_file_name_case test
	* src/dir.c (compare_names): Omit redundant test.

2023-08-20  Paul Eggert  <eggert@cs.ucla.edu>

	diff: fix recently-introduced file name case bug
	* src/diff.c (compare_files): When ignoring file name case
	and comparing a file f to a directory d at the top level,
	make sure that if we end up comparing f to d/F then
	don’t mistakenly try to open d/f instead.
	* src/dir.c (compare_collated): Do not worry about
	ignore_file_name_case here.
	(compare_names): Worry about it here instead.
	That way, we do the right thing with the test case.
	* tests/ignore-case: Test for the bug.

2023-08-19  Jim Meyering  <meyering@meta.com>

	maint: avoid syntax-check for doubled word "TO to" in lib/ucore.h
	* cfg.mk (exclude_file_name_regexp--sc_prohibit_doubled_word):
	Also exempt lib/ucore.h.

2023-08-15  Paul Eggert  <eggert@cs.ucla.edu>

	maint: update .gitignore
	* .gitignore: Remove lib/charset.alias, lib/configmake.h,
	lib/ref-add.sed, lib/ref-del.sed.  Add lib/c-file-type.c,
	lib/file-type.h.  Sort.

	diff: simplify multi-byte code (mbcel -> mcel)
	* lib/Makefile.am: Adjust to file renamings and additions.
	* lib/mbcel.c, lib/mbcel.h: Split into two APIs, replacing with ...
	* lib/mcel.c, lib/mcel.h, lib/ucore.c, lib/ucore.h: ... these new files.
	* lib/mcel.h: Simplify by assuming ucore.h is included.
	Check that bytes have 8 bits.
	(MCEL_LEN_MAX, mcel_t, MCEL_INLINE, MCEL_ENCODING_ERROR_SHIFT)
	(mcel_scan, mcel_scant, mcel_scanz, mcel_casecmp):
	Rename from MBCEL_LEN_MAX, mbcel_t, MBCEL_INLINE,
	MBCEL_ENCODING_ERROR_SHIFT, mbcel_scan, mbcel_scanz, mbcel_scant,
	mbcel_casecmp.
	(mcel_t): New member c, replacing old members ch and err.
	All uses changed.
	(MBCEL_UCHAR_FITS, MBCEL_UCHAR_EASILY_FITS): Remove.
	All uses removed.  No longer needed now 8-bit bytes are assumed.
	(MCEL_ENCODING_ERROR_SHIFT): Check that it matches UCORE_ERR_MIN.
	(mcel_isbasic): New function.  Use it where appropriate.
	(mbcel_cmp, mbcel_casecmp): Remove; replaced by ucore_cmp,
	ucore_tocmp.  All uses changed.
	* lib/mcel-casecmp.c: Rename from lib/mbcel-strcasecmp.c.
	Include mcel.h instead of mbcel.h.
	(mcel_casecmp): Rename from mbcel_strcasecmp.  All uses changed.
	Assert that UCHAR_MAX <= INT_MAX, as POSIX requires,
	and simplify code accordingly.  Use mcel rather than mbcel.
	* lib/ucore.h: Include verify.h.
	(ucore_t): New type.
	(UCORE_CHAR_MAX, UCORE_ERR_MIN, UCORE_ERR_MAX, UCORE_C32_SAFE):
	New constants.  Check that information is not lost by encoding
	errors as integers; this is a weaker test than CHAR_BIT == 8.
	(ucore_iserr, ucore_is, ucore_to): New functions.
	(ucore_cmp, ucore_tocmp): New functions, replacing the old
	mbcel_cmp, mbcel_casecmp.  All uses changed.
	* src/dir.c, src/io.c, src/side.c: Use mcel rather than mbcel.
	* src/io.c (same_ch_err): Remove.  All uses replaced by ucore_cmp.

2023-08-14  Paul Eggert  <eggert@cs.ucla.edu>

	diff: improve symlink handling, avoiding a race
	* bootstrap.conf (gnulib_modules): Add c-file-type
	and remove file-type.
	* po/POTFILES.in: Add lib/c-file-type.c, remove lib/file-type.c
	* src/diff.c (O_PATH_DEFINED): New constant.
	(detype_from_mode): Remove; no longer used.
	(dir_p): Go back to the old way of using S_ISDIR.
	(compare_prepped_files): Use filetype and stat macros, not detype.
	Pass symlink fd and "" to careadlinkat if available, as that
	avoids a race.  Test for dir vs file earlier, so that a missing
	file is treated consistently with dir/file vs file.
	(compare_files): New arg DETYPE replacing the old DETYPE0 and DETYPE1.
	All uses changed.  st_size for nonexistent files is 0, not -1.
	Set up .filetype, not .detype, as .filetype is finer-grained.
	Open symlinks with O_PATH on GNU/Linux, since we can then
	use readlinkat on the resulting file descriptor and this
	avoids a race.
	* src/diff.h (struct file_data): Remove detype member.
	Add filetype member; it’s finer-grained.  All uses changed.
	* tests/no-dereference: Add test that the previous commit failed.

	tests: fix comment numbering
	* tests/no-dereference: Omit comment numbers that didn’t correspond
	to test case ordering.

	build: update gnulib submodule to latest

	diff: simplify compare_files statting
	* src/diff.c (compare_files): Simplify the test for whether to get
	file status.  Although this change means diff sometimes will call
	fstat or fstatat when not needed, these occasions are so rare that
	the optimization is not worth the code complexity.

	diff: refactor compare_files
	Break out a good chunk of the body of compare_files into
	a new function compare_prepped_files.  This simplifies
	indenting and code slightly.
	* src/diff.c (compare_prepped_files): New function, taken
	from compare_files.
	(compare_files): Use it.

	diff: report special file major+minor
	* bootstrap.conf (gnulib_modules): Add sys_types,
	for MAJOR_IN_MKDEV and MAJOR_IN_SYSMACROS.
	* src/diff.c (major, minor): New macros or functions.
	Include <sys/mkdev.h> or <sys/sysmacros.h> for them.
	(compare_files): Output major and minor device numbers
	for special files that differ.

2023-08-11  Paul Eggert  <eggert@cs.ucla.edu>

	diff,cmp: tighten up same-file checks
	* src/cmp.c (main):
	* src/diff.c (compare_files):
	* src/dir.c (dir_loop):
	same_file returns bool, not int, so remove "0 <"s that date back
	to when it returned an int.  Remove uses of same_file_attributes.
	* src/system.h (same_file): Now an inline function not a macro.
	Tighten up comparison rules a bit, by ignoring attributes of
	special files whose st_rdev are the same, and by considering
	any birthtime differences to be definitive.  Do all the work
	that same_file_attributes used to do.  Update commentary.
	(same_file_attributes): Remove.  All uses removed.

	maint: tighten stat_size arg type
	* src/system.h (stat_size): Arg is now pointer to const.

2023-08-08  Paul Eggert  <eggert@cs.ucla.edu>

	cmp,diff,diff3,sdiff: quote more consistently
	* lib/diagnose.c, lib/diagnose.h: New files.
	* lib/Makefile.am (noinst_HEADERS, libdiffutils_a_SOURCES):
	Add them.
	* po/POTFILES.in: Add lib/diagnose.c.
	* src/analyze.c, src/cmp.c, src/diff3.c, src/dir.c:
	* src/sdiff.c, src/util.c:
	Include diagnose.h.
	* src/analyze.c (briefly_report, diff_2_files):
	* src/cmp.c (usage, main, cmp):
	* src/diff.c (add_regexp, summarize_regexp_list, main, compare_files):
	* src/diff3.c (usage, process_diff, scan_diff_line):
	* src/dir.c (diff_dirs):
	* src/sdiff.c (usage, ck_fopen, main, edit):
	* src/util.c (perror_with_name, begin_output):
	Quote file names or regexps with squote.
	* src/cmp.c, src/diff.c, src/diff3.c, src/dir.c, src/sdiff.c:
	Include quote.h.
	* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (try_help):
	Remove; now in diagnose.c.
	* src/cmp.c (specify_ignore_initial, main, cmp):
	* src/diff.c (main, specify_value, specify_colors_style):
	* src/diff3.c (main, read_diff):
	* src/dir.c (compare_collated):
	* src/sdiff.c (check_child_status, main):
	* src/util.c (finish_output):
	Quote strings with ‘quote’ or ‘quote_n’.
	* src/system.h (EXIT_TROUBLE): Remove; now in diagnose.h
	and now an enum.
	* src/util.c (c_escape_char, c_escape):
	Remove, as we now use squote.
	* tests/cmp, tests/filename-quoting, tests/invalid-re:
	Adjust to match new behavior.

	diff: try lseek on special files
	* src/diff.c (compare_files): It is OK to try lseek on special
	files, as failures are no-ops.  Treat failures as an indication
	that the file position is irrelevant.

	cmp: lseek need not succeed on special files
	* src/cmp.c (main): Do not report an error if lseek returns -1,
	as it is OK if the file is not seekable and none of the other
	lseek errors seem to be relevant.  This reverts my June 21 commit.

	diff: clarify /proc code
	* src/system.h (care_about_symlink_size): New macro.
	(stat_size): Use it. Do the simple checks (requiring no syscalls)
	first.  Although it now makes no difference, remove the S_ISREG (mode)
	check from the /proc test; this is clearer as /proc files need not be
	regular files.

	diff: output symlink contents when they differ
	* bootstrap.conf (gnulib_modules): Add quote.
	* src/diff.c: Include quote.h.
	(compare_files): Print contents of symlinks that differ,
	and quote their names and contents.
	* src/system.h (symlink_size_ok): Remove.
	(stat_size): Don’t worry about symlink sizes.
	* tests/no-dereference: Adjust tests to match new behavior.

2023-08-06  Paul Eggert  <eggert@cs.ucla.edu>

	diff: fix some behavior on unreadable input
	This fixes a bug I recently introduced.
	* src/diff.c (compare_files): Set and use openerr to avoid
	the need for a doomed second attempt at openat.
	Don’t insist on openat succeeding before trying fstatat.
	Unless openat fails with ENOENT, ENOTDIR, ELOOP, EOVERFLOW, ENAMETOOLONG
	it’s possible for it to fail even when fstatat would succeed.
	ENOTDIR also means the file does not exist.
	However, do not worry about EBADF as that is no longer possible
	now that diff uses xstdopen.  When checking whether a file should
	be considered to be nonexistent, do not require the other file
	desc to be UNOPENED or STDIN_FILENO; all that is needed is
	for the other file to not have an ENOENT or ENOTDIR failure.
	* src/diff.h (struct file_data): New member openerr.
	(OPEN_FAILED): New constant.
	* tests/new-file: Add a regression test to catch the bug
	fixed by the above.

	diff: fix recent -N regression
	* src/diff.c (compare_files): Fix recent regression, by
	looking at cmp.file[1 - f].err rather than cmp.file[1 - f].desc.
	Also, do not bother checking for EBADF, as that’s no longer
	possible now that diff uses xstdopen.

2023-08-05  Paul Eggert  <eggert@cs.ucla.edu>

	diff: minor errno performance tweak
	* src/diff.c (get_errno): New function.
	(compare_files): Use it.

	diff: prefer openat+fstat more often
	This closes some more races, by using openat+fstat instead
	of fstatat+openat which can get confused by some other process
	renaming files in the meantime.  Not all races are closed of course.
	* bootstrap.conf (gnulib_modules): Add d-type.
	* src/diff.c (errno_encode, errno_decode): Remove, as file
	descriptors are no longer portmanteau variables.  All uses removed.
	(detype_from_mode): New function.
	(dir_p): Use detype, not stat.st_mode.
	(compare_files): New args DETYPE0 and DETYPE1.  All uses changed.
	Update detype and err as new info arrives.
	Adjust to desc's new use (no longer encodes errno).
	Do not ignore lseek failures on regular files.
	Prefer openat+fstat to fstatat+openat when detype shows that it's safe,
	and avoid both fstat and fstatat if detype suffices.
	Use ‘error’ with errno value rather than setting error
	and then calling perror_with_name.  Coalesce two of these
	error diagnostics into one by moving an error check before
	the diagnostic is output.  Coalesce two calls to diff_dirs.
	Print file type based on detype if available,
	in case neither fstat nor fstatat was called.
	* src/diff.h (enum detype): New type.
	(struct file_data): New slots err, detype.
	(NONEXISTENT, UNOPENED): Renumber so that -1 stands for open failed.
	* src/dir.c (HAVE_STRUCT_DIRENT_D_TYPE): Default to false.
	(dir_read): Return to caller the d_type, if available.
	 	(diff_dirs): Pass detype to compare_files.

	maint: use O_CLOEXEC on streams
	* bootstrap.conf (gnulib_modules): Add fopen-gnu, for the "e" flag.
	* src/diff3.c (main):
	* src/sdiff.c (main, edit):
	Use the "e" flag.

	maint: use O_CLOEXEC
	* src/cmp.c (main):
	* src/diff.c (compare_files):
	* src/dir.c (dir_read):
	Use O_CLOEXEC when opening files that need not be shared with
	child processes.

	diff: tiny tweak to compare_files performance
	* src/diff.c (compare_files): Compare ints, not strings.

	diff: simplify diff_dirs API
	* src/diff.c (compare_files):
	Now extern, not static,	so that diff_dirs can call it.
	* src/dir.c (diff_dirs): Remove arg HANDLE_FILE, since it was
	always compare_files.  Just call compare_files directly.
	All uses changed.

	diff: simplify diff_dirs
	* src/dir.c (diff_dirs): Simplify and help the compiler a bit.

	diff: tune errno handling
	* src/diff.c (errno_encode): Add dassert to help debugging,
	and help the compiler when not debugging.

	diff: avoid a race when opening files
	* src/diff.c (O_PATHSEARCH): New constant.
	(compare_files): Prefer openat+fstat to fstatat+openat,
	as it avoids a race and should be a bit faster.

2023-08-01  Jim Meyering  <meyering@meta.com>

	maint: avoid new syntax-check failures
	* cfg.mk (_gl_TS_extern): Add SYSTEM_EXTERN to the list.
	* src/system.h (stat_size): Hoist function name onto the
	preceding line, to placate syntax-check rule.

2023-07-30  Paul Eggert  <eggert@cs.ucla.edu>

	diff: fail faster in odd --ignore-file-name-case usage
	* src/diff.c (compare_files):
	Fail faster with ‘diff --ignore-file-name case - .’.

	maint: be more careful about st_size
	* src/cmp.c (main): st_size == -2 now means the rest of
	the stat buf is unspecified; st_size == -1 now merely
	means st_size itself is unspecified.  All uses changed.
	* src/analyze.c (diff_2_files):
	* src/diff.c (compare_files):
	Trust st_size == 0, as this is now reliable.
	* src/diff.c (compare_files): Don’t always trust st_size of /proc
	files and symlinks.
	* src/system.h (SYSTEM_EXTERN): New macro.
	(proc_dev, symlink_size_ok): New vars.
	(stat_size): New function.

2023-07-28  Paul Eggert  <eggert@cs.ucla.edu>

	diff: omit no-longer-safe optimization
	* src/diff.c (compare_files): Remove optimization for size-zero
	files that is no longer valid for unusual combinations like ‘touch
	mt; diff /proc/kmsg mt’ where one file is an empty regular file
	and the other is an unreadable /proc file with st_size zero but
	where the actual size is nonzero.

2023-07-27  Paul Eggert  <eggert@cs.ucla.edu>

	diff: tweak context timestamp buffer size
	* src/context.c (print_context_label): Use a more conservative
	upper bound for timestamp length.  In practice this change
	makes no difference: it’s more for documentation.

2023-07-25  Paul Eggert  <eggert@cs.ucla.edu>

	diff: stop using sprintf
	The calls to sprintf are not needed any more, since the resulting
	string is now immediately passed to fprintf.
	* src/context.c (print_context_label): Redo to call

	maint: translate openat-die.c
	* po/POTFILES.in: Re-add lib/openat-die.c.

	diff3: simplify by assuming !GCC_LINT
	GCC's static checks no longer seem to warn about the code
	protected by GCC_LINT, so remove its last uses, which were in diff3.
	(Or perhaps it was valgrind or gcc -fsanitize=address leak
	checking instead?  But in that case there are other false
	positives and we don’t worry about them either.)  This code was
	problematic anyway when introduced (as witness the corresponding
	test case) and it slowed diff3 down a bit.
	* configure.ac (GCC_LINT): Remove.  All uses removed.
	* src/diff3.c: Simplify by assuming !GCC_LINT.

	diff: simplify SIGSTOP/SIGTSTP porting
	* src/util.c (SIGSTOP, SIGTSTP): Default to 0.
	(process_signals, is_tstp_index): Simplify by using the default.
	(sig): Adjust to default.

2023-07-25  Bruno Haible  <bruno@clisp.org>

	maint: Fix build failures mingw 10 and MSVC 14.30
	* bootstrap.conf (gnulib_modules): Add popen, pclose, readdir,
	readlinkat, sigaction.
	* configure.ac: Don't enable _FORTIFY_SOURCE on mingw.
	* src/util.c (process_signals): If SIGTSTP is not defined,
	stop_signal_count is zero, therefore disable the stop signal processing.
	(sig): If SIGHUP is not defined, don't list it. If SIGPIPE is not
	defined, don't list it.

2023-07-24  Paul Eggert  <eggert@cs.ucla.edu>

	maint: port better to MS-Windows
	Problem reported by Gisle Vanem <https://bugs.gnu.org/64811>.
	* bootstrap.conf (gnulib_modules): Add fstatat, openat.

	diff: compare symbolic links more efficently
	Also, remove dependence on xreadlink.
	* bootstrap.conf (gnulib_modules): Add careadlinkat.
	Remove xreadlink (which depends on careadlinkat).
	* src/diff.c: Include careadlinkat.h, not xreadlink.h.
	(compare_files): Don’t bother to read links if their lengths differ.
	Use careadlinkat instead of xreadlink so that normally malloc need
	not be called.

2023-07-23  Paul Eggert  <eggert@cs.ucla.edu>

	cmp: fix recent off-by-1 error
	* src/cmp.c (cmp): Subtract 1 from byte_number before printing,
	fixing an off-by-one error in the previous patch.

	build: update gnulib submodule to latest

	cmp: remove dependence on inttostr
	* bootstrap.conf (gnulib_modules): Remove inttostr.
	* src/cmp.c: Do not include inttostr.h.
	(cmp): Use C99-style PRIdMAX rather than Gnulib inttostr,
	as PRIdMAX is simpler and (thanks to Gnulib) is portable.

	diff: omit HAVE_STRUCT_STAT_ST_SPARE1
	* src/diff.c (main): Remove reference to macro
	HAVE_STRUCT_STAT_ST_SPARE1, which hasn’t been defined since 2007.

	diff: get current time lazily, via C11
	* bootstrap.conf (gnulib_modules): Remove gettime; add timespec_get.
	* src/context.c (print_context_label): Get current time lazily.
	Use C11 timespec_get rather than older Gnulib gettime function.
	* src/diff.c: Do not include timespec.h.
	(set_mtime_to_now): Remove.  All uses removed.

2023-07-22  Paul Eggert  <eggert@cs.ucla.edu>

	diff: check file attributes more carefully
	* src/system.h: Include stat-time.h, timespec.h.
	* bootstrap.conf (gnulib_modules): Add timespec, for timespec_cmp.
	(same_file_attributes): Check birthtime and ns components too.
	Check attributes earlier if they are more likely to differ.

2023-07-21  Paul Eggert  <eggert@cs.ucla.edu>

	diff: don’t think mbcel_strcasecmp preserves errno
	* configure.ac: Do not check for strcasecoll (which doesn’t exist)
	or stricoll (not worth the porting hassle, as it doesn’t set errno).
	* src/dir.c: Always include mbcel.h, since we now always
	use mbcel_strcasecmp.
	(strcasecoll): Remove
	(compare_collated, diff_dirs): Do the setjump business only when
	not ignoring file name case, since mbcel_strcasecmp doesn’t fail
	and doesn’t set errno.  This fixes a bug in recent changes,
	which incorrectly assumed mbcel_strcasecmp preserves errno.

	* src/dir.c:
	Always include mbcel.h, since we now always compile a call
	to mbcel_strcasecmp.
	(strcasecoll): Remove.  It’s not worth bothering to port to
	Microsoft stricoll’s idiosyncrasies; mbcel_strcasecmp is good enough.
	And nobody ever implemented strcasecoll.

2023-07-21  Paul Eggert  <eggert@cs.ucla.edu>

	diff: simplify qsort comparison function
	* src/dir.c (compare_names_for_qsort): Simplify.

	diff: sort multi-byte file names better
	* bootstrap.conf (gnulib_modules): Add builtin-expect.
	* lib/mbcel-strcasecmp.c: New file.
	* lib/Makefile.am (libdiffutils_a_SOURCES): Add it.
	* lib/mbcel.h (MBCEL_LEN_MAX, MBCEL_ENCODING_ERROR_SHIFT)
	(MBCEL_UCHAR_FITS, MBCEL_UCHAR_EASILY_FITS): New constants.
	(_GL_LIKELY): New macro.
	(mbcel_scan): Use it.  Simplify NetBSD code.
	(mbcel_scant, mbcel_scanz, mbcel_cmp, mbcel_casecmp): New functions.
	* src/dir.c (strcasecoll): Move defn here from system.h,
	since only dir.c needs it.  Use mbcel_strcasecmp instead
	of strcasecmp.

	diff: remove diff_dirs ‘volatile’
	* src/dir.c (diff_dirs): Omit ‘volatile’, as it’s no longer
	needed with the current use of setjmp.

2023-07-19  Paul Eggert  <eggert@cs.ucla.edu>

	cmp: remove IF_LINT
	* src/cmp.c (cmp): Redo to avoid the need for IF_LINT, while still
	pacifying GCC.  The machine code is a bit smaller too.  The price
	is a portmanteau variable, but it’s worth it.
	* src/system.h (IF_LINT): Remove.

	diff: simplify away an ‘IF_LINT (volatile)’
	* src/dir.c (find_dir_file_pathname): Simplify.  There is no
	longer a need for volatile or setjmp, now that dir_read does all
	the tricky sorting and longjmping.

	diff: improve -S dir-reading performance
