2022-04-15  Pádraig Brady  <P@draigBrady.com>

	version 9.1
	* NEWS: Record release date.

2022-04-15  Pádraig Brady  <P@draigBrady.com>

	doc: avoid unicode errors in texi conversion
	Avoid "Unicode character U+#1 not supported, sorry" error
	when converting from texi to dvi or pdf.

	* doc/coreutils.texi (tr invocation): Avoid the @U{XXXX}
	texi representation, as even though info and html can represent
	these characters directly, there are conversion errors
	for pdf and dvi.  Instead use the more abstract shell
	$'\uXXXX' representation.

2022-04-14  Pádraig Brady  <P@draigBrady.com>

	build: copy: fix build on macos 10.12
	* src/copy.c (copy_reg): Handle the case where CLONE_NOOWNERCOPY
	is not defined.
	Reported by Jeffrey Walton

2022-04-13  Pádraig Brady  <P@draigBrady.com>

	tail: detect closed stdout on Solaris
	* src/tail.c (check_output_alive): Use poll() on Solaris.
	Also handle POLLHUP, which Solaris returns in this case.
	* tests/tail-2/pipe-f.sh: Use `head -n2` rather than `sed 2q`
	as Solaris sed does not exit in this case.
	* NEWS: Mention the improvement.
	Reported by Bruno Haible.

	maint: syntax-check: fix preprocessor indentation
	* gl/lib/targetdir.h: Keep '#' at start of line.

2022-04-13  Paul Eggert  <eggert@cs.ucla.edu>

	cp,mv,install: omit an ‘inline’
	* gl/lib/targetdir.c (target_directory_operand):
	Omit unnecessary ‘inline’.

	cp,mv,install: improve EACCES targetdir messages
	This improves on the fix for --target-directory diagnostics bugs on
	Solaris 11.  Problem reported by Bruno Haible and Pádraig Brady; see:
	https://lists.gnu.org/r/coreutils/2022-04/msg00044.html
	Also, omit some unnecessary stat calls.
	* gl/lib/targetdir.c (target_directory_operand): If !O_DIRECTORY,
	do not bother calling open if stat failed with errno != EOVERFLOW.
	Rename is_a_dir to try_to_open since that’s closer to what it means.
	If the open failed with EACCES and we used O_SEARCH, look at stat
	results to see whether errno should be ENOTDIR for better diagnostics.
	Treat EOVERFLOW as an “I don’t know whether it’s a directory and
	there’s no easy way to find out” rather than as an error.

	cp,mv,install: avoid excess stat calls on non-GNU
	* gl/lib/targetdir.c (target_directory_operand): New arg ST.
	All callers changed.
	* src/cp.c (do_copy):
	* src/mv.c (main):
	Avoid unnecessary stat call if target_directory_operand already
	got the status.

	cp,mv,install: modularize targetdir
	Move target directory code out of system.h to a new targetdir module.
	This doesn’t change functionality.
	* bootstrap.conf (gnulib_modules): Add targetdir.
	* src/cp.c, src/install.c, src/mv.c: Include targetdir.h.
	* src/system.h (must_be_working_directory, target_directory_operand)
	(targetdir_dirfd_valid): Move from here ...
	* gl/lib/targetdir.c, gl/lib/targetdir.h, gl/modules/targetdir:
	... to these new files.

2022-04-13  Pádraig Brady  <P@draigBrady.com>

	cp,mv,install: avoid EACCES with non directory destination
	* src/system.h (target_directory_operand): Also check with stat()
	on systems with O_SEARCH, to avoid open("file", O_SEARCH|O_DIRECTORY)
	returning EACCES rather than ENOTDIR, which was seen on Solaris 11.4
	when operating on non dirs without execute bit set.
	* NEWS: Remove related bug entry, as that issue was only introduced
	after coreutils v9.0 was released.
	Reported by Bruno Haible.

	sync: support syncing files on cygwin
	* src/sync.c (sync_arg): Similarly to AIX, Cygwin 2.9.0
	was seen to need write access to have permission to sync a file.

	tests: cygwin: handle ENOENT from execvp(".")
	* tests/misc/env.sh: Verify with another command that
	execvp() doesn not return ENOENT, before testing the
	exit code from the command in question.
	* tests/misc/nice-fail.sh: Likewise.
	* tests/misc/stdbuf.sh: Likewise.
	* tests/misc/timeout-parameters.sh: Likewise.

	tests: env-S.pl: unset cygwin hardwired env vars
	* tests/misc/env-S.pl: Unset SYSTEMROOT and WINDIR.

2022-04-12  Pádraig Brady  <P@draigBrady.com>

	tests: md5sum: fix false failures on cygwin
	* tests/misc/md5sum-newline.pl: Avoid binary '*' tags when
	comparing checksums.
	* tests/misc/md5sum-bsd.sh: Avoid binary '*' tags so that we correctly
	trigger the ambiguity test.
	Reported by Bruno Haible

2022-04-11  Pádraig Brady  <P@draigBrady.com>

	tests: b2sum.sh: fix false failure on cygwin
	* tests/misc/b2sum.sh: Avoid binary '*' tags when comparing checksums.
	Reported by Bruno Haible

	tests: dircolors.pl: avoid false failure with TERM=dumb
	* tests/Coreutils.pm: Ensure an unset $TERM env var,
	which is required on perl 5.22.2 on Solaris 11 OpenIndiana at least,
	where TERM was being reset to 'dumb'.
	Reported By Bruno Haible.

	tests: printf-mb.sh: fix false failure with french translations
	* tests/misc/printf-mb.sh: As per commit 04148c99c,
	adjust non C warnings before comparison, to those of LC_MESSAGES=C.
	Reported by Adam Sampson

