Commit Graph
9417 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
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
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
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
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
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
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
Dr. David Alan Gilbert eaac58cffa maint: unexpand: remove dead store
The assign to next_tab_column in the backspace branch is never
read; in fact it's always written and then read solely inside the
blank branch.

Move the declaration of 'next_tab_column' down into the blank
branch, and remove its assignment in the backspace branch.

Spotted by the 'infer' static checker.

* src/unexpand.c (unexpand): Remove dead store of next_tab_column.
2026-02-06 14:43:24 +00:00
Pádraig Brady ddb8b78a2c doc: pr: use -COLS consistently
Help this back from release as would break a couple of translations.

* src/pr.c: Use COLS rather than COLUMN consistently
in comments and usage().
2026-02-06 13:37:58 +00:00
Collin Funk ddfe86bddf stat,df: remove an unnecessary alloca
* src/find-mount-point.c (find_mount_point): Don't call ASSIGN_STRDUPA
on the result of dir_name.
2026-02-04 16:42:26 -08:00
Pádraig Brady 32a5bf1ead doc: improve highlighting of dd --help translations
* src/system.h (oputs_): Ensure we're not matching '-' in
translated descriptions.  Also support highlighting only
dd "foo=bar" when the description is separated with a single space.
2026-01-31 22:08:09 +00:00
Pádraig Brady 18811574a2 maint: avoid prohibit-const-char syntax check failure
* src/copy.c: Avoid prohibit-const-char failure,
newly triggered by the (correct) recent adjustment.
2026-01-30 14:12:12 +00:00
Pádraig Brady b3a96b8b0b doc: move xgettext: hint to the correct translated string
* src/fmt.c (usage): Move comment down to the newly separated string.
Discussed in https://github.com/coreutils/coreutils/issues/178
2026-01-30 13:31:27 +00:00
Paul Eggert d72a03cedb maint: space between ‘char’ and ‘*’ 2026-01-28 11:25:36 -08:00
Pádraig Brady f2af245eba doc: improve highlighting of single spaced translations
* src/system.h (oputs_): Translations sometimes use a single space
between an option and its description.  They only do this though
for long options since they result in less available screen space.
Therefore be more strict with option matching once we've encountered
a long option, which supports the more varied formats often
associated with short options.
2026-01-27 17:59:38 +00:00
Paul Eggert f3980d7cfa doc: fix date(1) synopses etc
Font problem reported by Michael Aramini via Alejandro Colomar
<https://bugs.gnu.org/80258>.  This patch also fixes some
longstanding confusion with date synopses.
* src/date.c (usage): Do not imply that only -u can be used with
MMDDhhmm..., and do not put misleading brackets around the latter.
2026-01-25 19:08:53 -08:00
Pádraig Brady ca68ab6c8a doc: support TAB as a delimiter between --option and description
* src/system.h (oputs_): Treat a single TAB as an option delimiter.
Some zh translations use this delimiter format.
2026-01-25 21:19:45 +00:00
Pádraig Brady ebb856730c tail: fix EINTR handling on older systems
tail(1) could fail with an "Interrupted system call"
diagnostic, on some systems like Centos 5 (Linux 2.6.18).
This was seen with tests/tail/overlay-headers.sh
which sends SIGCONT, which should not induce a failure.

