]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
2 months agodoc: make command synopsis more consistent
Pádraig Brady [Tue, 3 Jun 2025 21:58:38 +0000 (22:58 +0100)] 
doc: make command synopsis more consistent

* doc/coreutils.texi: Use @dots{} after [OPTION],
to be consistent with man pages.
* src/printenv.c (Usage): Remove unneeded "...".
* src/timeout.c (Usage): Add needed "...",
and also remove redundant [OPTION] only form.
* src/chroot.c (Usage): Likewise.
Fixes https://bugs.gnu.org/78628

2 months agocksum: port to Apple LLVM version 10.0.0
Paul Eggert [Thu, 29 May 2025 15:30:13 +0000 (08:30 -0700)] 
cksum: port to Apple LLVM version 10.0.0

This compiler lacks support for the x86-64 VPCLMULQDQ instruction;
compiles fail with "error: invalid cpu feature string for builtin".
Problem reported by Peter Dyballa, and fix suggested by
Pádraig Brady <https://bugs.gnu.org/78562#8>.
* configure.ac (USE_AVX512_CRC32):
Also check that __builtin_cpu_supports ("vpclmulqdq") compiles.

2 months agotests: sort: expand multiple output testing
Pádraig Brady [Wed, 28 May 2025 19:48:31 +0000 (20:48 +0100)] 
tests: sort: expand multiple output testing

* tests/sort/sort.pl: Ensure duplicate
output strings are supported.

2 months agomaint: assume O_DIRECTORY
Paul Eggert [Wed, 28 May 2025 19:35:14 +0000 (12:35 -0700)] 
maint: assume O_DIRECTORY

Recent changes in Gnulib guarantee O_DIRECTORY != 0.
* gl/lib/targetdir.c (target_directory_operand):
* src/dd.c (usage):
* src/ln.c (main):
Simplify now that O_DIRECTORY must be nonzero.

2 months agobuild: update gnulib submodule to latest
Paul Eggert [Wed, 28 May 2025 19:35:14 +0000 (12:35 -0700)] 
build: update gnulib submodule to latest

2 months agomaint: avoid a sc_system_h_headers failure
Pádraig Brady [Sat, 24 May 2025 21:01:44 +0000 (22:01 +0100)] 
maint: avoid a sc_system_h_headers failure

* cfg.mk: Also exclude libstdbuf.c from this check.

2 months agostdbuf: don’t allocate more than SIZE_MAX / 2
Paul Eggert [Sat, 24 May 2025 20:01:31 +0000 (13:01 -0700)] 
stdbuf: don’t allocate more than SIZE_MAX / 2

* src/libstdbuf.c (apply_mode): Be more conservative about
sizes passed to malloc, since we can’t rely on Gnulib malloc.

2 months agostdbuf: simplify apply_mode + getenv
Paul Eggert [Sat, 24 May 2025 19:55:13 +0000 (12:55 -0700)] 
stdbuf: simplify apply_mode + getenv

* src/libstdbuf.c (apply_mode): Take getenv arg, not result.
All callers changed.  This is simpler.

2 months agostdbuf: port better to Mac OS X 10.4.11
Paul Eggert [Sat, 24 May 2025 19:47:06 +0000 (12:47 -0700)] 
stdbuf: port better to Mac OS X 10.4.11

Do not link to fchownat, fchmodat, xreallocarray.
While we’re at it, depend as little as possible on problematic
functions like fileno, strtoumax.  Use only functions that
were around in C89.
Problem reported by Peter Dyballa <https://bugs.gnu.org/78509#59>.
* src/libstdbuf.c: Include stddef.h, stdlib.h, gettext.h.
Do not include stdint.h or system.h.
(_): New macro, since we no longer include system.h.
Undef strtoul, not strtoumax.
(fileno_to_name): Remove.  All uses removed.
(apply_mode): New arg STREAM_NAME, so that we no longer need
to depend on fileno which might run into a Gnulib workaround.
Don’t allocate more than ULONG_MAX - 1 bytes, as that’s
not helpful in the real world and this lessens dependency
on newer features like strtoumax.

2 months agotests: avoid hung tests on older macOS
Pádraig Brady [Wed, 21 May 2025 20:20:11 +0000 (21:20 +0100)] 
tests: avoid hung tests on older macOS

These tests were seen to hang on PPC Mac OS X 10.4.11

* tests/cp/existing-perm-race.sh: Protect fifo interactions
with a 1 minute timeout.
* tests/cp/file-perm-race.sh: Likewise.
Reported in https://bugs.gnu.org/78509

2 months agosort: fix buffer under-read (CWE-127)
Pádraig Brady [Tue, 20 May 2025 15:03:44 +0000 (16:03 +0100)] 
sort: fix buffer under-read (CWE-127)

* src/sort.c (begfield): Check pointer adjustment
to avoid Out-of-range pointer offset (CWE-823).
(limfield): Likewise.
* tests/sort/sort-field-limit.sh: Add a new test,
which triggers with ASAN or Valgrind.
* tests/local.mk: Reference the new test.
* NEWS: Mention bug fix introduced in v7.2 (2009).
Fixes https://bugs.gnu.org/78507

2 months agomaint: omit -Wmissing-variable-declarations from tests
Paul Eggert [Mon, 19 May 2025 06:34:28 +0000 (23:34 -0700)] 
maint: omit -Wmissing-variable-declarations from tests

