Pádraig Brady [Tue, 27 Jan 2026 17:45:02 +0000 (17:45 +0000)]
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.
Paul Eggert [Mon, 26 Jan 2026 02:50:33 +0000 (18:50 -0800)]
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.
Collin Funk [Sat, 24 Jan 2026 22:12:10 +0000 (14:12 -0800)]
tests: chgrp: allow a numeric user id to be printed
* tests/chgrp/from.sh: If 'id' cannot find a user name for user id 1,
expect the user id to be printed in the message of 'chgrp'.
Reported by Bruno Haible.
Pádraig Brady [Sat, 24 Jan 2026 18:04:46 +0000 (18:04 +0000)]
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.
Collin Funk [Sat, 24 Jan 2026 19:15:10 +0000 (11:15 -0800)]
tests: avoid failures if 'ulimit -n' cannot set file descriptor limits
This fixes test failures seen on Haiku.
* tests/ls/recursive.sh: Run 'ls' even if ulimit fails.
* tests/split/r-chunk.sh: Run 'split' even if ulimit fails.
* tests/sort/sort-merge-fdlimit.sh: Skip test if 'ulimit -n' cannot set
file descriptor limits.
Reported by Bruno Haible.
Pádraig Brady [Sat, 24 Jan 2026 13:34:35 +0000 (13:34 +0000)]
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
Pádraig Brady [Thu, 22 Jan 2026 11:42:47 +0000 (11:42 +0000)]
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.
Pádraig Brady [Wed, 21 Jan 2026 18:57:53 +0000 (18:57 +0000)]
tests: avoid infinite loop in dd failure edge case
* tests/tee/tee.sh: If dd failed, then tee would spin
writing to the fifo forever, so add a timeout protection.
This was noticed with `export LD_PRELOAD=libasan.so.8`
with a non ASAN build, which induced a failure in dd invocations.
Pádraig Brady [Wed, 21 Jan 2026 17:31:24 +0000 (17:31 +0000)]
tests: avoid false failure with sanitizer builds
* init.cfg (sanitizer_build_): Add a helper to detect if a program
is built against a sanitizer.
* tests/df/no-mtab-status-masked-proc.sh: Skip if a sanitizer build.
Pádraig Brady [Tue, 20 Jan 2026 20:25:26 +0000 (20:25 +0000)]
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.
Pádraig Brady [Tue, 20 Jan 2026 19:27:49 +0000 (19:27 +0000)]
tests: ensure there is an anchor for each --help option
* tests/misc/usage_vs_refs.sh: A new test to correlation options
listed in --help, and anchors referenced in the texinfo (html) manual.
* tests/local.mk: Add the new test.
Pádraig Brady [Tue, 20 Jan 2026 19:23:42 +0000 (19:23 +0000)]
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.
Pádraig Brady [Tue, 20 Jan 2026 17:37:42 +0000 (17:37 +0000)]
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.
Pádraig Brady [Tue, 20 Jan 2026 13:35:54 +0000 (13:35 +0000)]
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.
Pádraig Brady [Thu, 1 Jan 2026 16:31:44 +0000 (16:31 +0000)]
doc: all: use option highlighting and more standard alignment
Adjust all utils to:
- Have a separate translation per option
- Use either oputs() or oprintf(), instead of fputs() or printf().
- Use more standard alignment as discussed in previous commits.
- Various tweaks to descriptions.
Pádraig Brady [Sat, 3 Jan 2026 17:55:50 +0000 (17:55 +0000)]
doc: ls: put option description on separate line to option
* src/ls.c (usage): This is less constrained when writing comments,
and more consistent in output alignment. There is less delineation
between options and descripts, but given options are highlighted
by default now, this is a more appropriate format to use.
Note consistently showing description on the line following the option,
avoids any issue with the user needing to visually line up
the option with a description far to the right.
Note this format more closely aligns with that used in man pages.
Pádraig Brady [Thu, 15 Jan 2026 22:00:28 +0000 (22:00 +0000)]
doc: help2man: convert all hyperlinks, not just ones in --options
* man/help2man: Make the (--?) part of the match optional.
Note we still extract the dashes, to support the existing
option matching logic in help2man.
Pádraig Brady [Thu, 15 Jan 2026 21:36:09 +0000 (21:36 +0000)]
doc: help2man: support alternate format OSC hyperlinks
* man/help2man: The BEL terminator format was already supported.
Add support for ESC + backslash terminator. Also split out
and document the regular expression.
Pádraig Brady [Mon, 29 Dec 2025 20:58:30 +0000 (20:58 +0000)]
doc: help2man: convert OSC hyperlinks
* man/help2man: Convert OSC hyperlinks to roff \X escapes,
which will be converted back to OSC hyperlinks when
the man page is displayed on the terminal.
Note formatting is removed from hyperlinked text by default,
thus relying on how the terminal highlights hyperlinks,
but --bold-refs is honored in this case, in which hyperlinked
text will be marked up as bold, which matches the default
markup used for non hyperlinked options.
Pádraig Brady [Sat, 3 Jan 2026 15:23:18 +0000 (15:23 +0000)]
doc: help2man: recognise option description with smaller indent
* man/help2man: Allow for a smaller indented option description.
This smaller indentation is present in timeout --help output,
so now the line spacing in timeout.1 is more consistent.
Also having the description on a separate line with
a smaller indentation, is a more general way to present
option descriptions (and what the man page formatting uses already).
We'll be changing many utilities, especially with longer multi-line
descriptions to this new format.
Pádraig Brady [Mon, 29 Dec 2025 16:46:15 +0000 (16:46 +0000)]
doc: help2man: strip ANSI codes
* man/help2man: With these ANSI codes, output is corrupted,
so it's best to strip these, which allows --help to
outputting formatting and hyperlinks by default.
Pádraig Brady [Sat, 17 Jan 2026 13:36:35 +0000 (13:36 +0000)]
doc: support more general option matching
* src/system.h: Support "-p DIR, --tmpdir[=DIR]" option.
Previously only the "-p" was highlighted.
Support highlighting dd option syntax (no '-').
Support test(1) "FILE1 -nt FILE2" syntax.
Pádraig Brady [Sat, 3 Jan 2026 17:15:12 +0000 (17:15 +0000)]
doc: optimize logic to disable SGR output in --help
* src/system.h (oputs_): Simplify processing if neither
MANUAL_URL or BOLD_MAN_REFS is defined. Also ensure
we only lookup the HELP_NO_MARKUP env var once per process.
* configure.ac: Adjust help text for --disable-bold-man-page-references,
and also define BOLD_MAN_REFS.
* src/ls.c (oputs): Output bold iff BOLD_MAN_REFS is defined.
Pádraig Brady [Tue, 25 Nov 2025 13:40:32 +0000 (13:40 +0000)]
doc: ls: support styling and links in --help output
* src/ls.c (oputs): A new function that wraps puts(),
but also highlights the --option-text portion, and
adds links to the appropriate part of the online manual.
(usage): Call oputs() rather than puts().
* doc/coreutils.texi (--help): Document new HELP_NO_MARKUP env var,
which can be used in the edge case one wants to suppress ansi escapes.
* tests/misc/getopt_vs_usage.sh: Use HELP_NO_MARKUP to ensure the
test continues to pass.
* src/cksum.c (PROGRAM_NAME): In legacy mode, i.e., when built
as a single binary, set the PROGRAM_NAME dynamically based on
the selected digest type. This is significant in --help
to ensure the correct texinfo node is referenced, and in
--version to ensure the correct utility name is output.
Collin Funk [Sun, 18 Jan 2026 21:58:27 +0000 (13:58 -0800)]
tests: sync: also test that -d and -f don't block on a FIFO
* tests/misc/sync.sh: Check 'sync fifo' with no arguments, -d, and -f
separately. Only perform the check for -f if RUN_EXPENSIVE_TESTS=yes
since it may be expensive.
Collin Funk [Sun, 18 Jan 2026 05:23:15 +0000 (21:23 -0800)]
doc: post process html with non-GNU make programs
* .gitignore (/build-aux/makeinfo-wrapper.sh):
* Makefile.am (EXTRA_DIST): Remove build-aux/makeinfo-wrapper.sh.
* build-aux/makeinfo-wrapper.sh.in: New file, renamed from
build-aux/makeinfo-wrapper.sh and modified to use @MAKEINFO@ instead of
makeinfo.
* cfg.mk (MAKEINFO): Remove variable.
* configure.ac: Add build-aux/makeinfo-wrapper.sh as a configure file.
* doc/local.mk (MAKEINFO): Define to
$(abs_top_builddir)/build-aux/makeinfo-wrapper.sh.
(AM_MAKEINFOFLAGS): Move over some values from the previous MAKEINFO
definition.
Pádraig Brady [Sun, 18 Jan 2026 16:56:24 +0000 (16:56 +0000)]
tests: strace: consider splice a "read" syscall
* tests/cksum/cksum-c.sh: Add 'splice' to the injection set.
* tests/misc/read-errors.sh: Likewise.
From https://github.com/coreutils/coreutils/pull/167
Pádraig Brady [Sun, 18 Jan 2026 12:48:36 +0000 (12:48 +0000)]
tests: use `command -v` to identify binary
* tests/misc/coreutils.sh: Be more flexibile by using `command -v`
to identify the binary to be executed, rather than linking
directly to the built binary.
Collin Funk [Sat, 17 Jan 2026 06:56:15 +0000 (22:56 -0800)]
maint: pacify another gcc -Wzero-as-null-pointer-constant warning
* src/uptime.c (print_uptime): Add a timezone_t cast to zero. Don't use
nullptr since timezone_t is not a standardized and may be defined to
something other than a pointer.
Paul Eggert [Fri, 16 Jan 2026 06:34:27 +0000 (22:34 -0800)]
maint: pacify gcc -Wzero-as-null-pointer-constant
* src/basenc.c (long_options):
* src/chcon.c (change_file_context):
* src/copy.c (is_ancestor):
* src/env.c (build_argv):
* src/expr.c (nomoreargs):
* src/factor.c (mp_no_factors):
* src/ls.c (long_options, main):
* src/selinux.c (defaultcon, restorecon_private):
* src/shred.c (dopass):
* src/shuf.c (long_opts):
* src/tac.c (output):
* src/test.c (term):
* src/uniq.c (check_file): Do not use ‘0’ as a null pointer
constant. Although it is typically valid C, there are exceptions
(e.g., stdarg) and it a bit cleaner to be consistent. This patch
uses NULL, not nullptr, as I have second thoughts about nullptr;
see <https://bugs.gnu.org/66221#53>.
Pádraig Brady [Thu, 15 Jan 2026 14:56:26 +0000 (14:56 +0000)]
all: with multi-call binary, only process options for known names
Setup
$ ln -nsf src/coreutils foo
Before
$ ./foo; echo $?
foo: unknown program ‘foo’
Try './foo --help' for more information.
1
./foo --version; echo $?
coreutils (GNU coreutils) 9.9.172-01993
0
After
$ ./foo; echo $?
coreutils: unknown program 'foo'
1
$ ./foo --version; echo $?
coreutils: unknown program 'foo'
1
* src/coreutils.c (main): Don't process options if
we don't know they're intended for the multi-call binary.
Otherwise `foo --version` would return true, even though
foo was symlinked to the multi-call binary, but not supported.
* tests/misc/coreutils.sh: Add test cases.
* NEWS: Mention the change in behavior.
Paul Eggert [Tue, 13 Jan 2026 17:35:12 +0000 (09:35 -0800)]
cat: don’t treat copy_file_range EFBIG as fatal
* src/cat.c (copy_cat):
* src/copy-file-data.c (sparse_copy):
Don’t treat EFBIG as a reportable error from copy_file_range.
If the input is at EOF and the output position is 2**63 - 1,
copy_file_range (ifd, NULL, ofd, NULL, 2146435072, 0)
incorrectly fails with EFBIG. Problem observed on Ubuntu 25.10
x86-64 with Linux kernel 6.17.0-8-generic #8-Ubuntu.
I am too lazy to report this kernel bug or add a coreutils test case.
* tests/misc/read-errors.sh: Ensure each utility calls a
read system call as requested. Not doing so (say by avoiding
reading from a directory) is a layering violation.
Also ensure we diagnose the particular error encountered.
Pádraig Brady [Mon, 12 Jan 2026 23:41:29 +0000 (23:41 +0000)]
paste: support multi-byte delimiters
* src/paste.c (collapse_escapes): This is the central --delimiters
parsing function, so adjust to handle multi-byte chars with
mcel_scanz(). Populate a delimiters length array to support
characters of differing lengths.
(paste_serial): Use the delimiters length array to output
the appropriate delimiter.
(paste_parallel): Likewise.
* tests/paste/multi-byte.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.