Commit Graph
31982 Commits
Author SHA1 Message Date
Sylvestre Ledru e376aa0507 tests: tail: ensure a count is validated even when later overridden
Reported at https://github.com/uutils/coreutils/issues/15997

* tests/tail/tail.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/438
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 42a8f28c00 tests: tail: ensure tail accepts a huge --max-unchanged-stats value
Reported at https://github.com/uutils/coreutils/issues/16007

* tests/tail/tail.pl: Add test case.

Link: https://github.com/coreutils/coreutils/pull/437
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 9fb2a03a63 tests: stat: ensure the last of stat's --printf and --format wins
Reported at https://github.com/uutils/coreutils/issues/15993

* tests/stat/stat-printf.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/436
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 5316d1ec95 tests: rm: ensure -i after -f reports a missing operand
Reported at https://github.com/uutils/coreutils/issues/15994

* tests/rm/f-then-i-no-operand.sh: New test.
* tests/local.mk: Reference the new test.

Link: https://github.com/coreutils/coreutils/pull/435
2026-11-07 12:35:10 +00:00
Sylvestre Ledru fb81c39b38 tests: split: ensure split accepts a leading '+' in the number of chunks
Reported at https://github.com/uutils/coreutils/issues/16006

* tests/split/b-chunk.sh: Add test case.

Link: https://github.com/coreutils/coreutils/pull/434
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 307bdd9441 tests: sort: ensure sort rejects -o combined with --debug
Reported at https://github.com/uutils/coreutils/issues/15998

* tests/sort/sort.pl: Add test case.

Link: https://github.com/coreutils/coreutils/pull/433
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 566aeee281 tests: realpath: ensure realpath -s -e fails on a dangling symlink
Reported at https://github.com/uutils/coreutils/issues/15996

* tests/misc/realpath.sh: Add test case.

Link: https://github.com/coreutils/coreutils/pull/432
2026-11-07 12:35:10 +00:00
Sylvestre Ledru cedefc7896 tests: readlink: ensure the last of readlink's -e, -f and -m wins
Reported at https://github.com/uutils/coreutils/issues/15995

* tests/readlink/can-e.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/431
2026-11-07 12:35:10 +00:00
Sylvestre Ledru bb0ffe17f7 tests: paste: ensure paste names the file in open and read errors
Reported at https://github.com/uutils/coreutils/issues/15983

* tests/paste/paste.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/430
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 30f5713ede tests: od: ensure od rejects an output type combined with --strings
Reported at https://github.com/uutils/coreutils/issues/15989

* tests/od/od.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/429
2026-11-07 12:35:10 +00:00
Sylvestre Ledru d6efb32a53 tests: od: ensure od prints the final offset even when an input fails
Reported at https://github.com/uutils/coreutils/issues/15990

* tests/od/od.pl: Add test case.

Link: https://github.com/coreutils/coreutils/pull/428
2026-11-07 12:35:10 +00:00
Sylvestre Ledru d004eacceb tests: numfmt: ensure unambiguous abbreviations of option values work
Reported at https://github.com/uutils/coreutils/issues/16005

* tests/numfmt/numfmt.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/427
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 5d793a1521 tests: nl: ensure nl accepts negative -v and -i values
Reported at https://github.com/uutils/coreutils/issues/15999

* tests/nl/nl.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/426
2026-11-07 12:35:10 +00:00
Sylvestre Ledru c1265262f9 tests: mkdir, mkfifo: ensure a numeric mode followed by ',' is rejected
Reported at https://github.com/uutils/coreutils/issues/16001

* tests/misc/mknod.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/425
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 68d3c16f99 tests: mkdir: ensure --context takes an optional argument
Reported at https://github.com/uutils/coreutils/issues/16002

* tests/mkdir/context-optional.sh: New test.
* tests/local.mk: Reference the new test.

Link: https://github.com/coreutils/coreutils/pull/424
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 98a6a87701 tests: sum: ensure the last of -r and -s wins
Reported at https://github.com/uutils/coreutils/issues/15986