* src/tail.c (tail_forever_inotify): Retry the poll()
upon receiving a non terminating signal, and the syscall
is not automatically restarted by the system.
* NEWS: Mention the bug fix.
Reported by Bruno Haible.
2026-01-24 20:00:32 +00:00
Pádraig Brady 1361ade5c4 doc: nproc: mention OpenMP env vars in --help
* src/nproc.c (usage): Clarify the impact of 'OMP_NUM_THREADS'
and 'OMP_THREAD_LIMIT' in --help and the man page.
Also mention that nproc(1) will always return > 0.
Fixes https://bugs.gnu.org/80243
2026-01-24 13:49:03 +00:00
Pádraig Brady 115a600100 doc: dir,vdir: fix anchor refs from --help
* src/system.h (oputs_): Map from dir,vdir to ls.
2026-01-22 16:23:41 +00:00
Egmont Koblinger b76c1539ad doc: stat: fix highlighting of --format
* src/stat.c (usage): Add missing comma after -c.
2026-01-22 16:15:26 +00:00
Pádraig Brady 49420ca7d9 doc: pr: fix --help output output
* src/pr.c (usage): Use consistent alignment with -J,
and highlight --pages using oputs().
2026-01-22 13:00:38 +00:00
Pádraig Brady 87219034b7 doc: use TERM=dumb rather than HELP_NO_MARKUP to disable markup
This is a more standard mechanism to disable markup.

* src/system.h (oputs_): Logic change to honor TERM=dumb,
rather than HELP_NO_MARKUP=something.
* doc/coreutils.texi: Adjust the description for --help.
* man/local.mk: Ensure TERM is set to something,
so that man pages have links included.
* man/viewman: Just honor users $TERM.
* tests/misc/getopt_vs_usage.sh: Remove env var complication,
as TERM is unset automatically.
* tests/misc/usage_vs_refs.sh: Likewise.
* NEWS: Adjust the change in behavior note.
2026-01-22 11:42:47 +00:00
Pádraig Brady 28c29d103e stat,tail: sync with latest Linux file systems
* src/stat.c (human_fstype): Add "guest-memfd".
* NEWS: Mention the improvement.
2026-01-21 16:29:03 +00:00
Pádraig Brady dfeb32f6e2 ls: --hyperlink: switch to more standard delimiters
* src/ls.c (quote_name): Use ST (ESC \) rather than BEL,
as that's the only terminator mentioned in at least
ECMA-48, DEC STD 070, and EK-VT520-RM.
* NEWS: Mention the change in behavior.
* tests/ls/hyperlink.sh: Adjust accordingly.

Suggested by Egmont Koblinger.
2026-01-21 14:05:48 +00:00
Pádraig Brady d6a81caafc doc: adjust --help hyperlinks to more standard format
* src/system.h (oputs_): Use ST rather than BEL.
2026-01-21 13:51:58 +00:00
Pádraig Brady 2753931590 doc: add commentary on details of --help references
* src/system.h: Mention why we don't bother with (the overhead of)
hostnames in these URLs, and why --help,--version link are special.
2026-01-21 13:51:58 +00:00
Pádraig Brady 49cabb6845 doc: cp: group related -HLP descriptions
* src/cp (usage): The -HLP options are close
in functionality and close alphabetically, so describe together.
* doc/coreutils.texi (cp invocation): Likewise.
2026-01-21 13:51:58 +00:00
Pádraig Brady c666aa7461 doc: cp: document --keep-directory-symlink in correct location
* src/cp.c (usage): Move to alphabetically in list.
* doc/coreutils.texi (mv invocation): Move description from here ...
(cp invocation): ... to here.
2026-01-21 13:51:58 +00:00
Pádraig Brady 9a10b354ec doc: who: document --users in manual
* doc/coreutils.texi (who invocation): Mention that --users
is equivalent to -u.
* src/who.c (usage): Mention -u shows idle time.
2026-01-21 13:51:58 +00:00
Pádraig Brady a06f0cf67e doc: more indexing fixes in manual
* doc/coreutils.texi: Add missing anchors.
* src/pr.c (Usage): Adjust to use -COLS, to avoid a clash
with the additional anchor added to the manual.
Also markup the --columns option as done for other options.
* tests/split/line-bytes.sh: Also fix --lines-bytes typo here.
2026-01-21 13:51:58 +00:00
Pádraig Brady 7426643f39 doc: make legacy digest utility --help reference cksum nodes
* src/system.h (oputs_): Map md5sum etc. to cksum urls,
as we only have cksum anchors in the manual to avoid
creating anchors for all of the legacy digest utilities.
2026-01-21 13:51:58 +00:00