]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
19 hours agotests: date: check fixed offset is anchored before relative items master
Sylvestre Ledru [Mon, 1 Jun 2026 18:00:00 +0000 (20:00 +0200)] 
tests: date: check fixed offset is anchored before relative items

A fixed-offset keyword such as 'UTC' must anchor the instant before
relative items are applied, so that '1970-01-01 UTC N seconds' is
exactly N seconds past the epoch even when the local zone observes
DST between the epoch and the result.

* tests/date/date-tz.sh: Add a relative-seconds-across-DST case.
https://github.com/coreutils/coreutils/pull/275

19 hours agotests: cover symlink-cycle detection in chmod/chown -RL
Sylvestre Ledru [Fri, 29 May 2026 22:43:06 +0000 (00:43 +0200)] 
tests: cover symlink-cycle detection in chmod/chown -RL

With -L, a recursive chmod/chown follows symlinks while descending;
a symlink pointing back to an ancestor forms a cycle that must be
detected and not descended into forever.

* tests/chmod/symlinks.sh: Add a symlink-cycle case for chmod -RL.
* tests/chown/deref.sh: Likewise for chown -RL.
https://github.com/coreutils/coreutils/pull/274

3 days agotests: cksum: check truncated digests are flagged as malformed
Sylvestre Ledru [Sat, 30 May 2026 16:03:31 +0000 (18:03 +0200)] 
tests: cksum: check truncated digests are flagged as malformed

* tests/cksum/cksum-c.sh: A tagged checksum line with a valid algorithm
but a hex digest of the wrong (truncated) length must be reported as
improperly formatted rather than as a checksum mismatch (FAILED).
See https://github.com/uutils/coreutils/issues/6576
https://github.com/coreutils/coreutils/pull/273

3 days agotests: shred: check the removal of files in a subdirectory
Collin Funk [Sat, 30 May 2026 09:09:10 +0000 (02:09 -0700)] 
tests: shred: check the removal of files in a subdirectory

* tests/shred/shred-remove.sh: Add a test case.

3 days agotests: chown: check --no-dereference on a symlink to a directory
Sylvestre Ledru [Sat, 30 May 2026 12:55:37 +0000 (14:55 +0200)] 
tests: chown: check --no-dereference on a symlink to a directory

* tests/chown/basic.sh: Add a case ensuring that "chown
--no-dereference" on a symlink to a directory operates on the link
itself and does not dereference it to change the owner of the target
directory.
https://github.com/coreutils/coreutils/pull/272

3 days agomaint: document .UR man macro
Pádraig Brady [Sat, 30 May 2026 11:05:45 +0000 (12:05 +0100)] 
maint: document .UR man macro

We currently prefer the 'tty: link' style for representing URIs
in man pages, as this falls back to _not_ displaying the URI
where not supported, whereas the .UR macro generally does fall back
to showing the URI, which has these disadvantages:
- They're long, redundant, and interfere when reading text
- With wrapping enabled with \: in the URI, it can become unclickable
- Without wrapping enabled it interferes in adjacent text justification

Note with groff >= 1.24 (March 2026), the .UR macro results
in OSC 8 hyperlinks being used, and thus the awkward URI is not
displayed.

* man/viewman: Configure groff 1.23 to display .UR macros
with OSC 8 hyperlinks.

See: https://lists.gnu.org/r/coreutils/2026-05/msg00080.html

4 days agotests: ls: verify in-group ordering with --group-directories-first
Sylvestre Ledru [Sun, 24 May 2026 15:51:11 +0000 (17:51 +0200)] 
tests: ls: verify in-group ordering with --group-directories-first

* tests/ls/group-dirs.sh: Check that entries within each group remain
alphabetically sorted, and that equal-size files keep a deterministic
order when combined with --sort=size.
https://github.com/uutils/coreutils/issues/11997
https://github.com/coreutils/coreutils/pull/267

4 days agotests: sort: check sort -m preserves long lines
Sylvestre Ledru [Mon, 25 May 2026 17:35:42 +0000 (19:35 +0200)] 
tests: sort: check sort -m preserves long lines

* tests/sort/sort-merge.pl: Add 'long-lines' case ensuring that
merging input whose lines exceed the read buffer does not split
lines on buffer boundaries.
https://github.com/coreutils/coreutils/pull/270

4 days agotests: stat: cover %N escaping of control characters
Sylvestre Ledru [Fri, 29 May 2026 16:55:48 +0000 (18:55 +0200)] 
tests: stat: cover %N escaping of control characters

The default shell-escape quoting style escapes control characters in
file names (e.g. newlines) as $'...' sequences, but no test exercised
this; only the single-quote character was covered.
referenced here: https://github.com/uutils/coreutils/issues/9925

* tests/stat/stat-fmt.sh: Add a case with a file name containing
contiguous and separated newlines.
https://github.com/coreutils/coreutils/pull/271

7 days agoprintenv: remove unsupported short options from getopt_long
Collin Funk [Wed, 27 May 2026 02:39:29 +0000 (19:39 -0700)] 
printenv: remove unsupported short options from getopt_long

This patch only improves some error messages. Here is the behavior
before the patch:

    $ printenv -i
    Try 'printenv --help' for more information.
    $ printenv -u
    printenv: option requires an argument -- 'u'
    Try 'printenv --help' for more information.
    $ printenv -u a
    Try 'printenv --help' for more information.

Here is the behavior after:

    $ ./src/printenv -i
    ./src/printenv: invalid option -- 'i'
    Try './src/printenv --help' for more information.
    $ ./src/printenv -u
    ./src/printenv: invalid option -- 'u'
    Try './src/printenv --help' for more information.
    $ ./src/printenv -u a
    ./src/printenv: invalid option -- 'u'
    Try './src/printenv --help' for more information.