* configure.ac (GNULIB_WARN_CFLAGS):
Omit -Wmissing-variable-declarations; needed for
gcc (GCC) 15.1.1 20250425 (Red Hat 15.1.1-1).

2 months agomaint: avoid sc_preprocessor_indentation failure
Pádraig Brady [Sun, 18 May 2025 09:37:35 +0000 (10:37 +0100)] 
maint: avoid sc_preprocessor_indentation failure

* src/factor.c: Tweak preprocessor indentation.

2 months agobuild: generate src/crctab.c when building from git
Collin Funk [Sun, 18 May 2025 04:43:31 +0000 (21:43 -0700)] 
build: generate src/crctab.c when building from git

* src/crctab.c: Remove file.
* src/cksum.c [!CRCTAB]: Include config.h.
* src/local.mk: Generate src/crctab.c in a temporary directory.
(EXTRA_DIST): Add src/crctab.c.
* .gitignore (/src/crctab.c): Add entry.

2 months agobuild: fix 'make distcheck'
Collin Funk [Sun, 18 May 2025 04:02:20 +0000 (21:02 -0700)] 
build: fix 'make distcheck'

* src/local.mk (EXTRA_DIST): Distribute src/make-prime-list.c
to satisfy the new make dependency.

2 months agofactor: fix bug with 128-bit uintmax_t
Paul Eggert [Sun, 18 May 2025 04:42:37 +0000 (21:42 -0700)] 
factor: fix bug with 128-bit uintmax_t

On so-far-only-theoretical platforms with 128-bit uintmax_t,
'factor' would misbehave by not factoring enough.
Work around the bug (at a performance cost)
and document the issue.  I hope someone with
more time and expertise can fix the performance cost
that this introduces.
To reproduce the correctness bug, build with
'gcc -DUSE_INT128 -DEXHIBIT_INT128_BUG';
'make check' should fail due to the new test case.
* src/factor.c (USE_INT128): New macro.
(wide_uint, wide_int, W_TYPE_SIZE, WIDE_UINT_MAX):
Define to proper values if USE_INT128.
(prime_p) [!EXHIBIT_INT128_BUG]: Work around bug
with 128-bit wide_uint, at some performance cost.
* tests/factor/factor.pl (bug-with-128-bit-uintmax_t):
New test.

2 months agofactor: refactor to allow non-uintmax_t ints
Paul Eggert [Sun, 18 May 2025 04:42:37 +0000 (21:42 -0700)] 
factor: refactor to allow non-uintmax_t ints

This prepares for using unsigned __int128 instead of uintmax_t.
It doesn’t change behavior.
* src/factor.c (wide_uint, wide_int):
New typedefs, replacing all uses of uintmax_t, intmax_t.
(WIDE_UINT_MAX): New macro, replacing all uses of UINTMAX_MAX.
(USE_LONGLONG_H): Don’t use LONG_MAX and INTMAX_MAX (which
should have been ULONG_MAX and UINTMAX_MAX anyway).
Instead, use W_TYPE_SIZE and ULONG_WIDTH, as that will be
easier to work with if we use unsigned __int128.
(binv): Also unroll for the 128-bit case.
* src/make-prime-list.c (print_wide_uint):
Print "wide_uint" not "uintmax_t".

2 months agobuild: support cross-compiling directly from git checkout
Collin Funk [Fri, 16 May 2025 05:02:26 +0000 (22:02 -0700)] 
build: support cross-compiling directly from git checkout

* src/local.mk: Compile the make-prime-list in a temporary directory
using $(BUILD_CC) so it can be run even when $(CC) is a cross-compiler.
Add some comments.
(noinst_PROGRAMS): Remove src/make-prime-list.
(src_make_prime_list_LDADD): Remove variable.
* src/make-prime-list.c: Don't include config.h and attributes.h.
Remove unnecessary #undefs
(ATTRIBUTE_CONST, ATTRIBUTE_MALLOC): Define for the host compiler.
Fixes https://bugs.gnu.org/78377

3 months agomaint: --help now outputs bug reporting address
Paul Eggert [Wed, 14 May 2025 20:36:40 +0000 (13:36 -0700)] 
maint: --help now outputs bug reporting address

This changes the tail of "cat --help" output from:

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation <https://www.gnu.org/software/coreutils/cat>
or available locally via: info '(coreutils) cat invocation'

to:

Report bugs to: bug-coreutils@gnu.org
GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
General help using GNU software: <https://www.gnu.org/gethelp/>
Full documentation <https://www.gnu.org/software/coreutils/cat>
or available locally via: info '(coreutils) cat invocation'

* src/system.h (emit_bug_reporting_address): Don’t #define.
(emit_ancillary_info): Call emit_bug_reporting_address
instead of doing it by hand, which omitted the bug reporting address.

3 months agomaint: avoid sc_gitignore_missing failure
Pádraig Brady [Mon, 12 May 2025 22:20:43 +0000 (23:20 +0100)] 
maint: avoid sc_gitignore_missing failure

* .gitignore: Add the soon to be generated lib/fts_.h
* cfg.mk (sc_gitignore_missing): Special case the mapping
of fts.in.h to fts_.h.
Fixes https://bugs.gnu.org/78398

3 months agodoc: NEWS: fix introduced version of a bug
Pádraig Brady [Mon, 12 May 2025 10:52:17 +0000 (11:52 +0100)] 
doc: NEWS: fix introduced version of a bug

* NEWS: The NFSv4 trivial ACL ENOTSUP issue was introduced in 9.6.

