1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-12 10:22:38 +02:00
Commit Graph

30797 Commits

Author SHA1 Message Date
Nicolas Boichat
ab5fce879b tests: du/bigtime: try harder to find a suitable filesystem
* 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-16 18:28:52 +01:00
Collin Funk
1066d442c2 tests: date: check that the hour format of the current locale is used
* 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-13 21:56:43 -07:00
Pádraig Brady
b4e02e0ef4 tests: fix false failure in recent memory limit test
* tests/basenc/bounded-memory.sh: Ensure we skip the test
upon failure to determine the memory lower bound.
Reported by Bruno Haible.
2025-10-13 13:22:38 +01:00
Pádraig Brady
b880b02c44 numfmt: fix buffer over-read (CWE-126)
* 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-11 12:37:56 +01:00
Pádraig Brady
dd3eab13ee tests: basenc: use less redundant naming
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-11 11:28:22 +01:00
Pádraig Brady
86234ebffa tests: fix memory limit determination in new test
* tests/basenc/basenc-bounded-memory.sh: The passed command
needs to succeed for memory limit determination to work.
2025-10-11 11:27:47 +01:00
Collin Funk
f88f0e5d44 tests: basenc: add a test for bounded memory operation
* tests/basenc/basenc-bounded-memory.sh: New file.
* tests/local.mk (all_tests): Add the test.
2025-10-11 01:33:15 -07:00
Sylvestre Ledru
ae0fcbba97 tests: ln -f: ensure existing link replaced
Identified here:
<https://github.com/uutils/coreutils/issues/8830>