* tests/cksum/sum.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/423
2026-11-07 12:35:10 +00:00
Sylvestre Ledru e2d537ace6 tests: mkfifo: ensure a -m value starting with '-' is accepted
Reported at https://github.com/uutils/coreutils/issues/16000

* tests/misc/mknod.sh: Add test case.

Link: https://github.com/coreutils/coreutils/pull/422
2026-11-07 12:35:10 +00:00
Sylvestre Ledru c310a8f0e5 tests: cp, ln, mv, install: ensure an empty --backup= acts like --backup
Reported at https://github.com/uutils/coreutils/issues/15988

* tests/misc/empty-backup-suffix.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/421
2026-11-07 12:35:10 +00:00
Sylvestre Ledru ddcabc55b5 tests: ls: ensure --block-size=0 is rejected despite later size options
Reported at https://github.com/uutils/coreutils/issues/16008

* tests/ls/ls-misc.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/420
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 7387195296 tests: ln: ensure --verbose uses '=>' for hard links, '->' for symlinks
Reported at https://github.com/uutils/coreutils/issues/15985

* tests/ln/misc.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/419
2026-11-07 12:35:10 +00:00
Sylvestre Ledru a1974b5605 tests: join: ensure the last of --check-order and --nocheck-order wins
Reported at https://github.com/uutils/coreutils/issues/16004

* tests/join/join.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/418
2026-11-07 12:35:10 +00:00
Sylvestre Ledru d77e262e13 tests: head: ensure a count is validated even when later overridden
Reported at https://github.com/uutils/coreutils/issues/15997

* tests/head/head.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/417
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 9233e94688 tests: expand, unexpand: ensure a bare '-' is treated as standard input
Reported at https://github.com/uutils/coreutils/issues/15658

* tests/expand/expand.pl: Add test case.
* tests/unexpand/unexpand.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/416
2026-11-07 12:35:10 +00:00
Sylvestre Ledru bea11752b3 tests: env: ensure an unset variable on its own adds no argument with -S
Reported at https://github.com/uutils/coreutils/issues/15773

* tests/env/env-S.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/415
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 3c77964c82 tests: env: ensure env -a requires a command
Reported at https://github.com/uutils/coreutils/issues/15991

* tests/env/env.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/414
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 8df8852fdc tests: du: ensure -P after --dereference-args wins
Reported at https://github.com/uutils/coreutils/issues/16003

* tests/du/deref-args.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/413
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 69a724b968 tests: cp: ensure cp rejects --link combined with --symbolic-link
Reported at https://github.com/uutils/coreutils/issues/15987

* tests/cp/link.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/412
2026-11-07 12:35:10 +00:00
Sylvestre Ledru e9de147d5a tests: cksum: ensure an explicit '-' operand is printed as the file name
Reported at https://github.com/uutils/coreutils/issues/15984

* tests/cksum/cksum.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/411
2026-11-07 12:35:10 +00:00
Sylvestre Ledru d1f6125ecf tests: chmod: ensure --reference processes operands in order
Reported at https://github.com/uutils/coreutils/issues/15666

* tests/chmod/reference-order.sh: New test.
* tests/local.mk: Reference the new test.

Link: https://github.com/coreutils/coreutils/pull/410
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 529612a8ae tests: basenc: ensure --base64url decodes input without '=' padding
Reported at https://github.com/uutils/coreutils/issues/15664

* tests/basenc/basenc.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/409
2026-11-07 12:35:10 +00:00
Collin Funk 605a37ee1e shred: quote file names in --verbose output when renaming them
* src/shred.c (wipename): Quote the names of the source and destination
when printing verbose messages for rename. Remove comment about not
needing quoting after the first message, since we still do not control
the contents of any parent directories contained in the source or
destination.
* tests/shred/verbose-quote.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-3UJ1SMSY.
2026-11-06 17:06:42 -08:00
Sylvestre Ledru 6d094859b0 tests: tr: ensure [c*] and [=c=] in string2 are only allowed where valid
Reported at https://github.com/uutils/coreutils/issues/15589

