]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
11 hours agoptx: fix infinite loop with -G and a narrow output width master
Ayesha Shafique [Mon, 27 Jul 2026 07:03:19 +0000 (02:03 -0500)] 
ptx: fix infinite loop with -G and a narrow output width

With GNU extensions disabled, before_max_width can go negative, and
define_all_fields then loops forever trying to shrink the before field
to a width narrower than empty:

  $ printf 'qux\n' | src/ptx -G -w2
  [hangs]

Commit v6.12-96-g773be9eca added a clamp for this, but placed it in
the GNU-extensions branch only.  Move it after that if/else so that
both branches are covered.

* src/ptx.c (fix_output_parameters): Clamp before_max_width for both
the GNU and non-GNU cases.
* tests/ptx/ptx-overrun.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/81507

18 hours agotests: join: test the parsing of space separated -o formats
Collin Funk [Mon, 27 Jul 2026 04:21:11 +0000 (21:21 -0700)] 
tests: join: test the parsing of space separated -o formats

* tests/join/join.pl: Add some test cases.

33 hours agotests: tail: remove redundant inotify config check
Pádraig Brady [Mon, 27 Jul 2026 13:25:39 +0000 (14:25 +0100)] 
tests: tail: remove redundant inotify config check

* tests/tail/inotify-rotate-resources.sh: This is implicit
in require_inotify_supported_.

33 hours agotests: expr: exercise the C.UTF-8 locale
Sylvestre Ledru [Sun, 26 Jul 2026 14:59:29 +0000 (16:59 +0200)] 
tests: expr: exercise the C.UTF-8 locale

* tests/expr/expr-multibyte.pl: Add 'cu' prefixed cases running in
C.UTF-8, which names no language but has a UTF-8 codeset, ensuring
length, index, substr and match still operate on characters there.
Skip them where that locale is unavailable.

Link: https://github.com/coreutils/coreutils/pull/323
33 hours agotests: sort: check byte-wise ordering in the C.UTF-8 locale
Sylvestre Ledru [Sun, 26 Jul 2026 14:59:29 +0000 (16:59 +0200)] 
tests: sort: check byte-wise ordering in the C.UTF-8 locale

* tests/sort/sort-locale.sh: C.UTF-8 has a UTF-8 codeset but the
collation rules of C, so add a case ensuring the ordering there stays
byte-wise rather than following the linguistic rules exercised for
en_US.iso8859-1 and fr_FR.UTF-8 above.

Link: https://github.com/coreutils/coreutils/pull/323
33 hours agotests: ls: cover quoting in the C.UTF-8 locale
Sylvestre Ledru [Sun, 26 Jul 2026 14:59:29 +0000 (16:59 +0200)] 
tests: ls: cover quoting in the C.UTF-8 locale

The quoting characters and the printability of a multibyte character are
selected by the locale's codeset, not by its language, but no test
covered a locale that has a UTF-8 codeset and no language.

* tests/ls/quoting-utf8.sh: Check that in C.UTF-8 the locale/clocale
styles use the Unicode quotes and that literal/escape/shell-escape pass
a multibyte character through unaltered, whereas the plain C locale
octal-escapes it or replaces it with '?'.

Link: https://github.com/coreutils/coreutils/pull/323
46 hours agotests: prefer require_inotify_supported_ to file system check
Collin Funk [Sun, 26 Jul 2026 23:41:35 +0000 (16:41 -0700)] 
tests: prefer require_inotify_supported_ to file system check

* tests/tail/inotify-rotate-resources.sh: Use require_inotify_supported_
instead of require_local_dir_ and the recently added check for
overlayfs.
Suggested by Pádraig Brady.

2 days agotest: handle adjacent binary operators
Collin Funk [Fri, 24 Jul 2026 04:12:42 +0000 (21:12 -0700)] 
test: handle adjacent binary operators

* NEWS: Mention the bug fix.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_test_minus_ao): Exclude
NEWS.
* src/test.c (term): Treat '-a' and '-o' as strings instead of expecting
them to be valid unary operators.
* tests/test/test.pl: Add some test cases.
* tests/test/test-diag.pl: Also test the diagnostics with '-a arg'.

2 days agotests: avoid a false ERROR when using overlayfs
Collin Funk [Sun, 26 Jul 2026 02:53:45 +0000 (19:53 -0700)] 
tests: avoid a false ERROR when using overlayfs

* tests/tail/inotify-rotate-resources.sh: Also skip the test on
overlayfs.

3 days agodoc: mention the option of a multi-call binary package
Pádraig Brady [Sat, 25 Jul 2026 11:43:21 +0000 (12:43 +0100)] 
doc: mention the option of a multi-call binary package

* PACKAGING: Mention the feature, and reference Fedora's
implementation details.

3 days agodoc: add packaging hints for distributions
Bruno Haible [Thu, 23 Jul 2026 19:57:36 +0000 (21:57 +0200)] 
doc: add packaging hints for distributions

* PACKAGING: New file.
* Makefile.am (EXTRA_DIST): Add it.

3 days agodoc: detail dependencies for users and distributions
Bruno Haible [Thu, 23 Jul 2026 19:54:35 +0000 (21:54 +0200)] 
doc: detail dependencies for users and distributions

* DEPENDENCIES: New file, based on gnulib/DEPENDENCIES.
* Makefile.am (EXTRA_DIST): Add it.
* README-install: Reference it.
* README-prereq: Likewise.

4 days agodoc: tweak recent NEWS entries
Pádraig Brady [Fri, 24 Jul 2026 12:32:01 +0000 (13:32 +0100)] 
doc: tweak recent NEWS entries

* NEWS: Fix recent NEWS entry issues.

