Commit Graph
31221 Commits
Author SHA1 Message Date
Collin Funk dc0baaf4de maint: comm: prefer static initialization
* src/comm.c (only_file_1, only_file_2, both): Initialize variables.
(main): Remove unnecessary initializations.
2026-02-19 21:18:41 -08:00
Collin Funk ecf3f98eec maint: wc: prefer static initialization
* src/wc.c (main): Remove unnecessary initializations.
2026-02-19 21:11:27 -08:00
Collin Funk 85dde4c2d9 maint: tac: prefer static initialization
* src/tac.c (separator, separator_ends_record, sentinel_length):
Initialize variables.
(main): Remove unnecessary initializations.
2026-02-19 21:08:43 -08:00
Collin Funk fea1dcadf6 maint: join: prefer static initialization
* src/join.c (print_pairables): Initialize variable.
(main): Remove unnecessary initializations.
2026-02-19 21:05:11 -08:00
Collin Funk 425dd90b88 maint: cut: prefer static initialization
* src/cut.c (main): Remove unnecessary initializations.
2026-02-19 21:01:10 -08:00
Collin Funk 82a20cd6f2 maint: seq: prefer static initialization
* src/seq.c (separator): Initialize variable.
(main): Remove unnecessary initializations.
2026-02-19 20:53:20 -08:00
Collin Funk ef72d0edd2 maint: paste: prefer static initialization
* src/paste.c (main): Remove unnecessary initializations.
2026-02-19 20:49:40 -08:00
Collin Funk 70e4e2d43a maint: install: prefer static initialization
* src/install.c (main): Remove unnecessary initializations.
2026-02-19 20:45:54 -08:00
Collin Funk beb9392206 maint: chmod: prefer static initialization
* src/chmod.c (main): Remove unnecessary initializations.
2026-02-19 20:39:41 -08:00
Collin Funk 5b29c9c04f maint: head: prefer static initialization
* src/head.c (line_end): Initialize variable.
(main): Remove unnecessary initializations.
2026-02-19 20:36:56 -08:00
Collin Funk 97b7213118 maint: ln: prefer static initialization
* src/ln.c (main): Remove unnecessary initializations.
2026-02-19 20:36:47 -08:00
Collin Funk 4bb3309b72 maint: nl: prefer static initialization
* src/nl.c (main): Remove unnecessary initialization.
2026-02-19 20:36:40 -08:00
Collin Funk 1197e54553 maint: touch: prefer static initialization
* src/touch.c (main): Remove unnecessary initializations.
2026-02-19 20:36:31 -08:00
Collin Funk f009f68e3b maint: fold: prefer static initialization
* src/fold.c (main): Remove unnecessary initializations.
2026-02-19 20:36:08 -08:00
Collin Funk a398d52b65 maint: tee: prefer static initialization
* src/tee.c (main): Remove unnecessary initializations.
2026-02-19 20:35:49 -08:00
Collin Funk 66d34782b9 maint: rmdir: prefer static initialization
* src/rmdir.c (main): Remove unnecessary initialization.
2026-02-19 20:35:35 -08:00
Collin Funk 300ef2e63b maint: tty: prefer static initialization
* src/tty.c (main): Remove unnecessary initialization.
2026-02-19 20:35:19 -08:00
Pádraig Brady 200cc6a598 maint: tests: DRY a recent change
* tests/pwd/pwd-long.sh: Adjust so complicated command is not repeated.
2026-02-19 19:42:14 +00:00
Collin Funk 6a3dde5dd2 wc: add aarch64 Neon optimization for wc -l
Here is an example of the performance improvement:

    $ yes abcdefghijklmnopqrstuvwxyz | head -n 100000000 > input
    $ time ./src/wc-prev -l < input
    100000000

    real	0m0.793s
    user	0m0.630s
    sys	0m0.162s
    $ time ./src/wc -l < input
    100000000

    real	0m0.230s
    user	0m0.065s
    sys	0m0.164s

