1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-14 19:32:10 +02:00
Commit Graph

5228 Commits

Author SHA1 Message Date
Pádraig Brady
d5a75a2f93 tests: enable mkdir/writable-under-readonly.sh
* tests/mkdir/writable-under-readonly.sh: Address FIXMEs and enable.
Addresses https://github.com/coreutils/coreutils/issues/137
2025-12-01 17:34:35 +00:00
Pádraig Brady
95b737c835 tests: mv: add checks for cross device handling of special files
* tests/mv/mv-special-2.sh: Add test to ensure we preserve
sparse files, character devices, symlinks, when moving across
file system boundaries.
Addresses https://github.com/coreutils/coreutils/issues/136
2025-12-01 15:09:02 +00:00
Pádraig Brady
ffbd8c4878 tests: rm: avoid usually skipped non root test
* tests/rm/fail-eperm.xpl: Remove this usually skipped non-root test.
* tests/rm/fail-2eperm.sh: Add the test to this root test instead.
* tests/local.mk: Remove the reference to *.xpl.
2025-12-01 13:23:45 +00:00
Pádraig Brady
0417a57624 tests: copy: reinstate check for symlink xattr copying
* tests/cp/cp-mv-enotsup-xattr.sh: Use two xattr supporting file
systems, to verify the propagation of xattrs.
2025-11-30 17:22:24 +00:00
Pádraig Brady
4ca0a1d22f tests: avoid skip due to missing nouser_xattr support
* tests/cp/cp-mv-enotsup-xattr.sh: The nouser_xattr option
is not supported by ext2 since about 2022.  Instead use
ramfs to ensure xattrs are not supported.  We also remove
part of the test that relied on partial xattr support.
Fixes https://github.com/coreutils/coreutils/issues/135
2025-11-30 15:04:48 +00:00
Pádraig Brady
faa566372d test: re-enable tests that had a false requirement on coreutils' kill
Recently we've not built our kill command by default,
so reduce test dependence on that.

* tests/sort/sort-compress-proc.sh: `kill -l [exit_status]` is well
supported, and is a POSIX requirement.
* tests/timeout/timeout.sh: There were actually no kill invocations
in this test at all.
2025-11-29 12:17:27 +00:00
Pádraig Brady
fc5c7b2e47 timeout: ensure we terminate command upon abnormal exit
* src/timeout.c (main): Use PR_SET_PDEATHSIG to ensure the
child is terminated even if the parent terminates abnormally.
* tests/timeout/timeout-group.sh: Add a case to ensure sending
SIGKILL results in the termination of the monitored command.
* NEWS: Mention the improvement.
2025-11-29 12:17:27 +00:00
Collin Funk
d1d311e7a2 tests: tac: test --separator with invalid UTF-8
* tests/tac/tac-locale.sh: Test that a string containing invalid UTF-8
characters can be used for --separator.
2025-11-28 21:46:40 -08:00
Collin Funk
90856dd867 du: add the short option -A corresponding to --apparent-size
The --apparent-size option to 'du' was added in
coreutils-4.5.8 (2003). FreeBSD 8.0 (2009) added the same functionality
under the short option -A. This long option previously had no short
option, so this patch adds -A to be compatible with FreeBSD.

* NEWS: Mention the new short option.
* doc/coreutils.texi: Document the short option.
* src/du.c (usage): Likewise.
(APPARENT_SIZE_OPTION): Remove definition.
(EXCLUDE_OPTION): Define to CHAR_MAX + 1.
(long_options): Use the -A short option for --apparent-size.
(main): Likewise.
* tests/du/apparent.sh: Test that '-b', '-A -B 1', and
'--apparent-size --block-size 1' function the same.
2025-11-28 14:08:31 -08:00
Collin Funk
7d94684f2c test: tac: test with non-ASCII values for --separator
* tests/tac/tac-locale.sh: New test.
* tests/local.mk (all_tests): Add it.
2025-11-28 13:23:47 -08:00
Pádraig Brady
0b2845ec79 tests: prefer ext4 casefold for case insensitive tests
* tests/mv/hardlink-case.sh: Try both ext4 casefold and hfsplus,
as ext4 has better availability.
Suggested at https://github.com/coreutils/coreutils/issues/133
2025-11-28 12:38:23 +00:00
Pádraig Brady
8c24619334 timeout: honor ignored signal dispositions
This behavior was depended on in our trap_sigpipe_or_skip_ helper,
and now that we're handling all terminating signals, we should
consistently honor their ignored signal dispositions.