2022-04-10  Pádraig Brady  <P@draigBrady.com>

	tests: stty.sh: skip on systems without perl
	* init.cfg (stty_reversible_init_): Add require_perl_
	to ensure we skip rather than error, without perl.

2022-04-09  Pádraig Brady  <P@draigBrady.com>

	cp,mv,install: avoid opening non directory destination
	commit v9.0-66-ge2daa8f79 introduced an issue, for example
	where cp could hang when overwriting a destination fifo,
	when it would try to open() the fifo on systems
	like Solaris 10 that didn't support the O_DIRECTORY flag.

	This is still racy on such systems, but only in the
	case where a directory is replaced by a fifo in
	the small window between stat() and open().

	* src/system.h (target_directory_operand): On systems without
	O_DIRECTORY, ensure the file is a directory before attempting to open().
	* tests/cp/special-f.sh: Protect cp with timeout(1),
	as cp was seen to hang when trying to overwrite an existing fifo.
	* NEWS: Mention the bug fix.

2022-04-09  Pádraig Brady  <P@draigBrady.com>

	doc: install --compare: clarify mode of operation
	* doc/coreutils.texi (install invocation): For the --compare option,
	clarify that the ownership or permissions of the source files don't
	matter.  Also don't imply --owner or --group need to be specified
	for --compare to be effective.
	* src/install.c (usage): Add more detail on what's being compared.
	Fixes https://bugs.gnu.org/50889

2022-04-08  Pádraig Brady  <P@draigBrady.com>

	doc: remove older ChangeLog items
	* Makefile.am: Update the oldest documented version
	to 8.27 which is now about 5 years old.

2022-04-08  Bernhard Voelker  <mail@bernhard-voelker.de>

	maint: remove obsolete statat gnulib module
	* bootstrap.conf (gnulib_modules): Remove statat.

2022-04-07  Pádraig Brady  <P@draigBrady.com>

	build: update gnulib submodule to latest
	* gnulib: Update to latest
	* src/copy.c: Replace deprecated {l,}statat(), with fstatat().
	* src/cp.c: Likewise.
	* src/install.c: Likewise.
	* src/remove.c: Likewise.

2022-04-04  Pádraig Brady  <P@draigBrady.com>

	factor: improve support on RISCV and loongson
	* src/longlong.h: Pull in RISCV fix and loongarch64 support from
	https://gmplib.org/repo/gmp/log/tip/longlong.h

2022-04-03  Pádraig Brady  <P@draigBrady.com>

	doc: describe `dd iseek` as a feature not a change
	* NEWS: Move description from "Changes in behavior"
	to "New features".

2022-04-03  Pádraig Brady  <P@draigBrady.com>

	ls: avoid expensive capability lookup by default
	Lookup of file-based capabilities adds 30% overhead to the common
	case of ls --color usage.  Since the use of file capabilities is
	very rare, it doesn't make sense to pay this cost in the common
	case.  It's better to use getcap to inspect capabilities, and the
	following run shows only 8 files using capabilities on my fedora
	35 distro (14 years after the feature was introduced to the linux
	kernel).

	  $ getcap -r /
	  /usr/bin/arping = cap_net_raw+p
	  /usr/bin/clockdiff = cap_net_raw+p
	  /usr/bin/gnome-keyring-daemon = cap_ipc_lock+ep
	  /usr/bin/gnome-shell = cap_sys_nice+ep
	  /usr/bin/newgidmap = cap_setgid+ep
	  /usr/bin/newuidmap = cap_setuid+ep
	  /usr/sbin/mtr-packet = cap_net_raw+ep
	  /usr/sbin/suexec = cap_setgid,cap_setuid+ep

	* src/dircolors.hin: Set "CAPABILITY" to "00", to indicate unused.
	* src/ls.c: Set the default C_CAP color to not colored.
	* NEWS: Mention the change in behavior.

2022-04-03  Ville Skyttä  <ville.skytta@iki.fi>

	dircolors: colorize backup files with bright black
	* src/dircolors.hin: Add patterns for suffixes for "backup files".
	The color used is so they stand out less than non-backup files,
	and bright black works well on both light and dark backgrounds.
	* THANKS.in: Remove duplicate.
	Fixes https://bugs.gnu.org/54521

2022-03-29  Pádraig Brady  <P@draigBrady.com>

	doc: join: clarify that -e only effective for -12jo fields
	* src/join.c (usage): Clarify that -e is not sufficient
	to enable output of missing fields from one of the inputs.
	Rather the -12jo options are required to explicitly
	enable output of those fields.
	Fixes https://bugs.gnu.org/54625

2022-03-25  Pádraig Brady  <P@draigBrady.com>

	maint: sync latest bootstrap from gnulib
	* bootstrap: Should have updated this with the last gnulib update.

2022-03-20  Pádraig Brady  <P@draigBrady.com>

	tests: improve recent printf test
	* tests/misc/printf-mb.sh: Given we shortcut the single char
	(invalid multi-byte) case, add a case to ensure we're correctly
	checking the return from mbrtowc().

