]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
2 weeks agobuild: fix make dist failure
Pádraig Brady [Mon, 17 Nov 2025 19:57:16 +0000 (19:57 +0000)] 
build: fix make dist failure

* src/local.mk: s/crc.h/cksum_crc.h/.
Reported by Bruno Haible.

2 weeks agotests: use tail --debug to determine inotify support
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.

2 weeks agotail: add --debug to report the --follow implementation
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.

3 weeks agomaint: convert remove a K&R declaration
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.

3 weeks agodu: document the TIME_STYLE env variable in usage
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.

3 weeks agotests: verify we document all supported options in --help
Pádraig Brady [Fri, 14 Nov 2025 23:44:30 +0000 (23:44 +0000)] 
tests: verify we document all supported options in --help

* tests/misc/getopt_vs_usage.sh: A new test which checks the
converse of usage_vs_getopt.sh
* tests/local.mk: Reference the new test.

3 weeks agomaint: tag supported options not documented in --help
Pádraig Brady [Sat, 15 Nov 2025 13:42:51 +0000 (13:42 +0000)] 
maint: tag supported options not documented in --help

3 weeks agomaint: rearrange cksum modules so main is in cksum.c
Pádraig Brady [Sat, 15 Nov 2025 13:21:10 +0000 (13:21 +0000)] 
maint: rearrange cksum modules so main is in cksum.c

* src/cksum.c: -> src/cksum_crc.c
* src/cksum.h: -> src/cksum_crc.h
* src/digest.c: -> src/cksum.c
* src/local.mk: Adjust accordingly.
* cfg.mk: Likewise.
* po/POTFILES.in: Likewise.
* src/cksum_avx2.c: Likewise.
* src/cksum_avx512.c: Likewise.
* src/cksum_pclmul.c: Likewise.
* src/cksum_vmull.c: Likewise.

3 weeks agowc: fix missing documentation for the --debug option
Pádraig Brady [Fri, 14 Nov 2025 17:21:00 +0000 (17:21 +0000)] 
wc: fix missing documentation for the --debug option

* doc/coreutils.texi (wc invocation): Desscribe --debug.
* src/wc.c (usage): Likewise.
* NEWS: Mention the bug fix.

3 weeks agotests: install should ignore umask
Sylvestre Ledru [Sat, 15 Nov 2025 21:24:04 +0000 (22:24 +0100)] 
tests: install should ignore umask

Identified here:
<https://github.com/uutils/coreutils/pull/9254>

  * tests/install/basic-1.sh: Add the check.

3 weeks agotests: pr: add a test for bounded memory operation
Collin Funk [Sat, 15 Nov 2025 08:32:48 +0000 (00:32 -0800)] 
tests: pr: add a test for bounded memory operation

* tests/pr/bounded-memory.sh: New file.
* tests/local.mk (all_tests): Add the test.

3 weeks agotests: dd: add tests for conv=lcase and conv=ucase
Collin Funk [Fri, 14 Nov 2025 10:55:44 +0000 (02:55 -0800)] 
tests: dd: add tests for conv=lcase and conv=ucase

* tests/dd/conv-case.sh: New test.
* tests/local.mk (all_tests): Add it.

3 weeks agodoc: shred: clarify what --verbose outputs
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.

3 weeks agotests: test: add test cases for -ef
Collin Funk [Thu, 13 Nov 2025 03:58:52 +0000 (19:58 -0800)] 
tests: test: add test cases for -ef

* tests/test/test-file.sh: Check that -ef works as expected on files,
symbolic links, and hard links.

3 weeks agomaint: fix a typo in comments
Collin Funk [Wed, 12 Nov 2025 18:59:08 +0000 (10:59 -0800)] 
maint: fix a typo in comments

* tests/date/reference.sh: Fix typo; s/modiication/modification.

3 weeks agotests: test: add test cases for -nt and -ot
Collin Funk [Wed, 12 Nov 2025 04:07:52 +0000 (20:07 -0800)] 
tests: test: add test cases for -nt and -ot

* tests/test/test-file.sh: Check that -nt and -ot work properly when
files may or may not exist.

3 weeks agosort: avoid pthread calls with --parallel=1
Pádraig Brady [Mon, 10 Nov 2025 23:17:24 +0000 (23:17 +0000)] 
sort: avoid pthread calls with --parallel=1

