5324 Commits

Author SHA1 Message Date
Collin Funk
2bd3e8bb7a tests: tac: test --regex with anchors in the separator
* tests/tac/tac.pl (@Tests): Add a few test cases.
2026-01-26 18:37:37 -08:00
Collin Funk
9cb06a7d13 tests: mktemp: export LC_ALL
* tests/mktemp/bad-unicode.sh: Run this test case using multiple
locales.
2026-01-25 21:19:45 +00:00
Collin Funk
c3894e0723 tests: chgrp: allow a numeric user id to be printed
* tests/chgrp/from.sh: If 'id' cannot find a user name for user id 1,
expect the user id to be printed in the message of 'chgrp'.
Reported by Bruno Haible.
2026-01-24 15:06:51 -08:00
Collin Funk
ec77664a31 tests: avoid failures if 'ulimit -n' cannot set file descriptor limits
This fixes test failures seen on Haiku.

* tests/ls/recursive.sh: Run 'ls' even if ulimit fails.
* tests/split/r-chunk.sh: Run 'split' even if ulimit fails.
* tests/sort/sort-merge-fdlimit.sh: Skip test if 'ulimit -n' cannot set
file descriptor limits.
Reported by Bruno Haible.
2026-01-24 11:20:56 -08:00
Pádraig Brady
75c671415e tests: dd: avoid EPERM false failure on Solaris
* tests/dd/fail-ftruncate-fstat.sh: Also map the "Not owner"
error for EPERM seen on earlier Solaris 11 releases.
Reported by Bruno Haible.
2026-01-24 14:53:30 +00:00
Pádraig Brady
acf0acd0c9 tests: stty: avoid false failure if resizing terminal
* tests/stty/stty-row-col.sh: Skip the test if we detect terminal
resizing.  Also more robustly restore the original size.
2026-01-24 12:49:52 +00:00
Collin Funk
c351e1965d tests: readlink: avoid a false failure on Haiku
* tests/readlink/readlink-posix.sh: Allow the "A" in "Argument" to be
capitalized in return value of strerror (EINVAL).
2026-01-24 12:47:51 +00:00
Pádraig Brady
bdf53cc685 tests: usage_vs_refs.sh: fix false failure with Alpine
* tests/misc/usage_vs_refs.sh: Fix missing escape on literal {,
required by busybox grep.
Reported by Bruno Haible.
2026-01-23 22:32:20 +00:00
Pádraig Brady
58ba9580e7 tests: fix false failure with pr -COLS
* tests/misc/usage_vs_getopt.sh: Fix false failure induced
by commit v9.9-239-ga06f0cf67
2026-01-22 11:56:50 +00:00
Pádraig Brady
87219034b7 doc: use TERM=dumb rather than HELP_NO_MARKUP to disable markup
This is a more standard mechanism to disable markup.

* src/system.h (oputs_): Logic change to honor TERM=dumb,
rather than HELP_NO_MARKUP=something.
* doc/coreutils.texi: Adjust the description for --help.
* man/local.mk: Ensure TERM is set to something,
so that man pages have links included.
* man/viewman: Just honor users $TERM.
* tests/misc/getopt_vs_usage.sh: Remove env var complication,
as TERM is unset automatically.
* tests/misc/usage_vs_refs.sh: Likewise.
* NEWS: Adjust the change in behavior note.
2026-01-22 11:42:47 +00:00
Pádraig Brady
bdc45990c7 tests: avoid false failure with non standard path
* tests/misc/usage_vs_refs.sh: Properly quote arguments
to avoid false failure with paths containing spaces etc.
2026-01-21 19:30:21 +00:00
Pádraig Brady
3e57f08e36 tests: avoid infinite loop in dd failure edge case
* tests/tee/tee.sh: If dd failed, then tee would spin
writing to the fifo forever, so add a timeout protection.
This was noticed with `export LD_PRELOAD=libasan.so.8`
with a non ASAN build, which induced a failure in dd invocations.
2026-01-21 19:00:03 +00:00
Pádraig Brady
f9eebda93c tests: avoid false failure with sanitizer builds
* init.cfg (sanitizer_build_): Add a helper to detect if a program
is built against a sanitizer.
* tests/df/no-mtab-status-masked-proc.sh: Skip if a sanitizer build.
2026-01-21 17:49:39 +00:00
Pádraig Brady
92df52d791 tests: avoid false failure on setgid dir
* tests/misc/mknod.sh: Skip a portion of the test
in the edge case of setgid directories.
2026-01-21 16:06:51 +00:00
Pádraig Brady
dfeb32f6e2 ls: --hyperlink: switch to more standard delimiters
* src/ls.c (quote_name): Use ST (ESC \) rather than BEL,
as that's the only terminator mentioned in at least
ECMA-48, DEC STD 070, and EK-VT520-RM.
* NEWS: Mention the change in behavior.
* tests/ls/hyperlink.sh: Adjust accordingly.

Suggested by Egmont Koblinger.
2026-01-21 14:05:48 +00:00
Pádraig Brady
77e6b5d8f8 tests: ensure there is an anchor for each --help option
* tests/misc/usage_vs_refs.sh: A new test to correlation options
listed in --help, and anchors referenced in the texinfo (html) manual.
* tests/local.mk: Add the new test.
2026-01-21 14:05:48 +00:00
Pádraig Brady
a06f0cf67e doc: more indexing fixes in manual
* doc/coreutils.texi: Add missing anchors.
* src/pr.c (Usage): Adjust to use -COLS, to avoid a clash
with the additional anchor added to the manual.
Also markup the --columns option as done for other options.
* tests/split/line-bytes.sh: Also fix --lines-bytes typo here.
2026-01-21 13:51:58 +00:00
Pádraig Brady
1e72a54ca7 doc: tweak tests to avoid false failure with --help
* tests/df/df-output.sh: Use a more relaxed match.
* tests/du/inodes.sh: Likewise.
2026-01-21 13:51:40 +00:00
Pádraig Brady
d5e15b2f29 doc: ls: support styling and links in --help output
* src/ls.c (oputs): A new function that wraps puts(),
but also highlights the --option-text portion, and
adds links to the appropriate part of the online manual.
(usage): Call oputs() rather than puts().
* doc/coreutils.texi (--help): Document new HELP_NO_MARKUP env var,
which can be used in the edge case one wants to suppress ansi escapes.
* tests/misc/getopt_vs_usage.sh: Use HELP_NO_MARKUP to ensure the
test continues to pass.
2026-01-21 13:51:39 +00:00
Pádraig Brady
88760f9c10 tests: test: ensure whitespace ignored when parsing numbers
* tests/test/test.pl: Add a test case.
2026-01-21 13:51:39 +00:00
Collin Funk
a96abcbbeb tests: dd: avoid a false test failure on Solaris 11.4
* tests/dd/fail-ftruncate-fstat.sh: Replace the message used by Solaris
11.4 for strerror (EPERM) with the one we expect.
2026-01-19 18:26:45 -08:00
Collin Funk
521a389635 tests: sync: check that all files are processed even when errors occur
* tests/misc/sync.sh: Add the test case.
2026-01-19 11:08:48 -08:00
Collin Funk
aac817f34b tests: sync: also test that -d and -f don't block on a FIFO
* tests/misc/sync.sh: Check 'sync fifo' with no arguments, -d, and -f
separately. Only perform the check for -f if RUN_EXPENSIVE_TESTS=yes
since it may be expensive.
2026-01-19 11:07:28 -08:00
oech3
d5164f3d21 tests: env.sh: avoid multi-call binary considerations
A simpler fix than commit v9.9-4-g3b6efd555
which is less dependent on the exact behavior
of a multi-call binary.

* tests/env/env.sh: Use a local script rather than 'true'.
which may be a symlinked multi-call binary.
https://github.com/coreutils/coreutils/pull/174
2026-01-18 21:41:23 +00:00
Pádraig Brady
4d03a1e408 tests: strace: consider splice a "read" syscall
* tests/cksum/cksum-c.sh: Add 'splice' to the injection set.
* tests/misc/read-errors.sh: Likewise.
From https://github.com/coreutils/coreutils/pull/167
2026-01-18 16:58:38 +00:00
Pádraig Brady
71ea30a742 maint: prefer NULL to nullptr
NULL is best for C as discussed at:
https://bugs.gnu.org/66221#53

* bootstrap.conf: Remove dependency on nullptr.
* s/nullptr/NULL/.
2026-01-18 15:55:38 +00:00
Pádraig Brady
fcaa3a39c7 tests: use command -v to identify binary
* tests/misc/coreutils.sh: Be more flexibile by using `command -v`
to identify the binary to be executed, rather than linking
directly to the built binary.
2026-01-18 12:48:36 +00:00
Collin Funk
c1d13a499a tests: avoid a test hang on AIX
* init.cfg (uses_strace_): New function.
(require_strace_): Use it.
tests/cksum/cksum-c.sh: Likewise.
tests/misc/read-errors.sh: Likewise.
2026-01-17 14:26:26 -08:00
Paul Eggert
23e696b0b2 maint: spelling fixes 2026-01-16 13:22:28 -08:00
Pádraig Brady
6b32a0bbde all: with multi-call binary, only process options for known names
Setup
  $ ln -nsf src/coreutils foo

Before
  $ ./foo; echo $?
  foo: unknown program ‘foo’
  Try './foo --help' for more information.
  1
  ./foo --version; echo $?
  coreutils (GNU coreutils) 9.9.172-01993
  0

After
  $ ./foo; echo $?
  coreutils: unknown program 'foo'
  1
  $ ./foo --version; echo $?
  coreutils: unknown program 'foo'
  1

* src/coreutils.c (main): Don't process options if
we don't know they're intended for the multi-call binary.
Otherwise `foo --version` would return true, even though
foo was symlinked to the multi-call binary, but not supported.
* tests/misc/coreutils.sh: Add test cases.
* NEWS: Mention the change in behavior.
2026-01-15 15:54:29 +00:00
Pádraig Brady
92d80b67cf tests: ensure utilities correctly diagnose read errors
* tests/misc/read-errors.sh: Ensure each utility calls a
read system call as requested.  Not doing so (say by avoiding
reading from a directory) is a layering violation.
Also ensure we diagnose the particular error encountered.
2026-01-13 15:08:04 +00:00
Pádraig Brady
06d228043f paste: support multi-byte delimiters
* src/paste.c (collapse_escapes): This is the central --delimiters
parsing function, so adjust to handle multi-byte chars with
mcel_scanz().  Populate a delimiters length array to support
characters of differing lengths.
(paste_serial): Use the delimiters length array to output
the appropriate delimiter.
(paste_parallel): Likewise.
* tests/paste/multi-byte.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
2026-01-13 14:32:01 +00:00
oech3
e326d0df65 tests: nice: ensure large values are clamped
* tests/nice/nice.sh: Ensure integers > UINTMAX_MAX are supported.
From https://github.com/coreutils/coreutils/pull/170
2026-01-13 14:20:13 +00:00
Dmitry V. Levin
2739fab817 tests: cksum: use more general strace syscall injection
* tests/cksum/cksum-c.sh: Match "read" with a regex
to match any of the read syscall variants.
2026-01-12 15:13:57 +00:00
Pádraig Brady
49788a4510 tests: paste -d: test supported escape sequences
* tests/misc/paste.pl: Test all supported POSIX and GNU
backslash escape sequences.
2026-01-12 14:13:26 +00:00
Pádraig Brady
210c000b8c tests: date: test nested parenthesis comment handling
* tests/date/date.pl: Add test cases.
Suggested by Sylvestre Ledru.
2026-01-11 18:51:19 +00:00
oech3
3a9777bdb0 tests: cksum: ensure --check handles I/O errors
* tests/cksum/cksum-c.sh: Use strace to inject EIO upon read(),
and verify it's handled appropriately.
From https://github.com/coreutils/coreutils/pull/167
2026-01-11 18:16:18 +00:00
Pádraig Brady
135dff3ad3 tests: cksum: ensure --check diagnoses read errors
* tests/misc/read-errors.sh: Add a test case.
Discussed in https://github.com/coreutils/coreutils/pull/167
2026-01-11 13:42:19 +00:00
Collin Funk
3621ad2f71 cksum: promptly diagnose write errors
* src/cksum.c (output_file, digest_check): Check if standard output has
it's error flag set after printing.
* tests/misc/write-errors.sh: Add a test case that would previously run
forever.
* NEWS: Mention the improvement. Reorder alphabetically.
2026-01-10 12:42:13 -08:00
Pádraig Brady
a9aad49f26 maint: remove redundant processing in a test
* tests/misc/write-errors.sh: This was a no-op anyway
due to inadequate escaping.  Also document the escaping requirement.
2026-01-10 01:04:33 +00:00
Pádraig Brady
19d2d707f7 du: promptly diagnose write errors
* src/du.c (print_size): Call write_error() if can't flush.
* tests/misc/write-errors.sh: Add a test case.
* NEWS: Mention the improvement.
2026-01-10 01:04:33 +00:00
Pádraig Brady
83f274feaa wc: promptly diagnose write errors
* src/wc.c (write_counts): Call write_error() if any pending errors.
* tests/misc/write-errors.sh: Add a test case.
* NEWS: Mention the improvement.
2026-01-10 01:04:33 +00:00
Pádraig Brady
9200747f65 cksum: validate options more consistently
We disallow `cksum --tag --check` which is fine,
but the error should be consistent with md5sum,
and less confusing, as it currently mentions
"--binary" and "--text" which weren't specified.

We disallow `cksum --tag --text` which is fine,
but we should also disallow `cksum --text --tag`.

We should honor an explicit --binary (output *)
with this combination of options:
cksum --binary --tag --untagged -a md5 /dev/null

Note this also makes both of `cksum -a md5` and
`cksum --tag -a md5` consistently use binary mode
when reading from a tty on systems like MinGW
where O_BINARY is set.

* src/cksum.c (main): Adjust --text,--binary
and --tag,--untagged option processing.
* tests/cksum/cksum-a.sh: Add test cases.
* tests/cksum/cksum-c.sh: Likewise.
* NEWS: Mention the improvement.
Fixes https://github.com/coreutils/coreutils/issues/163
2026-01-08 16:14:57 +00:00
Pádraig Brady
9a38863885 tests: chmod: fix false failure in recent test
* tests/chmod/partial-fail.sh: Test readablility of mode 0 files
independently, to avoid false failure, e.g., when run as root.
Reported by Bruno Haible.
2026-01-08 12:08:14 +00:00
Pádraig Brady
e1cbe82cc6 tests: tail/overlay-headers.sh: fix various issues
* tests/tail/overlay-headers.sh (cleanup_): Ensure we send SIGCONT
to the tail process, otherwise we would hang if the test is terminated
while the tail process is in stopped state.
(wait4stopped_): A new function to ensure tail is in the stopped state
before we start writing to the monitored files.
Also remove "---disable-inotify" from $fastpoll so we actually
test the inotify code (where supported).
Also remove the timeout(1) wrapper, so we actually suspend tail(1).

Reported by Bruno Haible on macOS 26
2026-01-08 12:08:14 +00:00
Pádraig Brady
30d296dcb8 fmt: interpret -w as an inclusive maximum
This aligns with `fold -w` and BSD `fmt` implementations.

* src/fmt.c (fmt_paragraph): Check len <= max_width.
* tests/fmt/width.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the change in behavior.
Addresses part of https://bugs.gnu.org/79497
2026-01-08 12:08:14 +00:00
Sylvestre Ledru
b7613ac8ff tests: date: test parenthesis comment handling
* tests/date/date.pl: Add the check.
2026-01-07 19:58:55 -08:00
Collin Funk
0fcdd37fbd maint: organize mktemp tests in a subdirectory
* tests/misc/mktemp.pl: Moved to tests/mktemp/mktemp.pl.
* tests/local.mk (all_tests): Adjust the file name.
2026-01-06 18:52:48 -08:00
Collin Funk
1f1bce27d7 tests: mktemp: add tests for invalid Unicode options
* init.cfg (bad_unicode): New function, copied from
tests/fold/fold-characters.sh with the NUL removed.
* tests/fold/fold-characters.sh (bad_unicode): Rename to
bad_unicode_with_nul. Reformat long line.
* tests/mktemp/bad-unicode.sh: New test.
* tests/local.mk (all_tests): Add the new test.
2026-01-06 18:52:48 -08:00
Pádraig Brady
c43f517e2a tests: cp: fix always skipped nfs-removal-race.sh
* tests/cp/nfs-removal-race.sh: This test was invalid since v8.32
as we now use fstatat() rather than stat().  Also since commit
v9.0-66-ge2daa8f79 we leverage the errno from open(O_DIRECTORY)
to avoid a stat, so pass --no-target-directory to ensure fstatat()
is called.
Discussed in https://github.com/coreutils/coreutils/pull/161
2026-01-06 20:35:44 +00:00