Commit Graph
5592 Commits
Author SHA1 Message Date
Collin Funk 54f88c7f2e tests: avoid a false ERROR when using overlayfs
* tests/tail/inotify-rotate-resources.sh: Also skip the test on
overlayfs.
2026-07-25 20:33:06 -07:00
Pádraig Brady 8f7ed6cf50 maint: refactor stat syscall determination
* init.cfg (+get_stat_syscalls_): Refactor from ...
* tests/ls/stat-free-color.sh: ... here.
* tests/ls/stat-free-symlinks.sh: ... here.
* tests/misc/traversal-missing.sh: ... here.
* tests/shred/fifo.sh: .. here.
2026-07-24 13:19:23 +01:00
Pádraig Brady 30866b30e2 chcon,chgrp,chmod,chown,du,ls: ignore missing files while traversing
* src/fts-missing.h: Add helper routines to determine
if an FTS entry is skippable.  I.e., that is traversed
and not specified on the command line.
* src/chcon.c (process_file): Setup to ignore skippable files.
(change_file_context): Ignore missing files if appropriate.
* src/chmod.c (process_file): Setup to ignore skippable files.
Ignore missing files if appropriate.
(mode_changed): Ignore missing files if appropriate.
* src/chown-core.c (change_file_owner): Setup to ignore skippable files.
Ignore missing files if appropriate.
* src/du.c (process_file): Likewise.
* src/ls.c (print_dir): Ignore missing files if appropriate.
(get_link_name): Likewise.
(gobble_file): Likewise.  Also handle the dangling symlink case.
* src/system.h (ignorable_traversal_errno): Match ENOENT for missing
files.
* tests/chcon/traversal-missing.sh: A new test.
* tests/misc/traversal-missing.sh: Likewise.
* tests/local.mk: Reference the new tests.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/81444
2026-07-24 13:19:23 +01:00
Collin Funk 6e812858bb tests: date: check that weekdays are ignored when given an explicit date
* tests/date/date.pl: Add some test cases.
* tests/date/date-debug.sh: Test the debug output for this case.
2026-07-22 21:52:56 -07:00
Collin Funk 2db599e8b0 tests: wc: test -m in single byte and multi byte locales
* tests/wc/wc.pl ($mb_locale, $single_byte_locale): New variables.
(@mbTests): Add some test cases.
2026-07-22 18:52:55 -07:00
Collin Funk 8bc9a81246 tests: paste: check the delimiter is reset for each file when -s is used
* tests/paste/paste.pl (@Tests): Add a test case.
2026-07-17 21:56:36 -07:00
Pádraig Brady dbed169835 tests: use more robust cleanup of immutable files
* tests/rm/empty-immutable-skip.sh: Use cleanup_() to
remove the immutable attribute, so that false failures
or stale files do not result from e.g. a killed test run.
2026-07-16 12:28:07 +01:00
Mateusz Nosek b4bc8f361b install: avoid redundant metadata updates with -C
"install -C" (--compare) has always called chown/chmod on the
destination even after determining that copying was unnecessary,
ever since --compare was added in commit v7.0-182-gdac5f12c6.
need_copy() already verifies that the destination's mode, owner, and
group match (and, with --preserve-context, that the SELinux context
matches too) before skipping the copy, so re-applying them is
redundant, and can needlessly fail on a destination that cannot be
chown/chmod'd even though nothing would actually change, e.g. one
marked immutable with chattr +i.

* src/install.c (install_file_in_file): Skip metadata updates
if we already skipped the data, as previous checks ensure
that the metadata is already as required.
* tests/install/install-C-immutable.sh: Add a test.
(based on tests/rm/empty-immutable-skip.sh).
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
2026-07-16 12:28:03 +01:00
Pádraig Brady c279e1557a tests: dd: fix false failure on NetBSD
* tests/cat/cat-distinct-err.sh: /proc/self/mem fails with EINVAL
on NetBSD, so extract the error from dd for comparison.
Reported by Bruno Haible.
2026-07-14 12:07:07 +01:00
Collin Funk fe186925c7 tests: join: test the behavior when given multiple -e options
* tests/join/join.pl (@tv): Add two test cases.
2026-07-13 22:38:03 -07:00
Pádraig Brady 2653c5c5e2 tests: dd: ensure nocache flag does not fail with pipes
* tests/dd/nocache.sh: Whether fadvise() is called (uutils)
or avoided (GNU), ensure there is no failure when nocache
is only the ancillary operation being requested.