Before this change there were the following unneeded pthread calls:

  $ seq 1e6 | ltrace -c -e 'pthread*' sort --parallel=1 | wc -l
  % time     seconds  usecs/call     calls      function
  ------ ----------- ----------- --------- --------------------
   39.13    0.031757          67       468 pthread_mutex_lock
   37.96    0.030811          65       468 pthread_mutex_unlock
   13.17    0.010691          65       162 pthread_cond_signal
    2.15    0.001747          64        27 pthread_mutex_destroy
    2.00    0.001620          60        27 pthread_mutex_init
    0.70    0.000565          62         9 pthread_cond_destroy
    0.64    0.000518          57         9 pthread_cond_init
  ------ ----------- ----------- --------- --------------------
  100.00    0.081159                  1170 total

* src/sort.c (sort): Avoid merge tree overhead when single threaded.

3 weeks agomd5sum: fix --text with the MSYS2 runtime
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

3 weeks agomaint: fix comment re PRLFS' remoteness
Pádraig Brady [Wed, 12 Nov 2025 14:06:44 +0000 (14:06 +0000)] 
maint: fix comment re PRLFS' remoteness

* src/stat.c (human_fstype): prlfs is used in a context of
separate host and guest OS, so should be treated as remote always.

3 weeks agotests: env --argv0: fix false failure with symlinked single binary
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.

3 weeks agomaint: fix a comment in the generated src/fs-is-local.h file
Collin Funk [Tue, 11 Nov 2025 23:37:44 +0000 (15:37 -0800)] 
maint: fix a comment in the generated src/fs-is-local.h file

Reported by Bruno Haible in
<https://lists.gnu.org/r/coreutils/2025-11/msg00113.html>.

* src/extract-magic ($magic_comment): Mention that the function returns
1 if the file system is local and 0 if it is remote.

3 weeks agotests: add tests for locale ordering
Pádraig Brady [Fri, 7 Nov 2025 20:49:25 +0000 (20:49 +0000)] 
tests: add tests for locale ordering

* tests/sort/sort-locale.sh: Check sort,ls have the same (non C) order.
* tests/local.mk: Reference the new test.

3 weeks agomaint: post-release administrivia
Pádraig Brady [Mon, 10 Nov 2025 13:54:30 +0000 (13:54 +0000)] 
maint: post-release administrivia

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

3 weeks agoversion 9.9 v9.9
Pádraig Brady [Mon, 10 Nov 2025 13:21:59 +0000 (13:21 +0000)] 
version 9.9

* NEWS: Record release date.

4 weeks agonice: clamp the niceness correctly on GNU/Hurd
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.

4 weeks agotests: tail: avoid a test failure on GNU/Hurd
Collin Funk [Sat, 8 Nov 2025 06:15:37 +0000 (22:15 -0800)] 
tests: tail: avoid a test failure on GNU/Hurd

* tests/tail/tail-c.sh: Allow 'tail -c 4096 /dev/urandom' to run forever
on GNU/Hurd since lseek fails with ESPIPE.

4 weeks agochcon: fix memory leak in error path
Pádraig Brady [Sat, 8 Nov 2025 10:32:14 +0000 (10:32 +0000)] 
chcon: fix memory leak in error path

* src/chcon.c (change_file_context): If compute_context_from_mask fails,
free the previously allocated file_context.
Fixes https://bugs.gnu.org/79780

4 weeks agotests: avoid false failure due to small timeout
Pádraig Brady [Sat, 8 Nov 2025 10:14:38 +0000 (10:14 +0000)] 
tests: avoid false failure due to small timeout

* tests/tail/tail-c.sh: Tests that fail after a timeout
should use as least 10s to avoid intermittent failures
on slow/loaded hosts.

4 weeks agobuild: update gnulib submodule to latest
Collin Funk [Sat, 8 Nov 2025 04:25:47 +0000 (20:25 -0800)] 
build: update gnulib submodule to latest

4 weeks agoinstall: fix crash with --strip and large $PATH on ppc and sparc
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.

4 weeks agodoc: cksum: clarify support of --text and --binary
Pádraig Brady [Fri, 7 Nov 2025 14:38:51 +0000 (14:38 +0000)] 
doc: cksum: clarify support of --text and --binary