* NEWS: Mention the change in behavior, especially in regard
to shell background jobs.
* src/timeout.c (sig_needs_handling): A new helper that return TRUE,
for --signal, SIG_ALRM, or non ignored signals.
(cleanup_install): Filter handled signals with the helper.
(block_cleanup_and_chld): Likewise.
* tests/timeout/timeout-group.sh: Adjust to use the now required
`env --default-signal=...` wrapper to reset (auto) ignored signals.
Also change the termination signal from SIGINT to SIGUSR1
to generalize the test signals not specially handled by the shell,
and newly handled by timeout(1).
* tests/timeout/timeout.sh: Add a test case for SIGPIPE
to ensure the ignored signal disposition is honored.
2025-11-22 08:49:20 +00:00
Pádraig Brady
d0a51c614d timeout: handle all terminating signals
* src/timeout.c (term_sig): A new global list of all signals
whose default disposition is to terminate the process.
(install_cleanup): Iterate over the TERM_SIG list, rather than
installing the handler for a specific subset.
(block_cleanup_and_chld): Likewise.
* tests/timeout/timeout.sh: Add a test case for SIGPIPE.
* NEWS: Mention the bug fix.
2025-11-21 12:12:28 +00:00
Collin Funk
0f695854d3 tests: check that mknod, mkfifo, and mkdir handle comma-separated modes
* tests/misc/mknod.sh: Test that mknod, mkfifo, and mkdir parse
comma-separated mode strings.
2025-11-17 19:17:08 -08:00
Sylvestre Ledru
c9303c5de0 tests: install supports comma-separated mode strings
Identified here:
<https://github.com/uutils/coreutils/pull/9298>

* tests/install/basic-1.sh: Add the check.
2025-11-17 19:15:34 -08:00
Pádraig Brady
eebe2abbb6 tests: use tail --debug to determine inotify support
* init.cfg (require_inotify_supported_): A new function that
indicates inotify support for a file in the current directory,
using tail --debug, rather than awkward strace checks etc.
* tests/tail/inotify-dir-recreate.sh: Call require_inotify_supported_.
 tests/tail/inotify-only-regular.sh: Likewise.
 tests/tail/inotify-race.sh: Likewise.
 tests/tail/inotify-race2.sh: Likewise.
2025-11-17 14:50:04 +00:00
Pádraig Brady
d611bcbfff tail: add --debug to report the --follow implementation
* doc/coreutils.texi (tail invocation): Describe --debug.
* src/tail.c (tail_forever, tail_forever_inotify): Output
which --follow implementation is being used.
* tests/tail/debug.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.
2025-11-17 13:55:12 +00:00
Pádraig Brady
3c1721d6c7 tests: verify we document all supported options in --help
* tests/misc/getopt_vs_usage.sh: A new test which checks the
converse of usage_vs_getopt.sh
* tests/local.mk: Reference the new test.
2025-11-16 17:18:03 +00:00
Sylvestre Ledru
8a56f4cb89 tests: install should ignore umask
Identified here:
<https://github.com/uutils/coreutils/pull/9254>

  * tests/install/basic-1.sh: Add the check.