* src/printenv.c (main): Remove 'i' and 'u' from the short options given
to getopt_long.

7 days agotests: tail: avoid false failure due to recent change
Pádraig Brady [Tue, 26 May 2026 10:58:47 +0000 (11:58 +0100)] 
tests: tail: avoid false failure due to recent change

* tests/tail/pipe-f.sh: Adjust to cater for recently
introduced quoting.

8 days agohead,tail: quote name in file headers appropriately
Pádraig Brady [Mon, 25 May 2026 14:56:34 +0000 (15:56 +0100)] 
head,tail: quote name in file headers appropriately

* src/tail.c (write_header): Use quotef() to quote
file names when needed.
* src/head.c (write_header): Likewise.
* tests/head/quote-headers.sh: Add a new test.
* tests/tail/quote-headers.sh: Add a new test.
* tests/local.mk: Reference the new test.
Reported by Michał Majchrowicz.

12 days agotests: install: check the behavior when standard input is the source
Collin Funk [Fri, 22 May 2026 06:15:43 +0000 (23:15 -0700)] 
tests: install: check the behavior when standard input is the source

* tests/install/stdin.sh: New file.
* tests/local.mk: Add the new test.

13 days agotests: shred: improve coverage for stat checks
Collin Funk [Thu, 21 May 2026 02:31:34 +0000 (19:31 -0700)] 
tests: shred: improve coverage for stat checks

* tests/shred/fifo.sh: Check for more stat system calls. Copied from
tests/ls/stat-free-symlinks.sh.
Suggested by Pádraig Brady.

13 days agotests: dd: add test case for OOM with skip=1
oech3 [Wed, 20 May 2026 05:40:25 +0000 (14:40 +0900)] 
tests: dd: add test case for OOM with skip=1

* tests/dd/no-allocate.sh: Add test cases for OOM with skip=1.
https://github.com/coreutils/coreutils/pull/265

2 weeks agoshred: preserve the ENXIO errno from open
Collin Funk [Wed, 20 May 2026 01:10:51 +0000 (18:10 -0700)] 
shred: preserve the ENXIO errno from open

This fixes an issue in unreleased commit f77f365ef (shred: don't block
when opening FIFOs with no readers, 2026-05-09).

* src/shred.c: Save the errno before calling stat and use it in the
error message.
* tests/shred/fifo.sh: Call getlimits_ and uses_strace_. Add a test
case.

2 weeks agotests: avoid false failures with older strace
Pádraig Brady [Tue, 19 May 2026 17:45:26 +0000 (18:45 +0100)] 
tests: avoid false failures with older strace

* tests/tee/short-write.sh: Check that all the required strace
options are supported, which is not the case with strace 5.10 at least.
* tests/tee/write-eagain.sh: Likewise.

2 weeks agotee: fix infinite loop when write returns EAGAIN and short write errors
Collin Funk [Tue, 19 May 2026 03:40:28 +0000 (20:40 -0700)] 
tee: fix infinite loop when write returns EAGAIN and short write errors

* NEWS: Mention the bug fixes.
* THANKS.in: Add Bernhard M. Wiedemann for reporting the bugs.
* src/iopoll.c (close_wait): Remove function.
(write_wait): Don't call wait_for_nonblocking_write if write is
successful. Handle errors more robustly.
* src/iopoll.h (close_wait): Remove declaration.
* src/tee.c (tee_files): Use close instead of close_wait.
* tests/tee/short-write.sh: New test for the bug.
* tests/tee/write-eagain.sh: Likewise.
* tests/local.mk (all_tests): Add the new tests.
Fixes https://bugs.gnu.org/81060

2 weeks agotests: dd: avoid a false failure when ulimit fails
Collin Funk [Tue, 19 May 2026 00:25:43 +0000 (17:25 -0700)] 
tests: dd: avoid a false failure when ulimit fails

This test failure was seen on NetBSD 10.0 machine, where ulimit failed
with EINVAL.

* tests/dd/bytes.sh: Don't fail the test case if ulimit fails.
Reported by Bruno Haible.

2 weeks agotests: tail: ensure --pid is responsive to intermittent input
Pádraig Brady [Sat, 16 May 2026 17:55:42 +0000 (18:55 +0100)] 
tests: tail: ensure --pid is responsive to intermittent input

* tests/tail/pid-pipe.sh: Ensure not only open() is
handled asynchronously with --pid.

2 weeks agomaint: chroot: remove unnecessary root-dev-ino.h include
Collin Funk [Sat, 16 May 2026 02:19:41 +0000 (19:19 -0700)] 
maint: chroot: remove unnecessary root-dev-ino.h include

The only use of this header was removed in commit d52092958 (chroot:
call chroot() unconditionally to handle bind mounted "/", 2014-10-15).

* src/chroot.c: Don't include root-dev-ino.h.

2 weeks agomaint: expr: remove unnecessary xstrtol.h include
Collin Funk [Sat, 16 May 2026 02:11:37 +0000 (19:11 -0700)] 
maint: expr: remove unnecessary xstrtol.h include

It has not been needed since commit 130464448 (maint: use Gnulib libgmp
module, 2020-07-07).

* src/expr.c: Don't include xstrtol.h.

2 weeks agomaint: basenc: remove unnecessary xdectoint.h include
Collin Funk [Sat, 16 May 2026 02:00:37 +0000 (19:00 -0700)] 
maint: basenc: remove unnecessary xdectoint.h include

The only use of this header was removed in commit 97d8dcc5c (basenc:
prefer signed to unsigned integers, 2021-08-27).

* src/basenc.c: Don't include xdectoint.h.

2 weeks agomaint: shred: remove unnecessary setjmp.h include
Collin Funk [Sat, 16 May 2026 01:30:13 +0000 (18:30 -0700)] 
maint: shred: remove unnecessary setjmp.h include