* tests/tr/tr.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/408
2026-11-06 23:55:28 +00:00
Pádraig Brady 67b6801ad3 cksum: use more defensive file name escaping
Similarly to commit v9.10-115-gb3fe24213, which applied
the same quoting mechanism to --check operation,
also quote file names when generating checksums to tty.
This change gives these advantages:

  1. Avoids dumping arbitrary data to vulnerable terminals
  2. Avoids visual deception with ansi codes with unknown file names
  3. More secure if users copy and paste file names from output

* doc/coreutils.texi (sum invocation): Mention the tty quoting
and reference the details from ...
(cksum output modes): Describe the two forms of quoting used.
* tests/misc/tty-quoting.sh: Add test cases.
* NEWS: Mention the improvement.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-Z25BP6MW.
2026-11-06 23:55:00 +00:00
Pádraig Brady f7f73ac1d8 doc: chroot: say --userspec gives no extra security protection
* doc/coreutils.texi (chroot invocation): State that --userspace and
--groups do not provide any real extra protection when working with
untrusted chroots.
2026-11-06 23:55:00 +00:00
Pádraig Brady bc177b4275 chroot: fix supplemental group lookup with --userspec=UID
* src/chroot.c (main): Copy pwd->pw_name as it can be overwritten.
* NEWS: Mention the fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-C8RRA4R8.
2026-11-06 23:54:53 +00:00
Collin Funk 37f04509c9 install: execute 'strip' in the current working directory with -D
* src/install.c (mkancesdirs_safe_wd): Save the current working
directory when using 'strip' on files.
* tests/install/strip-program.sh: Add two test cases.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-CBHGSM1T.
2026-11-05 19:22:08 -08:00
Collin Funk 368ca3629b mv: don't lose ENOENT errors when --exchange is used
This fixes the following error message:

    $ touch a; mv --exchange a b
    mv: cannot exchange 'a' and 'b': Unknown error -1

Here is the error message after this commit:

    $ touch a; ./src/mv --exchange a b
    mv: cannot exchange 'a' and 'b': No such file or directory

* THANKS.in: Add Igor Giamoniano, who reported the bug.
* src/copy.c (copy_internal): Save the EEXIST errno when stat fails,
since renameat would fail for the same reason.
* tests/mv/mv-exchange.sh: Add a few test cases where the bug could be
seen.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/82186
2026-11-05 18:27:53 -08:00
Li Guan fd366bec13 tests: dd: support 4 KiB alignment for direct I/O
Some file systems/device combinations reject 512-byte direct writes
with EINVAL but accept 4 KiB writes.
Try 4 KiB blocks before skipping the direct I/O test.

* tests/dd/direct.sh: Probe 512-byte blocks first and fall back to
4 KiB blocks.  Use the selected input and output block sizes in each
test case, and size the short input to one byte less than a block.

Link: https://github.com/coreutils/coreutils/pull/406
2026-11-05 17:28:27 +00:00
Pádraig Brady 3f01618856 tests: shred: check for chmod race
* tests/shred/chmod-race.sh: Add a new test, which is
the first in the test suite to use strace to STOP a process.
* tests/local.mk: Reference the new test.
2026-11-04 13:04:07 +00:00
Pádraig Brady 38bdf759e3 doc: ls: mention the default output formats in the man page
Also clarify that -C and -1 only output the file name.

* doc/coreutils.texi (General output formatting): Tweak the -C
description to emphasize that only names are output.
* src/ls.c (usage): Clarify that only names are printed with -1 and -C,
and mention which is the default depending on tty output and
which of ls,dir,vdir is in use.

Link: https://github.com/coreutils/coreutils/issues/405
2026-11-04 12:03:43 +00:00
Collin Funk 45cf8a870f maint: fix a license header
This was a mistake in my commit 16a673638 (fold: move multi-byte
character reading to a module, 2025-09-28), which added the file. The
correct license is in the module description and the header file, which
contains the module's implementation.

