1239 Commits

Author SHA1 Message Date
Pádraig Brady b130ed810e doc: fix typo in chmod example
* doc/coreutils.texi (chmod invocation): s/file/foo/ to match comment,
and previous example.
2026-05-03 10:40:31 +01:00
Collin Funk c5ddd417aa comm: don't close standard input twice
* NEWS: Mention the bug fix.
* src/comm.c (usage): Remove mention that FILE1 and FILE2 cannot both be
standard input.
(compare_files): Only close standard input once.
* doc/coreutils.texi (comm invocation): Document the behavior of
'comm - -' which is not portable to all implementations.
* tests/comm/dash-dash.sh: New file.
* tests/misc/comm.pl: Move to tests/comm/comm.pl.
* tests/local.mk (all_tests): Add the new test. Rename the existing
test.
2026-04-22 19:12:44 -07:00
Pádraig Brady fe00823330 doc: cut: clarify that combining characters are not treated specially
This is for consistency with other implementations and since the
interface separates -b and -c it might in future support -g (graphemes).
Normalizing content with a filter seems like the most appropriate
approach anyway, as there are various normalizations possible including
case etc. rather than baking that into every tool
2026-04-05 13:15:56 +01:00
Pádraig Brady c3e819fadc doc: cut: resintate and expand -d info
* doc/coreutils.texi (cut invocation): Add back the -d description,
and adjust for multi-byte support, and expand on specifying a NUL
delimitier, and detail the behavior when the delimiter matches
the line delimiter.
2026-04-05 13:15:56 +01:00
Pádraig Brady 03a686a456 doc: cut: clarify that -s suppressed lines with only trimmed spaces
* doc/coreutils.texi (cut invocation): State explicitly that
-s --whitespace-delimited=trimmed will suppress lines that
do not have field separating blanks.
2026-04-05 13:15:56 +01:00
Pádraig Brady 2c1ea231ca doc: cut: mention the default -O used with -w
* doc/coreutils.texi (cut invocation): Mention the default
--output-delimiter is a TAB when matching runs of blanks in the input.
2026-04-05 13:15:56 +01:00
Pádraig Brady f5b7d38d13 doc: cut: reorder -s in texi
Keep in alphabetical order.
2026-04-05 13:15:56 +01:00
Pádraig Brady c1d7b492c6 doc: cut: document the -w option
* src/cut.c (usage): Mention blank characters are used to separate.
* doc/coreutils.texi (cut invocation): Likewise.  Also describe
the 'trimmed' argument and the relation to -F.
2026-04-05 13:15:56 +01:00
Pádraig Brady a14ac29629 cut: support -F as an alias for -f -w -O ' '
To improve compatibility with toybox/busybox scripts.
2026-04-05 13:15:56 +01:00
Pádraig Brady 77ccacb9a7 cut: support -O as an alias for --output-delimiter
To improve compatibility with toybox/busybox scripts.

* doc/coreutils.texi (cut invocation): Add -O description.
* src/cut.c: Support -O as well as --output-delimiter
* tests/cut/cut.pl: Adjust one case to use -O.
2026-04-05 13:15:56 +01:00
Pádraig Brady 0ae17ffd99 doc: cut: adjust for multi-byte support
* doc/coreutils.texi (cut invocation): Remove the note about
-c being the same as -b.
2026-04-05 13:15:56 +01:00
Pádraig Brady 57110d8bae cut: implement -n to avoid outputting partial characters
Both the i18n patch and FreeBSD/macOS support this option.
They do differ in behavior somewhat as the i18n patch
may output more bytes than requested.

  $ printf '\xc3\xa9b\n' | i18n-cut -n -b1
  é

There is also a bug in the i18n patch with multi-byte
at the start of a line:

  $ printf '\xc3\xa9b\n' | i18n-cut -n -b1-2
  éb

We follow the FreeBSD behavior since it seems more
useful to have -b be a hard limit, rather than a soft limit.
This also reduces the possibility of duplicate character output
with separate cut invocations with non overlapping byte ranges.