It has not been needed since commit 9fd2c631b (Remove all uses of
signals; modern hosts have /dev/random and don't need this gorp.,
2005-04-09).

* src/shred.c: Don't include setjmp.h.

2 weeks agotests: date: test format options combined with format strings
Collin Funk [Fri, 15 May 2026 07:49:01 +0000 (00:49 -0700)] 
tests: date: test format options combined with format strings

* tests/date/date.pl (@Tests): Add a few test cases.

2 weeks agotests: mktemp: test the creation of hidden files in a subdirectory
Collin Funk [Fri, 15 May 2026 04:05:01 +0000 (21:05 -0700)] 
tests: mktemp: test the creation of hidden files in a subdirectory

* tests/mktemp/mktemp.pl (@Tests): Add two test cases.

2 weeks agotest: mktemp: test creation of a directory with a subdirectory template
Collin Funk [Fri, 15 May 2026 03:58:39 +0000 (20:58 -0700)] 
test: mktemp: test creation of a directory with a subdirectory template

* tests/mktemp/mktemp.pl (@Tests): Remove an unlink call handled in the
previous call to check_tmp. Add a test case.

2 weeks agotests: shred: check shred explicit deallocation
Pádraig Brady [Thu, 14 May 2026 13:25:41 +0000 (14:25 +0100)] 
tests: shred: check shred explicit deallocation

* tests/shred/shred-remove.sh: Ensure shred deallocates with
read-only directories, or '-' used to represent standard output.

2 weeks agomaint: sc_prohibit_test_empty: add avoidance comment
Pádraig Brady [Thu, 14 May 2026 13:45:20 +0000 (14:45 +0100)] 
maint: sc_prohibit_test_empty: add avoidance comment

* cfg.mk: Describe how to avoid the syntax check
in the case of possibly large / binary input.

2 weeks agodoc: shred: mention unsupported file types
Collin Funk [Wed, 13 May 2026 01:35:28 +0000 (18:35 -0700)] 
doc: shred: mention unsupported file types

* src/shred.c (usage): Mention the behavior of 'shred' on FIFOs,
sockets, and terminals.
* doc/coreutils.texi (shred invocation): Likewise.
Addresses https://bugs.gnu.org/30177

3 weeks agotests: date: test the behavior with multiple --iso-8601 options
Collin Funk [Tue, 12 May 2026 01:26:25 +0000 (18:26 -0700)] 
tests: date: test the behavior with multiple --iso-8601 options

* tests/date/date.pl (@Tests): Add test cases.

3 weeks agodoc: fix --enable-single-binary configure help
Leonid Evdokimov [Sat, 21 Mar 2026 11:29:06 +0000 (14:29 +0300)] 
doc: fix --enable-single-binary configure help

* configure.ac: Fix optional indication with square brackets.

3 weeks agomaint: pacify GCC 16 -Wuseless-cast
Paul Eggert [Mon, 11 May 2026 06:29:05 +0000 (23:29 -0700)] 
maint: pacify GCC 16 -Wuseless-cast

This mostly either removes casts if they are always no-ops, or
replaces casts (TYPE)(EXPR) with compound literals (TYPE){EXPR}.
Compound literals are a bit safer anyway, as casts are too
powerful in C.
* src/cksum_avx2.c (cksum_avx2):
* src/cksum_avx512.c (cksum_avx512):
* src/cksum_crc.c (cksum_slice8):
* src/cksum_pclmul.c (cksum_pclmul):
* src/cp-hash.c (remember_copied):
* src/numfmt.c (simple_strtod_float):
* src/system.h (x_timestyle_match):
Omit no-op casts.
* src/cp-hash.c (src_to_dest_hash):
* src/dd.c (dd_copy):
* src/df.c (devlist_hash):
* src/env.c (splitbuf_append_byte):
* src/getlimits.c (print_int, main):
* src/ls.c (dev_ino_hash):
* src/truncate.c (do_ftruncate):
Replace casts with compound literals.
* src/factor.c: Ignore -Wuseless-cast, as we include the imported
longlong.h file, which has many of them.
* src/numfmt.c (powerld): 2nd arg is now ptrdiff_t, not int, so
that integers are not silently mishandled in outlandish cases.

3 weeks agoshred: don't block when opening FIFOs with no readers
Collin Funk [Sat, 9 May 2026 22:43:39 +0000 (15:43 -0700)] 
shred: don't block when opening FIFOs with no readers

* NEWS: Mention the bug fix.
* src/shred.c (wipefile): Open the file with O_NONBLOCK.
* tests/shred/fifo.sh: New file.
* tests/local.mk (all_tests): Add the new test.

3 weeks agodoc: help2man: preserve layout of tables
Pádraig Brady [Fri, 8 May 2026 18:39:00 +0000 (19:39 +0100)] 
doc: help2man: preserve layout of tables

This is useful in many man pages like date , dd, od, tr, ...
where there are tables presented, where extraneous lines
between each entry are best avoided.

* man/help2man: Use .PD 0 (Paragraph Distance)
to avoid extraneous blank lines within .TP delineated tables.
Also use explicit widths with .TP in such tables,
to preserve the alignment from the --help output.

3 weeks agodoc: date: group format sequences by function
Pádraig Brady [Sat, 9 May 2026 16:46:48 +0000 (17:46 +0100)] 
doc: date: group format sequences by function

* src/date.c (usage): Grouping alphabetically is less useful.
Suggested by Bruno Haible.

3 weeks agodoc: date: show examples for format sequences in --help
Pádraig Brady [Thu, 7 May 2026 20:08:21 +0000 (21:08 +0100)] 
doc: date: show examples for format sequences in --help

