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

30781 Commits

Author SHA1 Message Date
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
Pádraig Brady
70eb250fd7 tests: fold: avoid false failures on Solaris 10
* tests/fold/fold-characters.sh: Ensure we have independent verification
of the width of characters before testing based on those widths.
* tests/fold/fold-zero-width.sh: Likewise.
* tests/fold/fold.pl: Only compare the exit status,
as the error message can be translated.
2025-09-20 22:12:58 +01:00
Pádraig Brady
df30ce36e8 tests: dd: avoid false failure on Solaris 10
* tests/dd/no-allocate.sh: Give some extra space to the
determined vm limit.
2025-09-20 22:12:58 +01:00
Pádraig Brady
7c217bd8ac tests: avoid false failure on CentOS 5,6,7
* tests/fold/fold-zero-width.sh: Increase vm limit to avoid
failures on CentOS 5,6,7.  Match the limit used in write-errors.sh
as per commit v9.5-255-g0bd149403
2025-09-20 16:17:43 +01:00
Collin Funk
2d2eb2cbe8 doc: don't capitalize the first letter of cgroup
This is the correct way to write it as described in the documentation:
<https://docs.kernel.org/admin-guide/cgroup-v2.html#terminology>.

* doc/coreutils.texi (nproc invocation): Use cgroup instead of Cgroup.
2025-09-20 15:21:41 +01:00
Collin Funk
bbde83899d tests: env: skip a few tests if LD_LIBRARY_PATH is set
* tests/env/env-null.sh: Skip test if LD_LIBRARY_PATH or platform's
equivalent is set, since 'env -i' will unset it which may prevent
programs from running.
* tests/env/env-S.pl: Likewise.
Issue and suggested fix reported by Bruno Haible.
2025-09-19 16:40:09 -07:00
Grisha Levit
d9ff4d9af2 touch: fix diagnostic on macOS 26
* src/touch.c (touch): Do not use open_errno == EEXIST for diagnostic
if file was a directory as macOS 26 sets it for open("/", O_CREAT, ...).
2025-09-19 11:29:37 -07:00
Paul Eggert
d535ca4c06 copy: pacify older clang
* src/copy-file-data.c (copy_file_data):
Redo conditionals for clarity.
This pacifies the clang in FreeBSD 11 and OpenBSD 7.6.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/coreutils/2025-09/msg00104.html
2025-09-19 08:55:12 -07:00
Collin Funk
2662ddf335 dd: don't mistakenly use O_EXCL on GNU/Hurd
* src/dd.c (v): Add the O_EXCL flag to the set of bits that we do not
want to use for our definitions.
* cfg.mk (sc_dd_O_FLAGS): Adjust to pass syntax-check.
* NEWS: Mention the fix.
Reported by Bruno Haible.
2025-09-18 23:31:18 -07:00
Paul Eggert
7e41b00d07 maint: we don’t use Gnulib’s fchownat module
* bootstrap.conf (gnulib_modules): Remove fchownat.
It is used only indirectly, via the chownat module.
2025-09-18 17:08:01 -07:00
Bruno Haible
71a8cdf6b1 fmt: eliminate a clang -Wformat-extra-args warning
* src/fmt.c (fmt): When not reading from stdin, always mention the
file name in the error message.
2025-09-18 22:33:51 +01:00
Paul Eggert
af536b5ab7 maint: we use Gnulib’s stddef-h module directly
* bootstrap.conf (gnulib_modules): Add stddef-h, since the code
uses ‘unreachable’ which is supplied by that module.
2025-09-18 14:22:55 -07:00
Pádraig Brady
4ca51b1013 tests: tail/overlay-headers.sh: protect against hang
* tests/tail/overlay-headers.sh: Protect tail invocation with timeout,
and extend the possible running period to 60 seconds like other tests.
Reported by Brudno Haible on T2SDE Linux/alpha
2025-09-18 19:04:57 +01:00
Pádraig Brady
514f723d39 build: fix compile error on macOS
* gnulib: Update to latest to pull fix
for localcharset compile failure on macOS.
2025-09-18 18:04:57 +01:00
Pádraig Brady
0a2a3deb33 tests: tests/tail/wait.sh: protect against hang
* tests/tail/wait.sh: This test was seen to hang occasionally
on an Alpine Linux 3.20 system, so protect the tail(1) call
with `timeout 60` as done in similar tests.
Reported by Bruno Haible.
2025-09-18 17:47:45 +01:00
Pádraig Brady
c2e1816a53 build: fix link failure on macOS
* src/local.mk: Explicitly depend on @INTL_MACOS_LIBS@
which may be not implicitly referenced (in LIBINTL) without gettext.
This is a new transitive dependency through localename-unsafe.
We add this globally to ease future maintenance as currently
6 commands require the localename-unsafe dependency:
date, du through show-date() (fprintftime), and
ls, pr, stat, uptime through strftime().
2025-09-18 17:13:02 +01:00
Pádraig Brady
dc30eab314 build: update gnulib for stringeq adjustment
* gnulib: Pull in stringeq adjustment.
2025-09-17 21:44:46 +01:00