* src/cut.c (cut_bytes_no_split): A new function
similar to cut_characters, to handle multi-byte characters
with byte limit semantics.
* tests/cut/cut.pl: Add test cases.
2026-04-05 13:15:56 +01:00
Pádraig Brady 97703386e6 cut: support multi-byte input with -c
* src/cut.c
* tests/cut/cut.pl
2026-04-05 13:15:55 +01:00
Pádraig Brady a04a1054f8 doc: cut: reorder --complement alphabetically in help
* src/cut.c (usage): Move placement of --comlement description.
* doc/coreutils.texi (cut invocation): Likewise.
2026-04-05 13:15:55 +01:00
Collin Funk c8b296683f doc: tty: mention the removal of the -s option from POSIX
* doc/coreutils.texi (tty invocation): Mention that POSIX.1-2001 removed
the -s option and that portable scripts can redirect standard out to
/dev/null instead.
2026-03-27 22:45:56 -07:00
Pádraig Brady 8cbe20a2ff doc: fix missing '=' in texi option descriptions
* doc/coreutils.texi (cut invocation, fold invocation):
Fix missing '=' before option parameters.
2026-03-13 10:30:46 +00:00
Pádraig Brady b3fe24213e cksum: use more defensive escaping for --check
cksum --check is often the first interaction
users have with possibly untrusted downloads, so we should try
to be as defensive as possible when processing it.

Specifically we currently only escape \n characters in file names
presented in checksum files being parsed with cksum --check.
This gives some possibilty of dumping arbitrary data to the terminal
when checking downloads from an untrusted source.
This change gives these advantages:

  1. Avoids dumping arbitrary data to vulnerable terminals
  2. Avoids visual deception with ansi codes hiding checksum failures
  3. More secure if users copy and paste file names from --check output
  4. Simplifies programmatic parsing

Note this changes programmatic parsing, but given the original
format was so awkward to parse, I expect that's extremely rare.
I was not able to find example in the wild at least.
To parse the new format from from shell, you can do something like:

  cksum -c checksums | while IFS= read -r line; do
    case $line in
      *': FAILED')
        filename=$(eval "printf '%s' ${line%: FAILED}")
        cp -v "$filename" /quarantine
        ;;
    esac
  done

This change also slightly reduces the size of the sum(1) utility.
This change also apples to md5sum, sha*sum, and b2sum.

* src/cksum.c (digest_check): Call quotef() instead of
cksum(1) specific quoting.
* tests/cksum/md5sum-bsd.sh: Adjust accordingly.
* doc/coreutils.texi (cksum general options): Describe the
shell quoting used for problematic file names.
* NEWS: Mention the change in behavior.
Reported by: Aaron Rainbolt
2026-03-04 22:17:39 +00:00
Collin Funk 7002e025de doc: tee: avoid the use of gpg cleartext signatures in an example
Cleartext signatures have many gotchas. Therefore, the use of detached
signatures is recommended where possible. See:
<https://gnupg.org/blog/20251226-cleartext-signatures.html>.

* doc/coreutils.texi (tee invocation): Adjust gpg invocation to produce
a detached signature.
2026-02-23 10:35:21 -08:00
Collin Funk 6ad189d87b doc: stty: mention the -g does not save the terminal window size
* doc/coreutils.texi (stty invocation): Mention that 'stty -g' does not
save the terminal window size as allowed by POSIX.1-2024.
2026-02-21 23:33:56 -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 088c011bfc doc: kill: adjust documentation to produce html anchors for --help
* doc/coreutils.texi (kill invocation): Adjust documentation to use the
@optItem macros.
Fixes https://bugs.gnu.org/80339
Fixes https://github.com/coreutils/coreutils/issues/185
2026-02-06 13:36:18 +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 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 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 af61d818f8 doc: ls: document --block-size in the manual
* doc/coreutils.texi (ls invocation): Document --block-size
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 1d1539a529 doc: id: document -a in manual
* doc/coreutils.texi (id invocation): Mention this option is ignored.
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
Egmont Koblinger 5de8835672 doc: tty: fix indexing in texinfo
* doc/coreutils.texi: Fix recently introduced typo.
* THANKS.in: Remove as now committed to the repo.
2026-01-21 13:51:58 +00:00
Pádraig Brady 0f5ab6cb8b doc: readlink: improve option ordering in texinfo
* doc/coreutils.texi (readlink invocation): Order -q,-s alphabetically.
2026-01-21 13:51:40 +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 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 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 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
Pádraig Brady 5c238fcadd doc: runcon: use more accurate synopsis format
* src/runcon.c (usage): Align synopsis with format
used in other commands.
* doc/coreutils.texi (runcon invocation): Likewise.
2026-01-11 18:43:32 +00:00
Pádraig Brady a3ae4123f9 doc: tr: warn about shell quoting [:classes:]
* src/tr.c (usage): Warn about avoiding shell globbing.
* doc/coreutils.texi (character arrays): Likewise.
Suggested by Daniel Dallos.
2026-01-06 18:41:00 +00:00
Pádraig Brady 7531d3a205 ptx: implement -t to change default width to 100
Align the -t implementation with the Heirloom project.

