30866 Commits

Author SHA1 Message Date
Pádraig Brady
f7be1e51a3 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2025-11-10 13:54:30 +00:00
Pádraig Brady
0ae5bdc7a8 version 9.9
* NEWS: Record release date.
v9.9
2025-11-10 13:21:59 +00:00
Collin Funk
fc93a44bbe 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.
2025-11-09 18:48:34 -08:00
Collin Funk
56fc0e6f8d 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.
2025-11-08 11:43:07 -08:00
Pádraig Brady
cc38da00ef 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
2025-11-08 10:41:48 +00:00
Pádraig Brady
cc88c2a807 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.
2025-11-08 10:14:38 +00:00
Collin Funk
9abf150477 build: update gnulib submodule to latest 2025-11-07 20:25:47 -08:00
Pádraig Brady
58944b541e 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.
2025-11-07 16:36:08 +00:00
Pádraig Brady
574b1b938c 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.
2025-11-07 16:36:08 +00:00
Collin Funk
8dd89f55d5 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.
2025-11-06 16:52:03 -08:00
Pádraig Brady
07cd38ef66 gnulib: update to latest
* NEWS: Mention the nproc build fix for older Android.
2025-11-05 18:39:06 +00:00
Collin Funk
1654bd8628 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.
2025-11-05 14:18:38 +00:00
Pádraig Brady
4c0cf3864a 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.
2025-11-04 16:32:16 +00:00
Bernhard Voelker
d36d0f28a4 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.
2025-11-04 11:33:35 +01:00
Bernhard Voelker
71c9921d55 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.
2025-11-04 11:33:29 +01:00
Collin Funk
0830838609 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.
2025-11-03 17:05:57 -08:00
Paul Eggert
c9425336f4 doc: squashfs issue to be squashed in Linux 6.18 2025-11-03 11:33:38 -08:00
Pádraig Brady
77322b3119 tests: truncate: ensure negative args not parsed as options
* tests/truncate/truncate-parameters.sh: Add a test case.
2025-11-03 13:52:54 +00:00
Pádraig Brady
cb0ab4ef39 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.
2025-11-03 13:00:32 +00:00
Pádraig Brady
d870bfbca1 date: translate/clarify recent error message
* src/show-date.c (show_date): Flagged by syntax-check.
2025-11-03 12:55:35 +00:00
Pádraig Brady
7d17e1d36c 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.
2025-11-03 12:51:04 +00:00
Collin Funk
170509d41f 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.
2025-11-02 10:57:21 -08:00
Paul Eggert
fdf88157c6 date: diagnose fprintftime failure
* src/show-date.c (show_date): Diagnose fprintftime failure,
as it need not be an output error.
2025-11-01 18:00:32 -06:00
Paul Eggert
70bb8fa34f 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..
2025-11-01 18:00:32 -06:00
Paul Eggert
b427c185f2 ls: better nstrftime failure check
* src/ls.c (print_long_format): Streamline the checking
for failure of nstrftime.
2025-11-01 18:00:32 -06:00
Paul Eggert
695cedcddd build: update gnulib submodule to latest 2025-11-01 18:00:32 -06:00
Collin Funk
6d273604d0 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.
2025-11-01 10:49:05 -07:00
Pádraig Brady
cf08d2d3b1 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.
2025-11-01 15:07:15 +00:00
Grisha Levit
8b111d0274 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.
2025-11-01 15:07:13 +00:00
Bruno Haible
d5cc0c3b8a 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.
2025-11-01 14:15:24 +00:00
Bruno Haible
8db63075a5 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.
2025-11-01 11:38:15 +00:00
Pádraig Brady
f079a6b63f build: update gnulib submodule to latest
* gnulib: update to latest
2025-11-01 11:26:54 +00:00
Pádraig Brady
2c5754649e 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.
2025-11-01 11:24:59 +00:00
Pádraig Brady
64b8fdb5b4 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
2025-11-01 11:24:59 +00:00
Pádraig Brady
231cc20195 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
2025-11-01 11:24:59 +00:00
Collin Funk
58a66cf3fd 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.
2025-10-31 19:57:36 -07:00
Pádraig Brady
eff5f82e92 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.
2025-10-31 14:21:16 +00:00
Bruno Haible
f287a2940c 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.
2025-10-31 13:37:22 +00:00
Collin Funk
cb53662552 maint: avoid syntax-check failure from previous commit
* src/sort.c (pipe_child): Use nullptr instead of NULL.
2025-10-30 22:05:20 -07:00
Bruno Haible
1cfc35ab4c 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.
2025-10-30 18:34:49 +00:00
Pádraig Brady
b294aff3fe 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.
2025-10-29 19:03:23 +00:00
Collin Funk
7bd932c34e build: update gnulib submodule to latest 2025-10-29 00:32:13 -07:00
Pádraig Brady
5a00d0a651 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.
2025-10-28 12:56:26 +00:00
Pádraig Brady
8177cc5b5d 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.
2025-10-28 12:23:28 +00:00
Collin Funk
dfcf92e96c 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.
2025-10-27 16:56:01 -07:00
Collin Funk
dac96ce3e3 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.
2025-10-27 16:54:45 -07:00
Collin Funk
ffa2632dcd 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.
2025-10-27 16:52:16 -07:00
Pádraig Brady
8ba47d09a3 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
2025-10-27 16:57:39 +00:00
Collin Funk
2b3eb795c8 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.
2025-10-25 12:59:08 -07:00
Collin Funk
a2a2f22efe 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.
2025-10-23 14:40:39 -07:00