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.
Pádraig Brady [Fri, 14 Nov 2025 13:23:09 +0000 (13:23 +0000)]
doc: shred: clarify what --verbose outputs
* doc/coreutils.texi (shred invocation): Give more details on what
--verbose outputs, to give some indication of its utility.
* src/shred.c (usage): Likewise. Also since we're changing the string,
split out translations to give translators more granular translations.
Pádraig Brady [Fri, 7 Nov 2025 13:55:39 +0000 (13:55 +0000)]
md5sum: fix --text with the MSYS2 runtime
Note the use of "rt" is non-standard, but we're restricting
its use here to systems that define O_BINARY, which should
invariably support "rt" mode.
* src/digest.c (): Where significant, explicitly use "rt" mode
with --text, as MSYS2 defaults to binary mode for fopen'd files
(though not for standard streams).
* NEWS: Mention the bug fix.
Fixes https://github.com/coreutils/coreutils/issues/123
Pádraig Brady [Wed, 12 Nov 2025 13:25:26 +0000 (13:25 +0000)]
tests: env --argv0: fix false failure with symlinked single binary
* tests/env/env.sh: Always pass --coreutils-prog=true so that the
program to run can be determined with --enable-single-binary=symlinks.
Also actually verify the expected verbose output.
Reported by the Alpine Linux project.
Collin Funk [Sun, 9 Nov 2025 04:30:08 +0000 (20:30 -0800)]
nice: clamp the niceness correctly on GNU/Hurd
* NEWS: Mention the bug fix.
* src/nice.c (MIN_ADJUSTMENT): Set to 0 on the Hurd with glibc ≤ 2.42.
(MAX_ADJUSTMENT): Set to (2 * NZERO - 2) on the Hurd with glibc ≤ 2.42.
(main): Clamp the niceness to be greater or equal to MIN_ADJUSTMENT and
less than or equal to MAX_ADJUSTMENT.
* tests/nice/nice.sh: Add some tests for the Hurd's ranges.
Pádraig Brady [Fri, 7 Nov 2025 16:14:12 +0000 (16:14 +0000)]
install: fix crash with --strip and large $PATH on ppc and sparc
* gnulib: Update to the latest gnulib to pull in the fix
(v1.0-2406-g89f63027de) to allocate the $PATH processing memory
before the vfork call, which is required on ppc and sparc.
* tests/install/basic-1.sh: Ensure posix_spawnp() suports a large $PATH,
which needs careful handling with vfork() as detailed in gnulib.
Collin Funk [Tue, 4 Nov 2025 03:47:52 +0000 (19:47 -0800)]
doc: mention nanosecond decimal points with --iso-8601=ns
Many people are used to seeing ISO 8601 dates using a period separating
seconds and nanoseconds. This behavior seems to be worth documenting
given the bug reports:
https://bugs.gnu.org/63119
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1118970
* doc/coreutils.texi (Options for date): Mention that
'date --iso-8601=ns' uses a comma as a separator, following the
preference of ISO 8601. Give an example of how to get an ISO 8601 date
with a period separator.
Pádraig Brady [Mon, 3 Nov 2025 22:42:22 +0000 (22:42 +0000)]
maint: adjust lseek_copy to handle non zero offsets
* src/copy-file-data.c (lseek_copy): hole_start is initialized
only when ext_start == ipos.
(infer_scantype): Update the hole_start initialization to
the more logically correct POS, even though that init
is only needed to suppress a -Wmaybe-uninitialized warning.
Note gcc 15.2 at least doesn't seem to need that suppression.
tests: avoid skipping of LD_PRELOAD based df tests
It was seen that gnulib's read_file_system_list may use fopen instead
of open. Adjust the df(1) tests to replace both library functions.
* tests/df/no-mtab-status.sh: Change the shared library code invoked
via LD_PRELOAD to override both fopen and open. While at it, perform
varargs processing only when path is not "/proc/self/mountinfo".
* tests/df/skip-duplicates.sh: Likewise.
tests: avoid skipping by fixing build of shared libraries
Two df(1) tests were skipped (since commit ee367bd38dac), because
the build of the shared library in those tests failed.
+ gcc -Wall -shared --std=gnu99 -fPIC -O2 k.c -o k.so -ldl
k.c: In function 'open':
k.c:37:7: error: implicit declaration of function 'streq'; did you \
mean 'strsep'? [-Wimplicit-function-declaration]
37 | if (streq (path, "/proc/self/mountinfo"))
| ^~~~~
| strsep
Gnulib streq is not available in the tests.
* tests/df/no-mtab-status.sh: Replace "streq" by "0==strcmp" in the
shared library source.
* tests/df/skip-duplicates.sh: Likewise.
Paul Eggert [Sat, 1 Nov 2025 23:42:59 +0000 (17:42 -0600)]
pr: improve nstrftime failure check
* src/pr.c (init_header): Do not report an nstrftime EOVERFLOW
error as memory exhaustion. Instead, output the time as an
integer. Also, work even if nstrftime (nullptr, SIZE_MAX, ...)
would return PTRDIFF_MAX which means adding 1 would overflow..
Pádraig Brady [Sat, 1 Nov 2025 14:30:12 +0000 (14:30 +0000)]
build: reduce explicit dependencies on macOS CoreFoundation
* src/local.mk: Revert v9.7-322-gc2e1816a5, instead relying
on the more focused v9.8-79-g532cd66af. When built with
--disable-nls on macOS this will result in only some commands
being linked with INTL_MACOSX_LIBS, thus resulting in env(1)
at least not setting a __CF_USER_TEXT_ENCODING envirnoment variable.
Pádraig Brady [Fri, 31 Oct 2025 15:37:55 +0000 (15:37 +0000)]
copy: be more defensive/restrictive with posix_fadvise
* src/copy-file-data.c (copy_file_data): Only give the
POSIX_FADV_SEQUENTIAL hint when we _know_ we'll definitely
use a read/write loop to copy the data. Also only apply
the hint to the whole file, as we've seen OpenZFS at least
special case that.
(sparse_copy): Update stale comment.
Pádraig Brady [Thu, 30 Oct 2025 13:02:48 +0000 (13:02 +0000)]
copy: don't avoid copy-offload upon SEEK_HOLE indicating non-sparse
* src/copy-file-data.c (infer_scantype): Fall back to a plain copy
if SEEK_HOLE indicates non-sparse, as zero copy avoids copy offload.
This was seen with transparently compressed files on OpenZFS.
* tests/cp/sparse-perf.sh: Add a test case even though it might
only trigger on compressed file systems that don't support reflink.
* NEWS: Mention the bug fix.
Addresses https://github.com/coreutils/coreutils/issues/122
* src/copy-file-data.c (): pass 0 to posix_fadvise to indicate to EOF.
coreutils 9.8 used OFF_T_MAX instead, which triggered OpenZFS 2.2.2
at least to synchronously (decompress and) populate the page cache.
Addresses https://github.com/coreutils/coreutils/issues/122
Collin Funk [Fri, 31 Oct 2025 04:10:52 +0000 (21:10 -0700)]
timeout: use fork and execvp instead of posix_spawn
* NEWS: Remove timeout from the list of programs that use posix_spawn.
* bootstrap.conf (gnulib_modules): Remove posix_spawnattr_setsigmask.
* src/timeout.c: Don't include spawn.h.
(main): Use fork and execvp instead of posix_spawn.
Pádraig Brady [Fri, 31 Oct 2025 14:17:31 +0000 (14:17 +0000)]
doc: NEWS: mention that sort --compress=script needs a shebang
* NEWS: Mention that we don't fall-back to executing /bin/sh <script>
for malformed scripts that don't start with #!..., or any executable
that returns ENOEXEC in general.
Bruno Haible [Thu, 30 Oct 2025 09:15:09 +0000 (10:15 +0100)]
sort: consistently diagnose access issues to --compress-program
* bootstrap.conf (gnulib_modules): Add findprog-in.
* src/sort.c: Include findprog.h.
(pipe_child): Look up the compress_program in $PATH and report errors
such as ENOENT or EACCES before invoking posix_spawnp.
This avoids inconsistency on systems that emulate posix_spawn through
fork/exec, as they would otherwise treat such a failure as a generic
failure and fail the sort, rather than continuing without compression.
Pádraig Brady [Tue, 28 Oct 2025 19:30:08 +0000 (19:30 +0000)]
sort: fix silent exit upon SIGPIPE from --compress-program
* src/sort.c (main): Ignore SIGPIPE so we've more control over
how we handle for stdout and compression programs.
(sort_die): Handle EPIPE from stdout and mimic a standard SIGPIPE,
otherwise reverting to a standard exit(SORT_FAILURE);
* tests/sort/sort-compress-proc.sh: Add a test case.
* NEWS: Mention the bug fix.
Pádraig Brady [Tue, 28 Oct 2025 12:52:55 +0000 (12:52 +0000)]
tests: fix new date/resolution.sh test on macOS
* tests/date/resolution.sh: Fix comparison on systems with less than
nano second reslution, where we use sed to discard the redundant
trailing zeros output by date --resolution.
Reported by Bruno Haible on macOS.