1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-05-31 06:46:37 +02:00

31525 Commits

Author SHA1 Message Date
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
Collin Funk f77f365ef5 shred: don't block when opening FIFOs with no readers
* NEWS: Mention the bug fix.
* src/shred.c (wipefile): Open the file with O_NONBLOCK.
* tests/shred/fifo.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-05-10 13:45:44 -07:00
Pádraig Brady ab18e90e8b doc: help2man: preserve layout of tables
This is useful in many man pages like date , dd, od, tr, ...
where there are tables presented, where extraneous lines
between each entry are best avoided.

* man/help2man: Use .PD 0 (Paragraph Distance)
to avoid extraneous blank lines within .TP delineated tables.
Also use explicit widths with .TP in such tables,
to preserve the alignment from the --help output.
2026-05-09 17:47:47 +01:00
Pádraig Brady 77cf018777 doc: date: group format sequences by function
* src/date.c (usage): Grouping alphabetically is less useful.
Suggested by Bruno Haible.
2026-05-09 17:47:47 +01:00
Pádraig Brady 2320df8fd6 doc: date: show examples for format sequences in --help
* src/date.c (usage): Show example to aid scanning
of format sequences.
2026-05-08 20:12:46 +01:00
Collin Funk ebe2b7513e shuf: prefer fwrite over fputs and fputc
On an AMD Ryzen 7 3700X running GNU/Linux:

    $ timeout 30 taskset 1 ./src/shuf-prev \
        -r -i 1000000-1000000 | pv -r > /dev/null
    [ 302MiB/s]
    $ timeout 30 taskset 1 ./src/shuf \
        -r -i 1000000-1000000 | pv -r > /dev/null
    [ 434MiB/s]

* src/shuf.c (print_number): New function.
(write_permuted_numbers, write_random_numbers): Use it.
* tests/shuf/shuf.sh: Add a test case to run 'shuf -i' with varying
numbers of digits to check that the string conversion is correct.
2026-05-07 23:32:52 -07:00
Collin Funk cab1d4bfbd tests: head: test 'head -n 0' and 'head -c 0' open files for reading
* tests/head/head-n0.sh: New file.
* tests/local.mk: Add the new test case.
2026-05-05 21:40:35 -07:00
Sylvestre Ledru d719413160 tests: ls: verify correct alignment with ACLs
* tests/ls/acl.sh: Check that the gap between the '+' indicator and
the link count is the same whether the listing contains one or
several ACL entries.
https://github.com/coreutils/coreutils/pull/251
2026-05-05 15:33:55 +01:00
Pádraig Brady e636811481 ls: exclude newline from consideration in line width
* src/ls.c (calculate_columns): Treat width as inclusive max.
(print_with_separator): Likewise.  Also handle commas explicitly,
since they're not catered for by an implicit newline in the count.
* tests/ls/w-option.sh: Adjust exact-fit column tests.
Note this change also makes the existing `ls -w4 -x -T0 a b` test
behave consistently with other output width limits.
Also add the test case from:
https://github.com/coreutils/coreutils/pull/213
* tests/ls/m-option.sh: Add a test case to ensure appropriate
wrapping when trailing comma at the line limit.
* NEWS: Mention the change in behavior.
2026-05-04 23:58:12 +01:00
Pádraig Brady 13b8c11275 ls: fix too few display columns edge case
In the edge case where the right most column would
consist of only files taking 1 or 2 cells, we accounted
for 3 cells, which would result in using 1 column too few.
This should have been part of commit v8.24-59-ge71be1292

* src/ls.c (init_column_info): Don't account for separator
in the the final column.
* tests/ls/w-option.sh: Add a test case.
2026-05-04 23:57:48 +01:00
Pádraig Brady dce828c3d6 tests: fix false failure with spaces in hierarchy
* tests/sort/sort-buffer-size.sh: Use `pwd` rather than $PWD,
and quote appropriately.
Reported by Bruno Haible.
2026-05-04 23:38:51 +01:00
Pádraig Brady a0b4ac0fa2 tests: tee: ensure tee is non buffered
* tests/tee/tee.sh: tests/misc/responsive.sh only confirms
responsiveness to lines, so add a test for non line terminated.
https://github.com/coreutils/coreutils/pull/259
2026-05-03 11:31:27 +01:00
Pádraig Brady b130ed810e doc: fix typo in chmod example
* doc/coreutils.texi (chmod invocation): s/file/foo/ to match comment,
and previous example.
2026-05-03 10:40:31 +01:00
Collin Funk 3f650f6924 tests: all: ensure closed stdin is handled appropriately
* tests/misc/close-stdin.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-05-02 14:23:11 -07:00
Pádraig Brady db0faabe1d doc: reference detailed "numeric mode" info from chmod.1
Note were links are not supported (like on Solaris or FreeBSD),
the text still displays normally.

* man/chmod.x: Link from "numeric mode" in chmod man page,
to more detailed online info.
2026-05-02 13:35:57 +01:00
Pádraig Brady 380dc99297 build: fix compilation error on Alpine Linux and OpenBSD
* gl/lib/mbbuf.h: Define MBBUF_EOF in terms of MCEL_CHAR_MAX,
rather than depending on the stdint module.
Reported by Bruno Haible.
2026-05-01 13:50:36 +01:00
Collin Funk 2de1a28bcf sum,cksum: consistently emit detailed write errors
Previously the string from strerror would only be printed for some
algorithms:

    $ cksum -a sha2 -l 256 /dev/null > /dev/full
    cksum: write error: No space left on device
    $ cksum -a sysv /dev/null > /dev/full
    cksum: write error

This patch fixes it so that the error information is always printed:

    $ ./src/cksum -a sha2 -l 256 /dev/null > /dev/full
    cksum: write error: No space left on device
    $ ./src/cksum -a sysv /dev/null > /dev/full
    cksum: write error: No space left on device

* src/cksum.c (output_file): Don't check for a write error here.
(main): Check for it here instead.
* tests/misc/io-errors.sh: Add a 'cksum' invocation for each supported
algorithm.
https://github.com/coreutils/coreutils/issues/258
2026-04-30 17:59:38 -07:00
Max Downey Twiss 578b2cd375 test: adjust -g description in --help
This matches the manual, as well as the -u option,
and should help reduce confusion.

* src/test.c (usage): Fix -g documentation to match the structure of -u
2026-04-30 14:51:23 +01:00
Pádraig Brady b60a159fdc unexpand: fix heap overflow
* src/unexpand.c (unexpand): Use xinmalloc() to gracefully
handle overflow.  Also use the runtime locale specific MB_CUR_MAX
rather than the worst case MB_LEN_MAX.
* tests/unexpand/mb.sh: Add a test case that fails in a default
glibc build with either MB_CUR_MAX or MB_LEN_MAX.
* NEWS: Mention the bug fix.
Reported by Michał Majchrowicz.
2026-04-29 13:16:43 +01:00
Pádraig Brady 00cd91288c unexpand: consolidate error messages
* src/unexpand.c (main): Use the same error
as in parse_tab_stops().
2026-04-29 13:16:21 +01:00