Collin Funk
89735ea830
shuf: avoid locking standard output when using --input-range
...
Here is the throughput before this patch:
# write_permuted_numbers
$ ./src/shuf-prev -i 0-100000000 | pv -r > /dev/null
[ 153MiB/s]
# write_random_numbers
$ timeout 10 ./src/shuf-prev -i 0-100000 -r | pv -r > /dev/null
[78.6MiB/s]
Here is the throughput after this patch:
# write_permuted_numbers
$ timeout 10 ./src/shuf -i 0-100000000 | pv -r > /dev/null
[ 308MiB/s]
# write_random_numbers
$ timeout 10 ./src/shuf -i 0-100000 -r | pv -r > /dev/null
[ 196MiB/s]
* NEWS: Mention the performance improvement.
* src/shuf.c (write_permuted_numbers, write_random_numbers): Prefer
fputs and fputc which may be unlocked over printf which locks standard
output.
2026-02-21 19:20:07 -08:00
Collin Funk
d233ebd7d9
tests: chmod: test that chmod(2) is always called
...
* tests/chmod/only-op.sh: New file.
* tests/local.mk (all_test): Add the new test.
2026-02-20 21:37:42 -08:00
Collin Funk
992da4574a
maint: printf: prefer static initialization
...
* src/printf.c (main): Remove unnecessary initialization.
2026-02-19 21:42:35 -08:00
Collin Funk
395fcca795
maint: fmt: prefer static initialization
...
* src/fmt.c (prefix, max_width): Initialize variables.
(main): Remove unnecessary initializations.
2026-02-19 21:40:44 -08:00
Collin Funk
6bf6d52e54
maint: sort: prefer static initialization
...
* src/sort.c (main): Remove unnecessary initialization.
2026-02-19 21:37:15 -08:00
Collin Funk
96e39300b1
maint: df: prefer static initialization
...
* src/df.c (human_output_opts, grand_fsu): Initialize variables.
(main): Remove unnecessary initializations.
2026-02-19 21:34:03 -08:00
Collin Funk
a24b3075c3
maint: split: prefer static initialization
...
* src/split.c (outbase, infile): Initialize variables.
(main): Remove unnecessary initializations.
2026-02-19 21:28:40 -08:00
Collin Funk
26c92a62c6
maint: tail: prefer static initialization
...
* src/tail.c (count_lines, line_end): Initialize variables.
(main): Remove unnecessary initializations.
2026-02-19 21:24:54 -08:00
Collin Funk
cc87809aae
maint: csplit: prefer static initialization
...
* src/csplit.c (prefix, remove_files): Initialize variables.
(main): Remove unnecessary initializations.
2026-02-19 21:22:17 -08:00
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