* src/date.c (usage): Show example to aid scanning
of format sequences.

3 weeks agoshuf: prefer fwrite over fputs and fputc
Collin Funk [Thu, 7 May 2026 03:39:20 +0000 (20:39 -0700)] 
shuf: prefer fwrite over fputs and fputc

On an AMD Ryzen 7 3700X running GNU/Linux:

    $ timeout 30 taskset 1 ./src/shuf-prev \
        -r -i 1000000-1000000 | pv -r > /dev/null
    [ 302MiB/s]
    $ timeout 30 taskset 1 ./src/shuf \
        -r -i 1000000-1000000 | pv -r > /dev/null
    [ 434MiB/s]

* src/shuf.c (print_number): New function.
(write_permuted_numbers, write_random_numbers): Use it.
* tests/shuf/shuf.sh: Add a test case to run 'shuf -i' with varying
numbers of digits to check that the string conversion is correct.

4 weeks agotests: head: test 'head -n 0' and 'head -c 0' open files for reading
Collin Funk [Wed, 6 May 2026 04:24:29 +0000 (21:24 -0700)] 
tests: head: test 'head -n 0' and 'head -c 0' open files for reading

* tests/head/head-n0.sh: New file.
* tests/local.mk: Add the new test case.

4 weeks agotests: ls: verify correct alignment with ACLs
Sylvestre Ledru [Sun, 12 Apr 2026 20:18:13 +0000 (22:18 +0200)] 
tests: ls: verify correct alignment with ACLs

* tests/ls/acl.sh: Check that the gap between the '+' indicator and
the link count is the same whether the listing contains one or
several ACL entries.
https://github.com/coreutils/coreutils/pull/251

4 weeks agols: exclude newline from consideration in line width
Pádraig Brady [Mon, 4 May 2026 14:34:32 +0000 (15:34 +0100)] 
ls: exclude newline from consideration in line width

* src/ls.c (calculate_columns): Treat width as inclusive max.
(print_with_separator): Likewise.  Also handle commas explicitly,
since they're not catered for by an implicit newline in the count.
* tests/ls/w-option.sh: Adjust exact-fit column tests.
Note this change also makes the existing `ls -w4 -x -T0 a b` test
behave consistently with other output width limits.
Also add the test case from:
https://github.com/coreutils/coreutils/pull/213
* tests/ls/m-option.sh: Add a test case to ensure appropriate
wrapping when trailing comma at the line limit.
* NEWS: Mention the change in behavior.

4 weeks agols: fix too few display columns edge case
Pádraig Brady [Mon, 4 May 2026 14:34:01 +0000 (15:34 +0100)] 
ls: fix too few display columns edge case

In the edge case where the right most column would
consist of only files taking 1 or 2 cells, we accounted
for 3 cells, which would result in using 1 column too few.
This should have been part of commit v8.24-59-ge71be1292

* src/ls.c (init_column_info): Don't account for separator
in the the final column.
* tests/ls/w-option.sh: Add a test case.

4 weeks agotests: fix false failure with spaces in hierarchy
Pádraig Brady [Mon, 4 May 2026 22:18:52 +0000 (23:18 +0100)] 
tests: fix false failure with spaces in hierarchy

* tests/sort/sort-buffer-size.sh: Use `pwd` rather than $PWD,
and quote appropriately.
Reported by Bruno Haible.

4 weeks agotests: tee: ensure tee is non buffered
Pádraig Brady [Sun, 3 May 2026 10:28:19 +0000 (11:28 +0100)] 
tests: tee: ensure tee is non buffered

* tests/tee/tee.sh: tests/misc/responsive.sh only confirms
responsiveness to lines, so add a test for non line terminated.
https://github.com/coreutils/coreutils/pull/259

4 weeks agodoc: fix typo in chmod example
Pádraig Brady [Sun, 3 May 2026 09:39:45 +0000 (10:39 +0100)] 
doc: fix typo in chmod example

* doc/coreutils.texi (chmod invocation): s/file/foo/ to match comment,
and previous example.

4 weeks agotests: all: ensure closed stdin is handled appropriately
Collin Funk [Sat, 2 May 2026 18:44:04 +0000 (11:44 -0700)] 
tests: all: ensure closed stdin is handled appropriately

* tests/misc/close-stdin.sh: New file.
* tests/local.mk (all_tests): Add the new test.

4 weeks agodoc: reference detailed "numeric mode" info from chmod.1
Pádraig Brady [Fri, 1 May 2026 17:48:39 +0000 (18:48 +0100)] 
doc: reference detailed "numeric mode" info from chmod.1

Note were links are not supported (like on Solaris or FreeBSD),
the text still displays normally.

* man/chmod.x: Link from "numeric mode" in chmod man page,
to more detailed online info.

4 weeks agobuild: fix compilation error on Alpine Linux and OpenBSD
Pádraig Brady [Fri, 1 May 2026 12:48:39 +0000 (13:48 +0100)] 
build: fix compilation error on Alpine Linux and OpenBSD

* gl/lib/mbbuf.h: Define MBBUF_EOF in terms of MCEL_CHAR_MAX,
rather than depending on the stdint module.
Reported by Bruno Haible.

4 weeks agosum,cksum: consistently emit detailed write errors
Collin Funk [Fri, 1 May 2026 00:59:38 +0000 (17:59 -0700)] 
sum,cksum: consistently emit detailed write errors

Previously the string from strerror would only be printed for some
algorithms:

    $ cksum -a sha2 -l 256 /dev/null > /dev/full
    cksum: write error: No space left on device
    $ cksum -a sysv /dev/null > /dev/full
    cksum: write error

