aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-11-08tests: tail: avoid a test failure on GNU/HurdHEADmasterCollin Funk1-1/+2
* tests/tail/tail-c.sh: Allow 'tail -c 4096 /dev/urandom' to run forever on GNU/Hurd since lseek fails with ESPIPE.
2025-11-08tests: avoid false failure due to small timeoutPádraig Brady1-1/+1
* tests/tail/tail-c.sh: Tests that fail after a timeout should use as least 10s to avoid intermittent failures on slow/loaded hosts.
2025-11-07install: fix crash with --strip and large $PATH on ppc and sparcPádraig Brady1-0/+5
* gnulib: Update to the latest gnulib to pull in the fix (v1.0-2406-g89f63027de) to allocate the $PATH processing memory before the vfork call, which is required on ppc and sparc. * tests/install/basic-1.sh: Ensure posix_spawnp() suports a large $PATH, which needs careful handling with vfork() as detailed in gnulib.
2025-11-06tests: wc: protect against a hang on GNU/HurdCollin Funk1-1/+2
Reported by Bruno Haible in <https://lists.gnu.org/r/coreutils/2025-11/msg00051.html>. * tests/wc/wc-total.sh: Skip a test that would exhaust memory on GNU/Hurd.
2025-11-04tests: avoid skipping of LD_PRELOAD based df testsBernhard Voelker2-26/+84
It was seen that gnulib's read_file_system_list may use fopen instead of open. Adjust the df(1) tests to replace both library functions. * tests/df/no-mtab-status.sh: Change the shared library code invoked via LD_PRELOAD to override both fopen and open. While at it, perform varargs processing only when path is not "/proc/self/mountinfo". * tests/df/skip-duplicates.sh: Likewise.
2025-11-04tests: avoid skipping by fixing build of shared librariesBernhard Voelker2-2/+4
Two df(1) tests were skipped (since commit ee367bd38dac), because the build of the shared library in those tests failed. + gcc -Wall -shared --std=gnu99 -fPIC -O2 k.c -o k.so -ldl k.c: In function 'open': k.c:37:7: error: implicit declaration of function 'streq'; did you \ mean 'strsep'? [-Wimplicit-function-declaration] 37 | if (streq (path, "/proc/self/mountinfo")) | ^~~~~ | strsep Gnulib streq is not available in the tests. * tests/df/no-mtab-status.sh: Replace "streq" by "0==strcmp" in the shared library source. * tests/df/skip-duplicates.sh: Likewise.
2025-11-03tests: date: check that write errors are promptly diagnosedCollin Funk1-0/+2
This improvement is due to changes to Gnulib's fprintftime module. * NEWS: Mention the improvement. * src/getlimits.c (OFF64_T_MAX, OFF64_T_MIN): New macros. (main): Print them. * tests/misc/write-errors.sh: Call getlimits_. Add a date invocation.
2025-11-03tests: truncate: ensure negative args not parsed as optionsPádraig Brady1-0/+4
* tests/truncate/truncate-parameters.sh: Add a test case.
2025-11-03date: promptly diagnose write errors with --filePádraig Brady1-0/+1
* src/date.c (batch_convert): Check error state of stdout after each date is processed. * tests/misc/write-errors.sh: Add a test case.
2025-11-02tests: stty: filter out ispeed and ospeed from boolean optionsCollin Funk2-2/+2
* tests/stty/stty-pairs.sh: Also ignore lines starting with ispeed and ospeed. * tests/stty/stty.sh: Likewise. Reported by Bernhard Voelker.
2025-11-01tests: date: avoid test failure on NetBSDCollin Funk1-1/+7
* tests/date/date-tz.sh: Allow date to fail with large values for TZ since NetBSD's tzalloc function limits them to 256 bytes.
2025-11-01copy: don't avoid copy-offload upon SEEK_HOLE indicating non-sparsePádraig Brady1-0/+10
* src/copy-file-data.c (infer_scantype): Fall back to a plain copy if SEEK_HOLE indicates non-sparse, as zero copy avoids copy offload. This was seen with transparently compressed files on OpenZFS. * tests/cp/sparse-perf.sh: Add a test case even though it might only trigger on compressed file systems that don't support reflink. * NEWS: Mention the bug fix. Addresses https://github.com/coreutils/coreutils/issues/122
2025-10-29sort: fix silent exit upon SIGPIPE from --compress-programPádraig Brady1-4/+22
* src/sort.c (main): Ignore SIGPIPE so we've more control over how we handle for stdout and compression programs. (sort_die): Handle EPIPE from stdout and mimic a standard SIGPIPE, otherwise reverting to a standard exit(SORT_FAILURE); * tests/sort/sort-compress-proc.sh: Add a test case. * NEWS: Mention the bug fix.
2025-10-28tests: fix new date/resolution.sh test on macOSPádraig Brady1-3/+4
* tests/date/resolution.sh: Fix comparison on systems with less than nano second reslution, where we use sed to discard the redundant trailing zeros output by date --resolution. Reported by Bruno Haible on macOS.
2025-10-25sort: use the more efficient posix_spawn to invoke --compress-programCollin Funk1-0/+9
* NEWS: Mention the improvement. Mention that 'sort' will continue without compressing temporary files if the program specified by --compress-program cannot be executed. * doc/coreutils.texi (sort invocation): Document the behavior when the program specified by --compress-program cannot be executed. * src/sort.c: Include spawn.h. (MAX_FORK_TRIES_COMPRESS, MAX_FORK_TRIES_DECOMPRESS): Remove definition. (MAX_TRIES_COMPRESS, MAX_TRIES_DECOMPRESS): New definitions based on MAX_FORK_TRIES_COMPRESS and MAX_FORK_TRIES_DECOMPRESS. (async_safe_die): Remove function. (posix_spawn_file_actions_move_fd): New function. (pipe_fork): Remove function. (pipe_child): New function based on pipe_fork. Return an error number instead of a pid. Use posix_spawnp instead of calling fork and expecting the caller to exec. (maybe_create_temp): Call pipe_child instead of pipe_fork. Print a warning to standard error if --compress-program cannot be executed and the error is different than the previous call. Remove code for the child process. (open_temp): Remove code for the child process. Improve error message. * tests/sort/sort-compress.sh: Add a test case for when the program specified by --compress-program does not exist.
2025-10-23tests: date: test --resolution and %-NPádraig Brady2-0/+32
* tests/date/resolution.sh: New test for --resolution and %-N. * tests/local.mk: Reference the new test.
2025-10-23tests: date: test --referencePádraig Brady2-0/+51
* tests/date/reference.sh: Ensure the -r option is tested. * tests/local.mk: Add the test.
2025-10-22pr: promptly diagnose write errorsPádraig Brady1-1/+2
* src/pr.c (print_page): Exit promptly for `yes | pr`. (print_clump): Exit promptly for `pr < /dev/zero`. * tests/misc/write-errors.sh: Enable test cases. * NEWS: Mention the improvement.
2025-10-22nl: promptly diagnose write errorsPádraig Brady1-1/+1
* NEWS: Mention the improvement. * src/nl.c (process_file): Exit if error outputting line. * tests/misc/write-errors.sh: Enable the test case.
2025-10-22fmt: promptly diagnose write errorsPádraig Brady1-1/+2
* NEWS: Mention the improvement. * src/fmt.c (put_line): Exit if any error writing line. (flush_paragraph): Exit if any error writing buffer. * tests/misc/write-errors.sh: Enable the (flush_paragraph) test case, and add another to check the put_line() case.
2025-10-22numfmt: promptly diagnose write errorsPádraig Brady1-1/+1
* src/numfmt.c (process line): Inspect the stdio error state when outputting each line so that we don't have to check each output function but do eventually exit upon write error, while also remaining buffered. (main): Also check when outputting a header for the edge case of very long headers. * tests/misc/write-errors.sh: Enable the numfmt test case. * NEWS: Mention the improvement, and reorganize all numfmt improvements.
2025-10-20tests: numfmt: add non-utf8 multi-byte testPádraig Brady3-1/+36
* tests/numfmt/mb-non-utf8.sh: Test GB18030 delimiter search. * tests/local.mk: Reference the new test, and move the existing numfmt.pl test from tests/misc to tests/numfmt.
2025-10-20numfmt: support multi-byte --delimiterPádraig Brady1-0/+7
* bootstrap.conf: Depend on mbsstr() to robustly search for a multi-byte delimiter character (string) within a multi-byte string. * src/numfmt.c (main): Accept a valid multi-byte delimiter character. (next_field): Adjust delimiter search from single byte to multi-byte aware. Use mbsstr to find the first match. * tests/misc/numfmt.pl: Add test case. * NEWS: Mention the improvement.
2025-10-18numfmt: fix issues with multi-byte blanksPádraig Brady1-0/+14
* src/numfmt.c (process_line): Restore byte overwritten with NUL, as it may be part of a multi-byte blank. (process_suffixed_number): Skip multi-byte blanks, and correctly determine width with mbswidth(). (parse_format_string): Use c_isblank() to explicitly indicate that's all the format spec supports. * tests/misc/numfmt.pl: Add test cases. * NEWS: Mention the bug fix.
2025-10-17numfmt: add --unit-separatorPádraig Brady1-0/+71
Output, accept, or disallow a string between the number and unit as recommended in <https://physics.nist.gov/cuu/Units/checklist.html> I.e. support outputting numbers of the form: "1234 M" * src/numfmt.c (simple_strtod_human): Skip unit separator if present, or disallow a unit separator if empty. (double_to_human): Output unit separator if specified. (main): Accept --unit-separator. * tests/misc/numfmt.pl: Add test cases. * doc/coreutils.texi: Describe the new option, giving examples of interaction with --delimiter. * NEWS: Mention the new feature. * THANKS.in: Add Johannes Schauer Marin Rodrigues, who provided a preliminary patch.
2025-10-17numfmt: support reading numbers with grouping charactersPádraig Brady1-2/+14
This does not validate grouping character placement, and currently just ignores grouping characters. * src/numfmt.c (simple_strtod_int): Skip grouping chars that are part of a number. * tests/misc/numfmt.pl: Add test cases. * NEWS: Mention the improvement.
2025-10-17numfmt: support reading numbers with NBSP before unitPádraig Brady1-0/+23
* src/numfmt.c (simple_strtod_human): Accept (multi-byte) non-breaking space character between number and unit. Note we restrict this to a single character between number and unit, to allow less ambiguous parsing if multiple blanks are used to delimit fields. * tests/misc/numfmt.pl: Add test cases. * doc/coreutils.texi (numfmt invocation): Fix stale description --delimiter skipping whitespace. * NEWS: Mention the improvement.
2025-10-16tests: du/bigtime: try harder to find a suitable filesystemNicolas Boichat1-14/+25
* tests/du/bigtime.sh: At least on Linux, the ext4 filesystem doesn't support such large timestamp, while tmpfs does. Try a bit harder to look for a filesystem with large timestamp support.
2025-10-13tests: date: check that the hour format of the current locale is usedCollin Funk2-0/+41
* tests/date/date-locale-hour.sh: New file. * tests/local.mk (all_tests): Add the new test. Co-authored-by: Pádraig Brady <P@draigBrady.com>
2025-10-13tests: fix false failure in recent memory limit testPádraig Brady1-1/+2
* tests/basenc/bounded-memory.sh: Ensure we skip the test upon failure to determine the memory lower bound. Reported by Bruno Haible.
2025-10-11numfmt: fix buffer over-read (CWE-126)Pádraig Brady1-0/+1
* src/numfmt.c (simple_strtod_human): Check for NULL after pointer adjustment to avoid Out-of-range pointer offset (CWE-823). * NEWS: Mention the fix.
2025-10-11tests: basenc: use less redundant namingPádraig Brady3-2/+2
Rename to less redundant names, now that we use a separate test directory per util. * tests/basenc/basenc-bounded-memory.sh -> .../bounded-memory.sh * tests/basenc/basenc-large.sh -> .../large-input.sh * tests/local.mk: Reference new names.
2025-10-11tests: fix memory limit determination in new testPádraig Brady1-1/+1
* tests/basenc/basenc-bounded-memory.sh: The passed command needs to succeed for memory limit determination to work.
2025-10-11tests: basenc: add a test for bounded memory operationCollin Funk2-0/+40
* tests/basenc/basenc-bounded-memory.sh: New file. * tests/local.mk (all_tests): Add the test.
2025-10-10tests: ln -f: ensure existing link replacedSylvestre Ledru1-0/+8
Identified here: <https://github.com/uutils/coreutils/issues/8830> * tests/ln/misc.sh: Add the check.
2025-10-07tests: cksum: add a test case for robust file name parsingPádraig Brady1-0/+6
* tests/cksum/cksum-c.sh: Add a test case where the file name contains tagged format delimiter characters.
2025-10-07cksum: fix --check with untagged base64 format with tag matchesPádraig Brady1-0/+8
* src/digest.c (split_3): Fallback to untagged matching in the case where -a is specified and we have matched a TAG in the possibly base64 data. This might happen in 1 in every 64K files. Note we remove the modification of string S (and redundant streq) in the tag matching, as that was not needed since v8.32-223-g217cd278e. * tests/cksum/cksum-c.sh: Add a test case. * NEWS: Mention the bug fix.
2025-10-07cksum: fix length validation with SHA2- tagged formatPádraig Brady1-0/+10
* src/digest.c (sha2_sum_stream): Change from unreachable() to affirm() so that we have defined behavior unless we configure with --disable-assert. (sha3_sum_stream): Likewise. (split_3): Validate SHA2-lengths before passing on. * tests/cksum/cksum-c.sh: Add a test case. * NEWS: Mention the bug fix.
2025-10-07cksum: fix --check with --algorithm=sha2Pádraig Brady1-4/+9
* src/digest.c (split_3): Look up the provided tag with -a sha2 because there is not a 1:1 mapping between them. * tests/cksum/cksum-c.sh: Add a test case. * NEWS: Mention the bug fix.
2025-10-05cksum: allow -a {blake2b,sha2,sha3} --check to work on base64Collin Funk2-0/+51
* NEWS: Mention the bug. * src/digest.c (split_3): Check that the base64 digest matches the length supported by the algorithm. (digest_check): Check that the read digest matches the base64 length of the algorithm's digest. The previous condition would not work for 'cksum -a blake2b -l 8 ...'. * tests/cksum/cksum-base64-untagged.sh: New file. * tests/local.mk (all_tests): Add the new test.
2025-10-02tests: factor: add suggested large prime testsPádraig Brady2-3/+11
* tests/factor/create-test.sh: Add 2 new large primes from: https://github.com/coreutils/coreutils/issues/65 * tests/local.mk: Reference the 2 new generated tests.
2025-10-02unexpand: fix heap buffer overflow with --tabs=[+/]NUMPádraig Brady1-0/+4
This avoids CWE-122: Heap-based Buffer Overflow where we could write blank characters beyond the allocated heap buffer. * src/expand-common.c (set_max_column_width): Refactor function from ... (add_tab_stop): ... here. (set_extend_size): Call new function. (set_increment_size): Likewise. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/79555
2025-09-30wc: add AVX512 function for line countingMathieu Bordere1-2/+10
* configure.ac: Add detection of AVX512 intrinsics for wc. * src/local.mk: Build AVX512 wc libraries. * src/wc.c: Add runtime detection of AVX512 intrinsics and call appropriate function when detected. * src/wc.h (wc_lines_avx512): Declare function. * tests/wc/wc-cpu.sh: Add a test that disables AVX512 intrinsics. * src/wc_avx512.c: New file containing the wc -l implementation using AVX512. The logic and code is reused from the AVX2 implementation with slight adaptations. Replaced __builtin_popcount by __builtin_popcountll and the combination of _mm256_cmpeq_epi8 and _mm256_movemask_epi8 by a single call to _mm512_cmpeq_epi8_mask. * NEWS: Mention the improvement.
2025-09-26tests: test: ensure file operations are coveredPádraig Brady2-0/+41
A coverage report indicated these weren't tested (as generally the test shell builtin is used). * tests/test/test-file.sh: Add a new test. * tests/local.mk: Reference the new test.
2025-09-24tail: fix tailing larger number of lines in regular filesHannes Braun2-0/+29
* src/tail.c (file_lines): Seek to the previous block instead of the beginning (or a little before) of the block that was just scanned. Otherwise, the same block is read and scanned (at least partially) again. This bug was introduced by commit v9.7-219-g976f8abc1. * tests/tail/basic-seek.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: mention the bug fix.
2025-09-24tests: wc: fix hardware acceleration disabling testPádraig Brady1-1/+1
* tests/wc/wc-cpu.sh: The message is only printed with wc -l. Reported by Mathieu Borderé.
2025-09-23basenc: --base58: fix buffer overflow with input > 15MBPádraig Brady2-0/+28
base58_length() operated naively on an int which resulted in an overflow to a negative number for any input > 2^31-1/138, i.e. 15,561,475 bytes. * src/basenc.c (base_length): Change input and output parameter types from int to idx_t since this needs to cater for the full input size in the base58 case. (base58_length): Likewise. Also reorder the calculation to be less exact, but doing the division first to minimize the chance of overflow (which now on 64 bit would only happen for inputs > around 6 Exa bytes). * tests/basenc/basenc-large.sh: Add a new test, that triggers with valgrind or ASAN. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix.
2025-09-22tests: ls: avoid alignment check with non printable charactersPádraig Brady1-0/+6
* tests/ls/block-size.sh: Skip the case where there are non-printable characters in ls' output, which is the case with NBSP thousands separators on FreeBSD 11 and 12. We may drop the MBSW_REJECT_UNPRINTABLE in future from ls and numfmt, but for now avoid these characters in the test. Reported by Bruno Haible.
2025-09-22tests: du: avoid false failure in racy testPádraig Brady1-4/+3
* tests/du/move-dir-while-traversing.sh: Expand the work to avoid a false failure where du completes before the directory is moved. Also expand the timeout to our more standard 10s to avoid the "directory mover" being killed before du processes the directory. This doesn't perceptibly impact the run time of the test. Reported by Bruno Haible on a CentOS 7 system.
2025-09-21maint: comment spelling fixesPaul Eggert1-1/+1