]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
43 hours agodoc: wc: clarify that wc supports character counts master
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 days 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 days 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 days 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 days 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.

5 days 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
5 days 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

6 days 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.

6 days 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.

6 days 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.

7 days 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’.

7 days 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

9 days 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
9 days 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
12 days 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.

13 days 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
2 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

2 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.

2 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.

2 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
2 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
2 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
2 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
2 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
2 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.

2 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.

2 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.

3 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.

3 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.

3 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.

3 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.

3 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

3 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.

3 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
3 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.

3 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

3 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

3 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

3 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

3 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

4 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.

4 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

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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

4 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.

5 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.

5 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

5 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.

5 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

5 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

5 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

5 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

5 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

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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

5 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.

5 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.

5 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.

5 weeks agostat: support %Qn format to output quoted file name
Pádraig Brady [Wed, 3 Jun 2026 15:24:18 +0000 (16:24 +0100)] 
stat: support %Qn format to output quoted file name

%N also outputs the target of a symlink
so support %Qn to give more control over quoted names.

* src/stat.c (print_it): Validate %Qn.
(print_stat): Output quoted file name with %Qn.
(usage): Add %Qn description.
* doc/coreutils.texi (stat invocation): Likewise.
* tests/stat/stat-fmt.sh: Add a test case.

5 weeks agostat: honor QUOTING_STYLE in default file name quoting
Pádraig Brady [Wed, 3 Jun 2026 15:04:09 +0000 (16:04 +0100)] 
stat: honor QUOTING_STYLE in default file name quoting

This is safer to output to terminal with malicious file names,
with multiple lines or control characters etc.

* src/stat.c: Quote the file name in the default output format
in the default quoting style, or as selected with QUOTING_STYLE.
Reported by Michał Majchrowicz and Marcin Wyczechowski.

5 weeks agodoc: stat: suppress ls specific info
Pádraig Brady [Wed, 3 Jun 2026 13:49:55 +0000 (14:49 +0100)] 
doc: stat: suppress ls specific info

* doc/coreutils.texi (stat invocation): Avoid outputting confusing
info specific to the ls command for QUOTING_STYLE.

5 weeks agotests: shred: really fix intermittent false failure
Pádraig Brady [Thu, 4 Jun 2026 12:04:10 +0000 (13:04 +0100)] 
tests: shred: really fix intermittent false failure

The previous commit is not sufficient to fix the race,
since I forgot shred now opens with O_NONBLOCK, and so cat may
not be even reading by the time shred's open() returns.

* tests/shred/fifo.sh: Put more robust synchronization in place
along the lines of what we did in commit v9.11-47-ga6ba6a23a,
using a separate fifo_writer_ to ensure the cat is reading,
before shred runs.

6 weeks agotests: shred: fix intermittent false failure
Pádraig Brady [Wed, 3 Jun 2026 21:14:04 +0000 (22:14 +0100)] 
tests: shred: fix intermittent false failure

* tests/shred/fifo.sh: Fix (unreleased) racy test.

6 weeks agotests: install: avoid failure on FreeBSD/macOS
Pádraig Brady [Wed, 3 Jun 2026 11:11:01 +0000 (12:11 +0100)] 
tests: install: avoid failure on FreeBSD/macOS

* tests/install/stdin.sh: Avoid inode correlation issue discussed at
https://lists.gnu.org/r/coreutils/2026-06/msg00004.html

6 weeks agotests: date: check fixed offset is anchored before relative items
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

6 weeks 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

6 weeks 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

6 weeks 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.

6 weeks 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

6 weeks 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

6 weeks 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

6 weeks 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

6 weeks 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 weeks 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 weeks 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.

7 weeks 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.

7 weeks 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.

8 weeks 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.

8 weeks 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

8 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.

8 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.

8 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

8 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.

8 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 months 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 months 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 months 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.