2025-11-15 23:10:54 +00:00
Collin Funk
28cf6ac831 tests: pr: add a test for bounded memory operation
* tests/pr/bounded-memory.sh: New file.
* tests/local.mk (all_tests): Add the test.
2025-11-15 11:34:21 -08:00
Collin Funk
71514b4983 tests: dd: add tests for conv=lcase and conv=ucase
* tests/dd/conv-case.sh: New test.
* tests/local.mk (all_tests): Add it.
2025-11-14 10:59:55 -08:00
Collin Funk
57b3ccc9b0 tests: test: add test cases for -ef
* tests/test/test-file.sh: Check that -ef works as expected on files,
symbolic links, and hard links.
2025-11-13 10:53:45 -08:00
Collin Funk
07b5679570 maint: fix a typo in comments
* tests/date/reference.sh: Fix typo; s/modiication/modification.
2025-11-12 10:59:08 -08:00
Collin Funk
e1bd591bc2 tests: test: add test cases for -nt and -ot
* tests/test/test-file.sh: Check that -nt and -ot work properly when
files may or may not exist.
2025-11-12 10:42:14 -08:00
Pádraig Brady
3b6efd5557 tests: env --argv0: fix false failure with symlinked single binary
* tests/env/env.sh: Always pass --coreutils-prog=true so that the
program to run can be determined with --enable-single-binary=symlinks.
Also actually verify the expected verbose output.
Reported by the Alpine Linux project.
2025-11-12 13:47:55 +00:00
Pádraig Brady
d6fc91f37a tests: add tests for locale ordering
* tests/sort/sort-locale.sh: Check sort,ls have the same (non C) order.
* tests/local.mk: Reference the new test.
2025-11-11 14:29:36 +00:00
Collin Funk
fc93a44bbe nice: clamp the niceness correctly on GNU/Hurd
* NEWS: Mention the bug fix.
* src/nice.c (MIN_ADJUSTMENT): Set to 0 on the Hurd with glibc ≤ 2.42.
(MAX_ADJUSTMENT): Set to (2 * NZERO - 2) on the Hurd with glibc ≤ 2.42.
(main): Clamp the niceness to be greater or equal to MIN_ADJUSTMENT and
less than or equal to MAX_ADJUSTMENT.
* tests/nice/nice.sh: Add some tests for the Hurd's ranges.
2025-11-09 18:48:34 -08:00
Collin Funk
56fc0e6f8d tests: tail: avoid a test failure on GNU/Hurd
* tests/tail/tail-c.sh: Allow 'tail -c 4096 /dev/urandom' to run forever
on GNU/Hurd since lseek fails with ESPIPE.
2025-11-08 11:43:07 -08:00
Pádraig Brady
cc88c2a807 tests: avoid false failure due to small timeout
* 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-08 10:14:38 +00:00
Pádraig Brady
58944b541e install: fix crash with --strip and large $PATH on ppc and sparc
* 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-07 16:36:08 +00:00
Collin Funk
8dd89f55d5 tests: wc: protect against a hang on GNU/Hurd
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-06 16:52:03 -08:00
Bernhard Voelker
d36d0f28a4 tests: avoid skipping of LD_PRELOAD based df tests
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-04 11:33:35 +01:00
Bernhard Voelker
71c9921d55 tests: avoid skipping by fixing build of shared libraries
Two df(1) tests were skipped (since commit ee367bd38d), 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-04 11:33:29 +01:00
Collin Funk
0830838609 tests: date: check that write errors are promptly diagnosed
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-03 17:05:57 -08:00
Pádraig Brady
77322b3119 tests: truncate: ensure negative args not parsed as options
* tests/truncate/truncate-parameters.sh: Add a test case.
2025-11-03 13:52:54 +00:00
Pádraig Brady
7d17e1d36c date: promptly diagnose write errors with --file
* 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-03 12:51:04 +00:00
Collin Funk
170509d41f tests: stty: filter out ispeed and ospeed from boolean options
* tests/stty/stty-pairs.sh: Also ignore lines starting with ispeed and
ospeed.
* tests/stty/stty.sh: Likewise.
Reported by Bernhard Voelker.
2025-11-02 10:57:21 -08:00
Collin Funk
6d273604d0 tests: date: avoid test failure on NetBSD
* 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-01 10:49:05 -07:00
Pádraig Brady
64b8fdb5b4 copy: don't avoid copy-offload upon SEEK_HOLE indicating non-sparse
* 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-11-01 11:24:59 +00:00
Pádraig Brady
b294aff3fe sort: fix silent exit upon SIGPIPE from --compress-program
* 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-29 19:03:23 +00:00
Pádraig Brady
5a00d0a651 tests: fix new date/resolution.sh test on macOS
* 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-28 12:56:26 +00:00
Collin Funk
2b3eb795c8 sort: use the more efficient posix_spawn to invoke --compress-program
* 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-25 12:59:08 -07:00
Pádraig Brady
1dabab7027 tests: date: test --resolution and %-N
* tests/date/resolution.sh: New test for --resolution and %-N.
* tests/local.mk: Reference the new test.
2025-10-23 17:40:13 +01:00
Pádraig Brady
14d24f7a53 tests: date: test --reference
* tests/date/reference.sh: Ensure the -r option is tested.
* tests/local.mk: Add the test.
2025-10-23 17:40:12 +01:00
Pádraig Brady
c5b147fabf pr: promptly diagnose write errors
* 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-22 19:11:37 +01:00
Pádraig Brady
9415cf01c6 nl: promptly diagnose write errors
* 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-22 16:32:34 +01:00
Pádraig Brady
c12a2ecb53 fmt: promptly diagnose write errors
* 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-22 16:18:06 +01:00
Pádraig Brady
5971f450b5 numfmt: promptly diagnose write errors
* 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-22 15:53:06 +01:00
Pádraig Brady
38b824ac7e tests: numfmt: add non-utf8 multi-byte test
* 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-20 13:27:33 +01:00
Pádraig Brady
09af58f4f9 numfmt: support multi-byte --delimiter
* 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-20 13:13:24 +01:00