Make the documentation more accurate following v9.3-80-g5e1e0993b

* doc/coreutils.texi (cksum common options): State that --text and
--binary are actually supported, but only to support emulation
of the legacy utils.

4 weeks agotests: wc: protect against a hang on GNU/Hurd
Collin Funk [Fri, 7 Nov 2025 00:52:03 +0000 (16:52 -0800)] 
tests: wc: protect against a hang on GNU/Hurd

Reported by Bruno Haible in
<https://lists.gnu.org/r/coreutils/2025-11/msg00051.html>.

* tests/wc/wc-total.sh: Skip a test that would exhaust memory on
GNU/Hurd.

4 weeks agognulib: update to latest
Pádraig Brady [Wed, 5 Nov 2025 18:39:06 +0000 (18:39 +0000)] 
gnulib: update to latest

* NEWS: Mention the nproc build fix for older Android.

4 weeks agodoc: mention nanosecond decimal points with --iso-8601=ns
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.

4 weeks agomaint: adjust lseek_copy to handle non zero offsets
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.

4 weeks agotests: avoid skipping of LD_PRELOAD based df tests
Bernhard Voelker [Sat, 1 Nov 2025 21:27:59 +0000 (22:27 +0100)] 
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.

4 weeks agotests: avoid skipping by fixing build of shared libraries
Bernhard Voelker [Sat, 1 Nov 2025 19:32:21 +0000 (20:32 +0100)] 
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.

4 weeks agotests: date: check that write errors are promptly diagnosed
Collin Funk [Mon, 3 Nov 2025 06:36:31 +0000 (22:36 -0800)] 
tests: date: check that write errors are promptly diagnosed

This improvement is due to changes to Gnulib's fprintftime module.

* NEWS: Mention the improvement.
* src/getlimits.c (OFF64_T_MAX, OFF64_T_MIN): New macros.
(main): Print them.
* tests/misc/write-errors.sh: Call getlimits_. Add a date invocation.

4 weeks agodoc: squashfs issue to be squashed in Linux 6.18
Paul Eggert [Mon, 3 Nov 2025 19:33:38 +0000 (11:33 -0800)] 
doc: squashfs issue to be squashed in Linux 6.18

4 weeks agotests: truncate: ensure negative args not parsed as options
Pádraig Brady [Mon, 3 Nov 2025 13:51:14 +0000 (13:51 +0000)] 
tests: truncate: ensure negative args not parsed as options

* tests/truncate/truncate-parameters.sh: Add a test case.

4 weeks agodate: avoid a duplicated write error diagnotic
Pádraig Brady [Mon, 3 Nov 2025 13:00:32 +0000 (13:00 +0000)] 
date: avoid a duplicated write error diagnotic

* src/show-date.c (show_date): Only show the fprintftime() diagnostic
if a further diagnostic will not be shown.

4 weeks agodate: translate/clarify recent error message
Pádraig Brady [Mon, 3 Nov 2025 12:55:35 +0000 (12:55 +0000)] 
date: translate/clarify recent error message

* src/show-date.c (show_date): Flagged by syntax-check.

4 weeks agodate: promptly diagnose write errors with --file
Pádraig Brady [Mon, 3 Nov 2025 12:44:07 +0000 (12:44 +0000)] 
date: promptly diagnose write errors with --file

* src/date.c (batch_convert): Check error state of stdout
after each date is processed.
* tests/misc/write-errors.sh: Add a test case.

5 weeks agotests: stty: filter out ispeed and ospeed from boolean options
Collin Funk [Sun, 2 Nov 2025 18:57:21 +0000 (10:57 -0800)] 
tests: stty: filter out ispeed and ospeed from boolean options

* tests/stty/stty-pairs.sh: Also ignore lines starting with ispeed and
ospeed.
* tests/stty/stty.sh: Likewise.
Reported by Bernhard Voelker.

5 weeks agodate: diagnose fprintftime failure
Paul Eggert [Sat, 1 Nov 2025 23:44:43 +0000 (17:44 -0600)] 
date: diagnose fprintftime failure

* src/show-date.c (show_date): Diagnose fprintftime failure,
as it need not be an output error.

5 weeks agopr: improve nstrftime failure check
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..