This patch fixes it so that the error information is always printed:

    $ ./src/cksum -a sha2 -l 256 /dev/null > /dev/full
    cksum: write error: No space left on device
    $ ./src/cksum -a sysv /dev/null > /dev/full
    cksum: write error: No space left on device

* src/cksum.c (output_file): Don't check for a write error here.
(main): Check for it here instead.
* tests/misc/io-errors.sh: Add a 'cksum' invocation for each supported
algorithm.
https://github.com/coreutils/coreutils/issues/258

4 weeks agotest: adjust -g description in --help
Max Downey Twiss [Thu, 30 Apr 2026 12:27:01 +0000 (22:27 +1000)] 
test: adjust -g description in --help

This matches the manual, as well as the -u option,
and should help reduce confusion.

* src/test.c (usage): Fix -g documentation to match the structure of -u

4 weeks agounexpand: fix heap overflow
Pádraig Brady [Tue, 28 Apr 2026 19:33:10 +0000 (20:33 +0100)] 
unexpand: fix heap overflow

* src/unexpand.c (unexpand): Use xinmalloc() to gracefully
handle overflow.  Also use the runtime locale specific MB_CUR_MAX
rather than the worst case MB_LEN_MAX.
* tests/unexpand/mb.sh: Add a test case that fails in a default
glibc build with either MB_CUR_MAX or MB_LEN_MAX.
* NEWS: Mention the bug fix.
Reported by Michał Majchrowicz.

4 weeks agounexpand: consolidate error messages
Pádraig Brady [Wed, 29 Apr 2026 10:11:36 +0000 (11:11 +0100)] 
unexpand: consolidate error messages

* src/unexpand.c (main): Use the same error
as in parse_tab_stops().

4 weeks agocut: use MCEL_LEN_MAX rather than MB_LEN_MAX
Pádraig Brady [Wed, 29 Apr 2026 10:48:15 +0000 (11:48 +0100)] 
cut: use MCEL_LEN_MAX rather than MB_LEN_MAX

* src/cut.c: We use the mcel interface to populate these arrays,
so restrict to the mcel supported max.  This is more efficient
as generally stateful encodings are not used or supported.

4 weeks agosort: use more dynamic memory allocation with pipes
Pádraig Brady [Mon, 27 Apr 2026 14:48:30 +0000 (15:48 +0100)] 
sort: use more dynamic memory allocation with pipes

The default memory allocation with pipes was too passive/static,
resulting in not allocating enough memory to enable threading.
By dynamically reallocating the buffer when reading from
unknown sized inputs we better use available memory and threads.

  $ time seq 10000000 -1 0 | sort-old >/dev/null
  real 0m16.523s
  user 0m16.900s
  sys 0m0.167s

  $ time seq 10000000 -1 0 | sort-old -S1G >/dev/null
  real 0m12.263s
  user 0m29.646s
  sys 0m0.527s

  $ time seq 10000000 -1 0 | sort-new >/dev/null
  real 0m12.994s
  user 0m31.266s
  sys 0m0.716s

It also avoids the overhead of writing to temp files
for modestly sized inputs. For example the following
input would induce interaction with temp storage:

  $ seq 125000 | wc -c
  763895

* src/sort.c (sort_buffer_size): Rename to ...
(sort_buffer_policy): ... here, and adjust to set
an initial size and limit, rather than just a size.
(fillbuf): Add a POLICY parameter, and use that
to call maybe_growbuf() as needed.
(maybe_growbuf): Return true if POLICY dictates we
should grow the buffer, and try_growbuf() was
able to reallocate the larger buffer.
* tests/sort/sort-buffer-size.sh: Add a new test.
* tests/local.mk: Reference new test.
* NEWS: Mention the improvement.
Related to https://bugs.gnu.org/10877

5 weeks agopinky: don't print output in the wrong order when fully buffered
Collin Funk [Wed, 29 Apr 2026 01:28:25 +0000 (18:28 -0700)] 
pinky: don't print output in the wrong order when fully buffered

* NEWS: Mention the bug fix.
* src/pinky.c (cat_file): Prefer streams to file descriptors when
writing to standard output.

5 weeks agouniq: fix read overrun with -w
Paul Eggert [Tue, 28 Apr 2026 18:25:00 +0000 (11:25 -0700)] 
uniq: fix read overrun with -w

Problem reported by Michał Majchrowicz.
* src/uniq.c (find_field): Fix typo.
* tests/uniq/uniq.pl (add_z_variants): Test for the bug.

5 weeks agotests: avoid false failure with perl-IO-Tty >= 1.24
Pádraig Brady [Mon, 27 Apr 2026 10:14:51 +0000 (11:14 +0100)] 
tests: avoid false failure with perl-IO-Tty >= 1.24

* tests/misc/tty-eof.pl: https://bugzilla.redhat.com/2463168

5 weeks agobuild: remove USE_NLS
Paul Eggert [Sun, 26 Apr 2026 15:05:09 +0000 (08:05 -0700)] 
build: remove USE_NLS

* configure.ac (USE_NLS): Remove.  The need for this went away
in commit 1d58e4ddab548f574210da57ca44890a73efe9f8 dated
2025-11-20 10:43:06 2025 +0000.

5 weeks agodoc: apply man page formatting suggestions from manpage-l10n
Pádraig Brady [Sat, 25 Apr 2026 18:01:53 +0000 (19:01 +0100)] 
doc: apply man page formatting suggestions from manpage-l10n

* src/basenc.c: Add (1) to base64 and base32 references.
* src/cksum.c. Likewise for cksum references.
* src/echo.c: Use "bell" in descriptions rather than BEL.
* src/printf.c: Likewise.
* src/id.c: Separate -u,-U,-G so marked up appropriately.
Fixes https://bugs.gnu.org/80904

