Commit Graph
31544 Commits
Author SHA1 Message Date
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
Collin Funk 7d2b55102d 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.
2026-05-15 19:19:41 -07:00
Collin Funk 13bb78af00 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.
2026-05-15 19:11:37 -07:00
Collin Funk c1c58b7449 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.
2026-05-15 19:00:37 -07:00
Collin Funk 2dbe5e26ff maint: shred: remove unnecessary setjmp.h include
It has not been needed since commit 9fd2c631b (Remove all uses of
signals; modern hosts have /dev/random and don't need this gorp.,
2005-04-09).

* src/shred.c: Don't include setjmp.h.
2026-05-15 18:30:13 -07:00
Collin Funk f3395e7a79 tests: date: test format options combined with format strings
* tests/date/date.pl (@Tests): Add a few test cases.
2026-05-15 00:49:01 -07:00
Collin Funk f76678dab0 tests: mktemp: test the creation of hidden files in a subdirectory
* tests/mktemp/mktemp.pl (@Tests): Add two test cases.
2026-05-14 21:05:01 -07:00
Collin Funk 91cd3f7a18 test: mktemp: test creation of a directory with a subdirectory template
* tests/mktemp/mktemp.pl (@Tests): Remove an unlink call handled in the
previous call to check_tmp. Add a test case.
2026-05-14 20:58:55 -07:00
Pádraig Brady 32d1c41c88 tests: shred: check shred explicit deallocation
* tests/shred/shred-remove.sh: Ensure shred deallocates with
read-only directories, or '-' used to represent standard output.
2026-05-14 14:49:47 +01:00
Pádraig Brady 2c706d0382 maint: sc_prohibit_test_empty: add avoidance comment
* cfg.mk: Describe how to avoid the syntax check
in the case of possibly large / binary input.
2026-05-14 14:49:47 +01:00
Collin Funk 45bbd75fb0 doc: shred: mention unsupported file types
* src/shred.c (usage): Mention the behavior of 'shred' on FIFOs,
sockets, and terminals.
* doc/coreutils.texi (shred invocation): Likewise.
Addresses https://bugs.gnu.org/30177
2026-05-13 20:45:47 -07:00
Collin Funk dcca2a53b3 tests: date: test the behavior with multiple --iso-8601 options
* tests/date/date.pl (@Tests): Add test cases.
2026-05-11 18:26:25 -07:00
Leonid Evdokimov fa889fdb60 doc: fix --enable-single-binary configure help
* configure.ac: Fix optional indication with square brackets.
2026-05-11 13:58:22 +01:00
Paul Eggert 834ea48535 maint: pacify GCC 16 -Wuseless-cast
This mostly either removes casts if they are always no-ops, or
replaces casts (TYPE)(EXPR) with compound literals (TYPE){EXPR}.
Compound literals are a bit safer anyway, as casts are too
powerful in C.
* src/cksum_avx2.c (cksum_avx2):
* src/cksum_avx512.c (cksum_avx512):
* src/cksum_crc.c (cksum_slice8):
* src/cksum_pclmul.c (cksum_pclmul):
* src/cp-hash.c (remember_copied):
* src/numfmt.c (simple_strtod_float):
* src/system.h (x_timestyle_match):
Omit no-op casts.
* src/cp-hash.c (src_to_dest_hash):
* src/dd.c (dd_copy):
* src/df.c (devlist_hash):
* src/env.c (splitbuf_append_byte):
* src/getlimits.c (print_int, main):
* src/ls.c (dev_ino_hash):
* src/truncate.c (do_ftruncate):
Replace casts with compound literals.
* src/factor.c: Ignore -Wuseless-cast, as we include the imported
longlong.h file, which has many of them.
* src/numfmt.c (powerld): 2nd arg is now ptrdiff_t, not int, so
that integers are not silently mishandled in outlandish cases.
2026-05-10 23:42:26 -07:00