1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-10 09:21:58 +02:00

31175 Commits

Author SHA1 Message Date
Collin Funk
cfd78d0877 tests: ls: use a larger file descriptor limit
OpenBSD and Alpine Linux /bin/sh cannot handle a file descriptor limit
of 7.

* tests/ls/recursive.sh: Create 30 directories and use a file descriptor
limit of 20. Don't check the output since we have coverage for that
elsewhere.
Reported by Bruno Haible.
2025-12-13 18:37:18 -08:00
Pádraig Brady
cd52292221 build: reduce size of multi-call binary by reusing cksum logic
Map md5sum and sha{1,224,256,385,512} to use cksum logic,
which selects appropriate behavior at runtime, rather than
separate binaries for each closely related utility.

$ size src/coreutils  # before
   text	   data	    bss	    dec	    hex	filename
1349509	   6812	 619312	1975633	 1e2551	src/coreutils
$ size src/coreutils  # after
   text	   data	    bss	    dec	    hex	filename
1306933	   6748	 619152	1932833	 1d7e21	src/coreutils

* build-aux/gen-single-binary.sh: Map sha*sum to use cksum.c
* src/cksum.c: Adjust to behave more like sha*sum,
when the algorithm to something other than "crc".
* src/cksum.h: Expose the cksum_algorithm global and enum.
* src/coreutils-md5sum.c: Set cksum_algorithm and call cksum logic.
* src/coreutils-sha1sum.c: Likewise.
* src/coreutils-sha224sum.c Likewise.
* src/coreutils-sha256sum.c Likewise.
* src/coreutils-sha384sum.c Likewise.
* src/coreutils-sha512sum.c Likewise.
* NEWS: Mention the improvement.
2025-12-13 17:18:47 +00: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
Pádraig Brady
ba3442f4fa tests: printf: add case for quoting single quotes
* tests/printf/printf-quote.sh: Add a test case for
https://bugs.debian.org/992161 which was fixed with
gnulib commit v0.1-7339-g07b31a9465
2025-12-12 14:21:44 +00:00
Collin Funk
6956163ee5 maint: organize tee tests in a subdirectory
* tests/misc/tee.sh: Moved to tests/tee/tee.sh.
* tests/local.mk (all_tests): Adjust the file name.
2025-12-11 19:00:58 -08:00
Collin Funk
37be9fcfe8 tests: tee: add a test for --append
* tests/tee/append.sh: New file.
* tests/local.mk (all_tests): Add the test.
2025-12-11 19:00:50 -08:00
Pádraig Brady
06ed0625bd tests: fix recent portability issue with printf
* tests/sort/sort-locale.sh: Avoid non portable printf \u....
* cfg.mk (sc_env_printf): Add a new syntax check to flag future cases.
2025-12-11 22:02:55 +00:00
Pádraig Brady
a68ffc7176 tests: env: ensure non-utf8 name or value is supported
* tests/env/env.sh: Add a test case ensuring non-utf8 characters
in the name or value are supported.
2025-12-11 21:27:44 +00:00
Pádraig Brady
8a3c75c6d8 tests: mv: ensure ownership preserved when copying
* tests/mv/meta-to-xpart.sh: Add new test.
* tests/local.mk: Reference new test.
2025-12-11 20:32:41 +00:00
Collin Funk
b1ba0f3843 maint: groups: reduce variable scope
* src/groups.c (main): Declare variables where they are used instead of
at the start of the function. Convert a comment to GNU style.
2025-12-10 18:50:53 -08:00
Collin Funk
ae1dcbdbc6 maint: printenv: reduce variable scope
* src/printenv.c (main): Declare variables where they are used instead
of at the start of the function. Constify some strings we do not modify.
2025-12-10 18:50:53 -08:00
Collin Funk
bdb276a0c5 maint: rmdir: reduce variable scope
* src/rmdir.c (remove_parents, main): Declare variables where they are
used instead of at the start of a block.
2025-12-10 18:50:53 -08:00
Collin Funk
553c33ba6a maint: date: reduce variable scope
* src/date.c (batch_convert, main): Declare variables where they are
used instead of at the start of the function.
2025-12-10 18:50:53 -08:00
Collin Funk
684ec5b8ad maint: install: reduce variable scope
* src/install.c (change_timestamps): Initialize variables where they are
declared.
(need_copy, setdefaultfilecon, get_ids, mkancesdirs_safe_wd, main):
Declare variables where they are used instead of at the start of the
block.
2025-12-10 18:50:53 -08:00
Collin Funk
55aa5afbaf maint: cp: reduce variable scope
* src/cp.c (re_protect): Initialize variables where they are declared.
(make_dir_parents_private, do_copy, main): Declare variables where they
are used instead of at the start of the block.
2025-12-10 18:50:53 -08:00
Collin Funk
71250b2772 maint: mv: reduce variable scope
* src/mv.c (do_move, main): Declare variables where they are used
instead of at the start of a block.
2025-12-10 18:50:53 -08:00
Pádraig Brady
ef613e2a76 tests: env: add a test for --ignore-signal=PIPE
* tests/env/env-signal-handler.sh: Add a test for this
oft interfered with signal.
2025-12-10 22:41:42 +00:00
Pádraig Brady
f01195cf98 doc: support html post processing in all cases
Previously the html-local make rule only worked for `make html`.
Instead add support for `make doc/coreutils.html` or `make web-manual`
through the use of a makeinfo wrapper.