* gl/lib/mbbuf.c: Change license header to LGPLv2+, matching the
associated header and module description.
2026-11-04 00:13:36 -08:00
Collin Funk 95063b7ddc dircolors: escape history substitution when using csh syntax
* src/dircolors.c (syntax): New global variable.
(append_quoted): Escape '!' if we are using 'csh' syntax to prevent
history substitution.
(main): Remove the syntax variable that was made global.
* tests/misc/dircolors.pl (@Tests): Add a test case.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-SFBDLZ6V.
2026-11-03 22:44:37 -08:00
Collin Funk 7b48dd18cd tests: shred: check the behavior when close fails
* tests/shred/failed-close.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
2026-11-03 20:19:47 -08:00
Collin Funk bfceb45637 shred: fix races with --force and --remove
* src/shred.c (wipefile): When --force or --remove are in use, and the
file is in a subdirectory, open a file descriptor to its parent and
perform operations on the basename relative to it.
(wipename): Add a file descriptor argument to the parent directory. Open
a readable file descriptor to the directory if we need to sync it. Use
the file descriptor with renameatu and unlinkat.
* tests/shred/unlink-race.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the bug fixes.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-O4Q4UVP2.
2026-11-03 20:16:05 -08:00
Pádraig Brady 1704600adc split: make the last specified --{hex,numeric} set the start
Given the FROM argument is interpreted as a different base
for --hex-suffixes and --numeric-suffixes, it makes more
sense for a previous start value to be discarded.

* doc/coreutils.texi: Mention this for --hex-suffixes,
and also mention the FROM argument is interpreted as hex.
* src/split.c (main): Just reset numeric_suffix_start,
and avoid reinterpretation validation.
* tests/split/numeric.sh: Adjust accordingly.
* NEWS: Mention the change in behavior.
2026-11-03 13:28:02 +00:00
Ismail Ramzi a65907555f split: fix out-of-bounds read with --hex-suffixes=FROM
When FROM contained the digits a-f, next_file_name() derived the
suffix index with c - '0', giving values up to 54 for a 16 character
alphabet.  Incrementing the suffix then read past the end of the
alphabet string and used those bytes in the output file names,
e.g., 'split --hex-suffixes=f' created x0f, x0s, x0u.

* src/split.c (next_file_name): Map start value characters through
the suffix alphabet rather than assuming decimal digits.
(main): Reject a start value not valid for the final suffix alphabet,
as can happen with --hex-suffixes=a --numeric-suffixes.
(set_suffix_length): Determine width using base 16 for hex suffixes.
* tests/split/numeric.sh: Add test cases.
* NEWS: Mention the bug fix.

Link: https://github.com/coreutils/coreutils/pull/404
Also discovered by Anthropic's OSS Scanner, as bug ANT-2026-DWADVADP.
2026-11-03 13:28:02 +00:00
Pádraig Brady d8df89c29d tests: fix false failure with spaces in the path
* tests/sort/sort-compress.sh: Quote the found sort exe.
Reported by Bruno Haible.
2026-11-03 13:23:47 +00:00
Collin Funk b3cb553e26 doc: TODO: update note about DoD 5220
* TODO: Mention that the referenced overwriting technique was removed
from NISPOM in 2006, and that it warns against overwriting for some
storage medias.
2026-11-02 16:52:32 -08:00
Pádraig Brady c509ca06d4 seq: fix handling of locale decimal point and upper case hex floats
* src/seq.c (scan_arg): Search for the locale decimal point.
Also handle uppercase 'P' in hex format floats.
(main): Recognize locale decimal point in apparent options.
* tests/seq/seq-locale.sh: Add test cases.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-ERV7HOGN.
2026-11-02 23:43:14 +00:00
Pádraig Brady e85bf8468f seq: ensure termination at floating point limits
* src/seq.c (dump_strings): Rearrange limit checks to
reduce rounding affects.  Also add sanity check on
on the iteration number limit.
* tests/seq/seq-no-progress.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-RI0OLUBX.
2026-11-02 23:42:42 +00:00