* tests/ln/misc.sh: Add the check.
2025-10-10 18:19:47 +01:00
Pádraig Brady
51f27a15b0 tests: cksum: add a test case for robust file name parsing
* tests/cksum/cksum-c.sh: Add a test case where the file name
contains tagged format delimiter characters.
2025-10-07 15:58:36 +01:00
Pádraig Brady
ac91433916 maint: cksum: document a base64/hex parsing ambiguity with untagged
* src/digest.c (split_3): Mention the ambiguity in misinterpreting
base64 characters as hex is not a practical consideration.
Also add an example of both tagged formats which makes it
easier to interpret the parsing logic.
2025-10-07 15:58:36 +01:00
Pádraig Brady
4639257610 cksum: fix --check with untagged base64 format with tag matches
* 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-07 15:58:36 +01:00
Pádraig Brady
e661c7a525 cksum: fix length validation with SHA2- tagged format
* 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-07 15:58:36 +01:00
Pádraig Brady
cd2a8edd84 cksum: fix --check with --algorithm=sha2
* 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-07 15:58:34 +01:00
Paul Eggert
311c04c059 rm: remove redundant mark_ancestor_dirs call
* src/remove.c (rm_fts): Remove unnecessary call.  Since this code
is executed only when not recursive, there are no ancestors to mark.
2025-10-06 13:37:22 -07:00
Paul Eggert
bae32db8fe rm: make ‘rm -d DIR’ more like ‘rmdir DIR’
* src/remove.c (rm_fts): When not recursive,
arrange for ‘rm -d DIR’ to behave more like ‘rmdir DIR’.
This works better for Ceph snapshot directories.
Problem reported by Yannick Le Pennec (bug#78245).
2025-10-06 13:37:21 -07:00
Collin Funk
ce8c22d25f cksum: allow -a {blake2b,sha2,sha3} --check to work on base64
* 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-05 15:38:27 -07:00
Paul Eggert
ebfd80083b maint: omit trailing white space in config.h
* configure.ac (FORTIFY_SOURCE): Don’t indent a line
where the indentation can cause trailing white space in config.h.
Problem reported by Grisha Levit (Bug#79567).
2025-10-03 17:06:00 -07:00
Collin Funk
dba5cdc24e maint: remove IRIX support
* src/ptx.c (main) [HAVE_SETCHRCLASS]: Remove call to setchrclass.
* src/stty.c (VREPRINT) [!VREPRINT && VRPRNT]: Remove definition.
2025-10-03 14:52:30 -07:00
Pádraig Brady
1b12425f67 tests: factor: add suggested large prime tests
* 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-02 17:22:28 +01:00
Pádraig Brady
75e3888bd3 unexpand: fix heap buffer overflow with --tabs=[+/]NUM
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-10-02 15:26:02 +01:00
Pádraig Brady
58ea3574e6 doc: man: consistently format -X[OPTIONAL] form
This is significant for the date, od, and pr commands
which have options of the form -X[OPTIONAL], which change like:

  diff -r man.orig/date.1 man/date.1
  < \fB\-I[FMT]\fR, \fB\-\-iso\-8601\fR[=\fI\,FMT\/\fR]
  > \fB\-I\fR[\fI\,FMT\/\fR], \fB\-\-iso\-8601\fR[=\fI\,FMT\/\fR]

  diff -r man.orig/od.1 man/od.1
  < \fB\-w[BYTES]\fR, \fB\-\-width\fR[=\fI\,BYTES\/\fR]
  > \fB\-w\fR[\fI\,BYTES\/\fR], \fB\-\-width\fR[=\fI\,BYTES\/\fR]

* man/help2man (convert_options): Support options of the form
-X[PARAM], so that we now consistently format them (in italics).
2025-10-02 10:14:16 +01:00
Pádraig Brady
1cac40b637 doc: man: consistently italicize --option parameters
This changes a few pages, but the changes in tail.1
concisely illustrate the resulting man page changes:

  $ diff -r man.orig/tail.1 man/tail.1
  < \fB\-c\fR, \fB\-\-bytes\fR=\fI\,[\/\fR+]NUM
  > \fB\-c\fR, \fB\-\-bytes\fR=\fI\,[+]NUM\/\fR

  < \fB\-f\fR, \fB\-\-follow[=\fR{name|descriptor}]
  > \fB\-f\fR, \fB\-\-follow\fR[=\fI\,{name|descriptor}\/\fR]

  < \fB\-n\fR, \fB\-\-lines\fR=\fI\,[\/\fR+]NUM
  > \fB\-n\fR, \fB\-\-lines\fR=\fI\,[+]NUM\/\fR

* man/help2man: Relax the option match so more --option
variations are supported, and passed through to convert_option().
Specifically more variations after '=' are now supported.
Also split and document the regular expression.
Reported at https://github.com/coreutils/coreutils/issues/84
2025-10-02 10:13:53 +01:00
Collin Funk
7d55fd0aa3 maint: prefer unreachable () to NOTREACHED comment
* src/tsort.c (search_item): Use unreachable () instead of NOTREACHED.
2025-10-01 23:44:18 -07:00
Collin Funk
16a6736389 fold: move multi-byte character reading to a module
* gl/modules/mbbuf: New file.
* gl/lib/mbbuf.c: Likewise.
* gl/lib/mbbuf.h: Likewise.
* gl/local.mk (EXTRA_DIST): Add the new files.
* bootstrap.conf (gnulib_modules): Add mbbuf.
* src/fold.c: Include mbbuf.h.
(fold_file): Use the mbbuf functions instead of calling fread and
handling the input buffer ourselves.
* cfg.mk (exclude_file_name_regexp--sc_preprocessor_indentation)
(exclude_file_name_regexp--sc_GPL_version): Match gl/lib/mbbuf.c and
gl/lib/mbbuf.h.
2025-09-30 19:45:44 -07:00
Mathieu Bordere
67e9068c5f wc: add AVX512 function for line counting
* 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-30 14:09:37 +01:00
Pádraig Brady
c6afc8fa67 maint: update valgrind instructions
* README-valgrind: Adjust to current repo structure,
and give clearer step by step instructions.
2025-09-28 00:25:06 +01:00
Collin Funk
4eb83aaa45 maint: convert some overflow checks to ckd_add and ckd_mul
* src/csplit.c (parse_repeat_count): Prefer ckd_add when checking for
overflows.
* src/install.c (get_ids): Likewise.
* src/shred.c (dopass): Likewise.
* src/tr.c (get_spec_stats): Likewise.
* src/sort.c (specify_sort_size): Prefer ckd_mul when checking for
overflows.
2025-09-27 14:34:44 -07:00
Pádraig Brady
bfcfe9e1c4 tests: test: ensure file operations are covered
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-26 21:01:04 +01:00
Bernhard Voelker
7ac313dce6 join: remove unused #include "argmatch.h"
Prompted by the syntax-check failure:
  maint.mk: the above files include argmatch.h but don't use it
  make: *** [maint.mk:741: sc_prohibit_argmatch_without_use] Error 1

* src/join.c: Remove include, as the previous commit changed from using
ARRAY_CARDINALITY to countof - for which system.h includes the header.
2025-09-25 19:18:16 -07:00
Collin Funk
1bc5ec61d8 maint: prefer countof over ARRAY_CARDINALITY
* bootstrap.conf (gnulib_modules): Add stdcountof-h.
* src/system.h: Include stdcountof.h.
(ARRAY_CARDINALITY): Remove definition.
* .gitignore (/lib/stdcountof.h): Ignore Gnulib generated file.
* src/csplit.c: Use countof instead of ARRAY_CARDINALITY.
* src/df.c: Likewise.
* src/digest.c: Likewise.
* src/dircolors.c: Likewise.
* src/factor.c: Likewise.
* src/join.c: Likewise.
* src/ls.c: Likewise.
* src/od.c: Likewise.
* src/sort.c: Likewise.
* src/stdbuf.c: Likewise.
* src/tr.c: Likewise.
2025-09-24 17:31:57 -07:00
Hannes Braun
914972e80d tail: fix tailing larger number of lines in regular files
* 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-24 22:37:18 +01:00
Pádraig Brady
0cc3e1bfb6 tests: wc: fix hardware acceleration disabling test
* tests/wc/wc-cpu.sh: The message is only printed with wc -l.
Reported by Mathieu Borderé.
2025-09-24 15:53:34 +01:00
Pádraig Brady
de3ea76dbc build: copy: add dependency on $(LIB_SMACK)
* src/local.mk: Due to gnulib adjustments, this explicit
dependency is required with the mold linker at least.
Reported at https://github.com/coreutils/coreutils/issues/113
2025-09-24 11:21:51 +01:00
Pádraig Brady
2ef53e5b04 basenc: --base58: fix buffer overflow with input > 15MB
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-23 20:35:34 +01:00
Pádraig Brady
d766efc7e4 doc: document gl_cv_crc_pclmul to control hardware acceleration
doc/coreutils.texi (Harware acceleration configuration):
Sort the list and add "gl_cv_crc_pclmul".
2025-09-23 20:28:19 +01:00
Pádraig Brady
062c16c17e build: fix build failure with mismatched pclmul
* src/cksum.c (pclmul_supported): In the case where
gnulib has pclmul enabled but coreutils does not,
ensure we don't reference the coreutils pclmul function.
Addresses https://bugs.gnu.org/79491
2025-09-23 20:28:19 +01:00
Paul Eggert
35795a8e35 build: update gnulib submodule to latest 2025-09-22 17:45:42 -07:00
Pádraig Brady
8c027d3bfb maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2025-09-22 18:23:31 +01:00
Pádraig Brady
76e161dc2d version 9.8
* NEWS: Record release date.
v9.8
2025-09-22 17:50:52 +01:00
Pádraig Brady
71849a2421 build: update gnulib to latest
* gnulib: Update to latest to pull Android build fixes,
and fchownat fixes.
2025-09-22 14:02:23 +01:00
Pádraig Brady
b8b486dc32 tests: ls: avoid alignment check with non printable characters
* 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-22 11:23:50 +01:00
Pádraig Brady
f9c6c730eb tests: du: avoid false failure in racy test
* 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-22 00:09:03 +01:00
Pádraig Brady
52a15e470d build: revert gnulib update
There is a pending issue with fchownat:
https://lists.gnu.org/r/bug-gnulib/2025-09/msg00282.html
2025-09-22 00:06:03 +01:00
Collin Funk
dfedc2ee63 build: update gnulib submodule to latest 2025-09-21 15:14:12 -07:00
Collin Funk
483fa3b9ab build: fix missing declarations on Android
* configure.ac: Check for statx using gl_CHECK_FUNCS_ANDROID since it is
hidden for Android API level <= 30.
* m4/jm-macros.m4 (coreutils_MACROS): Check for syncfs using
gl_CHECK_FUNCS_ANDROID since it is hidden for Android API level <= 28.
2025-09-21 13:40:18 -07:00
Paul Eggert
ebedbe8997 maint: comment spelling fixes 2025-09-21 11:30:40 -07:00
Paul Eggert
6c194dc85b tests: fix OMP_NUM_THREADS misspelling
* tests/nproc/nproc-quota.sh: Fix misspelling.
2025-09-21 11:30:12 -07:00
Paul Eggert
e65f3a36c8 maint: update bootstrap from Gnulib 2025-09-21 09:47:03 -07:00
Pádraig Brady
8a1f434463 tests: avoid false failure on older Linux kernels
* tests/fold/fold-zero-width.sh: Check the shell was able to create
the redirection file, as intermittently on CentOS 5,6,7 this wasn't
the case, with the shell giving an xmalloc failure due to the ulimit.
Reported by William Bader and Bruno Haible.
2025-09-21 16:37:26 +01:00
Pádraig Brady
076e247416 tests: tail: avoid false failure with overlayfs
* tests/tail/inotify-dir-recreate.sh: Add an extra check
that inotify is in use, as it's required for this test.
Inotify is avoided with overlayfs for which the
df --local check is not sufficient exclusion for.
2025-09-21 13:45:54 +01:00