5 weeks agols: better nstrftime failure check
Paul Eggert [Sat, 1 Nov 2025 23:39:07 +0000 (17:39 -0600)] 
ls: better nstrftime failure check

* src/ls.c (print_long_format): Streamline the checking
for failure of nstrftime.

5 weeks agobuild: update gnulib submodule to latest
Paul Eggert [Sat, 1 Nov 2025 23:15:33 +0000 (17:15 -0600)] 
build: update gnulib submodule to latest

5 weeks agotests: date: avoid test failure on NetBSD
Collin Funk [Sat, 1 Nov 2025 04:14:54 +0000 (21:14 -0700)] 
tests: date: avoid test failure on NetBSD

* tests/date/date-tz.sh: Allow date to fail with large values for TZ
since NetBSD's tzalloc function limits them to 256 bytes.

5 weeks agobuild: reduce explicit dependencies on macOS CoreFoundation
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.

5 weeks agobuild: fix macOS build without libintl
Grisha Levit [Tue, 29 Jul 2025 21:36:30 +0000 (17:36 -0400)] 
build: fix macOS build without libintl

A more precise fix than commit v9.7-322-gc2e1816a5

* configure.ac (USE_NLS): new AM_CONDITIONAL.
* src/local.mk: add @INTL_MACOSX_LIBS@ to <prog>_LDADD that need it.

5 weeks agomaint: ln: eliminate a clang -Wformat-extra-args warning
Bruno Haible [Thu, 18 Sep 2025 21:19:01 +0000 (23:19 +0200)] 
maint: ln: eliminate a clang -Wformat-extra-args warning

* src/ln.c (do_link): Don't pass unused arguments to error().
Don't use "%.0s" to consume a string argument without printing it.

5 weeks agomaint: ls: adjust to gnulib nstrftime changes
Bruno Haible [Sat, 1 Nov 2025 09:26:04 +0000 (10:26 +0100)] 
maint: ls: adjust to gnulib nstrftime changes

* src/ls.c (align_nstrftime): Change return type to ptrdiff_t.
(print_long_format): Treat a negative return value from align_nstrftime
as failure.

5 weeks agobuild: update gnulib submodule to latest
Pádraig Brady [Sat, 1 Nov 2025 11:26:54 +0000 (11:26 +0000)] 
build: update gnulib submodule to latest

* gnulib: update to latest

5 weeks agocopy: be more defensive/restrictive with posix_fadvise
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.

5 weeks agocopy: don't avoid copy-offload upon SEEK_HOLE indicating non-sparse
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

5 weeks agocopy: avoid posix_fadvise bypassing copy offload behavior
Pádraig Brady [Wed, 29 Oct 2025 23:41:55 +0000 (23:41 +0000)] 
copy: avoid posix_fadvise bypassing copy offload behavior

* 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

5 weeks agotimeout: use fork and execvp instead of posix_spawn
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.

This reverts commit dac96ce3e3a2424919fea6a17978b6e91e575d86.

5 weeks agodoc: NEWS: mention that sort --compress=script needs a shebang
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.

5 weeks agosort: optimize the lookups of the --compress-program
Bruno Haible [Fri, 31 Oct 2025 10:20:41 +0000 (11:20 +0100)] 
sort: optimize the lookups of the --compress-program

* src/sort.c (get_resolved_compress_program): New function.
(pipe_child): Use it instead of calling find_in_given_path each time.

5 weeks agomaint: avoid syntax-check failure from previous commit
Collin Funk [Fri, 31 Oct 2025 05:05:20 +0000 (22:05 -0700)] 
maint: avoid syntax-check failure from previous commit

* src/sort.c (pipe_child): Use nullptr instead of NULL.

5 weeks agosort: consistently diagnose access issues to --compress-program
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.

5 weeks agosort: fix silent exit upon SIGPIPE from --compress-program
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.

5 weeks agobuild: update gnulib submodule to latest
Collin Funk [Wed, 29 Oct 2025 07:27:00 +0000 (00:27 -0700)] 
build: update gnulib submodule to latest

5 weeks agotests: fix new date/resolution.sh test on macOS
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.

5 weeks agonumfmt: ensure fields don't split on nbsp
Pádraig Brady [Tue, 28 Oct 2025 12:18:47 +0000 (12:18 +0000)] 
numfmt: ensure fields don't split on nbsp