5 weeks agotests: all: ensure closed stdout is handled appropriately
Pádraig Brady [Sat, 25 Apr 2026 15:16:49 +0000 (16:16 +0100)] 
tests: all: ensure closed stdout is handled appropriately

* tests/misc/io-errors.sh: Add a check to ensure we diagose
writing to closed stdout.  Also ensure we exit with failure
in other cases.
* tests/misc/write-errors.sh: Likewise.

5 weeks agodoc: remove redundant "Report translation bugs to" in --help
Bruno Haible [Fri, 24 Apr 2026 13:36:51 +0000 (15:36 +0200)] 
doc: remove redundant "Report translation bugs to" in --help

* configure.ac: Define PACKAGE_L10N_BUGREPORT.
* man/local.mk (run_help2man): Set the IN_HELP2MAN environment variable.
* src/system.h (emit_ancillary_info): Don't emit "Report any translation
bugs to" line; this is already done by emit_bug_reporting_address() in
version-etc.c.
Fixes https://bugs.gnu.org/80886

5 weeks agobuild: update gnulib to latest
Pádraig Brady [Sat, 25 Apr 2026 11:14:20 +0000 (12:14 +0100)] 
build: update gnulib to latest

* gl/lib/mbbuf.h: Explicitly include string.h
needed since gnulib commit b6d5b2f72

5 weeks agotests: tail: avoid a rare false failure
Pádraig Brady [Fri, 24 Apr 2026 13:16:45 +0000 (14:16 +0100)] 
tests: tail: avoid a rare false failure

I noticed a single failure on cfarm29 (Linux 6.12 ppc64le),
where the output was missing:
-tail: directory containing watched file was removed
-tail: inotify cannot be used, reverting to polling
-tail: 'dir/file' has appeared;  following new file

* tests/tail/inotify-dir-recreate.sh: Leverage the new tail --debug
output to sync to a point where we know the inotify watches are in
place.  Also normalize the file argument quoting a bit.

5 weeks agodd: avoid recursive parsing of multipliers
Pádraig Brady [Thu, 23 Apr 2026 12:17:37 +0000 (13:17 +0100)] 
dd: avoid recursive parsing of multipliers

* src/dd.c (parse_integer): Use iterative rather than recursive parsing,
to avoid potential stack overflow.
* tests/dd/bytes.sh: Add a test case.
https://github.com/coreutils/coreutils/issues/254

5 weeks agocomm: don't close standard input twice
Collin Funk [Wed, 22 Apr 2026 03:10:55 +0000 (20:10 -0700)] 
comm: don't close standard input twice

* NEWS: Mention the bug fix.
* src/comm.c (usage): Remove mention that FILE1 and FILE2 cannot both be
standard input.
(compare_files): Only close standard input once.
* doc/coreutils.texi (comm invocation): Document the behavior of
'comm - -' which is not portable to all implementations.
* tests/comm/dash-dash.sh: New file.
* tests/misc/comm.pl: Move to tests/comm/comm.pl.
* tests/local.mk (all_tests): Add the new test. Rename the existing
test.

6 weeks agomaint: post-release administrivia
Pádraig Brady [Mon, 20 Apr 2026 13:17:01 +0000 (14:17 +0100)] 
maint: post-release administrivia

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

6 weeks agoversion 9.11 v9.11
Pádraig Brady [Mon, 20 Apr 2026 12:41:57 +0000 (13:41 +0100)] 
version 9.11

* NEWS: Record release date.

6 weeks agodoc: NEWS item for who systemd fix
Paul Eggert [Sun, 19 Apr 2026 18:50:19 +0000 (11:50 -0700)] 
doc: NEWS item for who systemd fix

6 weeks agobuild: update gnulib submodule to latest
Paul Eggert [Sun, 19 Apr 2026 18:13:50 +0000 (11:13 -0700)] 
build: update gnulib submodule to latest

6 weeks agoyes: make operation independent of pipe size
Pádraig Brady [Fri, 17 Apr 2026 13:36:26 +0000 (14:36 +0100)] 
yes: make operation independent of pipe size

* src/yes.c (splice_write): Always drain what we've written
to an internal pipe, so there is no possibility of vmsplice() blocking.
I.e., be defensive in the case that fcntl() fails, and
our default buffer size (currently 16kiB) is larger than the pipe.
https://github.com/coreutils/coreutils/issues/253

6 weeks agotests: reinstate logname error verification
Bruno Haible [Fri, 17 Apr 2026 13:46:19 +0000 (15:46 +0200)] 
tests: reinstate logname error verification

* tests/misc/user.sh: Modify the "unshare -U logname" test, so that it
does not fail on glibc versions (< 2.28, >= 2.38) that do a fallback
lookup based on the tty.

6 weeks agotests: fix false failure with dash
Pádraig Brady [Fri, 17 Apr 2026 12:17:56 +0000 (13:17 +0100)] 
tests: fix false failure with dash

* tests/date/date-locale-hour.sh: Just strip the char before the last x,
assuming it's going to be the newline output by `locale`.
dash doesn't support $'' within ${}.

6 weeks agobuild: update gnulib submodule to latest
Collin Funk [Fri, 17 Apr 2026 05:25:36 +0000 (22:25 -0700)] 
build: update gnulib submodule to latest

6 weeks agotests: Avoid accidental matching of the vendor field of $host, part 2
Collin Funk [Fri, 17 Apr 2026 04:07:26 +0000 (21:07 -0700)] 
tests: Avoid accidental matching of the vendor field of $host, part 2

* tests/local.mk (TESTS_ENVIRONMENT): Remove host_triplet.
* tests/chgrp/basic.sh: Use $host_os instead of $host_triplet.
* tests/misc/io-errors.sh: Likewise.