* NEWS: Mention the performance improvement.
* gnulib: Update to the latest commit.
* configure.ac: Check the the necessary intrinsics and functions.
* src/local.mk (noinst_LIBRARIES) [USE_NEON_WC_LINECOUNT]: Add
src/libwc_neon.a.
(src_libwc_neon_a_SOURCES, wc_neon_ldadd, src_libwc_neon_a_CFLAGS)
[USE_NEON_WC_LINECOUNT]: New variables.
(src_wc_LDADD) [USE_NEON_WC_LINECOUNT]: Add $(wc_neon_ldadd).
* src/wc.c [USE_NEON_WC_LINECOUNT]: Include sys/auxv.h and asm/hwcap.h.
(neon_supported) [USE_NEON_WC_LINECOUNT]: New function.
(wc_lines) [USE_NEON_WC_LINECOUNT]: Use neon_supported and
wc_lines_neon.
* src/wc.h (wc_lines_neon): Add declaration.
* src/wc_neon.c: New file.
* doc/coreutils.texi (Hardware Acceleration): Document the "-ASIMD"
hwcap and the variable used in ./configure to override detection of Neon
instructions.
* tests/wc/wc-cpu.sh: Also add "-ASIMD" to disable the use of Neon
instructions.
2026-02-18 20:09:44 -08:00
Pádraig Brady 5f3a601fbb tests: use system ENOTEMPTY message
* tests/mv/dir2dir.sh: Map system specific messages.
* tests/rm/d-2.sh: Likewise.
2026-02-18 18:31:49 +00:00
Pádraig Brady dd3fd4593d maint: tests: avoid ERANGE specific handling
* tests/fmt/base.pl: Verify ERANGE is diagnosed.
* tests/od/od.pl: Adjust determination of ERANGE.
2026-02-18 18:31:49 +00:00
Pádraig Brady 7d07156e03 maint: tests: avoid ELOOP specific handling
* tests/du/long-sloop.sh: Adjust determination of ELOOP.
2026-02-18 18:31:49 +00:00
Pádraig Brady 448a7dc072 maint: tests: avoid ENOSPC specific handling
* tests/csplit/csplit-io-err.sh: Adjust determination of ENOSPC.
* tests/csplit/split-io-err.sh: Likewise.
* tests/fold/fold-zero-width.sh: Verify full ENOSPC message.
* tests/tac/tac-continue.sh: Likewise.
* tests/misc/io-errors.sh: Likewise.
* tests/misc/write-errors.sh: Likewise.
2026-02-18 18:31:49 +00:00
Pádraig Brady 798f94c828 tests: use system ENOSPC message
* tests/head/head-write-error.sh: Verify ENOSPC is output.
* tests/misc/yes.sh: Likewise.
2026-02-18 18:31:49 +00:00
Pádraig Brady 17fb316388 tests: use system ENOTSUP message
* tests/cp/cp-mv-enotsup-xattr.sh: Don't hardcode "Operation not
supported".
* tests/cp/cp-a-selinux.sh: Likewise.
2026-02-18 18:31:49 +00:00
Pádraig Brady e001f99d1e maint: tests: avoid ENOTSUP specific handling
* tests/mv/mv-exchange.sh: Use ENOTSUP rather than
transforming variations.
2026-02-18 18:31:49 +00:00
Pádraig Brady 5c073ec7c5 tests: use system EACCES message
* tests/chgrp/no-x.sh: Don't harcode "Permission denied".
* tests/chmod/no-x.sh: Likewise.
* tests/du/inacc-dest.sh: Likewise.
* tests/du/no-x.sh: Likewise.
* tests/misc/nohup.sh: Likewise.
* tests/mv/part-fail.sh: Likewise.
* tests/mv/perm-1.sh: Likewise.
* tests/rm/fail-eacces.sh: Likewise.
* tests/rm/rm1.sh: Likewise.
* tests/rm/rm2.sh: Likewise.
* tests/rm/unread2.sh: Likewise.
* tests/rm/unreadable.pl: Likewise.
2026-02-18 18:31:49 +00:00
Pádraig Brady fe997b5f98 maint: tests: avoid AIX specific EACCES handling
* tests/rm/inaccessible.sh: Remove AIX specific handling.
* tests/cp/fail-perm.sh: Likeise.  Also remove confusing
EPERM/HPUX mentions.
* tests/misc/sync.sh: Don't hardcode EISDIR and EACCES.
2026-02-18 18:31:49 +00:00
Pádraig Brady c03cc2dca6 maint: tests: avoid EPERM/EACCES specific handling
* tests/Coreutils.pm: Remove associated comment.
* tests/mv/sticky-to-xpart.sh: Use $EACCES and $EPERM.
* tests/rm/fail-2eperm.sh: Likewise.
* tests/touch/not-owner.sh: Likewise.
2026-02-18 18:31:49 +00:00
Pádraig Brady 6218f2b7a3 maint: tests: avoid EPERM specific handling
* tests/dd/fail-ftruncate-fstat.sh: Use $EPERM rather than
mapping specific strings to the Linux $EPERM.
* tests/mkdir/smack-no-root.sh: Use $EPERM rather than hardcoding.
2026-02-18 18:31:49 +00:00
Collin Funk 9edebc617f maint: expr: reduce variable scope
* src/expr.c (mbs_logical_cspn, main, trace, docolon, eval7, eval6)
(eval5, eval4, eval3, eval2, eval1, eval): Declare variables where they
are used instead of at the start of the function.
2026-02-17 18:45:33 -08:00
Pádraig Brady 8a0d9b889f tests: pwd: ensure our getcwd fallback is tested
* tests/pwd/pwd-long.sh: Avoid the getcwd syscall,
to ensure our fallback getcwd code is exercised.
* NEWS: Mention the recent bug fix in pwd.
2026-02-17 00:41:50 +00:00
Chris Down 41e5ae80b1 pwd: fix heap buffer overflow in file_name_prepend
file_name_prepend works by right-aligning path data in a growing buffer.
When the buffer is too small, it then allocates a new buffer via
xpalloc() and copies existing data to the end of the new buffer.