2022-03-19  Pádraig Brady  <P@draigBrady.com>

	printf: support printing the numeric value of multi-byte chars
	* src/printf.c (STRTOX): Update to support multi-byte chars.
	* tests/misc/printf-mb.sh: Add a new test.
	* tests/local.mk: Reference the new test.
	* NEWS: Mention the improvement.
	Fixes https://bugs.gnu.org/54388

2022-03-18  Pádraig Brady  <P@draigBrady.com>

	maint: move build-related NEWS item to its own section
	* NEWS: Follow other Build-related patterns in NEWS.

2022-03-12  Pádraig Brady  <P@draigBrady.com>

	doc: test: clarify that -rwx don't just check perm bits
	* src/test.c (usage): State that -rwx is determined by
	user access, rather than permission bits.
	* doc/coreutils.texi (Access permission tests): Likewise.
	* man/test.x [SEE ALSO]: access(2).
	Fixes https://bugs.gnu.org/54338

2022-03-07  Pádraig Brady  <P@draigBrady.com>

	maint: address syntax-check issues in recent commit
	* cfg.mk (sc_die_EXIT_FAILURE): Generalize to match any EXIT_ define,
	and also relax to ignore error() usage with ternary operator.
	* src/chroot.c (main): Use () to avoid the sc_error_quotes check.

2022-03-07  Pádraig Brady  <P@draigBrady.com>

	stat: only automount with --cached=never
	Revert to the default behavior before the introduction of statx().

	* src/stat.c (do_stat): Set AT_NO_AUTOMOUNT without --cached=never.
	* doc/coreutils.texi (stat invocation): Mention the automount
	behavior with --cached=never.
	* NEWS: Mention the change in behavior.

	Fixes https://bugs.gnu.org/54287

2022-03-07  Rohan Sable  <rsable@redhat.com>

	ls: avoid triggering automounts
	statx() has different defaults wrt automounting
	compared to stat() or lstat(), so explicitly
	set the AT_NO_AUTOMOUNT flag to suppress that behavior,
	and avoid unintended operations or potential errors.

	* src/ls.c (do_statx): Pass AT_NO_AUTOMOUNT to avoid this behavior.
	* NEWS: Mention the change in behavior.
	Fixes https://bugs.gnu.org/54286

2022-03-07  Pádraig Brady  <P@draigBrady.com>

	build: ensure AT_NO_AUTOMOUNT is defined
	update gnulib submodule to latest,
	where this is the only change

2022-03-05  Paul Eggert  <eggert@cs.ucla.edu>

	date: fix newly-introduced %%-N bug
	* src/date.c (adjust_resolution): Don’t mishandle %%-N.
	* tests/misc/date.pl (pct-pct): New test.