3 months agomaint: avoid sc_GPL_version failure
Pádraig Brady [Mon, 12 May 2025 10:50:25 +0000 (11:50 +0100)] 
maint: avoid sc_GPL_version failure

* cfg.mk (VC_LIST_ALWAYS_EXCLUDE_REGEX): Exclude longlong.h also.

3 months agodoc: suggest GNULIB_REFDIR instead of GNULIB_SRCDIR
Collin Funk [Sun, 11 May 2025 17:07:22 +0000 (10:07 -0700)] 
doc: suggest GNULIB_REFDIR instead of GNULIB_SRCDIR

* README-hacking: Use GNULIB_REFDIR instead of GNULIB_SRCDIR since that
is the correct way to have ./bootstrap do 'git clone --reference'.

3 months agofactor: check overflow with ckd_add etc
Paul Eggert [Mon, 12 May 2025 07:09:16 +0000 (00:09 -0700)] 
factor: check overflow with ckd_add etc

* src/factor.c (umul_ppmm, add_ssaaaa, sub_ddmmss, submod)
(mulredc, strto2wide_uint): Prefer ckd_add etc. to doing
overflow checking by hand.

3 months agomaint: pacify GCC when selinux is missing
Paul Eggert [Mon, 12 May 2025 02:26:38 +0000 (19:26 -0700)] 
maint: pacify GCC when selinux is missing

* src/selinux.h (restorecon, defaultcon): Use MAYBE_UNUSED.

3 months agofactor: be more cautious about C compiler versions
Paul Eggert [Mon, 12 May 2025 01:22:44 +0000 (18:22 -0700)] 
factor: be more cautious about C compiler versions

* src/factor.c (__GMP_GNUC_PREREQ): Define compatibly with GMP.

3 months agomaint: sync longlong.h from gmp
Paul Eggert [Mon, 12 May 2025 01:00:50 +0000 (18:00 -0700)] 
maint: sync longlong.h from gmp

* .x-update-copyright: Add src/longlong.h.
* src/longlong.h: Sync from gmp.

3 months agofactor: omit incorrect affirms in mulredc2
Paul Eggert [Mon, 12 May 2025 00:25:30 +0000 (17:25 -0700)] 
factor: omit incorrect affirms in mulredc2

* src/factor.c (mulredc2): Remove two ‘affirm’ calls that didn’t
match the accompanying comment, and one of which has a false
positive if UINTMAX_WIDTH == 128 and we factor 2**128 + 1.

3 months agobuild: update gnulib submodule to latest
Collin Funk [Sun, 11 May 2025 16:56:37 +0000 (09:56 -0700)] 
build: update gnulib submodule to latest

* bootstrap: Update using './bootstrap --bootstrap-sync'.

3 months agomaint: update NEWS from Gnulib update
Paul Eggert [Sat, 10 May 2025 05:35:34 +0000 (22:35 -0700)] 
maint: update NEWS from Gnulib update

3 months agobuild: update gnulib submodule to latest
Paul Eggert [Sat, 10 May 2025 01:05:48 +0000 (18:05 -0700)] 
build: update gnulib submodule to latest

3 months agomaint: minor followon touchup of GCC warnings
Paul Eggert [Sat, 10 May 2025 04:01:14 +0000 (21:01 -0700)] 
maint: minor followon touchup of GCC warnings

* configure.ac (GNULIB_TEST_WARN_CFLAGS):
Do not use -Wsuggest-attribute=cold, -Wsuggest-attribute=const,
-Wsuggest-attribute=format as they produce false positives with
GCC 15 x86-64.  Use -Wmissing-variable-declarations, as it no
longer seems to hurt.

3 months agomaint: modernize GCC warning configuration
Paul Eggert [Fri, 9 May 2025 22:55:47 +0000 (15:55 -0700)] 
maint: modernize GCC warning configuration

* configure.ac: Simplify the setup of GCC’s -W... options,
by removing options no longer needed for GCC 15 (when
configuring with --enable-gcc-warnings) or GCC 12 (without).
I hope this is good enough nowadays.
Add GCC 15’s -Wtrailing-whitespace, since that works for us.

3 months agomaint: use MAYBE_UNUSED more consistently
Paul Eggert [Fri, 9 May 2025 22:52:15 +0000 (15:52 -0700)] 
maint: use MAYBE_UNUSED more consistently

* src/basenc.c (no_required_padding):
* gl/lib/smack.h (smack_new_label_from_self)
(smack_set_label_for_self):
* src/cksum.c (output_crc):
* src/digest.c (md5_sum_stream, sha1_sum_stream)
(sha224_sum_stream, sha256_sum_stream, sha384_sum_stream)
(sha512_sum_stream, sm3_sum_stream, output_file):
* src/stat.c (print_statfs, print_stat):
* src/sum.c (output_bsd, output_sysv):
* src/timeout.c (chld):
Mark possibly-unused parameters with MAYBE_UNUSED.

3 months agomaint: fix Automake warning
Paul Eggert [Fri, 9 May 2025 22:49:23 +0000 (15:49 -0700)] 
maint: fix Automake warning

* Makefile.am (prologue): Remove macro, as \# is not portable here
and Automake complains.  Replace its only use with its definiens.

3 months agotests: avoid false failures in user namespaces
Pádraig Brady [Sat, 3 May 2025 08:59:16 +0000 (09:59 +0100)] 
tests: avoid false failures in user namespaces