6 weeks agotests: mktemp: test the behavior when writing to standard output fails
Collin Funk [Thu, 16 Apr 2026 02:40:17 +0000 (19:40 -0700)] 
tests: mktemp: test the behavior when writing to standard output fails

* tests/mktemp/write-error.sh: New file.
* tests/local.mk (all_tests): Add the test.

6 weeks agobuild: update gnulib to latest
Pádraig Brady [Thu, 16 Apr 2026 21:22:41 +0000 (22:22 +0100)] 
build: update gnulib to latest

6 weeks agotests: avoid a failure on musl
Collin Funk [Thu, 9 Apr 2026 01:57:54 +0000 (18:57 -0700)] 
tests: avoid a failure on musl

* tests/misc/io-errors.sh: Allow a generic error string on musl since
the first line is emitted immediately instead of being buffered as
expected.
Reported by Bruno Haible.

6 weeks agobuild: fix build failure on AIX
Pádraig Brady [Thu, 16 Apr 2026 21:02:03 +0000 (22:02 +0100)] 
build: fix build failure on AIX

* m4/jm-macros.m4: AIX has a splice() function for TCP,
so check for vmsplice() instead.
* src/splice.h: Define HAVE_SPLICE if vmsplice available.
Reported by Bruno Haible.

6 weeks agotest: avoid false failure on OpenBSD
Pádraig Brady [Thu, 16 Apr 2026 20:41:40 +0000 (21:41 +0100)] 
test: avoid false failure on OpenBSD

* tests/numfmt/numfmt.pl: Use standard getopt error map,
needed on OpenBSD.
Reported by Bruno Haible.

6 weeks agotests: avoid false failure with hidden /proc on Guix
Pádraig Brady [Thu, 16 Apr 2026 20:27:42 +0000 (21:27 +0100)] 
tests: avoid false failure with hidden /proc on Guix

* tests/stat/stat-mount.sh: Don't try our stat under unshare
unless mount(8) exits gracefully.
Reported by Bruno Haible.

6 weeks agotests: avoid failure on Manjaro Linux
Pádraig Brady [Thu, 16 Apr 2026 20:07:46 +0000 (21:07 +0100)] 
tests: avoid failure on Manjaro Linux

* tests/misc/user.sh: Comment out part of test.
Reported by Bruno Haible.

6 weeks agocksum: fix --length validation on 32 bit platforms
Pádraig Brady [Thu, 16 Apr 2026 19:37:28 +0000 (20:37 +0100)] 
cksum: fix --length validation on 32 bit platforms

Fix an unreleased issue due to the recent change
to using idx_t in commit v9.10-91-g02983e493

* src/cksum.c (main): Limit the possible return to
the range supported by idx_t.
Reported by Bruno Haible.

6 weeks agotests: fix false failure due to ulimit usage
Pádraig Brady [Thu, 16 Apr 2026 18:03:13 +0000 (19:03 +0100)] 
tests: fix false failure due to ulimit usage

* tests/dd/no-allocate.sh: Run getlimits_ to ensure
we have $SSIZE_MAX etc. available.  Also give some buffer
for the configured ulimit to leave space for returns_ to work.

6 weeks agotests: avoid failure on older Centos 7
Pádraig Brady [Thu, 16 Apr 2026 17:35:26 +0000 (18:35 +0100)] 
tests: avoid failure on older Centos 7

* tests/cp/sparse-perf.sh: Old Centos 7 can give EINVAL
from SEEK_DATA on sparse files being copied from /dev/shm.
Avoid this failure as it's not practical to fix.

6 weeks agotests: fix false failure on Centos 7
Pádraig Brady [Thu, 16 Apr 2026 16:42:33 +0000 (17:42 +0100)] 
tests: fix false failure on Centos 7

* tests/date/date-locale-hour.sh: Ensure `locale date_fmt`
is propagated exactly, even when it contains trailing new lines,
as was seen with Serbian locales on Centos 7.

6 weeks agobuild: update gnulib to latest
Pádraig Brady [Wed, 15 Apr 2026 15:20:07 +0000 (16:20 +0100)] 
build: update gnulib to latest

6 weeks agotests: avoid intermittent false failures with ksh
Pádraig Brady [Wed, 15 Apr 2026 14:27:44 +0000 (15:27 +0100)] 
tests: avoid intermittent false failures with ksh

As noted in https://bugs.gnu.org/9089
ksh gives intermittent ECONNRESET errors with closed pipes.
This can be seen reliably on Linux with:
ksh -c 'yes | (sleep .1; head -n10 >/dev/null)'

* tests/misc/io-errors.sh: Avoid part of test on ksh.
* tests/misc/write-errors.sh: Likewise.

6 weeks agotests: use more accurate ulimit with $SHELL -c
Pádraig Brady [Wed, 15 Apr 2026 14:23:11 +0000 (15:23 +0100)] 
tests: use more accurate ulimit with $SHELL -c

* tests/misc/write-errors.sh: Use a more accurate ulimit determination
when we're using $SHELL -c.

6 weeks agotests: avoid $SHELL -c "ulimit ..." pattern
Pádraig Brady [Wed, 15 Apr 2026 14:08:27 +0000 (15:08 +0100)] 
tests: avoid $SHELL -c "ulimit ..." pattern

As described in commit v9.10-283-g5cb0cca3b
avoid using ulimit with $SHELL -c, and explict
invocation of the shell like that can require lots of memory,
often due to loading the locale archive.
* tests/basenc/bounded-memory.sh: Avoid $SHELL -c with ulimit.
* tests/cut/bounded-memory.sh: Likewise.
* tests/expand/bounded-memory.sh Likewise.
* tests/pr/bounded-memory.sh Likewise.
* tests/unexpand/bounded-memory.sh Likewise.
* tests/fold/fold-zero-width.sh: Bring the ulimit bound
down to the standard 6M over the determined limit.