2022-02-25  Paul Eggert  <eggert@cs.ucla.edu>

	chown: warn about USER.GROUP
	Suggested by Dan Jacobson (Bug#44770).
	* src/chown.c, src/chroot.c (main):
	Issue warnings if obsolete USER.GROUP notation is present.

	build: update gnulib submodule to latest

2022-02-24  Pádraig Brady  <P@draigBrady.com>

	fmt: fix invalid multi-byte splitting on macOS
	On macOS, isspace(0x85) returns true,
	which results in splitting within multi-byte characters.

	* src/fmt.c (get_line): s/isspace/c_isspace/.
	* tests/fmt/non-space.sh: Add a new test.
	* tests/local.mk: Reference new test.
	* NEWS: Mention the fix.
	Addresses https://bugs.gnu.org/54124

2022-02-24  Pádraig Brady  <P@draigBrady.com>

	tests: improve compat with macOS
	* tests/misc/wc-nbsp.sh: Only the en_US.iso8859-1 form
	is accepted on macOS 10.15.7 at least.  GNU/Linux also
	accepts ISO-8859-1 (and canonicalizes the charmap to this).

2022-02-23  Paul Eggert  <eggert@cs.ucla.edu>

	dd: counts ending in "B" now count bytes
	This implements my suggestion in Bug#54112.
	* src/dd.c (usage): Document the change.
	(parse_integer, scanargs): Implement the change.
	Omit some now-obsolete checks for invalid flags.
	* tests/dd/bytes.sh: Test the new behavior, while retaining
	checks for the now-obsolete usage.
	* tests/dd/nocache_eof.sh: Avoid now-obsolete usage.

2022-02-22  Paul Eggert  <eggert@cs.ucla.edu>

	dd: improve doc relative to POSIX
	* doc/coreutils.texi (dd invocation): Improve documentation,
	clarifying whether features are extensions to POSIX.

	dd: support iseek= and oseek=
	Alias iseek=N to skip=N, oseek=N to seek=N (Bug#45648).
	* src/dd.c (scanargs): Parse iseek= and oseek=.
	* tests/dd/skip-seek.pl (sk-seek5): New test case.

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

	cp: avoid unnecessary buffer allocation
	Do not allocate I/O buffer if copy_file_range suffices.
	* src/copy.c (sparse_copy, lseek_copy): Buffer arg is now char **
	instead of char *, and buffer is now allocated only if needed.
	All uses changed.

2022-02-19  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2022-02-15  Pádraig Brady  <P@draigBrady.com>

	doc: env: fix man page reference of exec(2) to exec(3p)
	* man/env.x: Change exec() reference from section 2 to 3p.

2022-02-15  Pádraig Brady  <P@draigBrady.com>

	doc: use bold style for man page references
	It's more common to use bold style than not,
	for references to other man pages.
	Ideally each man page renderer would highlight references,
	but currently some rely on styles in the page itself.

	* man/help2man: Implement a --bold-refs option that
	will mark up references like "name(1)" with bold
	style around the "name" component.
	* man/local.mk: Pass --bold-refs to our help2man unless disabled.
	* configure.ac: Add a --disable-bold-man-page-references option.
	Addresses https://bugs.gnu.org/53977

2022-02-15  Pádraig Brady  <P@draigBrady.com>

	dircolors: speed up processing of TERM entries
	* src/dircolors.c (main): Avoid glob matching
	when we've already matched in a group of {COLOR,}TERM entries.

2022-02-15  Pádraig Brady  <P@draigBrady.com>

	dircolors: consider COLORTERM as well as TERM env vars
	COLORTERM is an environment used usually to expose truecolor support in
	terminal emulators.  Therefore support matches on that in addition
	to TERM.  Also set the default COLORTERM match pattern so that
	we apply colors if COLORTERM is any value.

	This implicitly supports a terminal like "foot"
	without a need for an explicit TERM entry.

	* NEWS: Mention the new feature.
	* src/dircolors.c (main): Match COLORTERM like we do for TERM.
	* src/dircolors.hin: Add default config to match any COLORTERM.
	* tests/misc/dircolors.pl: Add test cases.

2022-02-14  Paul Eggert  <eggert@cs.ucla.edu>

	tr: mention multibyte problem in man page
	* man/tr.x: Document tr problem.

	tr: improve multibyte etc. doc
	Problem reported by Dan Jacobson (Bug#48248).
	* doc/coreutils.texi (tr invocation): Improve documentation for
	tr's failure to support multibyte characters POSIX-style.
	* doc/coreutils.texi (tr invocation), src/tr.c (usage):
	Use terminology closer to POSIX's.

2022-02-13  Pádraig Brady  <P@draigBrady.com>

	dircolors: add --print-ls-colors to display colored entries
	* NEWS: Mention the new feature.
	* doc/coreutils.texi (dircolors invocation): Describe the new
	--print-ls-colors option.
	* src/dircolors.c (print_ls_colors): A new global to select
	between shell or terminal output.
	(append_entry): A new function refactored from dc_parse_stream()
	to append the entry in the appropriate format.
	(dc_parse_stream): Adjust to call append_entry().
	* tests/misc/dircolors.pl: Add test cases.

2022-02-13  Pádraig Brady  <P@draigBrady.com>

	chown,chgrp: reinstate numeric id output in -v messages
	since gnulib commit ff208d546a,
	related to coreutils commit v9.0-143-gabde15969
	we no longer maintain numeric IDs through chopt->{user,group}_name.
	Therefore we need to adjust to ensure tests/chown/basic.sh passes.

	* src/chown-core.c (uid_to_str, gid_to_str): New helper functions
	to convert numeric id to string.
	(change_file_owner): Use the above new functions to pass
	numeric ids to describe_change().

2022-02-13  Paul Eggert  <eggert@cs.ucla.edu>

	sort: fix several version-sort problems
	This also affects ls -v in some corner cases.
	Problems reported by Michael Debertol <https://bugs.gnu.org/49239>.
	While looking into this, I spotted some more areas where the
	code and documentation did not agree, or where the documentation
	was unclear.  In some cases I changed the code; in others
	the documentation.  I hope things are nailed down better now.
	* doc/sort-version.texi: Distinguish more carefully between
	characters and bytes.  Say that non-identical strings can
	compare equal, since they now can.  Improve readability in
	various ways.  Make it clearer that a suffix can be the
	entire string.
	* src/ls.c (cmp_version): Fall back on strcmp if filevercmp
	reports equality, since filevercmp is no longer a total order.
	* src/sort.c (keycompare): Use filenvercmp, to treat NULs correctly.
	* tests/misc/ls-misc.pl (v_files):
	Adjust test to match new behavior.
	* tests/misc/sort-version.sh: Add tests for stability,
	and for sorting with NUL bytes.

	build: update gnulib submodule to latest

2022-02-12  Pádraig Brady  <P@draigBrady.com>

	doc: avoid using "[" is URLS in --help output
	* src/system.h (emit_ancillary_info): While supported if entered
	  manually, the "[" character is not highlighted as part of a
	  URL by default in terminals, so avoid using it.
	  Addresses https://bugs.gnu.org/53946

	doc: adust --help, --version alignment
	* src/system.h: Adjust the alignment of the --help
	and --version option descriptions, to start at column 21.
	This better aligns with the descriptions of most commands,
	and also aligns with the minimum column a description must
	start at to ensure a blank line is not output when a description
	follows an option on a line by itself.

	doc: rmdir: improve --help formatting
	* src/rmdir.c (usage): Move description to column 21,
	so that a --long-option on its own line without a
	trailing description, doesn't have an erroneous blank
	line inserted between the option and description.
	Also group descriptions with blank lines rather than indents,
	so that man pages don't have erroneous blank lines
	added within the description.
	Addresses https://bugs.gnu.org/53946

	doc: ls: reference dircolors(1) from --help
	* src/ls.c (usage): s/dircolors/dircolors(1)/.
	* man/ls.x [SEE ALSO]: Reference dircolors(1).
	Addresses https://bugs.gnu.org/53946

	doc: ls: improve --help formatting
	* src/ls.c (usage): Use blank lines to group multi-line
	option descriptions, rather than indenting.
	This results in more consistent alignment of descriptions,
	and also avoids erroneous new lines in generated in man pages.
	Addresses https://bugs.gnu.org/53946

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

	doc: improve version-sort doc
	* doc/coreutils.texi, doc/sort-version.texi:
	Capitalize “Coreutils”.
	* doc/sort-version.texi: Don’t emphasize natural sort so much,
	since Coreutils has just version sort.
	Use the term “lexicographic” instead of “alphabetic” or “standard”.
	Suggest combining ‘V’ with ‘b’, and show why ‘b’ is needed.
	Use shorter titles for sections, as GNU Emacs displays info poorly
	when titles are too long to fit in a line.
	Use @samp instead of @code for samples of data.
	Do not use @samp{@code{...}}; @samp{...} should suffice and
	double-nesting looks bad with Emacs.
	Omit blank lines in examples that would not be present
	in actual shell sessions.
	Quote with `` and '', not with " or with '.
	Mention dpkg --compare-versions more prominently.
	Don’t rely on "\n" being equivalent to "\\n" in shell args.
	Prefer Unicode name for hyphen-minus.

2022-02-07  Christian Hesse  <mail@eworm.de>

	dircolors: highlight .avif as image
	This add highlighting for AV1 Image File Format (AVIF):
	https://aomediacodec.github.io/av1-avif/

	* src/dircolors.hin: Highlight .avif as image.

2022-02-05  Paul Eggert  <eggert@cs.ucla.edu>

	date: test against bug#50115
	* tests/misc/date.pl: Add test.

	build: update gnulib submodule to latest

2022-02-05  Pádraig Brady  <P@draigBrady.com>

	doc: fix somewhat ambiguous date format representation
	* doc/coreutils.texi (date invocation): Remove @var{...} usage,
	as that capitalizes in the representation and thus somewhat
	ambiguates the format wrt Month and Minute.  This also avoids
	a syntax check failure about redundant capitalization in @var{}.

2022-02-05  Paul Eggert  <eggert@cs.ucla.edu>

	date: improve doc
	Problem reported by Dan Jacobson (Bug#51288).
	* doc/coreutils.texi (date invocation, Setting the time)
	(Options for date):
	* src/date.c (usage): Improve doc.

	build: update gnulib submodule to latest

2022-02-04  Paul Eggert  <eggert@cs.ucla.edu>

	id: print groups of listed name
	Problem reported by Vladimir D. Seleznev (Bug#53631).
	* src/id.c (main): Do not canonicalize user name before
	deciding what groups the user belongs to.

2022-02-01  Bernhard Voelker  <mail@bernhard-voelker.de>

	doc: add NEWS entry for recent cksum change
	* NEWS (Changes in behavior): Add entry for commit v9.0-92-ga42a03913.

2022-02-01  Paul Eggert  <eggert@cs.ucla.edu>

	maint: suppress bogus noreturn warnings
	* configure.ac: Move the single-binary code before the
	gcc-warnings code, so that the latter can depend on the former.
	Suppress -Wsuggest-attribute=noreturn with single binaries,
	to avoid diagnostics like the following:
	  src/expr.c: In function 'single_binary_main_expr':
	  error: function might be candidate for attribute 'noreturn'
	Problem reported by Pádraig Brady in:
	https://lists.gnu.org/r/coreutils/2022-01/msg00061.html

	tr: pacify -fsanitizer=leak
	* src/tr.c (main): Use main_exit, not return, in a couple of
	places missed last time.

	chgrp: fix typo in previous change
	* src/chgrp.c (main): Use main_exit, not exit.

	maint: mark some _Noreturn functions
	* src/basenc.c (finish_and_exit, do_encode, do_decode):
	* src/comm.c (compare_files):
	* src/tsort.c (tsort):
	* src/uptime.c (uptime):
	Mark with _Noreturn.  Otherwise, unoptimized compilations may warn
	that the calling renamed-main function doesn't return a value,
	when !lint and when single-binary.

	df: fix memory leak
	* src/df.c (devlist_free): Remove.
	(filter_mount_list): Free all of devlist, instead of merely
	the entries in devlist_table.

2022-01-31  Pádraig Brady  <P@draigBrady.com>

	maint: cut: avoid exporting recently added variable
	* src/cut.c: Make output_delimiter_default static,
	as identified by `make syntax-check`.

2022-01-31  Paul Eggert  <eggert@cs.ucla.edu>

	maint: pacify gcc -flto -Wmaybe-uninitialized
	* gl/lib/xdectoint.c (__xnumtoint): Tell gcc that ‘error’
	does not return here.
	* gl/modules/xdectoint (Depends-on): Add stdbool, verify.

	dd: do not access uninitialized
	* src/dd.c (parse_integer): Avoid undefined behavior
	that accesses an uninitialized ‘n’ when e == LONGINT_INVALID.
	Return more-accurate error code when INTMAX_MAX < n.

	uptime: simplify -fsanitize=leak pacification
	* src/uptime.c (uptime): Exit here ...
	(main): ... instead of here.

	uniq: remove IF_LINT
	* src/uniq.c (check_file): Remove a no-longer-needed IF_LINT.

	unexpand: remove IF_LINT
	* src/unexpand.c (unexpand): Remove a no-longer-needed IF_LINT.

	pr: remove IF_LINT
	* src/pr.c (read_line): Remove a no-longer-needed IF_LINT.

	truncate: simplify
	* src/truncate.c (do_ftruncate): Check != 0 instead of == -1.
	Avoid a cast.
	(main): Use C99 style decls after statements.
	Simplify ‘open’ logic.

2022-01-31  Paul Eggert  <eggert@cs.ucla.edu>

	shred: remove IF_LINT
	* src/shred.c (dopass): Remove a no-longer-needed IF_LINT.

	(read_line): Remove an IF_LINT; no longer needed with
	today’s GCC.

2022-01-31  Paul Eggert  <eggert@cs.ucla.edu>

	pr: simplify -fsanitize=leak pacification
	* src/pr.c (main): Remove an IF_LINT.
	Use main_exit rather than return.

	pinky: simplify -fsanitize=leak pacification
	* src/pinky.c (short_pinky): exit instead of freeing.

	paste: remove IF_LINT
	* src/paste.c (paste_parallel): Remove no-longer-needed IF_LINT.

	hostname: simplify
	* src/hostname.c (sethostname): Provide a substitute on all
	platforms, to simplify the mainline code.
	(main): Simplify.  Remove an IF_LINT.
	Use main_exit rather than return.

	factor: remove IF_LINT
	* src/factor.c (factor_using_squfof) [USE_SQUFOF]:
	Use plain assert (...), not IF_LINT (assert (...)).
	This code is currently never compiled or executed,
	so this is merely a symbolic cleanup.

	expand: remove IF_LINT
	* src/expand.c (expand): Remove no-longer-needed IF_LINT.

	env: simplify -fsanitize=leak pacification
	* src/env.c (unset_envvars): Remove IF_LINT code.
	(main): Use main_exit, not return.

	md5sum: remove IF_LINTs
	* src/digest.c (digest_check): Remove IF_LINTs that are no longer
	needed, as GCC has gotten smarter since 2008.

	df: simplify -fsanitize=leak pacification
	* src/df.c (print_table, main) [lint]: Omit unnecessary cleanup.
	(main): Use main_exit, not return.

	date: simplify -fsanitize=leak pacification
	* src/date.c (main) [lint]: Omit unnecessary cleanup.
	Use main_exit, not return.

	cut: simplify and remove an IF_LINT
	* src/cut.c (enum operating_mode, operating_mode)
	(output_delimiter_specified, cut_stream):
	Remove; no longer needed.
	(output_delimiter_default): New static var.  Code can now
	use ‘output_delimiter_string != output_delimiter_default’
	instead of ‘output_delimiter_specified’.
	(cut_file): New arg CUT_STREAM.  Caller changed.
	(main): Simplify.  Coalesce duplicate code.  Redo to avoid need
	for IF_LINT, or for the static var.  No need to xstrdup optarg.

	cut: simplify -fsanitize=leak pacification
	* src/set-fields.c (reset_fields): Remove, as it’s not needed for
	-fsanitize=leak even when ‘lint’ is defined.  All uses removed.

	cp: simplify GCC pacification
	* src/cp.c (make_dir_parents_private): Remove IF_LINT code that is
	no longer needed, as GCC has apparently gotten smarter since 2008.

	chown: simplify -fsanitize=leak pacification
	* src/chgrp.c, src/chown.c (main) [lint]: Omit unnecessary cleanup.
	Use main_exit, not return.

	basenc: simplify -fsanitize=leak pacification
	* src/basenc.c (finish_and_exit): New function.
	(do_encode, do_decode): Use it.  Accept new INFILE arg.  Remove
	no-longer-needed IF_LINT code.  Exit when done.  Caller changed.

	test: simplify gcc pacification
	* src/test.c (get_mtime) [lint]: Omit ifdef lint code that is no
	longer needed, as GCC has gotten smarter since 2005.

	tail: simplify -fsanitize=leak pacification
	Also, close a no-longer-needed file descriptor when falling
	back from inotify.
	* src/tail.c (tail_forever_inotify): Return void, not bool.  Exit
	on fatal error, or on successful completion.  Accept an extra
	argument pointing to a hash table that the caller should free on
	non-fatal error; this simplifies cleanup.  Don’t bother setting
	errno when returning.  Caller changed.
	(main): Omit no-longer-needed IF_LINT code.  Close inotify
	descriptor if inotify fails; this fixes a file descriptor leak and
	means we needn’t call inotify_rm_watch.  Use main_exit, not return.

	tac: simplify -fsanitize=leak pacification
	* src/tac.c (main) [lint]: Omit unnecessary cleanup.
	Use main_exit, not return.

	shuf: simplify -fsanitize=leak pacification
	* src/shuf.c (main) [lint]: Omit unnecessary cleanup.
	Use main_exit, not return.

	numfmt: simplify -fsanitize=leak pacification
	* src/numfmt.c (main) [lint]: Omit unnecessary cleanup.
	Use main_exit, not return.

	mktemp: simplify -fsanitize=leak pacification
	* src/mktemp.c (main) [lint]: Omit unnecessary cleanup.
	Use main_exit, not return.

	dd: simplify -fsanitize=leak pacification
	* src/dd.c (cleanup) [lint]: Omit unnecessary cleanup.
	(main): Use main_exit, not return.

	cp: simplify cp/install/ln/mv pacification
	* src/copy.c (dest_info_free, src_info_free) [lint]:
	Remove.  All uses removed.
	(copy_internal): Pacify only Clang and Coverity; GCC doesn’t need it.
	* src/cp-hash.c (forget_all) [lint]: Remove.  All uses removed.
	* src/cp.c, src/install.c, src/ln.c, src/mv.c (main):
	Use main_exit, not return.

	chmod: pacify -fsanitizer=leak
	* src/chmod.c (main): Use main_exit, not return.

	yes: pacify -fsanitizer=leak
	* src/yes.c (main): Use main_exit, not return.

	tsort: pacify -fsanitizer=leak
	* src/tsort.c (detect_loop): Free removed successor.

	sort: pacify -fsanitizer=leak
	* src/sort.c (pipe_fork, keycompare, sort, main):
	Remove lint code that no longer seems to be needed.
	(sort): Unconditionally compile ifdef lint code that is needed
	to free storage even when not linting.
	(main): Use main_exit, not return.

	split: pacify -fsanitizer=leak
	* src/split.c (lines_rr): New arg FILESP.  All uses changed.
	(main): Use main_exit, not return.  Omit unnecessary alignfree.

	ptx: pacify -fsanitizer=leak
	* src/ptx.c (unescape_string): Rename from copy_unescaped_string,
	and unescape the string in place.  Callers changed.  This way,
	we needn’t allocate storage and thus needn’t worry about
	-fsanitizer=leak.

	seq: pacify -fsanitizer=leak
	* src/seq.c (seq_fast): If successful, exit rather than returning true.
	Callers changed.
	(main): Use main_exit, not return.

	tsort: pacify -fsanitizer=leak
	* src/tsort.c (struct item.balance): Now signed char to save space.
	(struct item.printed): New member.
	(new_item): Initialize k->printed to false.  Simplify via xzalloc.
	(scan_zeros): Use k->printed rather than nulling out string.
	(tsort): Move exiting code here ...
	(main): ... from here.
	(tsort) [lint]: Omit no-longer-needed code.  Instead, set head->printed.

	tr: pacify -fsanitizer=leak
	* src/tr.c (main): Use main_exit, not return.

	stat: pacify -fsanitizer=leak
	* src/stat.c (main):  Use main_exit, not return.

	comm: pacify -fsanitizer=leak
	* src/comm.c (compare_files): Move exiting code here ...
	(main): ... from here, to pacify gcc -fsanitize=leak.

	expr: lint cleanup, and introducing main_exit
	This introduces a new macro main_exit, which is useful
	for pacifying gcc -fsanitizer=lint and in some cases
	means we can remove some ‘IF_LINT’ and ‘ifdef lint’ code.
	* src/expr.c (main): Use main_exit, not return.
	(docolon): Omit an IF_LINT that GCC no longer needs.
	* src/system.h (main_exit): New macro.

2022-01-30  Pádraig Brady  <P@draigBrady.com>

	cksum: use more exact selection of digest algorithms
	Use more constrained argument matching
	to improve forward compatibility and robustness.

	For example it's better that `cksum -a sha3` is _not_
	equivalent to `cksum -a sha386`, so that a user
	specifying `-a sha3` on an older cksum would not be surprised.

	Also argmatch() is used when parsing tags from lines like:
	SHA3 (filename) = abcedf....
	so it's more robust that older cksum instances to fail
	earlier in the parsing process, when parsing output from
	possible future cksum implementations that might support SHA3.

	* src/digest.c (algorithm_from_tag): Use argmatch_exact()
	to ensure we don't match abbreviated algorithms.
	(main): Likewise.
	* tests/misc/cksum-a.sh: Add a test case.

2022-01-30  Pádraig Brady  <P@draigBrady.com>

	build: update gnulib submodule to latest
	To provide argmatch_exact() that does not
	use abbreviated matching, to be used by cksum.

2022-01-30  Paul Eggert  <eggert@cs.ucla.edu>

	mv: when installing to dir use dir-relative names
	When the destination for mv is a directory, use functions like openat
	to access the destination files, when such functions are available.
	This should be more efficient and should avoid some race conditions.
	Likewise for 'install'.
	* src/cp.c (must_be_working_directory, target_directory_operand)
	(target_dirfd_valid): Move from here ...
	* src/system.h: ... to here, so that install and mv can use them.
	Make them inline so GCC doesn’t complain.
	* src/install.c (lchown) [HAVE_LCHOWN]: Remove; no longer needed.
	(need_copy, copy_file, change_attributes, change_timestamps)
	(install_file_in_file, install_file_in_dir):
	New args for directory-relative names.  All uses changed.
	Continue to pass full names as needed, for diagnostics and for
	lower-level functions that do not support directory-relative names.
	(install_file_in_dir): Update *TARGET_DIRFD as needed.
	(main): Handle target-directory in the new, cp-like way.
	* src/mv.c (remove_trailing_slashes): Remove static var; now local.
	(do_move): New args for directory-relative names.  All uses changed.
	Continue to pass full names as needed, for diagnostics and for
	lower-level functions that do not support directory-relative names.
	(movefile): Remove; no longer needed.
	(main): Handle target-directory in the new, cp-like way.
	* tests/install/basic-1.sh:
	* tests/mv/diag.sh: Adjust to match new diagnostic wording.

	cp: fix comment typo

2022-01-28  Pádraig Brady  <P@draigBrady.com>

	doc: NEWS: explain _why_ copy_file_range() is used
	* NEWS: Mention why we're making the change in behavior in cat(1).

	build: update gnulib submodule to latest
	To fix a syntax-check false failure

2022-01-28  Paul Eggert  <eggert@cs.ucla.edu>

	dd: synchronize output after write errors
	Problem reported by Sworddragon (Bug#51345).
	* src/dd.c (cleanup): Synchronize output unless dd has been interrupted.
	(synchronize_output): New function, split out from dd_copy.
	Update conversions_mask so synchronization is done at most once.
	(main): Do not die with the output file open, since we want to be
	able to synchronize it before exiting.  Synchronize output before
	exiting.

	dd: output final progress before syncing
	Problem reported by Sworddragon (Bug#51482).
	* src/dd.c (reported_w_bytes): New var.
	(print_xfer_stats): Set it.
	(dd_copy): Print a final progress report if useful before
	synchronizing output data.

2022-01-27  Paul Eggert  <eggert@cs.ucla.edu>

	cat: prefer copy_file_range to read+write
	* src/cat.c (copy_cat): New function.
	(main): Use it.

	csplit: improve integer overflow checking
	* src/csplit.c: Prefer signed integers to unsigned for sizes
	when either will do.  Check for some unlikely overflows.
	(INCR_SIZE): Remove; no longer used.
	(free_buffer): Also free the arg, simplifying callers.
	(get_new_buffer): Use xpalloc instead of computing new
	size by hand.  Add ATTRIBUTE_DEALLOC.
	(delete_all_files, close_output_file):
	If unlink fails with ENOENT, treat it as success.
	(close_output_file): If unlink fails, decrement count anyway.
	(parse_repeat_count, parse_patterns): Check for int overflow.
	(check_format_conv_type): Use signed format.

	maint: simplify memory alignment
	Use the new Gnulib modules alignalloc and xalignalloc
	to simplify some memory allocation.
	Also, fix some unlikely integer overflow problems.
	* bootstrap.conf (gnulib_modules): Add alignalloc, xalignalloc.
	* src/cat.c, src/copy.c, src/dd.c, src/shred.c, src/split.c:
	Include alignalloc.h.
	* src/cat.c (main):
	* src/copy.c (copy_reg):
	* src/dd.c (alloc_ibuf, alloc_obuf):
	* src/shred.c (dopass):
	* src/split.c (main):
	Use alignalloc/xalignalloc/alignfree instead of doing page
	alignment by hand.
	* src/cat.c (main):
	Check for integer overflow in page size calculations.
	* src/dd.c (INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP, MAX_BLOCKSIZE):
	(real_ibuf, real_obuf) [lint]:
	Remove; no longer needed.
	(cleanup) [lint]:
	(scanargs): Simplify.
	* src/ioblksize.h (io_blksize): Do not allow blocksizes largest
	than the largest power of two that fits in idx_t and size_t.
	* src/shred.c (PAGE_ALIGN_SLOP, PATTERNBUF_SIZE): Remove.

	build: update gnulib submodule to latest

	copy: remove unnecessary ‘free’
	* src/copy.c (copy_reg): Remove a ‘free’ call that does nothing
	because its argument is always a null pointer, starting with
	2007-11-1608:31:15Z!jim@meyering.net.

	dd: simplify conv=swab code
	Simplify byte-swapping, so that the code no longer needs to
	allocate a page before the input buffer.
	* src/dd.c (SWAB_ALIGN_OFFSET, char_is_saved, saved_char): Remove.
	All uses removed.
	(INPUT_BLOCK_SLOP): Simplify to just page_size.
	(alloc_ibuf, dd_copy): Adjust to new swab_buffer API.
	(swab_buffer): New arg SAVED_BYTE, taking the place of the old
	global variables.  Do not access BUF[-1].

	dd: improve integer overflow checking
	* src/dd.c: Prefer signed to unsigned types where either will do,
	as this helps improve checking with gcc -fsanitize=undefined.
	Limit the signed types to their intended ranges.
	(MAX_BLOCKSIZE): Don’t exceed IDX_MAX - slop either.
	(input_offset_overflow): Remove; overflow now denoted by negative.
	(parse_integer): Return INTMAX_MAX on overflow, instead of unspecified.
	Do not falsely report overflow for ‘00x99999999999999999999999999999’.
	* tests/dd/misc.sh: New test for 00xBIG.
	* tests/dd/skip-seek-past-file.sh: Adjust to new diagnostic wording.
	New test for BIGxBIG.

	shred: fix declaration typo
	* gl/lib/randint.h (randint_all_new):
	Do not declare with _GL_ATTRIBUTE_NONNULL (), as
	the arg can be a null pointer.  This fixes a typo added in
	2021-11-01T05:30:28Z!eggert@cs.ucla.edu.

	cat: prefer signed to unsigned
	* src/cat.c: Prefer signed to unsigned types
	where either will do, as they allow for better
	overflow checking at runtime.
