1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-15 03:41:57 +02:00

1385 Commits

Author SHA1 Message Date
oech3
7f592adc44 tests: coreutils: remove redundant validity check
* tests/misc/coreutils.sh: Remove the check for non-empty coreutils.h,
as the existing `print_ver_ coreutils` is sufficient to determine
support for single binary mode.
https://github.com/coreutils/coreutils/pull/189
2026-02-12 17:12:16 +00:00
oech3
78e97507e6 tests: arch: add option parsing check
* tests/misc/arch.sh: Ensure -- to indicate end of options is accepted.
https://github.com/coreutils/coreutils/pull/191
2026-02-12 16:26:44 +00:00
Pádraig Brady
3d35e82b9b tests: determine errno string more efficiently
* tests/misc/read-errors.sh: Use getlimits_ determined EIO error string,
rather than inferring the string from bash's output.
See https://bugs.gnu.org/80353
2026-02-10 12:36:06 +00:00
Pádraig Brady
1317074513 maint: remove extraneous code from test
* tests/misc/usage_vs_refs.sh: Remove copy and paste slop.
* tests/local.mk: Fix indentation.
2026-02-09 11:32:57 +00:00
Collin Funk
6bbf04db63 nl: support multi-byte section delimiters
* NEWS: Mention the improvement.
* src/nl.c: Include mcel.h.
(DEFAULT_SECTION_DELIMITERS): Resize to fit 2 multi-byte characters.
(section_del_len): New variable.
(check_section): Compare against section_del_len instead of 2.
(main): Support multi-byte characters for the -d option.
* tests/nl/multibyte.sh: New file.
* tests/nl/nl.sh: New file, moved from tests/misc/nl.sh.
* tests/local.mk (all_tests): Add the new test. Adjust the existing
tests file name.
* cfg.mk (exclude_file_name_regexp--sc_space_tab): Adjust Adjust the
existing tests file name.
2026-02-08 18:45:24 -08:00
Pádraig Brady
a3dbfb60e4 tests: fix false failure with dash or ksh
* tests/misc/read-errors.sh: Avoid dash or ksh as they
do _not_ print an error message upon EIO from read.
Fixes https://bugs.gnu.org/80353
2026-02-08 19:52:46 +00:00
Collin Funk
4fb263ce69 tests: nl: check that all files are processed
* tests/misc/nl.sh: Add a test case.
2026-02-06 15:46:44 -08:00
Pádraig Brady
41188ee3b8 tests: avoid false failure sync'ing busy systems
* tests/misc/sync.sh: Increase the timeout to 60s,
and restrict the case to when RUN_VERY_EXPENSIVE_TESTS=yes.
2026-02-02 12:55:37 +00:00
Pádraig Brady
bdf53cc685 tests: usage_vs_refs.sh: fix false failure with Alpine
* tests/misc/usage_vs_refs.sh: Fix missing escape on literal {,
required by busybox grep.
Reported by Bruno Haible.
2026-01-23 22:32:20 +00:00
Pádraig Brady
58ba9580e7 tests: fix false failure with pr -COLS
* tests/misc/usage_vs_getopt.sh: Fix false failure induced
by commit v9.9-239-ga06f0cf67
2026-01-22 11:56:50 +00:00
Pádraig Brady
87219034b7 doc: use TERM=dumb rather than HELP_NO_MARKUP to disable markup
This is a more standard mechanism to disable markup.

* src/system.h (oputs_): Logic change to honor TERM=dumb,
rather than HELP_NO_MARKUP=something.
* doc/coreutils.texi: Adjust the description for --help.
* man/local.mk: Ensure TERM is set to something,
so that man pages have links included.
* man/viewman: Just honor users $TERM.
* tests/misc/getopt_vs_usage.sh: Remove env var complication,
as TERM is unset automatically.
* tests/misc/usage_vs_refs.sh: Likewise.
* NEWS: Adjust the change in behavior note.
2026-01-22 11:42:47 +00:00
Pádraig Brady
bdc45990c7 tests: avoid false failure with non standard path
* tests/misc/usage_vs_refs.sh: Properly quote arguments
to avoid false failure with paths containing spaces etc.
2026-01-21 19:30:21 +00:00
Pádraig Brady
92df52d791 tests: avoid false failure on setgid dir
* tests/misc/mknod.sh: Skip a portion of the test
in the edge case of setgid directories.
2026-01-21 16:06:51 +00:00
Pádraig Brady
77e6b5d8f8 tests: ensure there is an anchor for each --help option
* tests/misc/usage_vs_refs.sh: A new test to correlation options
listed in --help, and anchors referenced in the texinfo (html) manual.
* tests/local.mk: Add the new test.
2026-01-21 14:05:48 +00:00
Pádraig Brady
d5e15b2f29 doc: ls: support styling and links in --help output
* src/ls.c (oputs): A new function that wraps puts(),
but also highlights the --option-text portion, and
adds links to the appropriate part of the online manual.
(usage): Call oputs() rather than puts().
* doc/coreutils.texi (--help): Document new HELP_NO_MARKUP env var,
which can be used in the edge case one wants to suppress ansi escapes.
* tests/misc/getopt_vs_usage.sh: Use HELP_NO_MARKUP to ensure the
test continues to pass.
2026-01-21 13:51:39 +00:00
Collin Funk
521a389635 tests: sync: check that all files are processed even when errors occur
* tests/misc/sync.sh: Add the test case.
2026-01-19 11:08:48 -08:00
Collin Funk
aac817f34b tests: sync: also test that -d and -f don't block on a FIFO
* tests/misc/sync.sh: Check 'sync fifo' with no arguments, -d, and -f
separately. Only perform the check for -f if RUN_EXPENSIVE_TESTS=yes
since it may be expensive.
2026-01-19 11:07:28 -08:00
Pádraig Brady
4d03a1e408 tests: strace: consider splice a "read" syscall
* tests/cksum/cksum-c.sh: Add 'splice' to the injection set.
* tests/misc/read-errors.sh: Likewise.
From https://github.com/coreutils/coreutils/pull/167
2026-01-18 16:58:38 +00:00
Pádraig Brady
fcaa3a39c7 tests: use command -v to identify binary
* tests/misc/coreutils.sh: Be more flexibile by using `command -v`
to identify the binary to be executed, rather than linking
directly to the built binary.
2026-01-18 12:48:36 +00:00
Collin Funk
c1d13a499a tests: avoid a test hang on AIX
* init.cfg (uses_strace_): New function.
(require_strace_): Use it.
tests/cksum/cksum-c.sh: Likewise.
tests/misc/read-errors.sh: Likewise.
2026-01-17 14:26:26 -08:00
Paul Eggert
23e696b0b2 maint: spelling fixes 2026-01-16 13:22:28 -08:00
Pádraig Brady
6b32a0bbde all: with multi-call binary, only process options for known names
Setup
  $ ln -nsf src/coreutils foo

Before
  $ ./foo; echo $?
  foo: unknown program ‘foo’
  Try './foo --help' for more information.
  1
  ./foo --version; echo $?
  coreutils (GNU coreutils) 9.9.172-01993
  0

After
  $ ./foo; echo $?
  coreutils: unknown program 'foo'
  1
  $ ./foo --version; echo $?
  coreutils: unknown program 'foo'
  1

* src/coreutils.c (main): Don't process options if
we don't know they're intended for the multi-call binary.
Otherwise `foo --version` would return true, even though
foo was symlinked to the multi-call binary, but not supported.
* tests/misc/coreutils.sh: Add test cases.
* NEWS: Mention the change in behavior.
2026-01-15 15:54:29 +00:00
Pádraig Brady
92d80b67cf tests: ensure utilities correctly diagnose read errors
* tests/misc/read-errors.sh: Ensure each utility calls a
read system call as requested.  Not doing so (say by avoiding
reading from a directory) is a layering violation.
Also ensure we diagnose the particular error encountered.
2026-01-13 15:08:04 +00:00
Pádraig Brady
06d228043f paste: support multi-byte delimiters
* src/paste.c (collapse_escapes): This is the central --delimiters
parsing function, so adjust to handle multi-byte chars with
mcel_scanz().  Populate a delimiters length array to support
characters of differing lengths.
(paste_serial): Use the delimiters length array to output
the appropriate delimiter.
(paste_parallel): Likewise.
* tests/paste/multi-byte.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
2026-01-13 14:32:01 +00:00
Pádraig Brady
49788a4510 tests: paste -d: test supported escape sequences
* tests/misc/paste.pl: Test all supported POSIX and GNU
backslash escape sequences.
2026-01-12 14:13:26 +00:00
Pádraig Brady
135dff3ad3 tests: cksum: ensure --check diagnoses read errors
* tests/misc/read-errors.sh: Add a test case.
Discussed in https://github.com/coreutils/coreutils/pull/167
2026-01-11 13:42:19 +00:00
Collin Funk
3621ad2f71 cksum: promptly diagnose write errors
* src/cksum.c (output_file, digest_check): Check if standard output has
it's error flag set after printing.
* tests/misc/write-errors.sh: Add a test case that would previously run
forever.
* NEWS: Mention the improvement. Reorder alphabetically.
2026-01-10 12:42:13 -08:00
Pádraig Brady
a9aad49f26 maint: remove redundant processing in a test
* tests/misc/write-errors.sh: This was a no-op anyway
due to inadequate escaping.  Also document the escaping requirement.
2026-01-10 01:04:33 +00:00
Pádraig Brady
19d2d707f7 du: promptly diagnose write errors
* src/du.c (print_size): Call write_error() if can't flush.
* tests/misc/write-errors.sh: Add a test case.
* NEWS: Mention the improvement.
2026-01-10 01:04:33 +00:00
Pádraig Brady
83f274feaa wc: promptly diagnose write errors
* src/wc.c (write_counts): Call write_error() if any pending errors.
* tests/misc/write-errors.sh: Add a test case.
* NEWS: Mention the improvement.
2026-01-10 01:04:33 +00:00
Collin Funk
0fcdd37fbd maint: organize mktemp tests in a subdirectory
* tests/misc/mktemp.pl: Moved to tests/mktemp/mktemp.pl.
* tests/local.mk (all_tests): Adjust the file name.
2026-01-06 18:52:48 -08:00
Collin Funk
73d3a49f45 maint: run 'make update-copyright' 2026-01-01 10:56:16 -08:00
Collin Funk
d45598f237 tests: kill: check that real-time signals are listed
* tests/misc/kill.sh: Call getlimits_. Check for RTMIN and RTMAX in the
output of 'kill -l' if the system defines SIGRTMIN and SIGRTMAX.
2025-12-27 21:48:42 -08:00
Pádraig Brady
e10205bab2 tests: check I/O error handling with /dev/full and closed pipes
* tests/misc/io-errors.sh: Verify that all commands diagnose write
errors, and handle a closed pipe appropriately.
* tests/local.mk: Reference the new test.
2025-12-27 16:55:48 +00:00
Collin Funk
6956163ee5 maint: organize tee tests in a subdirectory
* tests/misc/tee.sh: Moved to tests/tee/tee.sh.
* tests/local.mk (all_tests): Adjust the file name.
2025-12-11 19:00:58 -08:00
Collin Funk
bc1d66f8a5 maint: organize expand and unexpand tests in a subdirectory
* tests/misc/expand.pl: Move to tests/expand/expand.pl.
* tests/misc/unexpand.pl: Move to tests/unexpand/unexpand.pl.
* tests/local.mk (all_tests): Adjust file names.
2025-12-02 21:32:07 -08: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
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
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
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
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
Pádraig Brady
770078e315 numfmt: fix issues with multi-byte blanks
* 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-18 18:37:10 +01:00
Pádraig Brady
0f7babad38 numfmt: add --unit-separator
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-17 19:16:26 +01:00
Pádraig Brady
006dfe4cd4 numfmt: support reading numbers with grouping characters
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-17 17:26:30 +01:00
Pádraig Brady
8bc11f80a3 numfmt: support reading numbers with NBSP before unit
* 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-17 17:26:25 +01:00