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

31090 Commits

Author SHA1 Message Date
Pádraig Brady
e2fdbea10a 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.
2026-01-21 13:51:39 +00:00
Pádraig Brady
d06a666429 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.
2026-01-21 13:51:39 +00:00
Pádraig Brady
5a21df35b0 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.
2026-01-21 13:51:39 +00:00
Pádraig Brady
507252c6f2 doc: support highlighting printf formatted options
* src/system.h (oprintf): Add a printf wrapper that
calls oputs_() to markup the formatted text.
2026-01-21 13:51:39 +00:00
Pádraig Brady
d8df94bc02 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.
2026-01-21 13:51:39 +00:00
Pádraig Brady
3ec554d4dd doc: parse any whitespace as an option/description delimiter
* src/system.c (oputs_): Use isspace() rather than hardcoding.
Note we don't use c_isspace() as we need to support anything
coming from translations.
2026-01-21 13:51:39 +00:00
Pádraig Brady
cc002057b3 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.
2026-01-21 13:51:39 +00:00
Pádraig Brady
4555132f3c doc: move oputs() to system.h to support all commands
* src/ls.c: Move non ls specific helper to ...
* src/system.h: ... here.
2026-01-21 13:51:39 +00:00
Pádraig Brady
5c6cb2b26b doc: support a configurable manual url
* configure.ac: Support ./configure --enable-manual-url=...
* src/ls.c (oputs): Adjust accordingly.
2026-01-21 13:51:39 +00:00
Pádraig Brady
deba7a673d doc: --help: --disable-bold-man-page-references configures bold refs
* 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.
2026-01-21 13:51:39 +00:00
Pádraig Brady
d5e15b2f29 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.
2026-01-21 13:51:39 +00:00
Pádraig Brady
88760f9c10 tests: test: ensure whitespace ignored when parsing numbers
* tests/test/test.pl: Add a test case.
2026-01-21 13:51:39 +00:00
Pádraig Brady
89ea90fae8 cksum: use more accurate program name in single binary mode
Following commit v9.9-109-gcd5229222

* 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.
2026-01-21 13:50:37 +00:00
Collin Funk
a96abcbbeb tests: dd: avoid a false test failure on Solaris 11.4
* tests/dd/fail-ftruncate-fstat.sh: Replace the message used by Solaris
11.4 for strerror (EPERM) with the one we expect.
2026-01-19 18:26:45 -08:00
Collin Funk
521a389635 tests: sync: check that all files are processed even when errors occur
* tests/misc/sync.sh: Add the test case.
2026-01-19 11:08:48 -08:00
Collin Funk
aac817f34b 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.
2026-01-19 11:07:28 -08:00
Pádraig Brady
331c5f6857 build: update to latest gnulib
* gnulib: Update to latest.
* NEWS: Mention the bug fix.
https://github.com/coreutils/coreutils/issues/176
2026-01-19 17:57:59 +00:00
oech3
d5164f3d21 tests: env.sh: avoid multi-call binary considerations
A simpler fix than commit v9.9-4-g3b6efd555
which is less dependent on the exact behavior
of a multi-call binary.

* tests/env/env.sh: Use a local script rather than 'true'.
which may be a symlinked multi-call binary.
https://github.com/coreutils/coreutils/pull/174
2026-01-18 21:41:23 +00:00
Collin Funk
740d33b8da 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.
2026-01-18 12:09:47 -08:00
Pádraig Brady
4d03a1e408 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
2026-01-18 16:58:38 +00:00
Pádraig Brady
71ea30a742 maint: prefer NULL to nullptr
NULL is best for C as discussed at:
https://bugs.gnu.org/66221#53

* bootstrap.conf: Remove dependency on nullptr.
* s/nullptr/NULL/.
2026-01-18 15:55:38 +00:00
Pádraig Brady
f7bb91968b doc: add more redirections from legacy *sum to cksum
*  doc/coreutils.texi (md5sum invocation, sha1sum invocation,
b2sum invocation, sha2 utilities): Mention these are legacy interfaces,
and reference 'cksum invocation'.
*  src/cksum.c (usage): Likewise.
*  man/md5sum.x: Redirect to cksum, rather than individual utils.
*  man/sha1sum.x: Likewise.
2026-01-18 14:19:38 +00:00
Pádraig Brady
fcaa3a39c7 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.
2026-01-18 12:48:36 +00:00
Collin Funk
0d5b66ca66 build: fix error building html documentation from tarball
Reported by Egmont Koblinger <egmont@gmail.com> in
<https://lists.gnu.org/r/coreutils/2026-01/msg00111.html>.

