31573 Commits

Author SHA1 Message Date
Paul Eggert 79b49251b5 dd: revert previous patch
The lack of need for the patch was explained by Collin Funk in:
https://bugs.gnu.org/81269#19
2026-06-20 13:30:34 -07:00
Paul Eggert 2e7707c23e dd: work around Linux kernel CLOCK_MONOTONIC bug
Problem reported by Sick Pigs (bug#81269).
Ordinarily we’d say “fix the kernel or the hardware”,
but this bug seems widespread and unlikely to be fixed any time soon,
and the workaround is not a lot of trouble.
* src/dd.c (real_start_time): New static var.
(getrealxtime): New static function.
(print_xfer_stats): Use the max of elapsed monotonic and elapsed
real time.
2026-06-20 12:20:33 -07:00
aizu-m 6a850b9aac wc: fix out-of-bounds read for single-byte wide characters
In legacy CJK locales a single input byte can decode to a wide character
above UCHAR_MAX, e.g. SHIFT-JIS bytes 0xA1..0xDF become U+FF61..U+FF9F.
wc then indexed its 256-entry wc_isprint/wc_isspace tables with that
value and read past their end.
* src/wc.c (wc): Take the byte-indexed fast path only when the decoded
character fits in a byte; wider values fall through to c32width and
c32isspace.
* tests/wc/wc-sjis.sh: New test.
* tests/local.mk (all_tests): Add it.
* NEWS: Mention the fix.

Link: https://github.com/coreutils/coreutils/pull/298
2026-06-19 15:39:10 +01:00
Collin Funk 04b757da79 tests: cp,install,mv: check for data loss with just-created files
* tests/misc/just-created.sh: New file.
* tests/local.mk (all_tests): Add the test case.
2026-06-18 19:31:39 -07:00
Pádraig Brady 144287129e tests: nproc: ensure affinity mask is independent of scheduler
* tests/nproc/nproc-quota-systemd.sh: Check affinity mask with
various schedulers.
https://github.com/coreutils/coreutils/pull/291
2026-06-18 16:35:17 +01:00
oech3 19fb2a9aa3 tests: nproc: ensure OMP_NUM_THREADS overflow is clamped
* tests/nproc/nproc-override.sh: Test overflowed OMP_NUM_THREADS.
https://github.com/coreutils/coreutils/pull/292
2026-06-18 16:15:26 +01:00
oech3 196956dff9 tests: nproc: ensure --ignore clamps overflowed num
* tests/nproc/nproc-positive.sh: Test --ignore overflowed num
is clamped to $UINTMAX_MAX.
https://github.com/coreutils/coreutils/pull/293
2026-06-18 15:50:45 +01:00
Pádraig Brady 5800d91721 tests: nproc: ensure scheduler and OMP_NUM_THREADS are independent
* tests/nproc/nproc-quota-systemd.sh: Explicitly set OMP_NUM_THREADS
to an ignorable value, to ensure scheduler processing is independent.
* tests/nproc/nproc-quota.sh: Likewise for the SCHED_FIFO check.
https://github.com/coreutils/coreutils/pull/290
2026-06-18 15:38:18 +01:00
oech3 c5d2f42c43 tests: split: ensure no files created with no input
* tests/split/split-io-err.sh: Ensure 'xaa' is not opened/created
with empty input.
https://github.com/coreutils/coreutils/pull/297
2026-06-18 14:20:35 +01:00
Collin Funk da1d289554 tests: date: test -d with only a minus sign
* tests/date/date.pl (@Tests): Add the test case.
2026-06-16 20:20:36 -07:00
oech3 bd649cca23 tests: nice: add test for --adjustment long option
* tests/nice/nice.sh: Ensure (abbreviated) long option is supported.
https://github.com/coreutils/coreutils/pull/296
2026-06-16 18:48:15 +01:00
Collin Funk fa1ad3fa07 tests: split: avoid a false failure when ulimit fails
* tests/split/suffix-length.sh: Don't fail the test case if ulimit
fails.
Reported by Bruno Haible.
2026-06-15 22:06:22 -07:00
Collin Funk 16d292f065 tests: test: test numeric operators with -l STRING
* tests/test/test.pl (@Tests): Add a few test cases.
2026-06-14 22:50:50 -07:00
Collin Funk efeac27389 tests: date: test time zone format strings with space padding
* tests/date/date.pl (@Tests): Add a few test cases.
2026-06-14 16:19:06 -07:00
Collin Funk 60f342dc97 build: update gnulib submodule to latest
This imports a xstrtol-error change from Gnulib that fixes some error
messages that were not properly escaped when given an invalid integer
argument.

* .gitignore: Add /lib/thread-creators.h which is generated by Gnulib.
* gnulib: Update to the latest commit.
* tests/od/od.pl (@Tests): Add some test cases.
* NEWS: Mention the improvement.
2026-06-14 15:20:26 -07:00
Collin Funk 2a7d111818 tests: date: test that multiple time zone abbreviations cause an error
* tests/date/date.pl (@Tests): Add two test cases.
2026-06-14 11:15:03 -07:00
Collin Funk befdbed2f9 test: tail: test that --follow works on a symbolic link
* tests/tail/follow-symlink.sh: New file.
* tests/local.mk (all_tests): Add the test.
2026-06-14 10:52:46 -07:00
Collin Funk dfb89db157 tests: od: test command line arguments are checked for overflow
* tests/od/od.pl ($INTMAX_OFLOW): Add definition.
(@Tests): Test -j, -N, -S, and -w with $INTMAX_OFLOW.
2026-06-13 15:30:42 -07:00
Pádraig Brady bb55b57c0a tests: pr: add more numeric option tests
* tests/pr/options.sh: Add tests for -e, -l, -w, -W.
2026-06-12 17:17:43 +01:00
Pádraig Brady a52fcef903 tests: pr: add checks for +... parameter handling
* tests/pr/options.sh: Ad a new test.
* tests/local.mk: Reference new test.
Addresses https://bugs.gnu.org/81225
2026-06-12 13:24:42 +01:00
Collin Funk 41b205b6d7 tests: ptx: check that invalid regular expressions are diagnosed
* tests/ptx/ptx.pl (@Tests): Add two test test cases.
2026-06-11 21:42:47 -07:00
Collin Funk ce0f4f68df tests: join: add another -e test case
* tests/join/join.pl (@tv): Add a test case.
2026-06-11 00:14:21 -07:00
Pádraig Brady 0a1a7f9022 cut: fix NUL termination of multi-byte field delimiter
* src/cut.c (delim_bytes): Add a spare byte so a maximum-length
multi-byte delimiter stays NUL terminated for the strstr needle in
find_field_delim.  Note in 9.11 this buffer was larger (16 bytes)
and so didn't not have a buffer over-read issue.
(main): Ensure DELIM_BYTES is NUL terminated after each --delimeter.
Also explicitly writing the NUL allows for better testing by
triggering overflow issues in default builds, if the buffer
is not sized correctly.
* NEWS: Mention the bug fix.
* tests/cut/cut.pl: Add test cases.
Reported at https://github.com/coreutils/coreutils/pull/286
2026-06-10 13:50:04 +01:00
Collin Funk beb0190739 env: port to mingw
* src/env.c (IGNORE): Undefine the macro so it does not break the
SIGNAL_MODE enum.
2026-06-09 21:09:43 -07:00
aizu-m 4ade9cf77f unexpand: fix heap overflow when a wide blank overshoots a tab stop
* NEWS: Mention the bug fix.
* src/unexpand.c (unexpand): Check if the column is greater or equal to
the next_tab_column.
* tests/unexpand/mb.sh: Add a test case.
https://github.com/coreutils/coreutils/pull/285
Copyright-paperwork-exempt: Yes
2026-06-09 18:20:39 -07:00
Sylvestre Ledru a04250cf3b tests: ls: cover two-line --time-style format assignment
* tests/ls/ls-time.sh: Check that with a "FORMAT1 NEWLINE FORMAT2"
  --time-style, FORMAT1 is used for non-recent (old) files and FORMAT2
  for recent files.
  Identified here: https://github.com/uutils/coreutils/issues/12676
Closes https://github.com/coreutils/coreutils/pull/281
2026-06-09 14:38:15 +01:00
Sylvestre Ledru c8ce189cbd tests: split: reject excessively large suffix lengths
* tests/split/suffix-length.sh: Ensure that a pathologically large
-a/--suffix-length value fails gracefully rather than crashing or
hanging.
https://github.com/uutils/coreutils/pull/12609
Closes https://github.com/coreutils/coreutils/pull/282
2026-06-09 14:22:09 +01:00
Sylvestre Ledru 5008d5d112 tests: sort: cover punctuation weight in locale collation
* tests/sort/sort-locale.sh: In a UTF-8 locale '-' carries a minimal
(shifted) weight, so 'file1' sorts before 'file-2' even though '-'
precedes '1' in the C/byte order.  This is the opposite of the C locale
result, so it also exercises the differs-from-C path.
Identified here: https://github.com/uutils/coreutils/pull/12677
Closes https://github.com/coreutils/coreutils/pull/283
2026-06-09 14:08:02 +01:00
Sylvestre Ledru e75940f675 tests: date: check date-string parsing corner cases
* tests/date/date.pl: Add tests covering a leading day-of-week name,
out-of-range zone minutes, two timezone tokens, a bare sign operand,
a trailing token after an @epoch operand, operand quoting in
diagnostics, and a '+N unit' suffix following a complete time.
* tests/date/date-tz.sh: Add tests covering daylight-saving gap,
and overlap local times.
Closes https://github.com/coreutils/coreutils/pull/284
2026-06-09 13:42:00 +01:00
Collin Funk 3ae92d6fd2 tests: install: check the behavior when strip is terminated by a signal
* tests/install/strip-program.sh: Add the test case.
2026-06-08 21:57:39 -07:00
Collin Funk 65ce1bd641 tests: dircolors: add another test case for TERM
* tests/misc/dircolors.pl (@Tests): Add a test case.
2026-06-08 21:18:57 -07:00
Collin Funk dd777fe89f tests: install: check the behavior when the source is the destination
* tests/install/basic-1.sh: Add the test case.
2026-06-07 22:39:43 -07:00
Collin Funk e583cae508 tests: fold: test that --width=0 produces an error
* tests/fold/fold.pl ($limits): New variable.
(@Tests): Add the test case.
2026-06-07 19:45:30 -07:00
Collin Funk c687e0586f nohup: port to mingw
* bootstrap.conf (gnulib_modules): Add execvp which as a different
prototype on Windows along with other issues mentioned in the Gnulib
manual.
* src/nohup.c (main): Check if SIGHUP is defined.
2026-06-07 16:43:50 -07:00
Collin Funk 0749ae07a9 maint: use the memmem Gnulib module
* bootstrap.conf (gnulib_modules): Add memmem which is missing on some
platforms, e.g., mingw, and buggy on some older platforms.
2026-06-06 23:08:23 -07:00
Pádraig Brady bbbd14c6d8 maint: tests: remove extraneous "&& :"
* tests/cp/symlink-slash.sh: && : is always redundant.
* tests/ls/symlink-slash.sh: Likewise.
2026-06-06 11:46:43 +01:00
Sylvestre Ledru 8da9f0c815 tests: ls: also check a trailing '/.' dereferences a symlink arg
* tests/ls/symlink-slash.sh: A symlink-to-directory argument written as
'symlink/.' denotes the directory itself, just like a trailing slash, so
'ls -l symlink/.' must list the directory contents rather than show the
symlink.
See https://github.com/uutils/coreutils/issues/7873
and https://github.com/uutils/coreutils/issues/6467
https://github.com/coreutils/coreutils/pull/280
2026-06-06 11:35:10 +01:00
Pádraig Brady d63de5ed02 doc: NEWS: describe the stat file name quoting changes
Note also a previous discussion on stat quoting at:
https://bugs.gnu.org/23422

* NEWS: Describe the changes in behavior.
2026-06-04 14:00:33 +01:00
Pádraig Brady 5ce0a47fcc stat: change default quoting from shell-escape-always to shell-escape
This should not affect programatic parsing, because if you have to parse
the shell style, then the same logic will parse unescaped output.
This is a better default now that --terse uses quoted format by default,
and also the default output format quotes file names by default.

* src/stat.c (getenv_quoting_style): Change the default.
2026-06-04 13:48:09 +01:00
Pádraig Brady 5d3f03b4fb stat: use quoted file names with --terse
* src/stat.c: Use %Qn rather than a bare %n by default,
so output is maintained on a single line for parsing.
2026-06-04 13:48:05 +01:00
Pádraig Brady 49f3b66719 stat: support %Qn format to output quoted file name
%N also outputs the target of a symlink
so support %Qn to give more control over quoted names.

* src/stat.c (print_it): Validate %Qn.
(print_stat): Output quoted file name with %Qn.
(usage): Add %Qn description.
* doc/coreutils.texi (stat invocation): Likewise.
* tests/stat/stat-fmt.sh: Add a test case.
2026-06-04 13:14:27 +01:00
Pádraig Brady 641422abad stat: honor QUOTING_STYLE in default file name quoting
This is safer to output to terminal with malicious file names,
with multiple lines or control characters etc.

* src/stat.c: Quote the file name in the default output format
in the default quoting style, or as selected with QUOTING_STYLE.
Reported by Michał Majchrowicz and Marcin Wyczechowski.
2026-06-04 13:14:27 +01:00
Pádraig Brady 35d7f1f3ef doc: stat: suppress ls specific info
* doc/coreutils.texi (stat invocation): Avoid outputting confusing
info specific to the ls command for QUOTING_STYLE.
2026-06-04 13:14:27 +01:00
Pádraig Brady 6203f8f978 tests: shred: really fix intermittent false failure
The previous commit is not sufficient to fix the race,
since I forgot shred now opens with O_NONBLOCK, and so cat may
not be even reading by the time shred's open() returns.

* tests/shred/fifo.sh: Put more robust synchronization in place
along the lines of what we did in commit v9.11-47-ga6ba6a23a,
using a separate fifo_writer_ to ensure the cat is reading,
before shred runs.
2026-06-04 13:13:27 +01:00
Pádraig Brady ab7ef8b515 tests: shred: fix intermittent false failure
* tests/shred/fifo.sh: Fix (unreleased) racy test.
2026-06-03 22:17:01 +01:00
Pádraig Brady 2632fbf08c tests: install: avoid failure on FreeBSD/macOS
* tests/install/stdin.sh: Avoid inode correlation issue discussed at
https://lists.gnu.org/r/coreutils/2026-06/msg00004.html
2026-06-03 12:12:33 +01:00
Sylvestre Ledru 56ed0d516e tests: date: check fixed offset is anchored before relative items
A fixed-offset keyword such as 'UTC' must anchor the instant before
relative items are applied, so that '1970-01-01 UTC N seconds' is
exactly N seconds past the epoch even when the local zone observes
DST between the epoch and the result.

* tests/date/date-tz.sh: Add a relative-seconds-across-DST case.
https://github.com/coreutils/coreutils/pull/275
2026-06-02 11:45:52 +01:00
Sylvestre Ledru 7aeef80298 tests: cover symlink-cycle detection in chmod/chown -RL
With -L, a recursive chmod/chown follows symlinks while descending;
a symlink pointing back to an ancestor forms a cycle that must be
detected and not descended into forever.

* tests/chmod/symlinks.sh: Add a symlink-cycle case for chmod -RL.
* tests/chown/deref.sh: Likewise for chown -RL.
https://github.com/coreutils/coreutils/pull/274
2026-06-02 11:43:06 +01:00
Sylvestre Ledru 66f18c209c tests: cksum: check truncated digests are flagged as malformed
* tests/cksum/cksum-c.sh: A tagged checksum line with a valid algorithm
but a hex digest of the wrong (truncated) length must be reported as
improperly formatted rather than as a checksum mismatch (FAILED).
See https://github.com/uutils/coreutils/issues/6576
https://github.com/coreutils/coreutils/pull/273
2026-05-30 21:29:19 +01:00
Collin Funk 5ce903c004 tests: shred: check the removal of files in a subdirectory
* tests/shred/shred-remove.sh: Add a test case.
2026-05-30 10:25:40 -07:00