* src/numfmt.c (newline_or_blank): Explicitly ensure
we don't match NBSP as on platforms like NetBSD 10 or Solaris 11,
NBSP is considered a blank character.
This should have been part of commit v9.8-39-g8bc11f80a
Solaris 11 test failure reported by Bruno Haible.

5 weeks agomaint: prefer FTS_ROOTLEVEL when checking the fts_level of an FTSENT
Collin Funk [Mon, 27 Oct 2025 00:00:03 +0000 (17:00 -0700)] 
maint: prefer FTS_ROOTLEVEL when checking the fts_level of an FTSENT

* src/chcon.c (process_file): Use FTS_ROOTLEVEL instead of 0.
* src/chmod.c (process_file): Likewise.
* src/chown-core.c (change_file_owner): Likewise.

5 weeks agotimeout: use the more efficient posix_spawn to invoke the command
Collin Funk [Sun, 26 Oct 2025 22:33:24 +0000 (15:33 -0700)] 
timeout: use the more efficient posix_spawn to invoke the command

* NEWS: Mention the improvement. Consolidate the posix_spawn
improvements into one item.
* bootstrap.conf (gnulib_modules): Add posix_spawnattr_setsigmask.
* src/timeout.c: Include spawn.h.
(main): Setup signals using a posix_spawnattr_t object. Use posix_spawn
instead of fork and execvp.

5 weeks agomaint: prefer ckd_add for overflow checks
Collin Funk [Sun, 26 Oct 2025 19:20:01 +0000 (12:20 -0700)] 
maint: prefer ckd_add for overflow checks

* src/cksum.c (cksum_slice8, crc32b_sum_stream): Use ckd_add to check
for overflow.
* src/cksum_avx2.c (cksum_avx2): Likewise.
* src/cksum_avx512.c (cksum_avx512): Likewise.
* src/cksum_pclmul.c (cksum_pclmul): Likewise.
* src/cksum_vmull.c (cksum_vmull): Likewise.

5 weeks agobuild: don't build chcon or runcon unless selinux is available
Pádraig Brady [Sun, 26 Oct 2025 12:33:42 +0000 (12:33 +0000)] 
build: don't build chcon or runcon unless selinux is available

The build can be force enabled with --with-selinux and vice versa.

* build-aux/gen-lists-of-programs.sh: Move chcon and runcon
to the list of optional programs.
* configure.ac: Only enable chcon and runcon if selinux.h is available.
* NEWS: Mention the Build-related change.
Fixes https://github.com/coreutils/coreutils/issues/121

6 weeks agosort: use the more efficient posix_spawn to invoke --compress-program
Collin Funk [Fri, 24 Oct 2025 04:27:53 +0000 (21:27 -0700)] 
sort: use the more efficient posix_spawn to invoke --compress-program

* NEWS: Mention the improvement. Mention that 'sort' will continue
without compressing temporary files if the program specified by
--compress-program cannot be executed.
* doc/coreutils.texi (sort invocation): Document the behavior when the
program specified by --compress-program cannot be executed.
* src/sort.c: Include spawn.h.
(MAX_FORK_TRIES_COMPRESS, MAX_FORK_TRIES_DECOMPRESS): Remove definition.
(MAX_TRIES_COMPRESS, MAX_TRIES_DECOMPRESS): New definitions based on
MAX_FORK_TRIES_COMPRESS and MAX_FORK_TRIES_DECOMPRESS.
(async_safe_die): Remove function.
(posix_spawn_file_actions_move_fd): New function.
(pipe_fork): Remove function.
(pipe_child): New function based on pipe_fork. Return an error number
instead of a pid. Use posix_spawnp instead of calling fork and expecting
the caller to exec.
(maybe_create_temp): Call pipe_child instead of pipe_fork. Print a
warning to standard error if --compress-program cannot be executed and
the error is different than the previous call. Remove code for the child
process.
(open_temp): Remove code for the child process. Improve error message.
* tests/sort/sort-compress.sh: Add a test case for when the program
specified by --compress-program does not exist.

6 weeks agomaint: remove unnecessary ignore_value usage
Collin Funk [Thu, 23 Oct 2025 21:40:39 +0000 (14:40 -0700)] 
maint: remove unnecessary ignore_value usage