* doc/local.mk: Move post processing from here to ...
* build-aux/makeinfo-wrapper.sh: ... here.
* cfg.mk: Ensure our wrapper is called with MAKEINFO.
Also pass --no-node-files so redirection html files
are not created for each anchor.
2025-12-10 16:02:30 +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
Collin Funk
d1ac0f86b5 doc: html: fix build with parallel make
* doc/local.mk (html-local): Add html files to prerequisites so they are
generated before 'sed' is invoked.  Also interate over the already
populated $(HTMLS) to be more general (to multiple html files),
and more portable (to non GNU make).
2025-12-09 13:23:28 +00:00
Pádraig Brady
2692d599ec tests: fix non-portable use of printf '\x..'
* tests/dd/conv-case.sh: Use octal instead.
* tests/ls/hyperlink.sh: Likewise.
* tests/sort/sort-locale.sh: Likewise.
2025-12-08 22:32:48 +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
Collin Funk
cc3cb220c3 maint: env: reduce variable scope
* src/env.c (extract_varname, parse_signal_action_params)
(parse_block_signal_params, set_signal_proc_mask)
(list_signal_handling, main): Declare variables where they are used
instead of at the start of the function.
2025-12-07 15:48:15 -08:00
Collin Funk
5af9ffed32 maint: nohup: reduce variable scope
* src/nohup.c (main): Declare variables where they are used instead of
at the start of the function.
2025-12-07 15:47:24 -08:00
Collin Funk
d213c625ac maint: sync: reduce variable scope
* src/sync.c (sync_arg, main): Declare variables where they are used
instead of at the start of the function.
2025-12-07 15:35:48 -08:00
Collin Funk
881ac237be maint: pwd: reduce variable scope
* src/pwd.c (find_dir_entry, robust_getcwd): Declare variables where
they are used.
(logical_getcwd, main): Likewise. Constify the result of getenv, since
the result cannot be modified.
2025-12-07 15:35:16 -08:00
Collin Funk
8af2d813b9 maint: dirname: reduce variable scope
* src/dirname.c (main): Declare variables where they are used instead of
at the start of the function. Prefer idx_t to size_t.
2025-12-07 15:17:21 -08:00
Collin Funk
2880332ada maint: hostid: reduce variable scope
* src/hostid.c (main): Declare variables where they are used instead of
at the start of the function.
2025-12-07 15:11:55 -08:00
Collin Funk
dd2a113f5f maint: nproc: reduce variable scope
* src/nproc.c (main): Declare variables where they are used instead of
at the start of the function.
2025-12-07 15:06:24 -08:00
Collin Funk
b8abde0fe4 maint: whoami: reduce variable scope
* src/whoami.c (main): Declare variables where they are used instead of
at the start of the function.
2025-12-07 15:03:00 -08:00
Collin Funk
efd9a48ca5 maint: logname: reduce variable scope
* src/logname.c (main): Declare variables where they are used instead of
at the start of the function.
2025-12-07 14:59:19 -08:00
Collin Funk
597dfa0d31 maint: basename: initialize values while declaring
* src/basename.c (remove_suffix): Initialize values on the same line as
their declarations.
2025-12-07 14:56:23 -08:00
Collin Funk
c3eb8b4579 shred: use gethrxtime instead of time
The gethrxtime function uses a monotonic clock if available on the
system. The effect should be unnoticeable since we print --verbose
information every 5 seconds, but is more correct and we already do the
same in 'dd'.

* src/local.mk (src_shred_LDADD): Add $(GETHRXTIME_LIB).
* src/shred.c (dopass): Use xtime_t instead of time_t. Use gethrxtime
instead of time.
2025-12-07 11:37:17 -08:00
Pádraig Brady
3c9d4fdd83 tests: tac-continue.sh: modernise and always execute as root
* tests/tac/tac-continue.sh: This test was very awkard to setup,
and thus always skipped.  Instead move to a root only test
that creates an almost full partition itself.
* tests/local.mk: Move test to root only.
Suggested at https://github.com/uutils/coreutils/pull/9590
2025-12-07 13:31:07 +00:00
Collin Funk
3c405ae0b6 pinky: promptly diagnose write errors
In some cases 'pinky' could run forever until interrupted:

    $ ln -s /dev/zero ~/.plan
    $ ln -s /dev/zero ~/.project
    $ timeout -v 5 pinky -l collin > /dev/full
    timeout: sending signal TERM to command ‘pinky’