4 days agols: fix a small mem leak when CLI args have errors
Pádraig Brady [Wed, 22 Jul 2026 19:36:42 +0000 (20:36 +0100)] 
ls: fix a small mem leak when CLI args have errors

  $ valgrind --quiet --leak-check=full --show-leak-kinds=definite \
    src/ls --hyperlink=always foo bar
  ls: cannot access 'foo': No such file or directory
  ls: cannot access 'bar': No such file or directory

    32 bytes in 1 blocks are definitely lost in loss record 3 of 7
    at malloc (vg_replace_malloc.c:447)
    by canonicalize_filename_mode_stk (canonicalize.c:450)
    by canonicalize_filename_mode (canonicalize.c:471)
    by gobble_file.constprop.0 (ls.c:3392)
    by main (ls.c:1765)

* src/ls.c (gobble_file): Call free_ent() before returning.

4 days agomaint: refactor stat syscall determination
Pádraig Brady [Wed, 22 Jul 2026 19:10:57 +0000 (20:10 +0100)] 
maint: refactor stat syscall determination

* init.cfg (+get_stat_syscalls_): Refactor from ...
* tests/ls/stat-free-color.sh: ... here.
* tests/ls/stat-free-symlinks.sh: ... here.
* tests/misc/traversal-missing.sh: ... here.
* tests/shred/fifo.sh: .. here.

4 days agochcon,chgrp,chmod,chown,du,ls: ignore missing files while traversing
Pádraig Brady [Wed, 22 Jul 2026 18:23:26 +0000 (19:23 +0100)] 
chcon,chgrp,chmod,chown,du,ls: ignore missing files while traversing

* src/fts-missing.h: Add helper routines to determine
if an FTS entry is skippable.  I.e., that is traversed
and not specified on the command line.
* src/chcon.c (process_file): Setup to ignore skippable files.
(change_file_context): Ignore missing files if appropriate.
* src/chmod.c (process_file): Setup to ignore skippable files.
Ignore missing files if appropriate.
(mode_changed): Ignore missing files if appropriate.
* src/chown-core.c (change_file_owner): Setup to ignore skippable files.
Ignore missing files if appropriate.
* src/du.c (process_file): Likewise.
* src/ls.c (print_dir): Ignore missing files if appropriate.
(get_link_name): Likewise.
(gobble_file): Likewise.  Also handle the dangling symlink case.
* src/system.h (ignorable_traversal_errno): Match ENOENT for missing
files.
* tests/chcon/traversal-missing.sh: A new test.
* tests/misc/traversal-missing.sh: Likewise.
* tests/local.mk: Reference the new tests.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/81444

5 days agotests: date: check that weekdays are ignored when given an explicit date
Collin Funk [Thu, 23 Jul 2026 04:49:48 +0000 (21:49 -0700)] 
tests: date: check that weekdays are ignored when given an explicit date

* tests/date/date.pl: Add some test cases.
* tests/date/date-debug.sh: Test the debug output for this case.

5 days agotests: wc: test -m in single byte and multi byte locales
Collin Funk [Wed, 22 Jul 2026 04:45:42 +0000 (21:45 -0700)] 
tests: wc: test -m in single byte and multi byte locales

* tests/wc/wc.pl ($mb_locale, $single_byte_locale): New variables.
(@mbTests): Add some test cases.

6 days agodoc: printf: detail exactly which escapes are supported
Pádraig Brady [Wed, 22 Jul 2026 14:49:11 +0000 (15:49 +0100)] 
doc: printf: detail exactly which escapes are supported

* doc/coreutils.texi (echo invocation): Parameterize the escape list.
(printf invocation): Remove the C escape reference as it mentions
\' which we don't support, and doesn't mention \e which we do support
(and GCC also does).  Instead directly present the escape list
as done for the echo command, adjusted accordingly.

6 days agodoc: printf: provide usage examples
Pádraig Brady [Wed, 22 Jul 2026 11:49:52 +0000 (12:49 +0100)] 
doc: printf: provide usage examples

* src/printf.c (usage): List examples for each supported
conversion specifier.
* doc/coreutils.texi (printf invocation): Likewise.
Addresses https://bugs.gnu.org/81442

8 days agouptime: remove extraneous space
Pádraig Brady [Mon, 20 Jul 2026 18:45:14 +0000 (19:45 +0100)] 
uptime: remove extraneous space

This make output more consistent with procps.

* src/uptime.c (main): Remove extra space after "up"
when uptime is less than a day.
Fixes https://github.com/coreutils/coreutils/issues/321

9 days agobuild: reduce size of multi-call binary by reusing true logic
Collin Funk [Sun, 19 Jul 2026 03:47:58 +0000 (20:47 -0700)] 
build: reduce size of multi-call binary by reusing true logic

Map 'false' to reuse logic from 'true', instead of creating separate
binaries for each utility.

    $ size src/coreutils-prev
       text    data     bss     dec     hex filename
    1476092    7348 2191936 3675376  3814f0 src/coreutils-prev
    $ size src/coreutils
       text    data     bss     dec     hex filename
    1474612    7348 2191968 3673928  380f48 src/coreutils

* src/local.mk (noinst_HEADERS): Add src/true.h.
(src_false_LDADD): Organize with the rest of the reused programs. Use
$(src_true_LDADD) instead of $(LDADD).
(src_true_SOURCES, src_false_SOURCES): New variables.
* build-aux/gen-single-binary.sh (override_single): Map 'false' to
'true'.
* src/false.c: Remove file.
* po/POTFILES.in: Remove src/false.c.
* cfg.mk (_src): Match src/true-false.c and src/true-true.c.
* src/coreutils-false.c: New file.
* src/true-false.c: Likewise.
* src/true-true.c: Likewise.
* src/true.h: Likewise.
* src/true.c: Include true.h.
(EXIT_STATUS): Always define the macro to use the value of the TRUE_MODE
variable.
(PROGRAM_NAME): Likewise.
* NEWS: Mention the improvement.