Link: https://github.com/coreutils/coreutils/pull/276
2026-07-13 17:55:26 +01:00
oech3 a4ecf6cd2f tests: cat: extract checks for distinct read/write errors
* tests/cat/splice.sh: Move read/error distinction test to ...
* tests/cat/cat-distinct-err.sh: ... here, and augment.
* tests/local.mk: Reference the new file.
2026-07-13 17:32:39 +01:00
Sylvestre Ledru fb631c3e6d tests: cut: check byte-wise -c and -b -n in the C locale
* tests/cut/cut.pl: Add cases verifying that in the C locale -c and
-b -n select a single byte instead of decoding a multi-byte sequence.

Link: https://github.com/coreutils/coreutils/pull/316
2026-07-11 09:21:02 +01:00
Guanqiang Han 9342ddbd71 pr: guard input position update against overflow
* src/pr.c (char_to_clump): Use ckd_add() and report integer overflow.
* tests/pr/options.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/81393
2026-07-10 22:19:46 +01:00
Pádraig Brady 36d1a194a9 factor: avoid out-of-bounds prime table access
With an ASAN build we can trigger the issue like:

  $ src/factor 22486472939460651857
  src/factor.c:888:36: runtime error:
  index 675 out of bounds for type 'int_least16_t [675]'

* src/factor.c (factor_using_division): Guard the final unrolled block
before reading a subsequent prime.
* tests/factor/factor.pl: Add a test case.
* NEWS: Mention the bug fix.
Problem caught by Coverity analysis.
2026-07-10 12:12:41 +01:00
Sylvestre Ledru 68f15d9128 tests: numfmt: check --header does not swallow a following operand
* tests/numfmt/numfmt.pl (header-10): New test verifying that --header,
which only accepts an argument via '=', does not consume a following
operand as its value.
https://github.com/uutils/coreutils/pull/13273

Link: https://github.com/coreutils/coreutils/pull/312
2026-07-06 14:25:59 +01:00
Sylvestre Ledru 440fe62502 tests: ls: check that an invalid --tabsize is diagnosed
* tests/ls/ls-misc.pl: Add tests, generated by a loop over invalid
values, verifying that a negative (-9), non-numeric (zz), or
fractional (0.5) --tabsize argument is rejected with
"invalid tab size" and exit status 2.
https://github.com/uutils/coreutils/pull/13278

Link: https://github.com/coreutils/coreutils/pull/311
2026-07-06 14:23:58 +01:00
Collin Funk 165b62de80 du: treat negative --max-depth values as errors
* NEWS: Mention the bug fix.
* src/du.c (main): Prefer ckd_add to check for overflow. Emit an error
if the value is negative.
* tests/du/max-depth.sh: Add a test case for the bug.
2026-07-03 20:29:48 -07:00
oech3 a463a6e6ee tests: nproc: support referencing of external command
* tests/nproc/nproc-quota.sh: Use command -v nproc instead of
$abs_top_builddir for external usage of tests.
Also quote "$nproc" usage, to support spaces in path.

Link: https://github.com/coreutils/coreutils/pull/310
2026-07-03 10:51:57 +01:00
Pádraig Brady d73d2d1b31 tests: nproc: support more general syscall injection
* tests/nproc/nproc-quota.sh: Prefer strace to LD_PRELOAD,
as it's simpler and supports static executables.
https://github.com/coreutils/coreutils/issues/309
2026-07-02 11:21:47 +01:00
Pádraig Brady e45a3f6a19 tests: avoid false failure where mknod() can't create sockets
* tests/mv/mv-special-1.sh: Adjust the python probe to more
closely match how copy.c creates sockets, as otherwise we
get a false failure on systems where mknod() fails with S_IFSOCK,
which was seen on Solaris and FreeBSD at least.
* tests/mv/mv-special-2.sh: Adjust similarly as this
was a latent issue on this root only test.
Reported by Bruno Haible.
2026-07-02 00:58:18 +01:00
Collin Funk 4c234d7555 tests: csplit: avoid a false failure on NetBSD
* tests/csplit/csplit.sh: Don't run the test if calling read on a
directory file descriptor works.
Reported by Bruno Haible.
2026-06-30 20:04:10 -07:00
Pádraig Brady d2428b1f26 tests: mv: check cross-fs replacement with special files
* tests/mv/mv-special-1.sh: Moving a socket onto an existing file
on another file system must replace that file, and not for example
unlink the destination first and then fail, leaving the user
with neither file.