Unfortunately, the memcpy destination is computed as buf + p->n_alloc -
n_free, but xpalloc has already updated p->n_alloc to the new (larger)
allocation size while n_free still reflects the old state. This places
the data at too high an offset, writing past the end of the buffer.

Update to properly calculate the destination offset.

Fixes: v9.5-171-g61ab25c35 ("pwd: prefer xpalloc to xnrealloc")
2026-02-16 10:45:45 +00:00
Paul Eggert f529c33123 build: update gnulib submodule to latest 2026-02-14 23:51:47 -08:00
Collin Funk 131fad77ad maint: seq,who: prefer xasprintf
* src/seq.c (main): Use xasprintf instead of asprintf followed by a
check if the allocation fails.
* src/who.c (print_line): Likewise.
2026-02-14 14:48:45 -08:00
Collin Funk 84c2848f5d maint: seq: reduce variable scope
* src/seq.c (long_double_format, print_numbers, main): Declare variables
where they are used instead of at the start of the function.
2026-02-14 12:15:09 -08:00
Collin Funk fec63bfa03 tests: date: check that options can follow the format string
* tests/date/date.pl (@Tests): Add the test case.
2026-02-13 22:26:59 -08:00
Pádraig Brady e78328e707 doc: relax github issue/pull-request instructions
Be more accepting of github issues and pull-requests.
Be a bit less verbose in info provided.
2026-02-12 17:42:52 +00:00
oech3 f638c29df6 tests: sort: ensure --batch-size=(rlimit+1) fails
* tests/sort/sort-merge-fdlimit.sh: Add test case.
https://github.com/coreutils/coreutils/pull/182
2026-02-12 17:27:49 +00:00
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 fc42e7d281 tests: cp: ensure --debug output failure is diagnosed
* tests/cp/debug.sh: cp diagnostics are written to stdout,
so ensure output errors are diagnosed.
https://github.com/coreutils/coreutils/pull/192
2026-02-12 16:33:38 +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 b4c6e3cb7f tests: date: check dotted EU dates in combination
* tests/date/date.pl: Add other date elements
to ensure abbreviated dotted dates are parsed appropriately.
Corresponds to gnulib commit 451042cb76
2026-02-12 14:52:06 +00:00
Pádraig Brady 1f2aa39882 build: update gnulib to latest 2026-02-12 14:03:28 +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 8732e7e95e tests: getlimits: output error strings
* src/getlimits.c (main): Iterate over defined errnos,
and output shell compatible error strings.
* tests/Coreutils.pm: Adjust so shell quotes are stripped.
2026-02-10 12:24:17 +00:00
Collin Funk 224b90e603 maint: pinky: reduce variable scope
* src/pinky.c (create_fullname, idle_string, print_entry)
(print_long_entry, main): Declare variables where they are used instead
of at the start of the function. Initialize variables where they are
declared.
2026-02-09 22:30:48 -08: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