Collin Funk [Sat, 13 Dec 2025 07:11:09 +0000 (23:11 -0800)]
doc: dd: document the behavior of conv flags on multibyte characters
* doc/coreutils.texi (dd invocation): Document the behavior of 'dd' on
multibyte characters and some unspecified behavior that will be
documented in a future POSIX release [1].
Collin Funk [Sat, 13 Dec 2025 05:51:30 +0000 (21:51 -0800)]
tests: ls: use a larger file descriptor limit
OpenBSD and Alpine Linux /bin/sh cannot handle a file descriptor limit
of 7.
* tests/ls/recursive.sh: Create 30 directories and use a file descriptor
limit of 20. Don't check the output since we have coverage for that
elsewhere.
Reported by Bruno Haible.
Pádraig Brady [Sat, 6 Dec 2025 13:47:11 +0000 (13:47 +0000)]
build: reduce size of multi-call binary by reusing cksum logic
Map md5sum and sha{1,224,256,385,512} to use cksum logic,
which selects appropriate behavior at runtime, rather than
separate binaries for each closely related utility.
$ size src/coreutils # before
text data bss dec hex filename 1349509 6812 619312 1975633 1e2551 src/coreutils
$ size src/coreutils # after
text data bss dec hex filename 1306933 6748 619152 1932833 1d7e21 src/coreutils
* build-aux/gen-single-binary.sh: Map sha*sum to use cksum.c
* src/cksum.c: Adjust to behave more like sha*sum,
when the algorithm to something other than "crc".
* src/cksum.h: Expose the cksum_algorithm global and enum.
* src/coreutils-md5sum.c: Set cksum_algorithm and call cksum logic.
* src/coreutils-sha1sum.c: Likewise.
* src/coreutils-sha224sum.c Likewise.
* src/coreutils-sha256sum.c Likewise.
* src/coreutils-sha384sum.c Likewise.
* src/coreutils-sha512sum.c Likewise.
* NEWS: Mention the improvement.
Pádraig Brady [Fri, 12 Dec 2025 16:41:36 +0000 (16:41 +0000)]
doc: expand on shell-escape quoting style
* doc/coreutils.texi (quotingStyles): Expand on the advantages
of "shell-escape" quoting, and mention it's the default when
outputting to a tty. Also mention how it's also useful with
LC_ALL=C to further disambiguate output. Also reference the
separate page detailing various considerations and options
for file name quoting. Also move the mention of the default
quoting style to the top of the page where it's more obvious.
Collin Funk [Wed, 10 Dec 2025 05:13:10 +0000 (21:13 -0800)]
maint: install: reduce variable scope
* src/install.c (change_timestamps): Initialize variables where they are
declared.
(need_copy, setdefaultfilecon, get_ids, mkancesdirs_safe_wd, main):
Declare variables where they are used instead of at the start of the
block.
Collin Funk [Wed, 10 Dec 2025 05:05:22 +0000 (21:05 -0800)]
maint: cp: reduce variable scope
* src/cp.c (re_protect): Initialize variables where they are declared.
(make_dir_parents_private, do_copy, main): Declare variables where they
are used instead of at the start of the block.
Pádraig Brady [Tue, 9 Dec 2025 17:07:13 +0000 (17:07 +0000)]
doc: support html post processing in all cases
Previously the html-local make rule only worked for `make html`.
Instead add support for `make doc/coreutils.html` or `make web-manual`
through the use of a makeinfo wrapper.
* doc/local.mk: Move post processing from here to ...
* build-aux/makeinfo-wrapper.sh: ... here.
* cfg.mk: Ensure our wrapper is called with MAKEINFO.
Also pass --no-node-files so redirection html files
are not created for each anchor.
Collin Funk [Tue, 9 Dec 2025 13:17:33 +0000 (13:17 +0000)]
doc: html: fix build with parallel make
* doc/local.mk (html-local): Add html files to prerequisites so they are
generated before 'sed' is invoked. Also interate over the already
populated $(HTMLS) to be more general (to multiple html files),
and more portable (to non GNU make).
Pádraig Brady [Mon, 8 Dec 2025 14:15:00 +0000 (14:15 +0000)]
doc: fix pdf generation
* doc/coreutils.texi: Explicitly supply empty arguments to macros,
as dvi (a required prerequisite to pdf) is more strict in its
handling of macro arguments.
* cfg.mk (sc_texi_ensure_empty_option_args): Add a syntax check,
since this is not verified in the default build.
Reported by Collin Funk.
Collin Funk [Sun, 7 Dec 2025 23:48:15 +0000 (15:48 -0800)]
maint: env: reduce variable scope
* src/env.c (extract_varname, parse_signal_action_params)
(parse_block_signal_params, set_signal_proc_mask)
(list_signal_handling, main): Declare variables where they are used
instead of at the start of the function.
Collin Funk [Sun, 7 Dec 2025 23:27:29 +0000 (15:27 -0800)]
maint: pwd: reduce variable scope
* src/pwd.c (find_dir_entry, robust_getcwd): Declare variables where
they are used.
(logical_getcwd, main): Likewise. Constify the result of getenv, since
the result cannot be modified.
Collin Funk [Sun, 7 Dec 2025 01:19:55 +0000 (17:19 -0800)]
shred: use gethrxtime instead of time
The gethrxtime function uses a monotonic clock if available on the
system. The effect should be unnoticeable since we print --verbose
information every 5 seconds, but is more correct and we already do the
same in 'dd'.
* src/local.mk (src_shred_LDADD): Add $(GETHRXTIME_LIB).
* src/shred.c (dopass): Use xtime_t instead of time_t. Use gethrxtime
instead of time.
Pádraig Brady [Sun, 7 Dec 2025 13:24:00 +0000 (13:24 +0000)]
tests: tac-continue.sh: modernise and always execute as root
* tests/tac/tac-continue.sh: This test was very awkard to setup,
and thus always skipped. Instead move to a root only test
that creates an almost full partition itself.
* tests/local.mk: Move test to root only.
Suggested at https://github.com/uutils/coreutils/pull/9590
Collin Funk [Fri, 5 Dec 2025 06:14:31 +0000 (22:14 -0800)]
pinky: promptly diagnose write errors
In some cases 'pinky' could run forever until interrupted:
$ ln -s /dev/zero ~/.plan
$ ln -s /dev/zero ~/.project
$ timeout -v 5 pinky -l collin > /dev/full
timeout: sending signal TERM to command ‘pinky’
After this change it will exit upon failing to write to standard output:
$ timeout -v 5 ./src/pinky -l collin > /dev/full
pinky: write error: No space left on device
* src/pinky.c: Include fadvise.h, filenamecat.h, full-write.h, and
ioblksize.h.
(cat_file): New function.
(print_entry): Check if standard output has it's error flag set after
printing a user entry.
(print_long_entry): Likewise. Use the new cat_file function.
* NEWS: Mention the improvement.
Pádraig Brady [Thu, 27 Nov 2025 20:45:44 +0000 (20:45 +0000)]
doc: html: support defined anchors for command options
* doc/coreutils.texi (optAnchor): A new macro to output a
referencable anchor, called from ...
(optItem): ... here; a new macro to output all index entries
for each option item.
(optZero,optZeroTerminated): Show an example of the adjustment
done to each option description.
* doc/local.mk (html-local): Post-process the texinfo generated HTML
(`make html`) to remove our "-option" tag, and replace all
escaped _002d with a standard hyphen, which is fine in URLs.
Paul Eggert [Thu, 4 Dec 2025 20:39:17 +0000 (12:39 -0800)]
build: update gnulib submodule to latest
Gnulib issymlinkat change reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2025-12/msg00044.html
* bootstrap: Update from Gnulib.
* src/copy.c: Include issymlinkat.h, not issymlink.h.
Collin Funk [Wed, 3 Dec 2025 03:16:23 +0000 (19:16 -0800)]
timeout: print the signal number 0 instead of EXIT
POSIX.1-2024 added sig2str but leaves the behavior when called with
signal 0 unspecified. FreeBSD 15.0 does not return the signal name EXIT
like Gnulib's version causing a test failure. This fixes that and
changes the behavior to print 0 instead of EXIT, to avoid confusion when
the program does not exit.
* NEWS: Mention the change.
* src/timeout.c (cleanup): Use snprintf instead of sig2str if the signal
is 0.
* tests/timeout/timeout.sh: Updated the expected output.
Pádraig Brady [Tue, 2 Dec 2025 17:15:06 +0000 (17:15 +0000)]
timeout: prioritize "timed out" exit status
* src/timeout.c (cleanup): Reset the default exit status
to EXIT_TIMEDOUT, if we have in fact received an ALARM.
Otherwise we would exit with status EXIT_CANCELED if
there was an issue writing --verbose output for example.
This also ensures a consistent exit status with ASAN enabled,
as with ASAN stderr is not explicitly closed by gnulib's
close_stdout handler.
Pádraig Brady [Mon, 1 Dec 2025 15:03:36 +0000 (15:03 +0000)]
tests: mv: add checks for cross device handling of special files
* tests/mv/mv-special-2.sh: Add test to ensure we preserve
sparse files, character devices, symlinks, when moving across
file system boundaries.
Addresses https://github.com/coreutils/coreutils/issues/136
Pádraig Brady [Mon, 1 Dec 2025 13:23:45 +0000 (13:23 +0000)]
tests: rm: avoid usually skipped non root test
* tests/rm/fail-eperm.xpl: Remove this usually skipped non-root test.
* tests/rm/fail-2eperm.sh: Add the test to this root test instead.
* tests/local.mk: Remove the reference to *.xpl.
Collin Funk [Sun, 30 Nov 2025 00:17:40 +0000 (16:17 -0800)]
doc: du: mention the behavior when both --threshold and --total are used
* doc/coreutils.texi (du invocation): Mention that --threshold has no
effect on the grand total calculated when --total is used.
Addresses https://bugs.gnu.org/71309
Pádraig Brady [Sun, 30 Nov 2025 15:00:23 +0000 (15:00 +0000)]
tests: avoid skip due to missing nouser_xattr support
* tests/cp/cp-mv-enotsup-xattr.sh: The nouser_xattr option
is not supported by ext2 since about 2022. Instead use
ramfs to ensure xattrs are not supported. We also remove
part of the test that relied on partial xattr support.
Fixes https://github.com/coreutils/coreutils/issues/135
Collin Funk [Sat, 29 Nov 2025 07:42:40 +0000 (23:42 -0800)]
maint: remove note about old NEWS files
* NEWS: Remove mention about old fileutils, textutils, and sh-utils NEWS
files that were removed in commit 2c64bc872 (doc: only distribute 5
years of ChangeLogs, 2017-01-31).
* cfg.mk (old_NEWS_hash): Run 'make update-NEWS-hash'.
Pádraig Brady [Fri, 28 Nov 2025 17:39:20 +0000 (17:39 +0000)]
test: re-enable tests that had a false requirement on coreutils' kill
Recently we've not built our kill command by default,
so reduce test dependence on that.
* tests/sort/sort-compress-proc.sh: `kill -l [exit_status]` is well
supported, and is a POSIX requirement.
* tests/timeout/timeout.sh: There were actually no kill invocations
in this test at all.
Pádraig Brady [Fri, 28 Nov 2025 17:34:23 +0000 (17:34 +0000)]
timeout: ensure we terminate command upon abnormal exit
* src/timeout.c (main): Use PR_SET_PDEATHSIG to ensure the
child is terminated even if the parent terminates abnormally.
* tests/timeout/timeout-group.sh: Add a case to ensure sending
SIGKILL results in the termination of the monitored command.
* NEWS: Mention the improvement.
Collin Funk [Fri, 28 Nov 2025 05:33:30 +0000 (21:33 -0800)]
du: add the short option -A corresponding to --apparent-size
The --apparent-size option to 'du' was added in
coreutils-4.5.8 (2003). FreeBSD 8.0 (2009) added the same functionality
under the short option -A. This long option previously had no short
option, so this patch adds -A to be compatible with FreeBSD.
* NEWS: Mention the new short option.
* doc/coreutils.texi: Document the short option.
* src/du.c (usage): Likewise.
(APPARENT_SIZE_OPTION): Remove definition.
(EXCLUDE_OPTION): Define to CHAR_MAX + 1.
(long_options): Use the -A short option for --apparent-size.
(main): Likewise.
* tests/du/apparent.sh: Test that '-b', '-A -B 1', and
'--apparent-size --block-size 1' function the same.
Pádraig Brady [Fri, 28 Nov 2025 13:37:25 +0000 (13:37 +0000)]
doc: touch: man: state in summary that files are created
* man/touch.x: Creating files is core functionality of touch(1),
so state this in the summary, so that apropos can be used
to search for file creation functionality.
Pádraig Brady [Thu, 27 Nov 2025 21:52:20 +0000 (21:52 +0000)]
tests: prefer ext4 casefold for case insensitive tests
* tests/mv/hardlink-case.sh: Try both ext4 casefold and hfsplus,
as ext4 has better availability.
Suggested at https://github.com/coreutils/coreutils/issues/133
Collin Funk [Thu, 27 Nov 2025 03:17:43 +0000 (19:17 -0800)]
doc: du, sort, wc: adjust description of --files0-from
* src/du.c (usage): Remove an unnecessary "then".
* src/wc.c (usage): Likewise. Add a comma after "-".
* src/sort.c (usage): Likewise. Adjust the indentation to match du and
wc.
Pádraig Brady [Tue, 25 Nov 2025 22:48:37 +0000 (22:48 +0000)]
doc: fold: clarify operation of -s in --help
* src/fold.c (usage): The description of -s was unclear:
- State that we can also break within words.
- State that we split on blanks not spaces.
- State that we split after the blank, not before.
Pádraig Brady [Mon, 24 Nov 2025 13:17:22 +0000 (13:17 +0000)]
build: kill(1), uptime(1): don't install by default
* build-aux/gen-lists-of-programs.sh: kill and uptime are not installed
by arch, debian, fedora, suse at least, so add to disabled list.
Fixes https://github.com/coreutils/coreutils/issues/132
* NEWS: Mention the build change.
Paul Eggert [Sun, 23 Nov 2025 19:42:57 +0000 (11:42 -0800)]
du,ls: don’t modify getenv strings
Fix du and ls to conform to the POSIX getenv spec,
which says you can’t modify strings returned by getenv
unless you put the string there directly, or used putenv.
This portability bug was found by strict C23 checking
using qualifier-generic functions.
* bootstrap.conf (gnulib_modules): Add xmemdup0. Sort.
* src/du.c (main):
* src/ls.c (decode_switches):
Don’t modify the string that getenv returns.
Instead, use xmemdup0 if needed, and include xmemdup0.h.
Pádraig Brady [Fri, 21 Nov 2025 11:43:35 +0000 (11:43 +0000)]
timeout: honor ignored signal dispositions
This behavior was depended on in our trap_sigpipe_or_skip_ helper,
and now that we're handling all terminating signals, we should
consistently honor their ignored signal dispositions.
* NEWS: Mention the change in behavior, especially in regard
to shell background jobs.
* src/timeout.c (sig_needs_handling): A new helper that return TRUE,
for --signal, SIG_ALRM, or non ignored signals.
(cleanup_install): Filter handled signals with the helper.
(block_cleanup_and_chld): Likewise.
* tests/timeout/timeout-group.sh: Adjust to use the now required
`env --default-signal=...` wrapper to reset (auto) ignored signals.
Also change the termination signal from SIGINT to SIGUSR1
to generalize the test signals not specially handled by the shell,
and newly handled by timeout(1).
* tests/timeout/timeout.sh: Add a test case for SIGPIPE
to ensure the ignored signal disposition is honored.
Pádraig Brady [Thu, 20 Nov 2025 16:02:43 +0000 (16:02 +0000)]
timeout: handle all terminating signals
* src/timeout.c (term_sig): A new global list of all signals
whose default disposition is to terminate the process.
(install_cleanup): Iterate over the TERM_SIG list, rather than
installing the handler for a specific subset.
(block_cleanup_and_chld): Likewise.
* tests/timeout/timeout.sh: Add a test case for SIGPIPE.
* NEWS: Mention the bug fix.
Pádraig Brady [Thu, 20 Nov 2025 10:43:06 +0000 (10:43 +0000)]
build: remove explicit link to CoreFoundation libs on macOS
* src/local.mk: No longer explicitly depend on @INTL_MACOS_LIBS@
as they're no longer implicitly referenced (in LIBINTL) without gettext.
The old dependency was through localename-unsafe, specifically
date, du through show-date() (fprintftime), and
ls, pr, stat, uptime through strftime().
gnulib commit v1.0-2439-gff4b084a68 removed the localename-unsafe
dependency on macOS.
Collin Funk [Thu, 20 Nov 2025 03:08:49 +0000 (19:08 -0800)]
maint: add coreutils_hardlinks to src/.gitignore
* src/.gitignore (coreutils_hardlinks): Ignore this file. It is an empty
file created when --enable-single-binary=hardlinks is used to ensure
hardlinks are created after the multicall binary.
Pádraig Brady [Tue, 18 Nov 2025 15:30:26 +0000 (15:30 +0000)]
build: support --enable-single-binary=hardlinks
* Makefile.am: Use ln rather than $(LN_S) for hardlinks.
* configure.ac: Accept --enable-single-binary=hardlinks.
* man/local.mk: In hardlink mode, explicitly add the
hardlink creation rule to mandeps. Given the automake
generated dependency chain, this ensures that the hardlinks
are created _after_ the multicall binary, with `make all`
or `make check` etc.
* src/local.mk: Define the new src/coreutils_hardlinks rule,
and only depend on src/coreutils_{symlinks,shebangs} if
in those modes, so that hardlinks are created _after_
the multicall binary, and other link types before.
* NEWS: Mention the new feature.
Addresses https://github.com/coreutils/coreutils/issues/129
Pádraig Brady [Fri, 14 Nov 2025 17:03:38 +0000 (17:03 +0000)]
tests: use tail --debug to determine inotify support
* init.cfg (require_inotify_supported_): A new function that
indicates inotify support for a file in the current directory,
using tail --debug, rather than awkward strace checks etc.
* tests/tail/inotify-dir-recreate.sh: Call require_inotify_supported_.
tests/tail/inotify-only-regular.sh: Likewise.
tests/tail/inotify-race.sh: Likewise.
tests/tail/inotify-race2.sh: Likewise.
Pádraig Brady [Fri, 14 Nov 2025 16:26:43 +0000 (16:26 +0000)]
tail: add --debug to report the --follow implementation
* doc/coreutils.texi (tail invocation): Describe --debug.
* src/tail.c (tail_forever, tail_forever_inotify): Output
which --follow implementation is being used.
* tests/tail/debug.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.
Collin Funk [Mon, 17 Nov 2025 00:59:43 +0000 (16:59 -0800)]
maint: convert remove a K&R declaration
This function is hidden unless EVAL_TRACE is defined for debugging.
* src/expr.c (trace): Convert to a prototype instead of K&R definition
to avoid -Werror=strict-prototypes. Make the argument const to avoid
-Werror=discarded-qualifiers.
Bernhard Voelker [Sun, 16 Nov 2025 17:24:47 +0000 (18:24 +0100)]
du: document the TIME_STYLE env variable in usage
The impact of the TIME_STYLE environment variable on du(1) was only
documented in the Texinfo manual. To avoid surprises for users,
also mention TIME_STYLE in the usage text, i.e., for --help and man.
Organize similar as in ls(1), but as du(1) has slightly different
behavior it would be hard to share the translation.
* src/du.c (usage): Shorten the description of --time-style, and refer
to an additional --time-style / TIME_STYLE description below.