10 days agobuild: reduce size of multi-call binary by reusing test logic
Collin Funk [Sat, 18 Jul 2026 03:06:28 +0000 (20:06 -0700)] 
build: reduce size of multi-call binary by reusing test logic

Map the '[' command to which selects appropriate behavior at runtime,
rather than separate binaries for each closely related utility.

    $ size src/coreutils-prev
       text    data     bss     dec     hex filename
    1485188    7348 2191968 3684504  383898 src/coreutils-prev
    $ size src/coreutils
       text    data     bss     dec     hex filename
    1476092    7348 2191936 3675376  3814f0 src/coreutils

* src/local.mk (noinst_HEADERS): Add src/test.h.
(src___SOURCES): Remove src/lbracket.c. Add src/test.c and
src/test-lbracket.c.
(src_test_SOURCES): New variable.
(src/coreutils.h): Adjust the function name to be
single_binary_main_lbracket instead of single_binary_main__.
* build-aux/gen-single-binary.sh: Likewise. Map '[' to 'test'.
(override_single): Adjust the file name to be coreutils-lbracket.c
instead of coreutils-_.c.
* src/lbracket.c: Remove file.
* cfg.mk (_src): Don't match src/lbracket.c in the regular
expression. Match src/test-lbracket.c and src/test-test.c.
* src/coreutils-lbracket.c: New file.
* src/test-lbracket.c: Likewise.
* src/test-test.c: Likewise.
* src/test.h: Likewise.
* src/test.c: Include test.h.
(LBRACKET): Remove macro.
(PROGRAM_NAME): Use the variable TEST_MODE to determine the program
name.
(main): Use the variable TEST_MODE instead of the LBRACKET macro to
implement behavior specific to '['.
* NEWS: Mention the improvement.

10 days agotests: paste: check the delimiter is reset for each file when -s is used
Collin Funk [Sat, 18 Jul 2026 04:56:03 +0000 (21:56 -0700)] 
tests: paste: check the delimiter is reset for each file when -s is used

* tests/paste/paste.pl (@Tests): Add a test case.

12 days agomaint: avoid a recent syntax check failure
Pádraig Brady [Thu, 16 Jul 2026 11:17:27 +0000 (12:17 +0100)] 
maint: avoid a recent syntax check failure

* HACKING: Tweak line length.

12 days agotests: use more robust cleanup of immutable files
Pádraig Brady [Thu, 16 Jul 2026 11:14:59 +0000 (12:14 +0100)] 
tests: use more robust cleanup of immutable files

* tests/rm/empty-immutable-skip.sh: Use cleanup_() to
remove the immutable attribute, so that false failures
or stale files do not result from e.g. a killed test run.

12 days agoinstall: avoid redundant metadata updates with -C
Mateusz Nosek [Thu, 16 Jul 2026 11:04:57 +0000 (12:04 +0100)] 
install: avoid redundant metadata updates with -C

"install -C" (--compare) has always called chown/chmod on the
destination even after determining that copying was unnecessary,
ever since --compare was added in commit v7.0-182-gdac5f12c6.
need_copy() already verifies that the destination's mode, owner, and
group match (and, with --preserve-context, that the SELinux context
matches too) before skipping the copy, so re-applying them is
redundant, and can needlessly fail on a destination that cannot be
chown/chmod'd even though nothing would actually change, e.g. one
marked immutable with chattr +i.

* src/install.c (install_file_in_file): Skip metadata updates
if we already skipped the data, as previous checks ensure
that the metadata is already as required.
* tests/install/install-C-immutable.sh: Add a test.
(based on tests/rm/empty-immutable-skip.sh).
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.

13 days agodoc: reference the github mirror in docs
Pádraig Brady [Wed, 15 Jul 2026 14:41:15 +0000 (15:41 +0100)] 
doc: reference the github mirror in docs

The github mirror is a common interaction point
for issues and pull requests, so reference it in README and HACKING.
Also update the current size of the repo to be more accurate.

Addresses issue #318

13 days agodoc: install: mention -p may lose some of -C speed benefits
Pádraig Brady [Wed, 15 Jul 2026 10:34:48 +0000 (11:34 +0100)] 
doc: install: mention -p may lose some of -C speed benefits

* doc/coreutils.texi (install invocation): Mention that
--preserve-timestamps may lose some of the speed advantages of -C,
due to needing to update timestamps for each build.

2 weeks agodoc: wc: clarify that wc supports character counts
Pádraig Brady [Tue, 14 Jul 2026 16:30:29 +0000 (17:30 +0100)] 
doc: wc: clarify that wc supports character counts

* doc/coreutils.texi: Adjust command summary.
* man/wc.x: Likewise.
Fixes https://bugs.gnu.org/81405

2 weeks agotests: dd: fix false failure on NetBSD
Pádraig Brady [Tue, 14 Jul 2026 11:07:07 +0000 (12:07 +0100)] 
tests: dd: fix false failure on NetBSD

* tests/cat/cat-distinct-err.sh: /proc/self/mem fails with EINVAL
on NetBSD, so extract the error from dd for comparison.
Reported by Bruno Haible.

2 weeks agotests: join: test the behavior when given multiple -e options
Collin Funk [Tue, 14 Jul 2026 05:38:03 +0000 (22:38 -0700)] 
tests: join: test the behavior when given multiple -e options

* tests/join/join.pl (@tv): Add two test cases.

2 weeks agotests: dd: ensure nocache flag does not fail with pipes
Pádraig Brady [Mon, 13 Jul 2026 16:50:21 +0000 (17:50 +0100)] 
tests: dd: ensure nocache flag does not fail with pipes