* init.cfg (require_membership_in_two_groups_): Skip
overflow gids used in user namespaces, as one can't
chgrp() to these.
Fixes https://bugs.gnu.org/78225

3 months agobuild: update to latest gnulib
Pádraig Brady [Thu, 1 May 2025 13:05:59 +0000 (14:05 +0100)] 
build: update to latest gnulib

* bootstrap.conf: Adjust for hash-triple module renaming.
* src/copy.c: Likewise.
* src/ln.c: Likewise.
* gnulib: Update to latest.

3 months agotests: add a test case for negative relative date
Pádraig Brady [Wed, 23 Apr 2025 11:47:54 +0000 (12:47 +0100)] 
tests: add a test case for negative relative date

* tests/date/date.pl: To exercise option processing.

3 months agotests: fix false failure with constrained setfacl
Pádraig Brady [Mon, 21 Apr 2025 10:48:33 +0000 (11:48 +0100)] 
tests: fix false failure with constrained setfacl

* tests/ls/acl.sh: In constrained environments, like with
setxattr() disabled for example, require_acl_ does not
check for the required functionality, so use the more
stringent require_setfacl_ instead.
Reported at https://github.com/NixOS/nixpkgs/issues/394953

3 months agomaint: map Jim's new email address
Pádraig Brady [Sat, 19 Apr 2025 12:46:23 +0000 (13:46 +0100)] 
maint: map Jim's new email address

.mailmap: Add meta.com as an alias.

4 months agols: omit a static var
Paul Eggert [Sat, 12 Apr 2025 19:59:41 +0000 (12:59 -0700)] 
ls: omit a static var

* src/ls.c (file_has_aclinfo_cache): No need for unsupported_cached;
we can use unsupported_scontext.  Also, improve comments.

4 months agomaint: post-release administrivia
Pádraig Brady [Wed, 9 Apr 2025 11:14:12 +0000 (12:14 +0100)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

4 months agoversion 9.7 v9.7
Pádraig Brady [Wed, 9 Apr 2025 10:44:57 +0000 (11:44 +0100)] 
version 9.7

* NEWS: Record release date.

4 months agotests: adjust csplit VM limit for CheriBSD
Pádraig Brady [Tue, 8 Apr 2025 15:07:06 +0000 (16:07 +0100)] 
tests: adjust csplit VM limit for CheriBSD

* tests/misc/csplit-heap.sh: More memory is required to avoid
a false failure on CheriBSD with its heap accounting overhead.
This is confirmed to still trigger with the original memory leak
being tested.

4 months agols: support capabilities with device 0,0
Pádraig Brady [Tue, 8 Apr 2025 11:11:06 +0000 (12:11 +0100)] 
ls: support capabilities with device 0,0

* src/ls.c (has_capability_cache): Don't assume
a device major,minor of 0,0 never occurs.

4 months agols: fix crash of "ls -Z ." on OpenBSD's /dev/wd0a disk
Bruno Haible [Tue, 8 Apr 2025 10:14:29 +0000 (12:14 +0200)] 
ls: fix crash of "ls -Z ." on OpenBSD's /dev/wd0a disk

* src/ls.c (file_has_aclinfo_cache): Add new static variable
'unsupported_cached'. Don't assume that device 0 never occurs.

4 months agobuild: use _GL_ATTRIBUTE_NONSTRING attribute to avoid new warnings
Jim Meyering [Sun, 6 Apr 2025 14:55:04 +0000 (07:55 -0700)] 
build: use _GL_ATTRIBUTE_NONSTRING attribute to avoid new warnings

Avoid warnings like this from GCC 15:
src/basenc.c:1139:20: error: initializer-string for array of 'char'
truncates NUL terminator but destination lacks 'nonstring' attribute
(9 chars into 8 available) [-Werror=unterminated-string-initialization]
* src/basenc.c (z85_encoding, do_decode): Mark two more variables as
non-terminated.

4 months agomaint: avoid syntax-check failures from recent commit
Pádraig Brady [Mon, 7 Apr 2025 17:42:12 +0000 (18:42 +0100)] 
maint: avoid syntax-check failures from recent commit

* gl/lib/dtimespec-bound.h: Indent, Spellcheck.
* gl/local.mk: Add new gl files.

4 months agodoc: mention workaround for combining hex floats with suffixes
Paul Eggert [Mon, 7 Apr 2025 17:40:29 +0000 (18:40 +0100)] 
doc: mention workaround for combining hex floats with suffixes

* doc/coreutils.texi (hexDuration): Mention the p style exponent trick.

4 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 7 Apr 2025 08:46:34 +0000 (01:46 -0700)] 
build: update gnulib submodule to latest

4 months agotimeout: don’t sleep less than requested
Paul Eggert [Mon, 7 Apr 2025 07:30:14 +0000 (00:30 -0700)] 
timeout: don’t sleep less than requested

Also, change sleep and tail to not sleep less than requested.
* bootstrap.conf (gnulib_modules): Add dtimespec-bound.
* gl/lib/dtimespec-bound.c, gl/lib/dtimespec-bound.h:
* gl/modules/dtimespec-bound: New files.
* src/sleep.c, src/tail.c, src/timeout.c: Include dtimespec-bound.h.
* src/sleep.c, src/tail.c: Don’t include xstrtod.h.
* src/sleep.c (apply_suffix, main):
* src/tail.c (parse_options):
* src/timeout.c (apply_time_suffix):
Don’t sleep less than the true number of seconds.
* src/timeout.c: Don’t include ctype.h.
(is_negative): Remove; no longer needed.
(parse_duration): Use a slightly looser bound on the timeout, one
that doesn’t need -lm on GNU/Linux.  Clear errno before calling
cl_strtod.