* src/ptx.c (usage): Describe -t, and also mention
the default width is 72 when not used.
* doc/coreutils.texi (ptx invocation): Likewise.
(main): Override the default width if -t is specified.
* tests/ptx/ptx.pl: Add test cases.
* NEWS: Mention the change in behavior.
2026-01-05 23:37:49 +00:00
Collin Funk 73d3a49f45 maint: run 'make update-copyright' 2026-01-01 10:56:16 -08:00
Collin Funk d7aaa001d9 doc: prefer UTF-8 characters in texinfo sources
* doc/coreutils.texi (Introduction): Use ç instead of @,{c}.
(Character arrays): Use ö instead of @"o. Use Ł instead of @L{}.
(Formatting file timestamps): Use ä instead of @"a.
2025-12-20 13:27:07 -08:00
Pádraig Brady 3a07cefae0 doc: ls: fix recent typo for -F option in texinfo
* doc/coreutils.texi (ls invocation): Add a missing hyphen
that was inadvertently dropped in the recent adjustments.
2025-12-20 20:09:37 +00:00
Pádraig Brady 7be8402e1e doc: split,tac: document $TMPDIR usage
Following commit v9.3-92-g1b86b70dd
$TMPDIR is part of the interface and an important behavioral
characteristic of a command, which should be documented.

* doc/coreutils.texi (split invocation): Mention $TMPDIR is honored.
(tac invocation): Likewise.
* src/split.c (usage): Likewise.
* src/tac.c (usage): Likewise.
2025-12-19 00:09:58 +00:00
Collin Funk a2c3896b51 doc: tee: prefer cksum in examples
* doc/coreutils.texi (tee invocation): Use 'cksum' with '-a sha2' and
'-a sha3' instead of md5sum and sha1sum in examples.
2025-12-16 22:15:26 -08:00
Collin Funk 3b809382b8 doc: dd: document the behavior of conv flags on multibyte characters
* doc/coreutils.texi (dd invocation): Document the behavior of 'dd' on
multibyte characters and some unspecified behavior that will be
documented in a future POSIX release [1].

[1] https://austingroupbugs.net/view.php?id=1959
2025-12-13 18:55:00 -08:00
Pádraig Brady cdb966adb3 doc: expand on shell-escape quoting style
* doc/coreutils.texi (quotingStyles): Expand on the advantages
of "shell-escape" quoting, and mention it's the default when
outputting to a tty. Also mention how it's also useful with
LC_ALL=C to further disambiguate output.  Also reference the
separate page detailing various considerations and options
for file name quoting.  Also move the mention of the default
quoting style to the top of the page where it's more obvious.
2025-12-12 17:08:00 +00:00
Collin Funk 828073db6b doc: printf: mention how to print arguments starting with '-'
* doc/coreutils.texi (printDash): New macro.
(printf invocation, yes invocation): Use it.
Addresses https://bugs.gnu.org/79896
2025-12-09 18:45:22 -08:00
Pádraig Brady 15092bd518 doc: fix stale linuxjournal.com link
* doc/coreutils.texi: Update to working link.
Fixes https://bugs.gnu.org/79973
2025-12-09 14:10:58 +00:00
Pádraig Brady 0013f0e2ad doc: fix pdf generation
* doc/coreutils.texi: Explicitly supply empty arguments to macros,
as dvi (a required prerequisite to pdf) is more strict in its
handling of macro arguments.
* cfg.mk (sc_texi_ensure_empty_option_args): Add a syntax check,
since this is not verified in the default build.
Reported by Collin Funk.
2025-12-08 14:36:24 +00:00
Pádraig Brady 796b8d1a66 doc: html: reference each command option
* doc/coreutils.texi: Add anchors to each command option.
This also has the advantage of removing over 1000 lines,
through the use of macros.
2025-12-05 16:40:00 +00:00
Pádraig Brady cc3499326f doc: html: support defined anchors for command options
* doc/coreutils.texi (optAnchor): A new macro to output a
referencable anchor, called from ...
(optItem): ... here; a new macro to output all index entries
for each option item.
(optZero,optZeroTerminated): Show an example of the adjustment
done to each option description.
* doc/local.mk (html-local): Post-process the texinfo generated HTML
(`make html`) to remove our "-option" tag, and replace all
escaped _002d with a standard hyphen, which is fine in URLs.
2025-12-05 16:32:14 +00:00