aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-07-26maint: avoid :> pattern in testsPádraig Brady1-1/+1
This was seen to trigger the EXIT trap on cygwin * cfg.mk (sc_prohibit_colon_redirection): Disallow all cases of :> in tests/ * tests/cksum/md5sum-bsd.sh: Adjust to avoid more stringent syntax check.
2025-07-26tests: avoid a false failure on CygwinCollin Funk1-1/+1
* tests/cksum/md5sum-bsd.sh: Use 'echo' instead of ':' to redirect to the file. Otherwise 'Exit $fail' is not called on Cygwin.
2025-07-23tests: date: add tests for the Ethiopian calendarCollin Funk2-0/+46
* tests/date/date-ethiopia.sh: New file. * tests/local.mk (all_tests): Add the test.
2025-07-23tests: date: add tests for the Solar Hijri calendarCollin Funk2-0/+46
* tests/date/date-iran.sh: New file. * tests/local.mk (all_tests): Add the test.
2025-07-22install: with -d, use more accurate diagnosticsPádraig Brady1-0/+7
* gnulib: Update to latest to get the fix to propagate the appropriate error message. * tests/install/basic-1.sh: Add a test case. * NEWS: Mention the bug fix. Addresses https://bugs.gnu.org/79072
2025-07-21tests: date: add tests for the Thai solar calendarCollin Funk2-0/+47
* tests/date/date-thailand.sh: New file. * tests/local.mk (all_tests): Add the test.
2025-07-12tests: sort: add a test for equivalent floatsPádraig Brady1-0/+3
* tests/sort/sort-float.sh: Ensure equivalent floats are treated as such.
2025-07-11tests: fix fraction comparison in sort-floatPaul Eggert1-6/+12
Problem reported by Cosima Neidahl <https://bugs.gnu.org/78985#13>. * tests/sort/sort-float.sh: At top level, use C locale at first. (dbl_minima_order): Assume C locale. Use string comparison for the fractional parts. 2025-07-10 Paul Eggert <eggert@cs.ucla.edu> tests: fix integer overflow in sort-float Problem reported by Cosima Neidahl <https://bugs.gnu.org/78985>. * tests/sort/sort-float.sh (dbl_minima_order): Use expr instead of test, to avoid problems with integers too large for the shell.
2025-07-10tests: fix integer overflow in sort-floatPaul Eggert1-1/+2
Problem reported by Cosima Neidahl <https://bugs.gnu.org/78985>. * tests/sort/sort-float.sh (dbl_minima_order): Use expr instead of test to compare fractions, to avoid problems with integers too large for the shell.
2025-07-09factor: don’t prove primalityPaul Eggert2-1/+6
Suggested for consideration by Torbjörn Granlund in: https://lists.gnu.org/r/coreutils/2025-01/msg00000.html * src/factor.c (PROVE_PRIMALITY): Now defaults to false. (mp_prime_p): Help the compiler by telling it mpz_prob_prime_p returns nonnegative. * tests/factor/create-test.sh (bigprime): Test 2^400 - 593, since that’s now practical. * tests/local.mk (factor_tests): Add new test.
2025-07-09factor: switch from mp to single when doablePaul Eggert1-0/+3
This significantly improves performance when a number exceeds 2**(W_TYPE_SIZE - 1) and is the product of a prime less than FIRST_OMITTED_PRIME and another prime less than 2**(W_TYPE_SIZE - 1). On my platform, for example, it doubled the speed of factoring 4999 * (2**128 - 159). * src/factor.c (mp_size, mp_finish_in_single): New functions. (mp_factor_using_division, mp_factor_using_pollard_rho): Finish using single precision when possible. * tests/factor/factor.pl (lt-5000-times-128-bit): New test.
2025-07-09factor: fix test case namePaul Eggert1-1/+1
* tests/factor/factor.pl (bug-gmp-plus_2_sup_127_plus_1): Rename from bug-gmp-plus_2_sup_128_plus_1, so that it accurately reflects the test case.
2025-07-01tests: cat: add test for O_APPEND bug fixPádraig Brady1-0/+10
* tests/cat/cat-self.sh: Add a test case for commit v9.6-19-g7386c291b
2025-07-01tests: avoid false failure due to varied ERANGE errorsPádraig Brady1-3/+6
* tests/od/od.pl: Use the system error string for ERANGE, rather than hardcoding a particular one. Fixes https://bugs.gnu.org/78934
2025-06-29od: add test cases for recent fixPaul Eggert1-0/+18
* tests/od/od.pl: New tests for the offset issues
2025-06-28od: fix '+N.' bugPaul Eggert1-0/+4
* src/od.c (parse_old_offset): First arg is now char *, not char const *. If a decimal number, temporarily modify the string so that xstrtoumax does not complain about the '.'. * tests/od/od.pl: Test for the bug.
2025-06-28od: fix some unlikely integer overflowsPaul Eggert2-0/+44
* src/od.c (print_n_spaces, pad_at, pad_at_overflow): New static functions. (struct tspec, PRINT_FIELDS, print_named_ascii, print_ascii) (decode_one_format, write_block, main): Use idx_t, not int, for counts that depend on the number of bytes in an object. (decode_one_format): Use print_n_spaces to output spaces. (PRINT_FIELDS, print_named_ascii, print_ascii): Use pad_at to avoid integer overflow. (write_block): Do not use %*s to pad, as the total pad might exceed INT_MAX. Instead, pad by hand with putchar (' '). (main): Use pad_at_overflow to report integer overflow due to oversize -w. Use better way to tell whether -w is used, without needing IF_LINT. * tests/od/big-w.sh: New test. * tests/local.mk (all_tests): Add it.
2025-06-24od: output standard diagnostics for invalid -w argumentsPádraig Brady1-1/+11
* src/od.c (main): Don't pass LONGINT_OK to xstrtol_fatal(), as otherwise it will abort(). * tests/od/od.pl: Add test cases. * NEWS: Mention the bug fix. Addresses https://bugs.gnu.org/78879
2025-06-24od: fix various off-by-one issues with --strings with -NPádraig Brady1-2/+27
* src/od.c (dump_strings): There are three related issues here due to not accounting for the terminating NUL char appropriately. 1. Ensure BUF always has enough space for the terminating NUL. This avoids CWE-122: Heap-based Buffer Overflow, where we wrote a single NUL byte directly after the allocated buffer. I.e., there should be no buffer overflow with: printf '%100s' | od -N100 -S1 2. Ensure we support -S == -N (END_OFFSET - STRING_MIN == ADDRESS): I.e., there should be output with: printf '%100s' | od -N10 -S10 3. Ensure we always output a valid address by ensuring the ADDRESS and I variables are kept in sync. I.e., this should output address 0000000 not 1777777777777777777777: printf '%100s' | od -N10 -S1 As well as fixing these we simplify by using a single loop to read the data, rather than two. * doc/coreutils.texi (od invocation): Clarify that -N implicitly NUL terminates strings. * tests/od/od-N.sh: Add test cases. * NEWS: Mention the bug fixes. Fixes https://bugs.gnu.org/78880
2025-06-22stty: stricter floating point parsingPádraig Brady1-1/+2
* src/stty.c (string_to_baud): Disallow extraneous characters after floating point numbers. * tests/stty/stty-invalid.sh: Add test cases.
2025-06-20tty: better fix for Bug#26371Paul Eggert1-2/+8
* src/tty.c (TTY_USAGE): Rename from TTY_FAILURE, since this is used only for usage failures. All uses changed. (TTY_TTYNAME_FAILURE): New constant. (main): Remove no-longer-needed assignment of ENOENT to errno. Make status-setting clearer too. Report an error if ttyname fails even though stdin is a terminal, instead of silently pretending that stdin is not a terminal. * tests/tty/tty.sh: Test for this issue. This should fix Bug#78244.
2025-06-18tests: stty: adjust tests for arbitary speedsPádraig Brady4-2/+69
* tests/stty/stty-invalid.sh: Adjust to what is now invalid. * tests/stty/stty.sh: Add checks for valid speed variants. * tests/stty/bad-speed.sh: New test to ensure unsupported speeds are diagnosed.
2025-06-10date: port test to NetBSD 10Paul Eggert1-3/+6
Problem reported by Collin Funk in: https://lists.gnu.org/r/bug-gnulib/2025-06/msg00094.html * tests/date/date-debug.sh: Also allow NetBSD 10 mktime behavior. Although NetBSD contradicts POSIX, POSIX is likely wrong here and I vaguely recall that there’s a POSIX correction in progress that will allow the NetBSD behavior.
2025-06-08build: update gnulib submodule to latestPaul Eggert1-1/+1
* tests/date/date-debug.sh: Update to match current behavior of Gnulib's parse-datetime module.
2025-05-28tests: sort: expand multiple output testingPádraig Brady1-0/+5
* tests/sort/sort.pl: Ensure duplicate output strings are supported.
2025-05-21tests: avoid hung tests on older macOSPádraig Brady2-2/+2
These tests were seen to hang on PPC Mac OS X 10.4.11 * tests/cp/existing-perm-race.sh: Protect fifo interactions with a 1 minute timeout. * tests/cp/file-perm-race.sh: Likewise. Reported in https://bugs.gnu.org/78509
2025-05-20sort: fix buffer under-read (CWE-127)Pádraig Brady2-0/+36
* src/sort.c (begfield): Check pointer adjustment to avoid Out-of-range pointer offset (CWE-823). (limfield): Likewise. * tests/sort/sort-field-limit.sh: Add a new test, which triggers with ASAN or Valgrind. * tests/local.mk: Reference the new test. * NEWS: Mention bug fix introduced in v7.2 (2009). Fixes https://bugs.gnu.org/78507
2025-05-17factor: fix bug with 128-bit uintmax_tPaul Eggert1-0/+3
On so-far-only-theoretical platforms with 128-bit uintmax_t, 'factor' would misbehave by not factoring enough. Work around the bug (at a performance cost) and document the issue. I hope someone with more time and expertise can fix the performance cost that this introduces. To reproduce the correctness bug, build with 'gcc -DUSE_INT128 -DEXHIBIT_INT128_BUG'; 'make check' should fail due to the new test case. * src/factor.c (USE_INT128): New macro. (wide_uint, wide_int, W_TYPE_SIZE, WIDE_UINT_MAX): Define to proper values if USE_INT128. (prime_p) [!EXHIBIT_INT128_BUG]: Work around bug with 128-bit wide_uint, at some performance cost. * tests/factor/factor.pl (bug-with-128-bit-uintmax_t): New test.
2025-04-23tests: add a test case for negative relative datePádraig Brady1-0/+3
* tests/date/date.pl: To exercise option processing.
2025-04-21tests: fix false failure with constrained setfaclPádraig Brady1-1/+1
* tests/ls/acl.sh: In constrained environments, like with setxattr() disabled for example, require_acl_ does not check for the required functionality, so use the more stringent require_setfacl_ instead. Reported at https://github.com/NixOS/nixpkgs/issues/394953
2025-04-08tests: adjust csplit VM limit for CheriBSDPádraig Brady1-1/+1
* tests/misc/csplit-heap.sh: More memory is required to avoid a false failure on CheriBSD with its heap accounting overhead. This is confirmed to still trigger with the original memory leak being tested.
2025-04-06doc: mention the edge case of hex durations with 'd' suffixPádraig Brady1-0/+1
* doc/coreutils.texi (sleep invocation): Mention that suffixes are best avoided with hex arguments. (timeout invocation): Likewise. * tests/misc/sleep.sh: Ensure 'd' is not interpreted as "day".
2025-04-05maint: adjustments to recent timeout changePádraig Brady2-4/+1
* .gitignore: Add /lib/fenv.h to ignore list. * tests/timeout/timeout-parameters.sh: Use a sleep length of 10s to be consistent with the pattern where we use this larger time when it does not slow down a test, but also provides protection against a hung test, and better avoidance of false failures due to races on very loaded systems. Also fix the setting of FAIL. * tests/timeout/timeout-large-parameters.sh: Remove duplicated test.
2025-04-05timeout: round timeouts upPaul Eggert1-1/+6
This handles timeouts like 16777216.000000001 correctly; formerly the subsecond part of that timeout was ignored. * bootstrap.conf (gnulib_modules): Add fenv-rounding, signbit. * src/local.mk (src_timeout_LDADD): Append $(FENV_ROUNDING_LIBM). * src/timeout.c: Include fenv.h, math.h. Don’t include xstrtod.h, as xstrtod’s checking now gets in the way. (parse_duration): Round up when calling cl_strtod. Check for -1e-1000. Don’t double-round 1e-9. * tests/timeout/timeout-parameters.sh: Test for -0.1, -1e-1000, 1e-1000.
2025-04-04maint: ensure that new "make syntax-check"-run sc_codespell passesCollin Funk1-1/+1
* cfg.mk (codespell_ignore_words_list): Ignore false-positives. (exclude_file_name_regexp--sc_codespell): Skip some file names. * doc/coreutils.texi (mktemp invocation): Use "alphanumeric" which is consistent with the rest of the documentation. * src/expand-common.c: Fix typo. * src/ls.c: Likewise. * tests/split/l-chunk-root.sh: Likewise.
2025-04-04timeout: ensure infinitesimal timeouts timeout quicklyPádraig Brady1-0/+3
* src/timeout.c (parse_duration): Clamp infinitesimal values to 1ns. * tests/timeout/timeout-large-parameters.sh: Add a test case. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/77535
2025-04-04tests: fix false failure with multi-byte thousands separatorsPádraig Brady1-0/+3
* tests/sort/sort-h-thousands-sep.sh: sv_SE defaults to UTF-8 on macOS 18, so avoid the test for multi-byte separators. Fixes https://bugs.gnu.org/77509
2025-03-23mv: port test to OpenBSD 7.5Paul Eggert1-3/+12
Problem reported by Bruno Haible <https://bugs.gnu.org/75685>. * tests/mv/sticky-to-xpart.sh: Also allow OpenBSD behavior.
2025-03-10tests: dd: ensure posix_fadvise errors are handledPádraig Brady2-0/+57
* tests/dd/nocache_fail.sh: Add a test case for the recent fix.
2025-02-17cksum: fix test for missingPaul Eggert1-1/+1
* tests/cksum/cksum.sh: Don’t output confusing diagnostic. Problem reported by Alyssa Ross (Bug#76360).
2025-02-05tests: du: avoid intermittent false failurePádraig Brady1-1/+2
* tests/du/long-sloop.sh: Avoid failure due to intermittent reception of FTS_DNR, seen on BTRFS at least.
2025-01-22sort: drop "note" from a --debug messagePádraig Brady1-12/+12
* src/sort.c (key_warnings): Remove "note " from the start of a usually informational message, as this simplifies translation. * tests/sort/sort-debug-warn.sh": Adjust accordingly. Fixes https://bugs.gnu.org/75763
2025-01-20tests: avoid ENAMETOOLONG ERROR on some systemsPádraig Brady1-1/+1
* tests/du/long-from-unreadable.sh: Relax to a skip_ for now, as this was seen to error on ext4 on Debian 11 in a docker container.
2025-01-20maint: tests: remove duplicate uses of 'my' in PerlCollin Funk3-5/+4
* tests/env/env-S.pl (cf): Remove uses of 'my' after the variable has been declared. * tests/factor/factor.pl (t): Likewise. * tests/misc/fold.pl (prog): Remove duplicate assignment.
2025-01-20tests: remove use of unprotected 'set'Pádraig Brady10-18/+18
* cfg.mk (sc_prohibit_bare_set): A new syntax check to ensure we protect use of set with '--', so that args beginning with '-' are not interpreted as options, and if no args are present, all existing args are cleared. * tests/cp/symlink-slash.sh: Add -- to unprotected use of set. * tests/ls/ls-time.sh: Likewise. * tests/ls/symlink-slash.sh: Likewise. * tests/mkdir/perm.sh: Likewise. * tests/mkdir/selinux.sh: Likewise. * tests/mkdir/smack-no-root.sh: Likewise. * tests/mkdir/smack-root.sh: Likewise. * tests/mv/part-hardlink.sh: Likewise. * tests/nice/nice.sh: Likewise. * tests/stty/stty-row-col.sh: Likewise.
2025-01-19tests: fix typo in tests/ls/ls-time.shDaniel Hofstetter1-1/+1
* tests/ls/ls-time.sh: s/--sort-name -t/-t --sort=name/.
2025-01-18ls: fix crash with --contextPádraig Brady1-0/+3
* src/ls.c (main): Flag that we need to stat() if we're going to get security context (call file_has_aclinfo_cache). (file_has_aclinfo_cache): Be defensive and only lookup the device for the file if the stat has been performed. (has_capability_cache): Likewise. * tests/ls/selinux-segfault.sh: Add a test case. * NEWS: Mention the bug fix. Reported by Bruno Haible.
2025-01-16tests: tail-c.sh: avoid failure on Linux kernels <= 2Pádraig Brady1-1/+9
tests/tail/tail-c.sh: Exclude older kernels from timeout failure.
2025-01-16tests: avoid false failure with replaced readdirPádraig Brady1-2/+2
* tests/rm/rm-readdir-fail.sh: Simulate EIO rather than ENOENT, as gnulib absorbs the latter since commit 5a2d28df.
2025-01-15tests: misc/write-errors.sh: increase memory limitPádraig Brady1-1/+1
* tests/head/head-c.sh: Use a larger VM limit to avoid mem allocation failures, which were seen on CheriBSD.