4 months agomaint: silence a -Wunterminated-string-initialization warning
Jim Meyering [Sun, 6 Apr 2025 07:12:03 +0000 (08:12 +0100)] 
maint: silence a -Wunterminated-string-initialization warning

* src/basenc.c (base16_encode): Mark BASE16 as not NUL-terminated.

4 months agobuild: update gnulib submodule to latest
Pádraig Brady [Sat, 5 Apr 2025 22:24:32 +0000 (23:24 +0100)] 
build: update gnulib submodule to latest

4 months agotimeout: remove dependence on libm
Pádraig Brady [Sat, 5 Apr 2025 20:48:05 +0000 (21:48 +0100)] 
timeout: remove dependence on libm

This was seen to add about 100,000 ns to the startup time,
on a 2.6 GHz i7-5600U with glibc 2.40.

* .gitignore: Remove /lib/fenv.h.
* bootstrap.conf: Remove fenv-rounding and signbit deps.
* src/local.mk: Remove fenv lib dependency.
* src/timeout.c (is_negative): A new helper function to
be equivalent of signbit in the underflow case.
(parse_duration): Remove the rounding up logic,
as a nanosecond here or there has no significance.

4 months agodoc: mention the edge case of hex durations with 'd' suffix
Pádraig Brady [Sat, 5 Apr 2025 19:26:23 +0000 (20:26 +0100)] 
doc: mention the edge case of hex durations with 'd' suffix

* doc/coreutils.texi (sleep invocation): Mention that suffixes are
best avoided with hex arguments.
(timeout invocation): Likewise.
* tests/misc/sleep.sh: Ensure 'd' is not interpreted as "day".

4 months agomaint: adjustments to recent timeout change
Pádraig Brady [Sat, 5 Apr 2025 10:27:32 +0000 (11:27 +0100)] 
maint: adjustments to recent timeout change

* .gitignore: Add /lib/fenv.h to ignore list.
* tests/timeout/timeout-parameters.sh: Use a sleep length of 10s
to be consistent with the pattern where we use this larger time
when it does not slow down a test, but also provides protection
against a hung test, and better avoidance of false failures due
to races on very loaded systems.  Also fix the setting of FAIL.
* tests/timeout/timeout-large-parameters.sh: Remove duplicated test.

4 months agotimeout: round timeouts up
Paul Eggert [Sat, 5 Apr 2025 07:58:22 +0000 (00:58 -0700)] 
timeout: round timeouts up

This handles timeouts like 16777216.000000001 correctly;
formerly the subsecond part of that timeout was ignored.
* bootstrap.conf (gnulib_modules): Add fenv-rounding, signbit.
* src/local.mk (src_timeout_LDADD): Append $(FENV_ROUNDING_LIBM).
* src/timeout.c: Include fenv.h, math.h.
Don’t include xstrtod.h, as xstrtod’s checking now gets in the way.
(parse_duration): Round up when calling cl_strtod.
Check for -1e-1000.  Don’t double-round 1e-9.
* tests/timeout/timeout-parameters.sh: Test for -0.1,
-1e-1000, 1e-1000.

4 months agomaint: ensure that new "make syntax-check"-run sc_codespell passes
Collin Funk [Fri, 4 Apr 2025 19:35:15 +0000 (12:35 -0700)] 
maint: ensure that new "make syntax-check"-run sc_codespell passes

* cfg.mk (codespell_ignore_words_list): Ignore false-positives.
(exclude_file_name_regexp--sc_codespell): Skip some file names.
* doc/coreutils.texi (mktemp invocation): Use "alphanumeric" which is
consistent with the rest of the documentation.
* src/expand-common.c: Fix typo.
* src/ls.c: Likewise.
* tests/split/l-chunk-root.sh: Likewise.

4 months agotimeout: ensure infinitesimal timeouts timeout quickly
Pádraig Brady [Fri, 4 Apr 2025 19:40:26 +0000 (20:40 +0100)] 
timeout: ensure infinitesimal timeouts timeout quickly

* src/timeout.c (parse_duration): Clamp infinitesimal values to 1ns.
* tests/timeout/timeout-large-parameters.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/77535

4 months agotests: fix false failure with multi-byte thousands separators
Pádraig Brady [Fri, 4 Apr 2025 10:53:10 +0000 (11:53 +0100)] 
tests: fix false failure with multi-byte thousands separators

* tests/sort/sort-h-thousands-sep.sh: sv_SE defaults to UTF-8
on macOS 18, so avoid the test for multi-byte separators.
Fixes https://bugs.gnu.org/77509

4 months agols: suppress ENOENT errors when reading ACL info
Pádraig Brady [Sun, 30 Mar 2025 14:16:54 +0000 (15:16 +0100)] 
ls: suppress ENOENT errors when reading ACL info

* src/ls.c (gobble_file): Indicating unknown ACL info with '?'
suffices for the edge case of a file being removed while reading,
or older cygwin when reading through dangling symlinks.
Reported by Corinna Vinschen.

4 months agols: print correct xattr error on all platforms
Pádraig Brady [Fri, 28 Mar 2025 20:24:18 +0000 (20:24 +0000)] 
ls: print correct xattr error on all platforms