* tests/dd/nocache.sh: Whether fadvise() is called (uutils)
or avoided (GNU), ensure there is no failure when nocache
is only the ancillary operation being requested.

Link: https://github.com/coreutils/coreutils/pull/276
2 weeks agotests: cat: extract checks for distinct read/write errors
oech3 [Thu, 4 Jun 2026 11:15:40 +0000 (20:15 +0900)] 
tests: cat: extract checks for distinct read/write errors

* tests/cat/splice.sh: Move read/error distinction test to ...
* tests/cat/cat-distinct-err.sh: ... here, and augment.
* tests/local.mk: Reference the new file.

2 weeks agotests: cut: check byte-wise -c and -b -n in the C locale
Sylvestre Ledru [Fri, 10 Jul 2026 01:52:00 +0000 (21:52 -0400)] 
tests: cut: check byte-wise -c and -b -n in the C locale

* tests/cut/cut.pl: Add cases verifying that in the C locale -c and
-b -n select a single byte instead of decoding a multi-byte sequence.

Link: https://github.com/coreutils/coreutils/pull/316
2 weeks agopr: guard input position update against overflow
Guanqiang Han [Tue, 7 Jul 2026 14:58:43 +0000 (22:58 +0800)] 
pr: guard input position update against overflow

* src/pr.c (char_to_clump): Use ckd_add() and report integer overflow.
* tests/pr/options.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/81393

2 weeks agofactor: avoid out-of-bounds prime table access
Pádraig Brady [Fri, 10 Jul 2026 10:36:34 +0000 (11:36 +0100)] 
factor: avoid out-of-bounds prime table access

With an ASAN build we can trigger the issue like:

  $ src/factor 22486472939460651857
  src/factor.c:888:36: runtime error:
  index 675 out of bounds for type 'int_least16_t [675]'

* src/factor.c (factor_using_division): Guard the final unrolled block
before reading a subsequent prime.
* tests/factor/factor.pl: Add a test case.
* NEWS: Mention the bug fix.
Problem caught by Coverity analysis.

2 weeks agomaint: avoid sc-lower-case-var syntax check failure
Pádraig Brady [Fri, 10 Jul 2026 11:10:53 +0000 (12:10 +0100)] 
maint: avoid sc-lower-case-var syntax check failure

* doc/coreutils.texi (touch invocation): Use lower case for @var{}.
This is ambiguous for MM and mm, but these are not ambiguous
from the context, so shouldn't cause confusion.

2 weeks agotouch: improve -d documentation
Paul Eggert [Thu, 9 Jul 2026 23:35:32 +0000 (16:35 -0700)] 
touch: improve -d documentation

