Commit Graph
31557 Commits
Author SHA1 Message Date
Collin Funk befdbed2f9 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.
2026-06-14 10:52:46 -07:00
Collin Funk dfb89db157 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.
2026-06-13 15:30:42 -07:00
Pádraig Brady bb55b57c0a tests: pr: add more numeric option tests
* tests/pr/options.sh: Add tests for -e, -l, -w, -W.
2026-06-12 17:17:43 +01:00
Pádraig Brady a52fcef903 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
2026-06-12 13:24:42 +01:00
Collin Funk 41b205b6d7 tests: ptx: check that invalid regular expressions are diagnosed
* tests/ptx/ptx.pl (@Tests): Add two test test cases.
2026-06-11 21:42:47 -07:00
Collin Funk ce0f4f68df tests: join: add another -e test case
* tests/join/join.pl (@tv): Add a test case.
2026-06-11 00:14:21 -07:00
Pádraig Brady 0a1a7f9022 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
2026-06-10 13:50:04 +01:00
Collin Funk beb0190739 env: port to mingw
* src/env.c (IGNORE): Undefine the macro so it does not break the
SIGNAL_MODE enum.
2026-06-09 21:09:43 -07:00
aizu-m 4ade9cf77f 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
2026-06-09 18:20:39 -07:00
Sylvestre Ledru a04250cf3b 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
2026-06-09 14:38:15 +01:00
Sylvestre Ledru c8ce189cbd 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
2026-06-09 14:22:09 +01:00
Sylvestre Ledru 5008d5d112 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
2026-06-09 14:08:02 +01:00
Sylvestre Ledru e75940f675 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
2026-06-09 13:42:00 +01:00
Collin Funk 3ae92d6fd2 tests: install: check the behavior when strip is terminated by a signal
* tests/install/strip-program.sh: Add the test case.
2026-06-08 21:57:39 -07:00
Collin Funk 65ce1bd641 tests: dircolors: add another test case for TERM
* tests/misc/dircolors.pl (@Tests): Add a test case.
2026-06-08 21:18:57 -07:00
Collin Funk dd777fe89f tests: install: check the behavior when the source is the destination
* tests/install/basic-1.sh: Add the test case.
2026-06-07 22:39:43 -07:00
Collin Funk e583cae508 tests: fold: test that --width=0 produces an error
* tests/fold/fold.pl ($limits): New variable.
(@Tests): Add the test case.
2026-06-07 19:45:30 -07:00
Collin Funk c687e0586f 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.
2026-06-07 16:43:50 -07:00
Collin Funk 0749ae07a9 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.
2026-06-06 23:08:23 -07:00
Pádraig Brady bbbd14c6d8 maint: tests: remove extraneous "&& :"
* tests/cp/symlink-slash.sh: && : is always redundant.
* tests/ls/symlink-slash.sh: Likewise.
2026-06-06 11:46:43 +01:00
Sylvestre Ledru 8da9f0c815 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
2026-06-06 11:35:10 +01:00
Pádraig Brady d63de5ed02 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.
2026-06-04 14:00:33 +01:00
Pádraig Brady 5ce0a47fcc 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.
2026-06-04 13:48:09 +01:00
Pádraig Brady 5d3f03b4fb 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.
2026-06-04 13:48:05 +01:00
Pádraig Brady 49f3b66719 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.
2026-06-04 13:14:27 +01:00
Pádraig Brady 641422abad 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.
2026-06-04 13:14:27 +01:00
Pádraig Brady 35d7f1f3ef doc: stat: suppress ls specific info
* doc/coreutils.texi (stat invocation): Avoid outputting confusing
info specific to the ls command for QUOTING_STYLE.
2026-06-04 13:14:27 +01:00
Pádraig Brady 6203f8f978 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.
2026-06-04 13:13:27 +01:00
Pádraig Brady ab7ef8b515 tests: shred: fix intermittent false failure
* tests/shred/fifo.sh: Fix (unreleased) racy test.
2026-06-03 22:17:01 +01:00
Pádraig Brady 2632fbf08c 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
2026-06-03 12:12:33 +01:00
Sylvestre Ledru 56ed0d516e 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
2026-06-02 11:45:52 +01:00
Sylvestre Ledru 7aeef80298 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
2026-06-02 11:43:06 +01:00
Sylvestre Ledru 66f18c209c 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
2026-05-30 21:29:19 +01:00
Collin Funk 5ce903c004 tests: shred: check the removal of files in a subdirectory
* tests/shred/shred-remove.sh: Add a test case.
2026-05-30 10:25:40 -07:00
Sylvestre Ledru d768f2144b 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
2026-05-30 14:08:14 +01:00
Pádraig Brady 08207e93d8 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
2026-05-30 12:14:08 +01:00
Sylvestre Ledru e32eaee1f0 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
2026-05-29 19:29:10 +01:00
Sylvestre Ledru 6f8600f5d1 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
2026-05-29 19:25:40 +01:00
Sylvestre Ledru cec863ff08 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
2026-05-29 19:19:36 +01:00
Collin Funk 255febf98b 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.
2026-05-26 19:48:52 -07:00
Pádraig Brady 22c0191824 tests: tail: avoid false failure due to recent change
* tests/tail/pipe-f.sh: Adjust to cater for recently
introduced quoting.
2026-05-26 11:58:47 +01:00
Pádraig Brady fdcfb10873 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.
2026-05-25 16:07:05 +01:00
Collin Funk b2095290fb tests: install: check the behavior when standard input is the source
* tests/install/stdin.sh: New file.
* tests/local.mk: Add the new test.
2026-05-21 23:15:43 -07:00
Collin Funk 2f865e275d 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.
2026-05-20 19:31:34 -07:00
oech3 e964f2f431 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
2026-05-20 13:09:28 +01:00
Collin Funk 4d63accc08 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.
2026-05-19 18:16:21 -07:00
Pádraig Brady 157bdb2443 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.
2026-05-19 19:06:13 +01:00
Collin Funk 0d6fcb99d6 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
2026-05-18 20:50:48 -07:00
Collin Funk fbd3072360 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.
2026-05-18 17:32:58 -07:00
Pádraig Brady a6ba6a23ad tests: tail: ensure --pid is responsive to intermittent input
* tests/tail/pid-pipe.sh: Ensure not only open() is
handled asynchronously with --pid.
2026-05-16 23:01:16 +01:00