* src/install.c: Remove ignore-value.h include.
(strip): Don't use ignore_value on posix_spawnattr_destroy since it
isn't declared with the warn_unused_result attribute. Pass the checked
pointer to posix_spawnattr_destroy instead of the variable it points to.

6 weeks agoinstall: enhance error diagnostic when running strip fails
Bernhard Voelker [Thu, 23 Oct 2025 07:33:22 +0000 (09:33 +0200)] 
install: enhance error diagnostic when running strip fails

* src/install.c (strip): Mention explicitly that the strip program
failed in the case the user specified a custom strip program name.

6 weeks agosplit: cleanup after posix_spawn
Collin Funk [Thu, 23 Oct 2025 19:35:37 +0000 (12:35 -0700)] 
split: cleanup after posix_spawn

* boostrap.conf (gnulib_modules): Add posix_spawn_file_actions_destroy.
* src/split.c (cleanup): Call posix_spawnattr_destroy and
posix_spawn_file_actions_destroy after a successful posix_spawn.

6 weeks agosplit: prefer posix_spawn to fork and execl
Collin Funk [Thu, 23 Oct 2025 08:11:50 +0000 (01:11 -0700)] 
split: prefer posix_spawn to fork and execl

* NEWS: Mention the change.
* bootstrap.conf (gnulib_modules): Add posix_spawn,
posix_spawnattr_setsigdefault, posix_spawn_file_actions_addclose,
posix_spawn_file_actions_adddup2, and posix_spawn_file_actions_init.
* src/split.c: Include spawn.h.
(create): Use posix_spawn instead of fork and execl.

6 weeks agotests: date: test --resolution and %-N
Pádraig Brady [Thu, 23 Oct 2025 15:44:14 +0000 (16:44 +0100)] 
tests: date: test --resolution and %-N

* tests/date/resolution.sh: New test for --resolution and %-N.
* tests/local.mk: Reference the new test.

6 weeks agotests: date: test --reference
Pádraig Brady [Thu, 23 Oct 2025 14:25:14 +0000 (15:25 +0100)] 
tests: date: test --reference

* tests/date/reference.sh: Ensure the -r option is tested.
* tests/local.mk: Add the test.

6 weeks agopr: promptly diagnose write errors
Pádraig Brady [Wed, 22 Oct 2025 17:13:48 +0000 (18:13 +0100)] 
pr: promptly diagnose write errors

* src/pr.c (print_page): Exit promptly for `yes | pr`.
(print_clump): Exit promptly for `pr < /dev/zero`.
* tests/misc/write-errors.sh: Enable test cases.
* NEWS: Mention the improvement.

6 weeks agonl: promptly diagnose write errors
Pádraig Brady [Wed, 22 Oct 2025 15:31:15 +0000 (16:31 +0100)] 
nl: promptly diagnose write errors

* NEWS: Mention the improvement.
* src/nl.c (process_file): Exit if error outputting line.
* tests/misc/write-errors.sh: Enable the test case.

6 weeks agofmt: promptly diagnose write errors
Pádraig Brady [Wed, 22 Oct 2025 15:11:53 +0000 (16:11 +0100)] 
fmt: promptly diagnose write errors

* NEWS: Mention the improvement.
* src/fmt.c (put_line): Exit if any error writing line.
(flush_paragraph): Exit if any error writing buffer.
* tests/misc/write-errors.sh: Enable the (flush_paragraph) test case,
and add another to check the put_line() case.

6 weeks agonumfmt: promptly diagnose write errors
Pádraig Brady [Wed, 22 Oct 2025 12:53:46 +0000 (13:53 +0100)] 
numfmt: promptly diagnose write errors

* src/numfmt.c (process line): Inspect the stdio error state when
outputting each line so that we don't have to check each output function
but do eventually exit upon write error, while also remaining buffered.
(main): Also check when outputting a header for the edge case
of very long headers.
* tests/misc/write-errors.sh: Enable the numfmt test case.
* NEWS: Mention the improvement, and reorganize all numfmt improvements.

6 weeks agoinstall: prefer posix_spawnp to fork and execlp
Collin Funk [Sun, 19 Oct 2025 22:22:17 +0000 (15:22 -0700)] 
install: prefer posix_spawnp to fork and execlp