* doc/coreutils.texi (touch invocation):
Describe -d behavior for HH:MM:60 (Bug#81331), as it seems that a
future version of POSIX will bless GNU touch here.
Be clearer about POSIX vs GNU extensions with -d.

2 weeks agodoc: ‘mv --update’ has optional [=WHICH]
Paul Eggert [Wed, 8 Jul 2026 20:33:06 +0000 (13:33 -0700)] 
doc: ‘mv --update’ has optional [=WHICH]

* doc/coreutils.texi (mv invocation):
‘mv --update’ has an optional WHICH, just like ‘cp --update’.

2 weeks agodoc: fix description of mv -n
Pádraig Brady [Wed, 8 Jul 2026 17:55:34 +0000 (18:55 +0100)] 
doc: fix description of mv -n

The description of mv --no-clobber got out of sync
between commit v9.1-133-g7a69df889 and v9.4-134-g9907b6f5d

* doc/coreutils.texi (mv invocation): Copy most of the -n
description from the cp --no-clobber description.
* src/mv.c (usage): Likewise.  Note this explicitly deprectates
the mv -n option as like cp the exit code varies across platforms.
Solaris 11 was seen to silently fail, while Linux/FreeBSD succeed.
Fixes https://bugs.gnu.org/81377

3 weeks agotests: numfmt: check --header does not swallow a following operand
Sylvestre Ledru [Sun, 5 Jul 2026 18:40:00 +0000 (20:40 +0200)] 
tests: numfmt: check --header does not swallow a following operand

* tests/numfmt/numfmt.pl (header-10): New test verifying that --header,
which only accepts an argument via '=', does not consume a following
operand as its value.
https://github.com/uutils/coreutils/pull/13273

Link: https://github.com/coreutils/coreutils/pull/312
3 weeks agotests: ls: check that an invalid --tabsize is diagnosed
Sylvestre Ledru [Sat, 4 Jul 2026 19:15:00 +0000 (21:15 +0200)] 
tests: ls: check that an invalid --tabsize is diagnosed

* tests/ls/ls-misc.pl: Add tests, generated by a loop over invalid
values, verifying that a negative (-9), non-numeric (zz), or
fractional (0.5) --tabsize argument is rejected with
"invalid tab size" and exit status 2.
https://github.com/uutils/coreutils/pull/13278

Link: https://github.com/coreutils/coreutils/pull/311
3 weeks agodu: treat negative --max-depth values as errors
Collin Funk [Sat, 4 Jul 2026 03:24:39 +0000 (20:24 -0700)] 
du: treat negative --max-depth values as errors

* NEWS: Mention the bug fix.
* src/du.c (main): Prefer ckd_add to check for overflow. Emit an error
if the value is negative.
* tests/du/max-depth.sh: Add a test case for the bug.

3 weeks agotests: nproc: support referencing of external command
oech3 [Fri, 3 Jul 2026 01:00:30 +0000 (10:00 +0900)] 
tests: nproc: support referencing of external command

* tests/nproc/nproc-quota.sh: Use command -v nproc instead of
$abs_top_builddir for external usage of tests.
Also quote "$nproc" usage, to support spaces in path.

Link: https://github.com/coreutils/coreutils/pull/310
3 weeks agotests: nproc: support more general syscall injection
Pádraig Brady [Thu, 2 Jul 2026 10:21:47 +0000 (11:21 +0100)] 
tests: nproc: support more general syscall injection

* tests/nproc/nproc-quota.sh: Prefer strace to LD_PRELOAD,
as it's simpler and supports static executables.
https://github.com/coreutils/coreutils/issues/309

3 weeks agotests: avoid false failure where mknod() can't create sockets
Pádraig Brady [Wed, 1 Jul 2026 23:52:01 +0000 (00:52 +0100)] 
tests: avoid false failure where mknod() can't create sockets

* tests/mv/mv-special-1.sh: Adjust the python probe to more
closely match how copy.c creates sockets, as otherwise we
get a false failure on systems where mknod() fails with S_IFSOCK,
which was seen on Solaris and FreeBSD at least.
* tests/mv/mv-special-2.sh: Adjust similarly as this
was a latent issue on this root only test.
Reported by Bruno Haible.

3 weeks agotests: csplit: avoid a false failure on NetBSD
Collin Funk [Wed, 1 Jul 2026 02:45:24 +0000 (19:45 -0700)] 
tests: csplit: avoid a false failure on NetBSD

* tests/csplit/csplit.sh: Don't run the test if calling read on a
directory file descriptor works.
Reported by Bruno Haible.

4 weeks agotests: mv: check cross-fs replacement with special files
Pádraig Brady [Thu, 25 Jun 2026 20:03:00 +0000 (22:03 +0200)] 
tests: mv: check cross-fs replacement with special files

* tests/mv/mv-special-1.sh: Moving a socket onto an existing file
on another file system must replace that file, and not for example
unlink the destination first and then fail, leaving the user
with neither file.

Link: https://github.com/coreutils/coreutils/pull/303
4 weeks agotests: shuf: check -o output is preserved when the run fails
Sylvestre Ledru [Sat, 27 Jun 2026 09:02:51 +0000 (11:02 +0200)] 
tests: shuf: check -o output is preserved when the run fails

A failed shuf invocation should leave an existing output file untouched
rather than truncating it before the failure is detected.
* tests/shuf/shuf.sh: Verify that a missing input file or an unreadable
random source leaves an existing -o file unchanged.

Link: https://github.com/coreutils/coreutils/pull/304
4 weeks agotests: ls: check C1 control char escaping in UTF-8 quoting
Sylvestre Ledru [Sun, 28 Jun 2026 09:27:19 +0000 (11:27 +0200)] 
tests: ls: check C1 control char escaping in UTF-8 quoting

* tests/ls/quoting-utf8.sh: A non-ASCII C1 control character (U+0085
NEL) is not printable, so locale/clocale quoting must octal-escape its
bytes (\302\205) rather than emit them literally.  Add a file named
with U+0085 and verify the escaped form for both styles.
gap identified here: https://github.com/uutils/coreutils/pull/13150

Link: https://github.com/coreutils/coreutils/pull/306
4 weeks agotests: realpath: a trailing slash must not require read permission
Sylvestre Ledru [Sun, 28 Jun 2026 12:27:46 +0000 (14:27 +0200)] 
tests: realpath: a trailing slash must not require read permission

A trailing slash only asserts that the operand is a directory.  That
is a stat-level check, needing search permission on the parent, not
read permission on the directory itself.
* tests/misc/realpath.sh: Check that a searchable but unreadable
directory still resolves with a trailing slash, with and without -e.

Link: https://github.com/coreutils/coreutils/pull/307
4 weeks agotests: cp: --remove-destination must honor the same-file check
Sylvestre Ledru [Thu, 25 Jun 2026 19:14:00 +0000 (21:14 +0200)] 
tests: cp: --remove-destination must honor the same-file check

* tests/cp/same-file.sh: A different spelling of the same path
('foo' vs './foo') must still be detected as the same file, so
--remove-destination refuses instead of unlinking the source.

Link: https://github.com/coreutils/coreutils/pull/302
4 weeks agouniq: avoid locking standard output when printing line counts with -c
Collin Funk [Fri, 26 Jun 2026 03:12:28 +0000 (20:12 -0700)] 
uniq: avoid locking standard output when printing line counts with -c

This increases throughput on systems with unlocked stdio functions.
E.g., 2.5x in the following case:

    $ timeout 1m taskset 1 shuf -r -i 0-100 \
        | taskset 2 uniq -c \
        | taskset 3 pv -r > /dev/null
    [ 100MiB/s]
    $ timeout 1m taskset 1 shuf -r -i 0-100 \
        | taskset 2 uniq -c \
        | taskset 3 pv -r > /dev/null
    [ 246MiB/s]

* src/uniq.c: Include assure.h.
(writeline): Convert the value to a string by hand and use fwrite, which
may be unlocked, instead of printf.
* tests/uniq/uniq-c-width.sh: New test to verify the padding logic.
* tests/local.mk (all_tests): Add the test case.
* NEWS: Mention the improvement.

4 weeks agotests: csplit: also test a read failure without -k
Collin Funk [Sat, 27 Jun 2026 23:14:34 +0000 (16:14 -0700)] 
tests: csplit: also test a read failure without -k

* tests/csplit/csplit.sh: Adjust the test case added by the previous
commit to also run without the -k option.

4 weeks agotests: csplit: check for message to standard output after read fails
Collin Funk [Sat, 27 Jun 2026 19:48:19 +0000 (12:48 -0700)] 
tests: csplit: check for message to standard output after read fails

* tests/csplit/csplit.sh: Add a test case.

4 weeks agotests: dd: check that files are opened with O_TRUNC
Collin Funk [Mon, 22 Jun 2026 03:45:09 +0000 (20:45 -0700)] 
tests: dd: check that files are opened with O_TRUNC

* tests/dd/misc.sh: Add the test case.

4 weeks agotests: date: remove a non-portable test
Collin Funk [Wed, 24 Jun 2026 01:26:21 +0000 (18:26 -0700)] 
tests: date: remove a non-portable test

This test failure was seen on FreeBSD, NetBSD, and OpenBSD.

* tests/date/date-tz.sh: Remove the test case.
Reported by Bruno Haible.

5 weeks agocksum: remove the ability to use AF_ALG
Collin Funk [Tue, 23 Jun 2026 02:36:47 +0000 (19:36 -0700)] 
cksum: remove the ability to use AF_ALG

* gnulib: Update to latest gnulib for commit e191cc8118 (crypto/af_alg:
Deprecate., 2026-06-22).
* NEWS: Mention the removal of the --with-linux-crypto configure option.
* doc/coreutils.texi (Hardware Acceleration): Remove the reference to
--with-linux-crypto and the Linux kernel cryptographic API.

5 weeks agotests: sort: check that invalid --parallel arguments are diagnosed
Collin Funk [Mon, 22 Jun 2026 02:11:51 +0000 (19:11 -0700)] 
tests: sort: check that invalid --parallel arguments are diagnosed

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

5 weeks agodd: revert previous patch
Paul Eggert [Sat, 20 Jun 2026 20:30:20 +0000 (13:30 -0700)] 
dd: revert previous patch

The lack of need for the patch was explained by Collin Funk in:
https://bugs.gnu.org/81269#19

5 weeks agodd: work around Linux kernel CLOCK_MONOTONIC bug
Paul Eggert [Sat, 20 Jun 2026 19:14:55 +0000 (12:14 -0700)] 
dd: work around Linux kernel CLOCK_MONOTONIC bug

Problem reported by Sick Pigs (bug#81269).
Ordinarily we’d say “fix the kernel or the hardware”,
but this bug seems widespread and unlikely to be fixed any time soon,
and the workaround is not a lot of trouble.
* src/dd.c (real_start_time): New static var.
(getrealxtime): New static function.
(print_xfer_stats): Use the max of elapsed monotonic and elapsed
real time.

5 weeks agowc: fix out-of-bounds read for single-byte wide characters
aizu-m [Fri, 19 Jun 2026 06:53:03 +0000 (12:23 +0530)] 
wc: fix out-of-bounds read for single-byte wide characters

In legacy CJK locales a single input byte can decode to a wide character
above UCHAR_MAX, e.g. SHIFT-JIS bytes 0xA1..0xDF become U+FF61..U+FF9F.
wc then indexed its 256-entry wc_isprint/wc_isspace tables with that
value and read past their end.
* src/wc.c (wc): Take the byte-indexed fast path only when the decoded
character fits in a byte; wider values fall through to c32width and
c32isspace.
* tests/wc/wc-sjis.sh: New test.
* tests/local.mk (all_tests): Add it.
* NEWS: Mention the fix.

Link: https://github.com/coreutils/coreutils/pull/298
5 weeks agotests: cp,install,mv: check for data loss with just-created files
Collin Funk [Thu, 18 Jun 2026 03:28:38 +0000 (20:28 -0700)] 
tests: cp,install,mv: check for data loss with just-created files

* tests/misc/just-created.sh: New file.
* tests/local.mk (all_tests): Add the test case.

5 weeks agotests: nproc: ensure affinity mask is independent of scheduler
Pádraig Brady [Sun, 14 Jun 2026 02:39:37 +0000 (11:39 +0900)] 
tests: nproc: ensure affinity mask is independent of scheduler

* tests/nproc/nproc-quota-systemd.sh: Check affinity mask with
various schedulers.
https://github.com/coreutils/coreutils/pull/291

5 weeks agotests: nproc: ensure OMP_NUM_THREADS overflow is clamped
oech3 [Sun, 14 Jun 2026 03:40:50 +0000 (12:40 +0900)] 
tests: nproc: ensure OMP_NUM_THREADS overflow is clamped

* tests/nproc/nproc-override.sh: Test overflowed OMP_NUM_THREADS.
https://github.com/coreutils/coreutils/pull/292

5 weeks agotests: nproc: ensure --ignore clamps overflowed num
oech3 [Sun, 14 Jun 2026 16:02:18 +0000 (01:02 +0900)] 
tests: nproc: ensure --ignore clamps overflowed num

* tests/nproc/nproc-positive.sh: Test --ignore overflowed num
is clamped to $UINTMAX_MAX.
https://github.com/coreutils/coreutils/pull/293

5 weeks agotests: nproc: ensure scheduler and OMP_NUM_THREADS are independent
Pádraig Brady [Sat, 13 Jun 2026 14:50:53 +0000 (23:50 +0900)] 
tests: nproc: ensure scheduler and OMP_NUM_THREADS are independent

* tests/nproc/nproc-quota-systemd.sh: Explicitly set OMP_NUM_THREADS
to an ignorable value, to ensure scheduler processing is independent.
* tests/nproc/nproc-quota.sh: Likewise for the SCHED_FIFO check.
https://github.com/coreutils/coreutils/pull/290

5 weeks agotests: split: ensure no files created with no input
oech3 [Wed, 17 Jun 2026 09:12:18 +0000 (18:12 +0900)] 
tests: split: ensure no files created with no input

* tests/split/split-io-err.sh: Ensure 'xaa' is not opened/created
with empty input.
https://github.com/coreutils/coreutils/pull/297

5 weeks agotests: date: test -d with only a minus sign
Collin Funk [Wed, 17 Jun 2026 03:20:36 +0000 (20:20 -0700)] 
tests: date: test -d with only a minus sign

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

6 weeks agotests: nice: add test for --adjustment long option
oech3 [Tue, 16 Jun 2026 15:34:04 +0000 (00:34 +0900)] 
tests: nice: add test for --adjustment long option

* tests/nice/nice.sh: Ensure (abbreviated) long option is supported.
https://github.com/coreutils/coreutils/pull/296

6 weeks agotests: split: avoid a false failure when ulimit fails
Collin Funk [Tue, 16 Jun 2026 05:06:22 +0000 (22:06 -0700)] 
tests: split: avoid a false failure when ulimit fails

* tests/split/suffix-length.sh: Don't fail the test case if ulimit
fails.
Reported by Bruno Haible.

6 weeks agotests: test: test numeric operators with -l STRING
Collin Funk [Mon, 15 Jun 2026 05:50:50 +0000 (22:50 -0700)] 
tests: test: test numeric operators with -l STRING

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

6 weeks agotests: date: test time zone format strings with space padding
Collin Funk [Sun, 14 Jun 2026 22:55:55 +0000 (15:55 -0700)] 
tests: date: test time zone format strings with space padding

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

6 weeks agobuild: update gnulib submodule to latest
Collin Funk [Sun, 14 Jun 2026 02:34:51 +0000 (19:34 -0700)] 
build: update gnulib submodule to latest

This imports a xstrtol-error change from Gnulib that fixes some error
messages that were not properly escaped when given an invalid integer
argument.

* .gitignore: Add /lib/thread-creators.h which is generated by Gnulib.
* gnulib: Update to the latest commit.
* tests/od/od.pl (@Tests): Add some test cases.
* NEWS: Mention the improvement.

6 weeks agotests: date: test that multiple time zone abbreviations cause an error
Collin Funk [Sun, 14 Jun 2026 18:11:41 +0000 (11:11 -0700)] 
tests: date: test that multiple time zone abbreviations cause an error

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

6 weeks agotest: tail: test that --follow works on a symbolic link
Collin Funk [Sat, 13 Jun 2026 03:21:37 +0000 (20:21 -0700)] 
test: tail: test that --follow works on a symbolic link

* tests/tail/follow-symlink.sh: New file.
* tests/local.mk (all_tests): Add the test.

6 weeks agotests: od: test command line arguments are checked for overflow
Collin Funk [Sat, 13 Jun 2026 22:30:42 +0000 (15:30 -0700)] 
tests: od: test command line arguments are checked for overflow

* tests/od/od.pl ($INTMAX_OFLOW): Add definition.
(@Tests): Test -j, -N, -S, and -w with $INTMAX_OFLOW.

6 weeks agotests: pr: add more numeric option tests
Pádraig Brady [Fri, 12 Jun 2026 16:15:18 +0000 (17:15 +0100)] 
tests: pr: add more numeric option tests

* tests/pr/options.sh: Add tests for -e, -l, -w, -W.

6 weeks agotests: pr: add checks for +... parameter handling
Pádraig Brady [Fri, 12 Jun 2026 12:07:25 +0000 (13:07 +0100)] 
tests: pr: add checks for +... parameter handling

* tests/pr/options.sh: Ad a new test.
* tests/local.mk: Reference new test.
Addresses https://bugs.gnu.org/81225

6 weeks agotests: ptx: check that invalid regular expressions are diagnosed
Collin Funk [Fri, 12 Jun 2026 04:42:47 +0000 (21:42 -0700)] 
tests: ptx: check that invalid regular expressions are diagnosed

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

6 weeks agotests: join: add another -e test case
Collin Funk [Thu, 11 Jun 2026 07:14:21 +0000 (00:14 -0700)] 
tests: join: add another -e test case

* tests/join/join.pl (@tv): Add a test case.

6 weeks agocut: fix NUL termination of multi-byte field delimiter
Pádraig Brady [Wed, 10 Jun 2026 06:02:40 +0000 (11:32 +0530)] 
cut: fix NUL termination of multi-byte field delimiter

* src/cut.c (delim_bytes): Add a spare byte so a maximum-length
multi-byte delimiter stays NUL terminated for the strstr needle in
find_field_delim.  Note in 9.11 this buffer was larger (16 bytes)
and so didn't not have a buffer over-read issue.
(main): Ensure DELIM_BYTES is NUL terminated after each --delimeter.
Also explicitly writing the NUL allows for better testing by
triggering overflow issues in default builds, if the buffer
is not sized correctly.
* NEWS: Mention the bug fix.
* tests/cut/cut.pl: Add test cases.
Reported at https://github.com/coreutils/coreutils/pull/286

6 weeks agoenv: port to mingw
Collin Funk [Wed, 10 Jun 2026 04:09:43 +0000 (21:09 -0700)] 
env: port to mingw

* src/env.c (IGNORE): Undefine the macro so it does not break the
SIGNAL_MODE enum.

6 weeks agounexpand: fix heap overflow when a wide blank overshoots a tab stop
aizu-m [Tue, 9 Jun 2026 07:07:06 +0000 (12:37 +0530)] 
unexpand: fix heap overflow when a wide blank overshoots a tab stop

* NEWS: Mention the bug fix.
* src/unexpand.c (unexpand): Check if the column is greater or equal to
the next_tab_column.
* tests/unexpand/mb.sh: Add a test case.
https://github.com/coreutils/coreutils/pull/285
Copyright-paperwork-exempt: Yes

7 weeks agotests: ls: cover two-line --time-style format assignment
Sylvestre Ledru [Sun, 7 Jun 2026 09:43:43 +0000 (11:43 +0200)] 
tests: ls: cover two-line --time-style format assignment

* tests/ls/ls-time.sh: Check that with a "FORMAT1 NEWLINE FORMAT2"
  --time-style, FORMAT1 is used for non-recent (old) files and FORMAT2
  for recent files.
  Identified here: https://github.com/uutils/coreutils/issues/12676
Closes https://github.com/coreutils/coreutils/pull/281

7 weeks agotests: split: reject excessively large suffix lengths
Sylvestre Ledru [Sun, 7 Jun 2026 09:54:40 +0000 (11:54 +0200)] 
tests: split: reject excessively large suffix lengths

* tests/split/suffix-length.sh: Ensure that a pathologically large
-a/--suffix-length value fails gracefully rather than crashing or
hanging.
https://github.com/uutils/coreutils/pull/12609
Closes https://github.com/coreutils/coreutils/pull/282

7 weeks agotests: sort: cover punctuation weight in locale collation
Sylvestre Ledru [Sun, 7 Jun 2026 09:58:49 +0000 (11:58 +0200)] 
tests: sort: cover punctuation weight in locale collation

* tests/sort/sort-locale.sh: In a UTF-8 locale '-' carries a minimal
(shifted) weight, so 'file1' sorts before 'file-2' even though '-'
precedes '1' in the C/byte order.  This is the opposite of the C locale
result, so it also exercises the differs-from-C path.
Identified here: https://github.com/uutils/coreutils/pull/12677
Closes https://github.com/coreutils/coreutils/pull/283

7 weeks agotests: date: check date-string parsing corner cases
Sylvestre Ledru [Mon, 8 Jun 2026 19:43:00 +0000 (21:43 +0200)] 
tests: date: check date-string parsing corner cases

* tests/date/date.pl: Add tests covering a leading day-of-week name,
out-of-range zone minutes, two timezone tokens, a bare sign operand,
a trailing token after an @epoch operand, operand quoting in
diagnostics, and a '+N unit' suffix following a complete time.
* tests/date/date-tz.sh: Add tests covering daylight-saving gap,
and overlap local times.
Closes https://github.com/coreutils/coreutils/pull/284

7 weeks agotests: install: check the behavior when strip is terminated by a signal
Collin Funk [Tue, 9 Jun 2026 04:56:48 +0000 (21:56 -0700)] 
tests: install: check the behavior when strip is terminated by a signal

* tests/install/strip-program.sh: Add the test case.

7 weeks agotests: dircolors: add another test case for TERM
Collin Funk [Tue, 9 Jun 2026 04:13:03 +0000 (21:13 -0700)] 
tests: dircolors: add another test case for TERM

* tests/misc/dircolors.pl (@Tests): Add a test case.

7 weeks agotests: install: check the behavior when the source is the destination
Collin Funk [Mon, 8 Jun 2026 05:27:18 +0000 (22:27 -0700)] 
tests: install: check the behavior when the source is the destination

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

7 weeks agotests: fold: test that --width=0 produces an error
Collin Funk [Mon, 8 Jun 2026 02:42:20 +0000 (19:42 -0700)] 
tests: fold: test that --width=0 produces an error

* tests/fold/fold.pl ($limits): New variable.
(@Tests): Add the test case.

7 weeks agonohup: port to mingw
Collin Funk [Sun, 7 Jun 2026 23:43:50 +0000 (16:43 -0700)] 
nohup: port to mingw

* bootstrap.conf (gnulib_modules): Add execvp which as a different
prototype on Windows along with other issues mentioned in the Gnulib
manual.
* src/nohup.c (main): Check if SIGHUP is defined.

7 weeks agomaint: use the memmem Gnulib module
Collin Funk [Sun, 7 Jun 2026 05:13:08 +0000 (22:13 -0700)] 
maint: use the memmem Gnulib module

* bootstrap.conf (gnulib_modules): Add memmem which is missing on some
platforms, e.g., mingw, and buggy on some older platforms.

7 weeks agomaint: tests: remove extraneous "&& :"
Pádraig Brady [Sat, 6 Jun 2026 10:46:43 +0000 (11:46 +0100)] 
maint: tests: remove extraneous "&& :"

* tests/cp/symlink-slash.sh: && : is always redundant.
* tests/ls/symlink-slash.sh: Likewise.

7 weeks agotests: ls: also check a trailing '/.' dereferences a symlink arg
Sylvestre Ledru [Sat, 6 Jun 2026 06:11:52 +0000 (08:11 +0200)] 
tests: ls: also check a trailing '/.' dereferences a symlink arg

* tests/ls/symlink-slash.sh: A symlink-to-directory argument written as
'symlink/.' denotes the directory itself, just like a trailing slash, so
'ls -l symlink/.' must list the directory contents rather than show the
symlink.
See https://github.com/uutils/coreutils/issues/7873
and https://github.com/uutils/coreutils/issues/6467
https://github.com/coreutils/coreutils/pull/280

7 weeks agodoc: NEWS: describe the stat file name quoting changes
Pádraig Brady [Wed, 3 Jun 2026 17:06:11 +0000 (18:06 +0100)] 
doc: NEWS: describe the stat file name quoting changes

Note also a previous discussion on stat quoting at:
https://bugs.gnu.org/23422

* NEWS: Describe the changes in behavior.

7 weeks agostat: change default quoting from shell-escape-always to shell-escape
Pádraig Brady [Wed, 3 Jun 2026 15:31:39 +0000 (16:31 +0100)] 
stat: change default quoting from shell-escape-always to shell-escape

This should not affect programatic parsing, because if you have to parse
the shell style, then the same logic will parse unescaped output.
This is a better default now that --terse uses quoted format by default,
and also the default output format quotes file names by default.

* src/stat.c (getenv_quoting_style): Change the default.

7 weeks agostat: use quoted file names with --terse
Pádraig Brady [Wed, 3 Jun 2026 15:28:34 +0000 (16:28 +0100)] 
stat: use quoted file names with --terse

* src/stat.c: Use %Qn rather than a bare %n by default,
so output is maintained on a single line for parsing.