After this change it will exit upon failing to write to standard output:

    $ timeout -v 5 ./src/pinky -l collin > /dev/full
    pinky: write error: No space left on device

* src/pinky.c: Include fadvise.h, filenamecat.h, full-write.h, and
ioblksize.h.
(cat_file): New function.
(print_entry): Check if standard output has it's error flag set after
printing a user entry.
(print_long_entry): Likewise. Use the new cat_file function.
* NEWS: Mention the improvement.
2025-12-05 15:42:16 -08: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
Collin Funk
8787601bbe tests: ls: check that 'ls -R' doesn't run out of file descriptors
* tests/ls/recursive.sh: Add a test where the file descriptor limit is
less than the number of directories we visit recursively.
2025-12-04 18:00:49 -08:00
Paul Eggert
2a21ecb16f build: update gnulib submodule to latest
Gnulib issymlinkat change reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2025-12/msg00044.html
* bootstrap: Update from Gnulib.
* src/copy.c: Include issymlinkat.h, not issymlink.h.
2025-12-04 12:45:02 -08:00
Collin Funk
bc1d66f8a5 maint: organize expand and unexpand tests in a subdirectory
* tests/misc/expand.pl: Move to tests/expand/expand.pl.
* tests/misc/unexpand.pl: Move to tests/unexpand/unexpand.pl.
* tests/local.mk (all_tests): Adjust file names.
2025-12-02 21:32:07 -08:00
Collin Funk
649be7359e tests: expand, unexpand: add a test for bounded memory operation
* tests/expand/bounded-memory.sh: New file.
* tests/unexpand/bounded-memory.sh: New file.
* tests/local.mk (all_tests): Add the tests.
2025-12-02 21:25:37 -08:00
Collin Funk
f23509b4f1 maint: don't use == on bools
* src/df.c (filter_mount_list): Adjust comment.
* src/sync.c (sync_arg): Don't use == on bools.
* src/pr.c (init_parameters): Likewise.
2025-12-02 20:24:16 -08:00
Collin Funk
c00a094188 timeout: print the signal number 0 instead of EXIT
POSIX.1-2024 added sig2str but leaves the behavior when called with
signal 0 unspecified. FreeBSD 15.0 does not return the signal name EXIT
like Gnulib's version causing a test failure. This fixes that and
changes the behavior to print 0 instead of EXIT, to avoid confusion when
the program does not exit.

* NEWS: Mention the change.
* src/timeout.c (cleanup): Use snprintf instead of sig2str if the signal
is 0.
* tests/timeout/timeout.sh: Updated the expected output.
2025-12-02 19:16:23 -08:00
Pádraig Brady
86061ddbbd timeout: prioritize "timed out" exit status
* src/timeout.c (cleanup): Reset the default exit status
to EXIT_TIMEDOUT, if we have in fact received an ALARM.
Otherwise we would exit with status EXIT_CANCELED if
there was an issue writing --verbose output for example.
This also ensures a consistent exit status with ASAN enabled,
as with ASAN stderr is not explicitly closed by gnulib's
close_stdout handler.
2025-12-02 17:20:19 +00:00
Pádraig Brady
2d07c26d95 tests: ls --hyperlink: add more escaping test cases
* tests/ls/hyperlink.sh: Add tests for anchors, colons,
utf8, and invalid utf8 characters.
2025-12-02 13:17:51 +00:00
Collin Funk
936a866de0 tests: cut: add a test for bounded memory operation
* tests/cut/bounded-memory.sh: New file.
* tests/local.mk (all_tests): Add the test.
2025-12-01 17:12:55 -08:00
Pádraig Brady
d5a75a2f93 tests: enable mkdir/writable-under-readonly.sh
* tests/mkdir/writable-under-readonly.sh: Address FIXMEs and enable.
Addresses https://github.com/coreutils/coreutils/issues/137
2025-12-01 17:34:35 +00:00
Pádraig Brady
95b737c835 tests: mv: add checks for cross device handling of special files
* tests/mv/mv-special-2.sh: Add test to ensure we preserve
sparse files, character devices, symlinks, when moving across
file system boundaries.
Addresses https://github.com/coreutils/coreutils/issues/136
2025-12-01 15:09:02 +00:00
Pádraig Brady
ffbd8c4878 tests: rm: avoid usually skipped non root test
* tests/rm/fail-eperm.xpl: Remove this usually skipped non-root test.
* tests/rm/fail-2eperm.sh: Add the test to this root test instead.
* tests/local.mk: Remove the reference to *.xpl.
2025-12-01 13:23:45 +00:00