* NEWS: Mention the change.
* bootstrap.conf (gnulib_modules): Add posix_spawnattr_destroy,
posix_spawnattr_init, posix_spawnattr_setflags, and posix_spawnp.
* src/install.c (strip): Use posix_spawnp instead of fork and execlp.

6 weeks agomaint: remove a redundant write after mcel_scan returns an error
Collin Funk [Sun, 19 Oct 2025 03:24:21 +0000 (20:24 -0700)] 
maint: remove a redundant write after mcel_scan returns an error

* gl/lib/mbbuf.h (mbbuf_get_char): Don't set G.len to 1, since mcel_err
has already done it.

6 weeks agotests: numfmt: add non-utf8 multi-byte test
Pádraig Brady [Mon, 20 Oct 2025 11:53:13 +0000 (12:53 +0100)] 
tests: numfmt: add non-utf8 multi-byte test

* tests/numfmt/mb-non-utf8.sh: Test GB18030 delimiter search.
* tests/local.mk: Reference the new test, and move
the existing numfmt.pl test from tests/misc to tests/numfmt.

6 weeks agonumfmt: optimize multi-byte --delimiter search
Pádraig Brady [Sun, 19 Oct 2025 12:11:46 +0000 (13:11 +0100)] 
numfmt: optimize multi-byte --delimiter search

* src/numfmt.c (is_utf8_charset): A new function to efficiently
determine if running with a UTF-8 charset.
(mbsmbchr): A new function to efficiently search for
a (multi-byte) character in a multi-byte string.
(next-field): Use mbsmbchr() rather than mbstr() directly.

6 weeks agonumfmt: support multi-byte --delimiter
Pádraig Brady [Sat, 18 Oct 2025 16:44:49 +0000 (17:44 +0100)] 
numfmt: support multi-byte --delimiter

* bootstrap.conf: Depend on mbsstr() to robustly search for a
multi-byte delimiter character (string) within a multi-byte string.
* src/numfmt.c (main): Accept a valid multi-byte delimiter character.
(next_field): Adjust delimiter search from single byte
to multi-byte aware.  Use mbsstr to find the first match.
* tests/misc/numfmt.pl: Add test case.
* NEWS: Mention the improvement.

7 weeks agonumfmt: use multi-byte aware suffix matching
Pádraig Brady [Sat, 18 Oct 2025 12:02:44 +0000 (13:02 +0100)] 
numfmt: use multi-byte aware suffix matching

* src/numfmt.c (process_suffixed_number): Use gnulib's
mbs_endswith() helper, which is more robust in non UTF-8 locales.
Also always output a devmsg if a suffix is specified.

7 weeks agonumfmt: fix issues with multi-byte blanks
Pádraig Brady [Fri, 17 Oct 2025 18:14:21 +0000 (19:14 +0100)] 
numfmt: fix issues with multi-byte blanks

* src/numfmt.c (process_line): Restore byte overwritten with NUL,
as it may be part of a multi-byte blank.
(process_suffixed_number): Skip multi-byte blanks,
and correctly determine width with mbswidth().
(parse_format_string): Use c_isblank() to explicitly
indicate that's all the format spec supports.
* tests/misc/numfmt.pl: Add test cases.
* NEWS: Mention the bug fix.

7 weeks agonumfmt: add --unit-separator
Pádraig Brady [Thu, 9 Oct 2025 13:24:12 +0000 (14:24 +0100)] 
numfmt: add --unit-separator

Output, accept, or disallow a string between the number and unit
as recommended in <https://physics.nist.gov/cuu/Units/checklist.html>
I.e. support outputting numbers of the form: "1234 M"

* src/numfmt.c (simple_strtod_human): Skip unit separator if present,
or disallow a unit separator if empty.
(double_to_human): Output unit separator if specified.
(main): Accept --unit-separator.
* tests/misc/numfmt.pl: Add test cases.
* doc/coreutils.texi: Describe the new option,
giving examples of interaction with --delimiter.
* NEWS: Mention the new feature.
* THANKS.in: Add Johannes Schauer Marin Rodrigues,
who provided a preliminary patch.

7 weeks agonumfmt: support reading numbers with grouping characters
Pádraig Brady [Tue, 14 Oct 2025 20:06:03 +0000 (21:06 +0100)] 
numfmt: support reading numbers with grouping characters