Link: https://github.com/coreutils/coreutils/pull/303
2026-06-30 19:04:23 +01:00
Sylvestre Ledru 970548101e tests: shuf: check -o output is preserved when the run fails
A failed shuf invocation should leave an existing output file untouched
rather than truncating it before the failure is detected.
* tests/shuf/shuf.sh: Verify that a missing input file or an unreadable
random source leaves an existing -o file unchanged.

Link: https://github.com/coreutils/coreutils/pull/304
2026-06-30 18:26:51 +01:00
Sylvestre Ledru 7dd7fd17b9 tests: ls: check C1 control char escaping in UTF-8 quoting
* tests/ls/quoting-utf8.sh: A non-ASCII C1 control character (U+0085
NEL) is not printable, so locale/clocale quoting must octal-escape its
bytes (\302\205) rather than emit them literally.  Add a file named
with U+0085 and verify the escaped form for both styles.
gap identified here: https://github.com/uutils/coreutils/pull/13150

Link: https://github.com/coreutils/coreutils/pull/306
2026-06-30 18:21:36 +01:00
Sylvestre Ledru 9502f05a30 tests: realpath: a trailing slash must not require read permission
A trailing slash only asserts that the operand is a directory.  That
is a stat-level check, needing search permission on the parent, not
read permission on the directory itself.
* tests/misc/realpath.sh: Check that a searchable but unreadable
directory still resolves with a trailing slash, with and without -e.

Link: https://github.com/coreutils/coreutils/pull/307
2026-06-30 16:27:15 +01:00
Sylvestre Ledru 0eb2fff613 tests: cp: --remove-destination must honor the same-file check
* tests/cp/same-file.sh: A different spelling of the same path
('foo' vs './foo') must still be detected as the same file, so
--remove-destination refuses instead of unlinking the source.

Link: https://github.com/coreutils/coreutils/pull/302
2026-06-29 20:42:59 +01:00
Collin Funk 52ff9b97fb uniq: avoid locking standard output when printing line counts with -c
This increases throughput on systems with unlocked stdio functions.
E.g., 2.5x in the following case:

    $ timeout 1m taskset 1 shuf -r -i 0-100 \
        | taskset 2 uniq -c \
        | taskset 3 pv -r > /dev/null
    [ 100MiB/s]
    $ timeout 1m taskset 1 shuf -r -i 0-100 \
        | taskset 2 uniq -c \
        | taskset 3 pv -r > /dev/null
    [ 246MiB/s]

* src/uniq.c: Include assure.h.
(writeline): Convert the value to a string by hand and use fwrite, which
may be unlocked, instead of printf.
* tests/uniq/uniq-c-width.sh: New test to verify the padding logic.
* tests/local.mk (all_tests): Add the test case.
* NEWS: Mention the improvement.
2026-06-28 19:44:00 -07:00
Collin Funk d7622d8629 tests: csplit: also test a read failure without -k
* tests/csplit/csplit.sh: Adjust the test case added by the previous
commit to also run without the -k option.
2026-06-27 16:14:34 -07:00
Collin Funk cd381f4afd tests: csplit: check for message to standard output after read fails
* tests/csplit/csplit.sh: Add a test case.
2026-06-27 12:48:19 -07:00
Collin Funk 57fe9ecd69 tests: dd: check that files are opened with O_TRUNC
* tests/dd/misc.sh: Add the test case.
2026-06-24 21:08:33 -07:00
Collin Funk 17e6bfcc2b tests: date: remove a non-portable test
This test failure was seen on FreeBSD, NetBSD, and OpenBSD.

