summaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorLines
4 daysdd: always diagnose partial writes on write failurePádraig Brady-0/+38
* src/dd.c (dd_copy): Increment the partial write count upon failure. * tests/dd/partial-write.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/80583
6 daystests: rm: check for hints when running 'rm -foo'Collin Funk-0/+54
* tests/rm/dash-hint.sh: New file. * tests/local.mk (all_tests): Add the new test.
6 daysyes: use a zero-copy implementation via (vm)splicePádraig Brady-0/+20
A good reference for the concepts used here is: https://mazzo.li/posts/fast-pipes.html We don't consider huge pages or busy loops here, but use vmsplice(), and splice() to get significant speedups: i7-5600U-laptop $ taskset 1 yes | taskset 2 pv > /dev/null ... [4.98GiB/s] i7-5600U-laptop $ taskset 1 src/yes | taskset 2 pv > /dev/null ... [34.1GiB/s] IBM,9043-MRX $ taskset 1 yes | taskset 2 pv > /dev/null ... [11.6GiB/s] IBM,9043-MRX $ taskset 1 src/yes | taskset 2 pv > /dev/null ... [175GiB/s] Also throughput to file (on BTRFS) was seen to increase significantly. With a Fedora 43 laptop improving from 690MiB/s to 1.1GiB/s. * bootstrap.conf: Ensure sys/uio.h is present. This was an existing transitive dependency. * m4/jm-macros.m4: Define HAVE_SPLICE appropriately. We assume vmsplice() is available if splice() is as they were introduced at the same time to Linux and glibc. * src/yes.c (repeat_pattern): A new function to efficiently duplicate a pattern in a buffer with memcpy calls that double in size. This also makes the setup for the existing write() path more efficient. (pipe_splice_size): A new function to increase the kernel pipe buffer if possible, and use an appropriately sized buffer based on that (25%). (splice_write): A new function to call vmplice() when outputting to a pipe, and also splice() if outputting to a non-pipe. * tests/misc/yes.sh: Verify the non-pipe output case, (main): Adjust to always calling write on the minimal buffer first, then trying vmsplice(), then falling back to write from bigger buffer. and the vmsplice() fallback to write() case. * NEWS: Mention the improvement.
7 daystests: expand: fix false failure on various systemsPádraig Brady-3/+5
* tests/expand/mb.sh: Use $LOCALE_FR_UTF8 rather than hardcoding "en_US.UTF-8". * tests/unexpand/mb.sh: Likewise. Reported by Bruno Haible.
9 daysexpand,unexpand: support multi-byte inputLukáš Zaoral-0/+336
* src/expand.c: Use mbbuf to support multi-byte input. * src/unexpand.c: Likewise. * tests/expand/mb.sh: New multi-byte test. * tests/unexpand/mb.sh: Likewise. * tests/local.mk: Reference new tests. * NEWS: Mention the improvement.
12 daysinstall: allow the combination of --compare and --preserve-timestampsCollin Funk-2/+26
* NEWS: Mention the improvement. * src/install.c (enum copy_status): New type to let the caller know if the copy was performed or skipped. (copy_file): Return the new type instead of bool. Reduce variable scope. (install_file_in_file): Only strip the file if the copy was performed. Update the timestamps if the copy was skipped. (main): Don't error when --compare and --preserve-timestamps are combined. * tests/install/install-C.sh: Add some test cases.
12 dayscksum: use more defensive escaping for --checkPádraig Brady-2/+2
cksum --check is often the first interaction users have with possibly untrusted downloads, so we should try to be as defensive as possible when processing it. Specifically we currently only escape \n characters in file names presented in checksum files being parsed with cksum --check. This gives some possibilty of dumping arbitrary data to the terminal when checking downloads from an untrusted source. This change gives these advantages: 1. Avoids dumping arbitrary data to vulnerable terminals 2. Avoids visual deception with ansi codes hiding checksum failures 3. More secure if users copy and paste file names from --check output 4. Simplifies programmatic parsing Note this changes programmatic parsing, but given the original format was so awkward to parse, I expect that's extremely rare. I was not able to find example in the wild at least. To parse the new format from from shell, you can do something like: cksum -c checksums | while IFS= read -r line; do case $line in *': FAILED') filename=$(eval "printf '%s' ${line%: FAILED}") cp -v "$filename" /quarantine ;; esac done This change also slightly reduces the size of the sum(1) utility. This change also apples to md5sum, sha*sum, and b2sum. * src/cksum.c (digest_check): Call quotef() instead of cksum(1) specific quoting. * tests/cksum/md5sum-bsd.sh: Adjust accordingly. * doc/coreutils.texi (cksum general options): Describe the shell quoting used for problematic file names. * NEWS: Mention the change in behavior. Reported by: Aaron Rainbolt
12 daysmaint: tests: refactor uses of bad_unicode()Pádraig Brady-8/+2
* init.cfg: Use 0xFF rather than 0xC3 everywhere. * tests/fold/fold-characters.sh: Reuse bad_unicode(). * tests/tac/tac-locale.sh: Likewise.
12 daysfold: fix output truncation with 0xFF bytes in inputPádraig Brady-4/+5
On signed char platforms, 0xFF was converted to -1 which matches MBBUF_EOF, causing fold to stop processing. * NEWS: Mention the bug fix. * gl/lib/mbbuf.h: Avoid sign extension on signed char platforms. * tests/fold/fold-characters.sh: Adjust test case. Reported at https://src.fedoraproject.org/rpms/coreutils/pull-request/20
12 daystests: date: add timezone conversion testSylvestre Ledru-0/+4
*tests/date/date.pl: Add the test case. Add test case for https://github.com/uutils/coreutils/issues/10800 to verify `date -u -d '10:30 UTC-05'` converts to 15:30 UTC.
12 daystests: date: add edge cases for modifiersSylvestre Ledru-0/+17
* tests/date/date.pl: Add the test case. Add test cases for https://github.com/uutils/coreutils/issues/10957
12 daystests: cut: add test case for newline delimiter with -s flagSylvestre Ledru-0/+3
* tests/cut/cut.pl: Add a new test case. https://github.com/coreutils/coreutils/pull/211
13 daystests: mktemp: ensure mktemp does not depend on getrandom and ASLRoech3-0/+34
* tests/mktemp/mktemp-misc.sh: Add new test. * tests/local.mk: Reference new test. https://github.com/coreutils/coreutils/pull/206
13 daysmaint: tests: decouple debug output determinationPádraig Brady-14/+3
* tests/misc/warning-errors.sh: Simply check there is output to stderr before checking that output induces an error.
13 daystests: avoid false test failure when using address sanitizerCollin Funk-0/+3
* tests/misc/warning-errors.sh: Skip commands which have been built with sanitizers, since standard error will not be closed and checked for errors. Reported by Bruno Haible.
14 daystests: avoid failure on systems without an optimized 'cksum' or 'wc -l'Collin Funk-0/+10
* tests/misc/warning-errors.sh: Expect 'wc' and 'cksum' to exit successfully if there is not an optimized 'wc -l' implementation or CRC32 implementation. Reported by Bruno Haible.
2026-03-02tests: shuf: ensure memory exhaustion is handled gracefullyoech3-0/+5
* tests/shuf/shuf.sh: Ensure we exit 1 upon failure to allocate memory. https://github.com/uutils/coreutils/issues/11170 https://github.com/coreutils/coreutils/pull/209
2026-03-02test: cp: add test for non-UTF8 directory namesSylvestre Ledru-0/+48
Missing test identified here: https://github.com/uutils/coreutils/pull/11148 * tests/cp/non-utf8-name.sh: Add a new test to cover this case. https://github.com/coreutils/coreutils/pull/207
2026-02-28tests: wc,du: add additional --files0-from test casesCollin Funk-4/+29
* tests/wc/wc-files0-from.pl ($limits): New variable. (@Tests): Prefer the error strings from getlimits over writing them by hand. Add test cases for --files0-from listing missing files and duplicate files. * tests/du/files0-from.pl ($limits): New variable. (@Tests): Prefer the error strings from getlimits over writing them by hand. Add test cases for --files0-from listing missing files. Add tests for --files0-from listing duplicate files with and without the -l option also in use.
2026-02-28tests: ls: treat invalid UTF-8 paths starting with a dot as hiddenSylvestre Ledru-0/+61
* tests/ls/non-utf8-hidden.sh: Add the test case. https://github.com/uutils/coreutils/pull/11135 https://github.com/coreutils/coreutils/pull/202
2026-02-28tests: ln: verify that -f and -i override each otherSylvestre Ledru-0/+21
Identified here: <https://github.com/uutils/coreutils/pull/11129> * tests/ln/misc.sh: Add the check. https://github.com/coreutils/coreutils/pull/199
2026-02-28test: ln: verify backup suffix path traversal preventionSylvestre Ledru-0/+66
missing test detected thanks to: https://github.com/uutils/coreutils/pull/11149 * tests/ln/backup-suffix-traversal.sh: Add a test. https://github.com/coreutils/coreutils/pull/208
2026-02-28maint: fix typo in previous testPádraig Brady-1/+1
* tests/shuf/shuf.sh: Use non varying $ret rather than $?
2026-02-28tests: shuf: ensure we handle unsupported getrandom syscall gracefullyoech3-0/+6
* tests/shuf/shuf.sh: Check we fail normally or succeed where the getrandom syscall is not available. https://github.com/coreutils/coreutils/pull/205
2026-02-27stat: handle %%%N tooPaul Eggert-3/+3
* src/stat.c (main): Fix incorrect counting of '%'s before 'N'. * tests/stat/stat-fmt.sh: Test for the bug.
2026-02-26stat: don't check QUOTING_STYLE when --printf %%N is usedCollin Funk-0/+30
* NEWS: Mention the fix. * src/stat.c (main): Only check QUOTING_STYLE if there is a %N that is not preceded by a percentage sign. * tests/stat/stat-fmt.sh: Add some test cases.
2026-02-26id: promptly diagnose write errorsCollin Funk-0/+1
* NEWS: Mention the improvement. * src/id.c (print_stuff): Call fflush for each listed user to check for write errors. * tests/misc/io-errors.sh: Add an invocation of 'id'.
2026-02-26groups: promptly diagnose write errorsCollin Funk-0/+1
* NEWS: Mention the improvement. * src/groups.c (main): Call fflush for each listed user to check for write errors. * tests/misc/io-errors.sh: Add an invocation of 'groups'.
2026-02-26tests: ensure failure to write warnings is handled gracefullyPádraig Brady-0/+64
* tests/misc/warning-errors.sh: Add a new test to ensure failure to write warnings is diagnosed in the exit status. * tests/local.mk: Reference the new test.
2026-02-26tests: shuf: ensure randomization doesn't depend solely on ASLRoech3-0/+6
* tests/shuf/shuf.sh: Use setarch --addr-no-randomize to disable ASLR, and show the output is still random. https://github.com/coreutils/coreutils/pull/198
2026-02-26maint: fix description of tests/misc/io-errors.shPádraig Brady-1/+1
* tests/misc/io-errors.sh: Promptness is checked in write-errors.sh, not this test.
2026-02-25tests: nice: ensure a particular adjustment is disallowedoech3-0/+1
* tests/nice/nice-fail.sh: Ensure "1+2-3" is disallowed. https://github.com/coreutils/coreutils/pull/197
2026-02-25tests: factor,numfmt: verify embedded NUL handlingPádraig Brady-3/+25
* tests/factor/factor.pl: Verify that embedded NULs on stdin terminate the _number_. * tests/numfmt/numfmt.p: Verify that embedded NULs on stdin terminate the _line_. https://github.com/coreutils/coreutils/pull/196
2026-02-24tests: fix "Hangup" termination of non-interactive runsPádraig Brady-5/+16
This avoids the test harness being terminated like: make[1]: *** [Makefile:24419: check-recursive] Hangup make[3]: *** [Makefile:24668: check-TESTS] Hangup make: *** [Makefile:24922: check] Hangup make[2]: *** [Makefile:24920: check-am] Hangup make[4]: *** [Makefile:24685: tests/misc/usage_vs_refs.log] Error 129 ... This happened sometimes when the tests were being run non interactively. For example when run like: setsid make TESTS="tests/timeout/timeout.sh \ tests/tail/overlay-headers.sh" SUBDIRS=. -j2 check Note the race window can be made bigger by adding a sleep after tail is stopped in overlay-headers.sh The race can trigger the kernel to induce its job control mechanism to prevent stuck processes. I.e. where it sends SIGHUP + SIGCONT to a process group when it determines that group may become orphaned, and there are stopped processes in that group. * tests/tail/overlay-headers.sh: Use setsid(1) to keep the stopped tail process in a separate process group, thus avoiding any kernel job control protection mechanism. * tests/timeout/timeout.sh: Use setsid(1) to avoid the kernel checking the main process group when sleep(1) is reparented. Fixes https://bugs.gnu.org/80477
2026-02-23tests: whoami, logname: verify error handlingoech3-1/+33
* tests/df/no-mtab-status-masked-proc.sh: Tweak unshare check. * tests/local.mk: Reference new test. * tests/misc/user.sh: Add new test using unshare -U, to verify that whoami and logname diagnose failure correctly. https://github.com/coreutils/coreutils/pull/195
2026-02-21tests: shuf: check that write errors are promptly diagnosedCollin Funk-0/+1
* tests/misc/write-errors.sh: Add a shuf invocation that would run forever if write errors weren't diagnosed.
2026-02-20tests: chmod: test that chmod(2) is always calledCollin Funk-0/+32
* tests/chmod/only-op.sh: New file. * tests/local.mk (all_test): Add the new test.
2026-02-19maint: tests: DRY a recent changePádraig Brady-7/+4
* tests/pwd/pwd-long.sh: Adjust so complicated command is not repeated.
2026-02-18wc: add aarch64 Neon optimization for wc -lCollin Funk-2/+2
Here is an example of the performance improvement: $ yes abcdefghijklmnopqrstuvwxyz | head -n 100000000 > input $ time ./src/wc-prev -l < input 100000000 real 0m0.793s user 0m0.630s sys 0m0.162s $ time ./src/wc -l < input 100000000 real 0m0.230s user 0m0.065s sys 0m0.164s * NEWS: Mention the performance improvement. * gnulib: Update to the latest commit. * configure.ac: Check the the necessary intrinsics and functions. * src/local.mk (noinst_LIBRARIES) [USE_NEON_WC_LINECOUNT]: Add src/libwc_neon.a. (src_libwc_neon_a_SOURCES, wc_neon_ldadd, src_libwc_neon_a_CFLAGS) [USE_NEON_WC_LINECOUNT]: New variables. (src_wc_LDADD) [USE_NEON_WC_LINECOUNT]: Add $(wc_neon_ldadd). * src/wc.c [USE_NEON_WC_LINECOUNT]: Include sys/auxv.h and asm/hwcap.h. (neon_supported) [USE_NEON_WC_LINECOUNT]: New function. (wc_lines) [USE_NEON_WC_LINECOUNT]: Use neon_supported and wc_lines_neon. * src/wc.h (wc_lines_neon): Add declaration. * src/wc_neon.c: New file. * doc/coreutils.texi (Hardware Acceleration): Document the "-ASIMD" hwcap and the variable used in ./configure to override detection of Neon instructions. * tests/wc/wc-cpu.sh: Also add "-ASIMD" to disable the use of Neon instructions.
2026-02-18tests: use system ENOTEMPTY messagePádraig Brady-8/+8
* tests/mv/dir2dir.sh: Map system specific messages. * tests/rm/d-2.sh: Likewise.
2026-02-18maint: tests: avoid ERANGE specific handlingPádraig Brady-11/+10
* tests/fmt/base.pl: Verify ERANGE is diagnosed. * tests/od/od.pl: Adjust determination of ERANGE.
2026-02-18maint: tests: avoid ELOOP specific handlingPádraig Brady-10/+2
* tests/du/long-sloop.sh: Adjust determination of ELOOP.
2026-02-18maint: tests: avoid ENOSPC specific handlingPádraig Brady-16/+15
* tests/csplit/csplit-io-err.sh: Adjust determination of ENOSPC. * tests/csplit/split-io-err.sh: Likewise. * tests/fold/fold-zero-width.sh: Verify full ENOSPC message. * tests/tac/tac-continue.sh: Likewise. * tests/misc/io-errors.sh: Likewise. * tests/misc/write-errors.sh: Likewise.
2026-02-18tests: use system ENOSPC messagePádraig Brady-9/+7
* tests/head/head-write-error.sh: Verify ENOSPC is output. * tests/misc/yes.sh: Likewise.
2026-02-18tests: use system ENOTSUP messagePádraig Brady-5/+6
* tests/cp/cp-mv-enotsup-xattr.sh: Don't hardcode "Operation not supported". * tests/cp/cp-a-selinux.sh: Likewise.
2026-02-18maint: tests: avoid ENOTSUP specific handlingPádraig Brady-5/+3
* tests/mv/mv-exchange.sh: Use ENOTSUP rather than transforming variations.
2026-02-18tests: use system EACCES messagePádraig Brady-30/+43
* tests/chgrp/no-x.sh: Don't harcode "Permission denied". * tests/chmod/no-x.sh: Likewise. * tests/du/inacc-dest.sh: Likewise. * tests/du/no-x.sh: Likewise. * tests/misc/nohup.sh: Likewise. * tests/mv/part-fail.sh: Likewise. * tests/mv/perm-1.sh: Likewise. * tests/rm/fail-eacces.sh: Likewise. * tests/rm/rm1.sh: Likewise. * tests/rm/rm2.sh: Likewise. * tests/rm/unread2.sh: Likewise. * tests/rm/unreadable.pl: Likewise.
2026-02-18maint: tests: avoid AIX specific EACCES handlingPádraig Brady-22/+12
* tests/rm/inaccessible.sh: Remove AIX specific handling. * tests/cp/fail-perm.sh: Likeise. Also remove confusing EPERM/HPUX mentions. * tests/misc/sync.sh: Don't hardcode EISDIR and EACCES.
2026-02-18maint: tests: avoid EPERM/EACCES specific handlingPádraig Brady-17/+11
* tests/Coreutils.pm: Remove associated comment. * tests/mv/sticky-to-xpart.sh: Use $EACCES and $EPERM. * tests/rm/fail-2eperm.sh: Likewise. * tests/touch/not-owner.sh: Likewise.
2026-02-18maint: tests: avoid EPERM specific handlingPádraig Brady-12/+5
* tests/dd/fail-ftruncate-fstat.sh: Use $EPERM rather than mapping specific strings to the Linux $EPERM. * tests/mkdir/smack-no-root.sh: Use $EPERM rather than hardcoding.