This does not validate grouping character placement,
and currently just ignores grouping characters.

* src/numfmt.c (simple_strtod_int): Skip grouping chars
that are part of a number.
* tests/misc/numfmt.pl: Add test cases.
* NEWS: Mention the improvement.

7 weeks agonumfmt: support reading numbers with NBSP before unit
Pádraig Brady [Tue, 14 Oct 2025 15:17:56 +0000 (16:17 +0100)] 
numfmt: support reading numbers with NBSP before unit

* src/numfmt.c (simple_strtod_human): Accept (multi-byte)
non-breaking space character between number and unit.
Note we restrict this to a single character between number
and unit, to allow less ambiguous parsing if multiple blanks
are used to delimit fields.
* tests/misc/numfmt.pl: Add test cases.
* doc/coreutils.texi (numfmt invocation): Fix stale description
--delimiter skipping whitespace.
* NEWS: Mention the improvement.

7 weeks agotests: du/bigtime: try harder to find a suitable filesystem
Nicolas Boichat [Sat, 26 Jul 2025 06:58:33 +0000 (14:58 +0800)] 
tests: du/bigtime: try harder to find a suitable filesystem

* tests/du/bigtime.sh: At least on Linux, the ext4 filesystem
doesn't support such large timestamp, while tmpfs does.  Try a bit
harder to look for a filesystem with large timestamp support.

7 weeks agotests: date: check that the hour format of the current locale is used
Collin Funk [Sun, 12 Oct 2025 04:55:31 +0000 (21:55 -0700)] 
tests: date: check that the hour format of the current locale is used

* tests/date/date-locale-hour.sh: New file.
* tests/local.mk (all_tests): Add the new test.

Co-authored-by: Pádraig Brady <P@draigBrady.com>
7 weeks agotests: fix false failure in recent memory limit test
Pádraig Brady [Mon, 13 Oct 2025 12:22:38 +0000 (13:22 +0100)] 
tests: fix false failure in recent memory limit test

* tests/basenc/bounded-memory.sh: Ensure we skip the test
upon failure to determine the memory lower bound.
Reported by Bruno Haible.

8 weeks agonumfmt: fix buffer over-read (CWE-126)
Pádraig Brady [Sat, 11 Oct 2025 11:19:34 +0000 (12:19 +0100)] 
numfmt: fix buffer over-read (CWE-126)

* src/numfmt.c (simple_strtod_human): Check for NULL after pointer
adjustment to avoid Out-of-range pointer offset (CWE-823).
* NEWS: Mention the fix.

8 weeks agotests: basenc: use less redundant naming
Pádraig Brady [Sat, 11 Oct 2025 10:25:27 +0000 (11:25 +0100)] 
tests: basenc: use less redundant naming

Rename to less redundant names, now that we use
a separate test directory per util.

* tests/basenc/basenc-bounded-memory.sh -> .../bounded-memory.sh
* tests/basenc/basenc-large.sh -> .../large-input.sh
* tests/local.mk: Reference new names.

8 weeks agotests: fix memory limit determination in new test
Pádraig Brady [Sat, 11 Oct 2025 10:21:38 +0000 (11:21 +0100)] 
tests: fix memory limit determination in new test

* tests/basenc/basenc-bounded-memory.sh: The passed command
needs to succeed for memory limit determination to work.

8 weeks agotests: basenc: add a test for bounded memory operation
Collin Funk [Sat, 11 Oct 2025 04:13:55 +0000 (21:13 -0700)] 
tests: basenc: add a test for bounded memory operation

* tests/basenc/basenc-bounded-memory.sh: New file.
* tests/local.mk (all_tests): Add the test.

8 weeks agotests: ln -f: ensure existing link replaced
Sylvestre Ledru [Fri, 10 Oct 2025 11:38:33 +0000 (13:38 +0200)] 
tests: ln -f: ensure existing link replaced

Identified here:
<https://github.com/uutils/coreutils/issues/8830>

* tests/ln/misc.sh: Add the check.

2 months agotests: cksum: add a test case for robust file name parsing
Pádraig Brady [Tue, 7 Oct 2025 14:24:12 +0000 (15:24 +0100)] 
tests: cksum: add a test case for robust file name parsing

* tests/cksum/cksum-c.sh: Add a test case where the file name
contains tagged format delimiter characters.