* src/ls.c (gobble_file): Output errno, as u.err
is not populated by file_has_aclinfo() on all platforms.
* NEWS: Mention the bug fix.

4 months agomv: port test to OpenBSD 7.5
Paul Eggert [Sun, 23 Mar 2025 19:00:31 +0000 (12:00 -0700)] 
mv: port test to OpenBSD 7.5

Problem reported by Bruno Haible <https://bugs.gnu.org/75685>.
* tests/mv/sticky-to-xpart.sh: Also allow OpenBSD behavior.

4 months agodoc: id: be direct about valid options with -nr
Pádraig Brady [Sat, 22 Mar 2025 12:28:56 +0000 (12:28 +0000)] 
doc: id: be direct about valid options with -nr

* src/id.c (usage): State what options are valid with -nr,
rather than just stating the default format is invalid.
Fixes https://bugs.gnu.org/77163

4 months agodoc: id: make option combinations more searchable
Pádraig Brady [Sat, 22 Mar 2025 12:10:36 +0000 (12:10 +0000)] 
doc: id: make option combinations more searchable

* src/id.c (usage): Add commas to make options more searchable.
Don't add spaces since that would overflow 80 cols.
Fixes https://bugs.gnu.org/77162

4 months agols: fix crash on systems with SELinux but without xattr support
Pádraig Brady [Thu, 20 Mar 2025 18:40:01 +0000 (18:40 +0000)] 
ls: fix crash on systems with SELinux but without xattr support

This was seen on termux on Android with ./configure --disable-xattr
where listxattr() and getxattr() returned ENOTSUP.
Then the valid security context obtained by file_has_aclinfo()
was discounted, and problematically then freed multiple times.
Reported at https://github.com/termux/termux-packages/issues/23752

* src/ls.c (file_has_aclinfo_cache): Only discount the returned
acl info when all components are defaulted due to being unsupported.

5 months agodircolors: add vt220 as a color capable terminal
Pádraig Brady [Sat, 15 Mar 2025 12:54:38 +0000 (12:54 +0000)] 
dircolors: add vt220 as a color capable terminal

This isn't strictly historically accurate
but most practical these days, especially since
systemd uses this as its default TERM type.
See https://github.com/coreutils/coreutils/issues/96

Tested with:
  $ LS_COLORS= COLORTERM= TERM=vt220 src/ls --color
  $ COLORTERM= TERM=vt220 src/dircolors

* src/dircolors.hin: Add vt220.

5 months agotests: dd: ensure posix_fadvise errors are handled
Pádraig Brady [Mon, 10 Mar 2025 12:33:20 +0000 (12:33 +0000)] 
tests: dd: ensure posix_fadvise errors are handled

* tests/dd/nocache_fail.sh: Add a test case for the recent fix.

5 months agodd: fix error detection with "nocache" flag
Frédéric Yhuel [Sun, 9 Mar 2025 19:12:14 +0000 (19:12 +0000)] 
dd: fix error detection with "nocache" flag

* NEWS: Mention the bug fix.
* src/dd.c (invalidate_cache): Adjust to the unusual
error propagation sematics of posix_fadvise().

5 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 10 Mar 2025 03:04:31 +0000 (20:04 -0700)] 
build: update gnulib submodule to latest

5 months agodoc: mention logname improvement in NEWS
Pádraig Brady [Sun, 9 Mar 2025 12:42:12 +0000 (12:42 +0000)] 
doc: mention logname improvement in NEWS

* NEWS: Mention the improvement in gnulib commit 90840606.
Addresses https://bugs.gnu.org/76876

5 months agobuild: fix LIBCRYPTO_SONAME value with config cache
Grisha Levit [Fri, 7 Feb 2025 01:56:46 +0000 (20:56 -0500)] 
build: fix LIBCRYPTO_SONAME value with config cache

* configure.ac (LIBCRYPTO_SONAME): Store library name in cache so we
do not end up with an empty value for it when a cache file is used.
The configure variable name is changed from utils_cv_dlopen_libcrypto
to utils_cv_libcrypto_soname.

5 months agowho: fix -m with guessed tty names
Lukáš Zaoral [Mon, 24 Feb 2025 09:36:35 +0000 (10:36 +0100)] 
who: fix -m with guessed tty names

* who.c (scan_entries): Account for guessed tty names (e.g.
'sshd pts/1') from the readutmp module when using the systemd backend.
* bootstrap.conf (gnulib_modules): Add str_endswith.
* News: Mention the bug fix.
Addresses https://bugzilla.redhat.com/2343998

5 months agobuild: update gnulib submodule to latest
Pádraig Brady [Thu, 20 Feb 2025 12:58:08 +0000 (12:58 +0000)] 
build: update gnulib submodule to latest

* gnulib: Update to 757345e8.
* src/who.c: Adjust to new defines.

5 months agomaint: fix sc_tight_scope failure
Pádraig Brady [Thu, 20 Feb 2025 12:54:53 +0000 (12:54 +0000)] 
maint: fix sc_tight_scope failure

This reverts commit 83fb600a21c6bad362b5739e7a9a9780639fa550.

5 months agomaint: fix sc_preprocessor_indentation failure
Pádraig Brady [Thu, 20 Feb 2025 12:54:16 +0000 (12:54 +0000)] 
maint: fix sc_preprocessor_indentation failure

* src/cksum.h: Indent appropriately.

5 months agosort: improve -u brief doc
Paul Eggert [Wed, 19 Feb 2025 21:17:48 +0000 (13:17 -0800)] 
sort: improve -u brief doc