* tests/date/date-tz.sh: Remove the test case.
Reported by Bruno Haible.
2026-06-23 18:26:21 -07:00
Collin Funk 05d237cc56 tests: sort: check that invalid --parallel arguments are diagnosed
* tests/sort/sort.pl (@Tests): Add a few test cases.
2026-06-21 19:11:51 -07:00
aizu-m 6a850b9aac wc: fix out-of-bounds read for single-byte wide characters
In legacy CJK locales a single input byte can decode to a wide character
above UCHAR_MAX, e.g. SHIFT-JIS bytes 0xA1..0xDF become U+FF61..U+FF9F.
wc then indexed its 256-entry wc_isprint/wc_isspace tables with that
value and read past their end.
* src/wc.c (wc): Take the byte-indexed fast path only when the decoded
character fits in a byte; wider values fall through to c32width and
c32isspace.
* tests/wc/wc-sjis.sh: New test.
* tests/local.mk (all_tests): Add it.
* NEWS: Mention the fix.

Link: https://github.com/coreutils/coreutils/pull/298
2026-06-19 15:39:10 +01:00
Collin Funk 04b757da79 tests: cp,install,mv: check for data loss with just-created files
* tests/misc/just-created.sh: New file.
* tests/local.mk (all_tests): Add the test case.
2026-06-18 19:31:39 -07:00
Pádraig Brady 144287129e tests: nproc: ensure affinity mask is independent of scheduler
* tests/nproc/nproc-quota-systemd.sh: Check affinity mask with
various schedulers.
https://github.com/coreutils/coreutils/pull/291
2026-06-18 16:35:17 +01:00
oech3 19fb2a9aa3 tests: nproc: ensure OMP_NUM_THREADS overflow is clamped
* tests/nproc/nproc-override.sh: Test overflowed OMP_NUM_THREADS.
https://github.com/coreutils/coreutils/pull/292
2026-06-18 16:15:26 +01:00
oech3 196956dff9 tests: nproc: ensure --ignore clamps overflowed num
* tests/nproc/nproc-positive.sh: Test --ignore overflowed num
is clamped to $UINTMAX_MAX.
https://github.com/coreutils/coreutils/pull/293
2026-06-18 15:50:45 +01:00
Pádraig Brady 5800d91721 tests: nproc: ensure scheduler and OMP_NUM_THREADS are independent
* tests/nproc/nproc-quota-systemd.sh: Explicitly set OMP_NUM_THREADS
to an ignorable value, to ensure scheduler processing is independent.
* tests/nproc/nproc-quota.sh: Likewise for the SCHED_FIFO check.
https://github.com/coreutils/coreutils/pull/290
2026-06-18 15:38:18 +01:00
oech3 c5d2f42c43 tests: split: ensure no files created with no input
* tests/split/split-io-err.sh: Ensure 'xaa' is not opened/created
with empty input.
https://github.com/coreutils/coreutils/pull/297
2026-06-18 14:20:35 +01:00
Collin Funk da1d289554 tests: date: test -d with only a minus sign
* tests/date/date.pl (@Tests): Add the test case.
2026-06-16 20:20:36 -07:00
oech3 bd649cca23 tests: nice: add test for --adjustment long option
* tests/nice/nice.sh: Ensure (abbreviated) long option is supported.
https://github.com/coreutils/coreutils/pull/296
2026-06-16 18:48:15 +01:00
Collin Funk fa1ad3fa07 tests: split: avoid a false failure when ulimit fails
* tests/split/suffix-length.sh: Don't fail the test case if ulimit
fails.
Reported by Bruno Haible.
2026-06-15 22:06:22 -07:00
Collin Funk 16d292f065 tests: test: test numeric operators with -l STRING
* tests/test/test.pl (@Tests): Add a few test cases.
2026-06-14 22:50:50 -07:00
Collin Funk efeac27389 tests: date: test time zone format strings with space padding
* tests/date/date.pl (@Tests): Add a few test cases.
2026-06-14 16:19:06 -07:00
Collin Funk 60f342dc97 build: update gnulib submodule to latest
This imports a xstrtol-error change from Gnulib that fixes some error
messages that were not properly escaped when given an invalid integer
argument.

* .gitignore: Add /lib/thread-creators.h which is generated by Gnulib.
* gnulib: Update to the latest commit.
* tests/od/od.pl (@Tests): Add some test cases.
* NEWS: Mention the improvement.
2026-06-14 15:20:26 -07:00
Collin Funk 2a7d111818 tests: date: test that multiple time zone abbreviations cause an error
* tests/date/date.pl (@Tests): Add two test cases.
2026-06-14 11:15:03 -07:00
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