* Makefile.am (EXTRA_DIST): Add build-aux/makeinfo-wrapper.sh.
2026-01-17 20:15:25 -08:00
Collin Funk
c1d13a499a tests: avoid a test hang on AIX
* init.cfg (uses_strace_): New function.
(require_strace_): Use it.
tests/cksum/cksum-c.sh: Likewise.
tests/misc/read-errors.sh: Likewise.
2026-01-17 14:26:26 -08:00
Collin Funk
44746418db build: update gnulib submodule to latest 2026-01-17 14:12:27 -08:00
Pádraig Brady
6328e7f17d maint: remove sc_prohibit_NULL syntax check
* cfg.mk: NULL is fine and good in C as per:
https://bugs.gnu.org/66221#53
2026-01-17 12:45:42 +00:00
Pádraig Brady
8d791ada1e build: update gnulib submodule to latest 2026-01-17 12:45:08 +00:00
Collin Funk
289278eee2 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.
2026-01-16 22:56:15 -08:00
Paul Eggert
23e696b0b2 maint: spelling fixes 2026-01-16 13:22:28 -08:00
Paul Eggert
676c3bb397 build: update gnulib submodule to latest 2026-01-16 13:06:45 -08:00
Paul Eggert
1202fac2dc 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>.
2026-01-15 22:36:16 -08:00
Collin Funk
2d45a671a0 build: fix link errors with multi-call binary and 'cksum' excluded
* src/local.mk (src_ls_LDADD, src_seq_LDADD, src_md5sum_LDADD)
(src_sha1sum_LDADD, src_sha224sum_LDADD, src_sha256sum_LDADD)
(src_sha384sum_LDADD, src_sha512sum_LDADD): Set to
$(src_cksum_LDADD).
Reported at https://github.com/coreutils/coreutils/issues/172
2026-01-15 18:21:01 -08:00
Pádraig Brady
6b32a0bbde 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.
2026-01-15 15:54:29 +00:00
Pádraig Brady
36d6cb2774 doc: paste: give a CSV generation example
* doc/coreutils.texi (paste invocation): Provide an example
to comma separate data.
2026-01-15 15:54:18 +00:00
Pádraig Brady
a0119d5982 build: paste: fix build failure with C99
GCC 10.2 gave the following error:
"error: a label can only be part of a statement
 and a declaration is not a statement"

* src/fold.c (fold_file): Add a ";" to avoid C2X specific syntax.
2026-01-14 11:38:59 +00:00
Collin Funk
418d4084b4 maint: avoid syntax-check failure from previous commit
* src/copy-file-data.c (sparse_copy): Use nullptr instead of NULL.
2026-01-13 20:45:32 -08:00
Paul Eggert
cf36efedc0 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.
2026-01-13 10:12:39 -08:00
Paul Eggert
0dd30755ab build: update gnulib submodule to latest 2026-01-13 10:12:39 -08:00
Paul Eggert
15be3c6307 cp: copy-file-data.c commentary fixes
* src/copy-file-data.c: Update commentary to match code better.
2026-01-13 10:12:39 -08:00
Pádraig Brady
92d80b67cf tests: ensure utilities correctly diagnose read errors
* 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.
2026-01-13 15:08:04 +00:00
Pádraig Brady
495e3528d7 fmt: correctly diagnose read errors
* src/fmt.c (fmt): Pass errno to error() so that
the particular error is diagnosed.
* NEWS: Mention the improvement.
2026-01-13 15:08:03 +00:00
Pádraig Brady
06d228043f 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.
2026-01-13 14:32:01 +00:00
oech3
e326d0df65 tests: nice: ensure large values are clamped
* tests/nice/nice.sh: Ensure integers > UINTMAX_MAX are supported.
From https://github.com/coreutils/coreutils/pull/170
2026-01-13 14:20:13 +00:00
Collin Funk
87898a6a94 maint: ptx: place long options without short options after CHAR_MAX
* src/ptx.c (FORMAT_OPTION): New constant.
(long_options): Use FORMAT_OPTION instead of 10.
(main): Likewise.
2026-01-12 17:42:16 -08:00
Dmitry V. Levin
2739fab817 tests: cksum: use more general strace syscall injection
* tests/cksum/cksum-c.sh: Match "read" with a regex
to match any of the read syscall variants.
2026-01-12 15:13:57 +00:00
Pádraig Brady
49788a4510 tests: paste -d: test supported escape sequences
* tests/misc/paste.pl: Test all supported POSIX and GNU
backslash escape sequences.
2026-01-12 14:13:26 +00:00
Pádraig Brady
9a8b09f025 doc: paste: add more detail on operation and options
* src/paste.c (usage): Mention how lines are processed
with and without the -s option.  Also mention that -d
supports backslash escapes.
* doc/coreutils.texi (paste invocation): Likewise.
Also detail the backslash escapes, noting which are non-POSIX.
2026-01-12 14:13:20 +00:00
Collin Funk
3e9f4ad5b9 maint: ptx: reuse octhexdigits macros instead of redefining them
* src/ptx.c: Include octhexdigits.h.
(HEXTOBIN, ISODIGIT, OCTTOBIN): Remove macros.
(unescape_string): Use the macros from octhexdigits.h instead of the
removed macros.
2026-01-11 20:22:52 -08:00
Pádraig Brady
210c000b8c tests: date: test nested parenthesis comment handling
* tests/date/date.pl: Add test cases.
Suggested by Sylvestre Ledru.
2026-01-11 18:51:19 +00:00