* src/sort.c (usage): Reword -u help (Bug#76290).

5 months agodu: update debug option setup
Paul Eggert [Wed, 19 Feb 2025 04:09:10 +0000 (20:09 -0800)] 
du: update debug option setup

Current Gnulib arranges for fts debugging if GNULIB_FTS_DEBUG
is defined, so key off that rather than off DU_DEBUG.
* src/du.c (fts_debug): Remove decl, as Gnulib does this now.
(FTS_CROSS_CHECK): Remove; all uses removed.
(FTS_DEBUG) [!GNULIB_FTS_DEBUG]: Remove.
(long_options) [GNULIB_FTS_DEBUG]: Add a ---debug option.
(du_files): Call fts_cross_check only if fts_debug and GNULIB_FTS_DEBUG.
(main): Set fts_debug if GNULIB_FTS_DEBUG, not DU_DEBUG.

5 months agomaint: omit function defn extern
Paul Eggert [Wed, 19 Feb 2025 04:09:10 +0000 (20:09 -0800)] 
maint: omit function defn extern

* src/chown-core.c, src/copy.c, src/cp-hash.c, src/csplit.c:
* src/expand-common.c, src/find-mount-point.c, src/force-link.c:
* src/group-list.c, src/iopoll.c, src/operand2sig.c:
* src/show-date.c, src/wc_avx2.c:
Omit unnecessary ‘extern ’ at the start of function defns.
This is less wordy, makes it a bit easier to grep for issues such
as the missing consistency checking in cksum.

5 months agocksum: check API better
Paul Eggert [Wed, 19 Feb 2025 04:09:10 +0000 (20:09 -0800)] 
cksum: check API better

* src/cksum_avx2.c, src/cksum_avx512.c, src/cksum_pclmul.c:
* src/cksum_vmull.c:
Include cksum.h instead of copying its decls/includes by hand.
This is a better way to ensure consistency among defns and uses.

5 months agocksum: minor crctab generation cleanups
Paul Eggert [Wed, 19 Feb 2025 04:09:10 +0000 (20:09 -0800)] 
cksum: minor crctab generation cleanups

* src/cksum.c [CRCTAB]: Include only config.h and stdio.h,
to simplify the crctab-generating code.
[!CRCTAB]: Do not include stdint.h or stdio.h, as cksum.h does it now.
(BIT, r, crc_remainder, main) [CRCTAB]: Use unsigned int, not
uint_fast32_t or uint32_t, as this is good enough for GNU where
unsigned int is guaranteed to be at least 32 bits, and this way we
needn’t worry about mismatches between %08x formats and uint_fast32_t.
(main) [CRCTAB]: Prefer more-local decls.  Do not output
unnecessary directives to include stdint.h or stdio.h.
No need for ‘return EXIT_SUCCESS;’ nowadays.
* src/crctab.c: Regenerate.

5 months agocksum: make cksum.h standalone
Paul Eggert [Wed, 19 Feb 2025 04:09:10 +0000 (20:09 -0800)] 
cksum: make cksum.h standalone

* src/cksum.h: Include stdint.h, stdio.h so that this file
can be included in any order, after config.h.
Add a copyright notice.

5 months agobuild: update gnulib submodule to latest
Paul Eggert [Wed, 19 Feb 2025 04:09:10 +0000 (20:09 -0800)] 
build: update gnulib submodule to latest

5 months agocksum: port to 32-bit uint_fast32_t
Paul Eggert [Mon, 17 Feb 2025 10:27:09 +0000 (02:27 -0800)] 
cksum: port to 32-bit uint_fast32_t

* src/cksum_vmull.c (cksum_vmull): Don’t assume
uint_fast32_t can hold 64 bits.
Problem reported by Alyssa Ross (Bug#76360).

5 months agocksum: fix test for missing
Paul Eggert [Mon, 17 Feb 2025 10:23:52 +0000 (02:23 -0800)] 
cksum: fix test for missing

* tests/cksum/cksum.sh: Don’t output confusing diagnostic.
Problem reported by Alyssa Ross (Bug#76360).

5 months agodircolors: recognize “jxl” (JPEG XL) files
Mike Swanson [Sun, 16 Feb 2025 06:56:32 +0000 (22:56 -0800)] 
dircolors: recognize “jxl” (JPEG XL) files

5 months agocat: fix plain ‘cat’ bug
Paul Eggert [Fri, 14 Feb 2025 21:10:02 +0000 (13:10 -0800)] 
cat: fix plain ‘cat’ bug

* src/cat.c (main): Do not fail with plain ‘cat’ where input and
output are both /dev/tty, if the output happens to have O_APPEND set.
Problem reported by lilydjwg <https://bugs.gnu.org/76255>.
Also, don’t report an error if the seek position is at or after EOF,
even if O_APPEND is set.

5 months agocat: omit unnecessary lseek
Paul Eggert [Fri, 14 Feb 2025 21:01:35 +0000 (13:01 -0800)] 
cat: omit unnecessary lseek

* src/cat.c (main): Don’t bother to try lseek on a fifo or socket,
as it will fail.

5 months agocat: port to platforms with shm, tmo
Paul Eggert [Fri, 14 Feb 2025 07:27:42 +0000 (23:27 -0800)] 
cat: port to platforms with shm, tmo

* src/cat.c (main): Work even on platforms that have shared memory
objects and typed memory objects, which means st_dev and st_ino do
not work.

6 months agodoc: remove extraneous new lines in some man pages
Pádraig Brady [Wed, 5 Feb 2025 12:41:45 +0000 (12:41 +0000)] 
doc: remove extraneous new lines in some man pages

* local.mk: Add the --loose-indent option, which results in help2man
avoiding extraneous new lines in expr.1, id.1, numfmt.1, shred.1,
tail.1, and timeout.1.
Fixes https://bugs.gnu.org/74107

6 months agodoc: sync help2man to latest version
Pádraig Brady [Wed, 5 Feb 2025 12:00:22 +0000 (12:00 +0000)] 
doc: sync help2man to latest version

* man/help2man: sync changes to commit 8fe02612
The main change here is to Use \f(CR for monospace text
when using groff in troff mode.
Previously \f(CW was used, but that's not portable.

6 months agotests: du: avoid intermittent false failure
Pádraig Brady [Wed, 5 Feb 2025 11:18:13 +0000 (11:18 +0000)] 
tests: du: avoid intermittent false failure

* tests/du/long-sloop.sh: Avoid failure due to
intermittent reception of FTS_DNR, seen on BTRFS at least.

6 months agobuild: update gnulib submodule to latest
Paul Eggert [Tue, 4 Feb 2025 17:45:41 +0000 (09:45 -0800)] 
build: update gnulib submodule to latest

6 months agomaint: pacify ‘gcc -Wswitch-enum’
Paul Eggert [Mon, 3 Feb 2025 06:09:09 +0000 (22:09 -0800)] 
maint: pacify ‘gcc -Wswitch-enum’

I thought of a way to pacify -Wswitch-enum without much trouble.
Either add all the enums, or if that’s too verbose use ‘switch (+E)’
to indicate to the reader that there need not be a case for
every enum value.  Since this approach improves static checking,
make the change everywhere and check it with -Wswitch-enum.
* configure.ac: Compile with -Wswitch-enum if it works and
--enable-gcc-warnings.  No need to remove -Wswitch-default
since Gnulib no longer adds it.
* src/chmod.c (describe_change):
* src/chown-core.c (describe_change):
* src/copy.c (copy_debug_string, copy_debug_sparse_string):
* src/df.c (decode_output_arg, get_dev):
* src/du.c (main):
* src/factor.c (print_factors):
* src/head.c (diagnose_copy_fd_failure):
* src/ls.c (time_type_to_statx, calc_req_mask)
(decode_line_length, get_funky_string, parse_ls_color)
(gobble_file, print_long_format):
* src/split.c (main):
* src/sync.c (sync_arg):
* src/tr.c (is_char_class_member):
* src/wc.c (main):
Add switch cases to pacify -Wswitch-enum.
* src/copy.c (copy_debug_string, copy_debug_sparse_string):
Add unreachable () for unreachable cases.
* src/digest.c (main):
* src/od.c (decode_one_format):
* src/tr.c (get_next, get_spec_stats):
switch (E) → switch (+E).
* src/digest.c (main):
* src/tr.c (get_next):
Omit unnecessary ‘default: break;’ that merely pacified GCC,
as the new pacification style is better.
* src/ls.c (decode_line_length):
Add default unreachable case to prevent warning that function
might not return a value.
(gobble_file): Distinguish DEREF_NEVER from unreachable cases.

6 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 3 Feb 2025 03:16:24 +0000 (19:16 -0800)] 
build: update gnulib submodule to latest

6 months agodoc: ls: clarify --format options
Pádraig Brady [Wed, 29 Jan 2025 11:33:25 +0000 (11:33 +0000)] 
doc: ls: clarify --format options

* src/ls.c (usage): Use parentheses to be less ambiguous as
to what are WORDs and equivalent short options.  This is also
consistent with the description of --sort and --indicator-style.
Fixes https://bugs.gnu.org/75916

6 months agodoc: support --with-packager-bug-reports
Pádraig Brady [Tue, 28 Jan 2025 18:31:48 +0000 (18:31 +0000)] 
doc: support --with-packager-bug-reports

* src/system.h (emit_ancillary_info): Output
PACKAGE_PACKAGER_BUG_REPORTS if the build is configured
--with-packager-bug-reports.
Reported by Bruno Haible.

6 months agosort: drop "note" from a --debug message
Pádraig Brady [Wed, 22 Jan 2025 17:55:25 +0000 (17:55 +0000)] 
sort: drop "note" from a --debug message

* src/sort.c (key_warnings): Remove "note " from the start
of a usually informational message, as this simplifies translation.
* tests/sort/sort-debug-warn.sh": Adjust accordingly.
Fixes https://bugs.gnu.org/75763

6 months agotests: avoid ENAMETOOLONG ERROR on some systems
Pádraig Brady [Mon, 20 Jan 2025 17:22:43 +0000 (17:22 +0000)] 
tests: avoid ENAMETOOLONG ERROR on some systems

* tests/du/long-from-unreadable.sh: Relax to a skip_ for now,
as this was seen to error on ext4 on Debian 11 in a docker container.

6 months agomaint: tests: remove duplicate uses of 'my' in Perl
Collin Funk [Mon, 20 Jan 2025 05:15:35 +0000 (21:15 -0800)] 
maint: tests: remove duplicate uses of 'my' in Perl

* tests/env/env-S.pl (cf): Remove uses of 'my' after the variable has
been declared.
* tests/factor/factor.pl (t): Likewise.
* tests/misc/fold.pl (prog): Remove duplicate assignment.