6 weeks agotests: fix false failure due to race
Pádraig Brady [Wed, 15 Apr 2026 12:14:18 +0000 (13:14 +0100)] 
tests: fix false failure due to race

* tests/misc/tty-eof.pl: Fix a race that commit v9.10-269-gf312af49a
made more apparent, and resulted in intermittent failure like:
"... (with input) didn't produce expected output".
Now Instead of waiting for overlapping echo and output,
just wait for EOF, and if received, use exp->before()
to inspect the accumulated output.

6 weeks agodf: improve detection of duplicate entries
Lukáš Zaoral [Tue, 14 Apr 2026 12:09:02 +0000 (14:09 +0200)] 
df: improve detection of duplicate entries

Do not compare only with the latest entry for given device id but also
all previously saved entries with the same id.

* src/df.c (struct devlist): Add next_same_dev struct member.
(filter_mount_list): Iterate over next_same_dev to find duplicates.
* tests/df/skip-duplicates.sh: Add test cases.
* NEWS: Mention the improvement.
https://redhat.atlassian.net/browse/RHEL-5649

7 weeks agotests: fix false failure under some shells
Pádraig Brady [Sat, 11 Apr 2026 21:33:50 +0000 (22:33 +0100)] 
tests: fix false failure under some shells

Verified with:
  make -j4 PREFERABLY_POSIX_SHELL=/bin/ksh SUBDIRS=. check

* tests/fold/fold-zero-width.sh: Don't timeout $SHELL -c ...
as the ulimit induces a failure in the subshell depending
on the order of the allocations it does.  The main issue is
disparity between the probed ulimit and that needed by $SHELL -c.
Such subshells load the often very large locale archive, thus
if there are any allocations done after the now too low ulimit is set,
then the $SHELL command fails. Note we timeout fold rather than
the whole pipeline so any 124 exit status is propagated.

7 weeks agotests: validate error handling when reading multiple files
Pádraig Brady [Sat, 11 Apr 2026 12:57:31 +0000 (13:57 +0100)] 
tests: validate error handling when reading multiple files

* tests/misc/read-errors.sh: Validate that commands which read multiple
files, read all files on error, and exit with appropriate status.

7 weeks agomktemp: prefer rmdir and unlink to remove
Collin Funk [Sat, 11 Apr 2026 03:29:54 +0000 (20:29 -0700)] 
mktemp: prefer rmdir and unlink to remove

This avoids the following behavior:

    $ strace -e silence=exit -e trace=unlink,rmdir \
        mktemp -d > /dev/full
    unlink("/tmp/tmp.ZBuPmS9ZGD") = -1 EISDIR (Is a directory)
    rmdir("/tmp/tmp.ZBuPmS9ZGD")  = 0
    mktemp: write error: No space left on device

In the above invocation we know that we created a directory, so we
should not remove a regular file that must have been created by another
process:

    $ strace -e silence=exit -e trace=unlink,rmdir \
        ./src/mktemp -d > /dev/full
    rmdir("/tmp/tmp.hGbME1HmJr") = 0
    mktemp: write error: No space left on device

* src/mktemp.c (main): Prefer rmdir and unlink depending on whether we
created a directory or regular file.
* bootstrap.conf (gnulib_modules): Remove the remove module.

7 weeks agocat: avoid redundant pipe creation and resizing
Collin Funk [Fri, 10 Apr 2026 02:41:48 +0000 (19:41 -0700)] 
cat: avoid redundant pipe creation and resizing

* src/cat.c (splice_cat): Don't bother resizing input as it generally
doesn't help perf, and also save an fstat per input. Don't close the
intermediate pipe once created, unless there is an error reading from
it.

Co-authored-by: Pádraig Brady <P@draigBrady.com>
7 weeks agotests: validate command responsiveness
Pádraig Brady [Fri, 10 Apr 2026 16:15:01 +0000 (17:15 +0100)] 
tests: validate command responsiveness

* tests/misc/responsive.sh: Test commands that should output immediately
upon receiving input, and that there is no unecessary buffering.
* cfg.mk: Avoid false failure in sc_prohibit_test_backticks.
* tests/local.mk: Reference the new test.

7 weeks agotests: stat: ensure independence from /proc/
Pádraig Brady [Fri, 10 Apr 2026 13:55:07 +0000 (14:55 +0100)] 
tests: stat: ensure independence from /proc/

* tests/stat/stat-mount.sh: Ensure stat -c '%a'
is independent from /proc.
https://github.com/coreutils/coreutils/pull/250

7 weeks agotests: cut: ensure separate read paths checked
Pádraig Brady [Fri, 10 Apr 2026 10:24:58 +0000 (11:24 +0100)] 
tests: cut: ensure separate read paths checked

* tests/misc/read-errors.sh: Use cut -b as that has a separate
read path to cut -c.

7 weeks agotests: Avoid accidental matching of the vendor field of $host
Bruno Haible [Fri, 10 Apr 2026 06:13:24 +0000 (08:13 +0200)] 
tests: Avoid accidental matching of the vendor field of $host

* tests/chgrp/basic.sh: Test $host_os, not $host_triplet.
* tests/chown/separator.sh: Likewise.
* tests/rm/r-root.sh: Likewise.
* tests/tail/pipe-f.sh: Likewise.
* tests/tail/tail-c.sh: Likewise.
* tests/tee/tee.sh: Likewise.
* tests/touch/dangling-symlink.sh: Likewise.

7 weeks agoenv: avoid locking standard output for each printed variable
Collin Funk [Fri, 10 Apr 2026 04:59:12 +0000 (21:59 -0700)] 
env: avoid locking standard output for each printed variable

* src/env.c (main): Use fputs and putchar instead of printf.