Commit Graph
30460 Commits
Author SHA1 Message Date
Pádraig Brady f40438900b tty: translate new error
* src/tty.c (main): Translate and adjust new ttyname() error
diagnostic, to be clearer and avoid a syntax check failure.
2025-06-21 10:59:46 +01:00
Paul Eggert aec89a3e7d tty: better fix for Bug#26371
* src/tty.c (TTY_USAGE): Rename from TTY_FAILURE, since this
is used only for usage failures.  All uses changed.
(TTY_TTYNAME_FAILURE): New constant.
(main): Remove no-longer-needed assignment of ENOENT to errno.
Make status-setting clearer too.
Report an error if ttyname fails even though stdin is a terminal,
instead of silently pretending that stdin is not a terminal.
* tests/tty/tty.sh: Test for this issue.  This should fix Bug#78244.
2025-06-20 12:15:27 -07:00
Pádraig Brady efaec80781 tests: stty: adjust tests for arbitary speeds
* tests/stty/stty-invalid.sh: Adjust to what is now invalid.
* tests/stty/stty.sh: Add checks for valid speed variants.
* tests/stty/bad-speed.sh: New test to ensure unsupported speeds
are diagnosed.
2025-06-18 14:21:30 +01:00
H. Peter Anvin 357fda90d1 stty: arbitrary or non-a priori known speed_t support
Support the case where speed_t is simply a number, and in that case
assume that arbitrary values can be passed.  This is assumed to be the
case when all known speed_t macros equal their own value.

Try to probe for a variety of speed_t constants by trying to coax
$(CC) into emitting macro definitions (-E -dM).  If this is not
supported, use a fairly extensive list of constants as a
fallback.  This both improves the test for arbitrary speed support, as
well as allowing proper operation in the case where the constants are
not plain numbers and allows for handing enumerated speed constants
that were not known a priori when the source code was written.

A simple shell script (mostly using sed) is used to turn the list of
constants (probed and predefined) into a pair of conversion functions,
baud_to_value() and value_to_baud(); string_to_baud() is then
reimplemented as a wrapper around the latter.

* src/.gitignore: Add generated speedlist.h.
* src/local.mk: Generate speedlist.h.
* src/speedgen: Portable shell script to generate speedlist.h.
* src/stty.c: Adjust string_to_baud to
convert from arbitrary numeric values.
* src/termios.c: A helper used when generating speedlist.h
* NEWS: Mention the improvement.
2025-06-18 14:20:17 +01:00
Paul Eggert 5c5e8b4a98 date: port test to NetBSD 10
Problem reported by Collin Funk in:
https://lists.gnu.org/r/bug-gnulib/2025-06/msg00094.html
* tests/date/date-debug.sh: Also allow NetBSD 10 mktime behavior.
Although NetBSD contradicts POSIX, POSIX is likely wrong here and
I vaguely recall that there’s a POSIX correction in progress
that will allow the NetBSD behavior.
2025-06-10 13:03:40 -07:00
Paul Eggert 276c04905f build: update gnulib submodule to latest
* tests/date/date-debug.sh: Update to match current behavior
of Gnulib's parse-datetime module.
2025-06-08 23:56:27 -07:00
Pádraig Brady 2f6a74920b doc: cp --help: mention --reflink=auto is now the default
* src/cp.c (usage): Reword the REFLINK description to
indicate that --reflink=auto is the default.
Fixes https://github.com/coreutils/coreutils/issues/103
2025-06-07 18:53:43 +01:00
Pádraig Brady 037b931061 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
2025-06-03 23:11:44 +01:00
Paul Eggert 4eb2ff1c89 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.
2025-05-29 09:06:34 -07:00
Pádraig Brady 21a662b1ee tests: sort: expand multiple output testing
* tests/sort/sort.pl: Ensure duplicate
output strings are supported.
2025-05-28 21:11:34 +01:00
Paul Eggert c8d75786b2 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.
2025-05-28 12:49:17 -07:00
Paul Eggert c82b1f01ba build: update gnulib submodule to latest 2025-05-28 12:49:17 -07:00
Pádraig Brady d3133bd38d maint: avoid a sc_system_h_headers failure
* cfg.mk: Also exclude libstdbuf.c from this check.
2025-05-24 22:01:44 +01:00
Paul Eggert 2b54fe97ff 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.
2025-05-24 13:02:31 -07:00
Paul Eggert 610725919c stdbuf: simplify apply_mode + getenv
* src/libstdbuf.c (apply_mode): Take getenv arg, not result.
All callers changed.  This is simpler.
2025-05-24 13:02:31 -07:00
Paul Eggert 69b1893585 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.
2025-05-24 13:02:31 -07:00
Pádraig Brady dc4e6b6703 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
2025-05-21 21:22:08 +01:00
Pádraig Brady 8c9602e3a1 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
2025-05-20 19:36:00 +01:00
Paul Eggert 4469576154 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).
2025-05-18 23:34:51 -07:00
Pádraig Brady 1be322fd3e maint: avoid sc_preprocessor_indentation failure
* src/factor.c: Tweak preprocessor indentation.
2025-05-18 10:37:35 +01:00
Collin Funk d8a7220142 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.
2025-05-18 09:49:29 +01:00
Collin Funk dc6ce1d0c6 build: fix 'make distcheck'
* src/local.mk (EXTRA_DIST): Distribute src/make-prime-list.c
to satisfy the new make dependency.
2025-05-18 09:41:02 +01:00
Paul Eggert fe51b33859 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.
2025-05-17 21:49:22 -07:00
Paul Eggert c4fdbd95bd 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".
2025-05-17 21:49:22 -07:00
Collin Funk 3844c15934 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
2025-05-17 09:17:12 +01:00
Paul Eggert c8cbb321d9 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.
2025-05-15 09:00:18 -07:00
Pádraig Brady bd8be6b99e 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
2025-05-12 23:20:43 +01:00
Pádraig Brady a11c7dcaaf doc: NEWS: fix introduced version of a bug
* NEWS: The NFSv4 trivial ACL ENOTSUP issue was introduced in 9.6.
2025-05-12 11:53:31 +01:00
Pádraig Brady 63e657e877 maint: avoid sc_GPL_version failure
* cfg.mk (VC_LIST_ALWAYS_EXCLUDE_REGEX): Exclude longlong.h also.
2025-05-12 11:51:16 +01:00
Collin Funk d314730ea4 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'.
2025-05-12 11:37:18 +01:00
Paul Eggert 8dd5b91d2c 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.
2025-05-12 01:28:48 -07:00
Paul Eggert 229ddeb36a maint: pacify GCC when selinux is missing
* src/selinux.h (restorecon, defaultcon): Use MAYBE_UNUSED.
2025-05-12 01:28:48 -07:00
Paul Eggert 5e35f0e770 factor: be more cautious about C compiler versions
* src/factor.c (__GMP_GNUC_PREREQ): Define compatibly with GMP.
2025-05-12 01:28:48 -07:00
Paul Eggert c1424ea25e maint: sync longlong.h from gmp
* .x-update-copyright: Add src/longlong.h.
* src/longlong.h: Sync from gmp.
2025-05-12 01:28:48 -07:00
Paul Eggert 4274ff6eee 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.
2025-05-12 01:28:48 -07:00
Collin Funk 4ebc75a36f build: update gnulib submodule to latest
* bootstrap: Update using './bootstrap --bootstrap-sync'.
2025-05-11 10:20:59 -07:00
Paul Eggert 6bd4b1936e maint: update NEWS from Gnulib update 2025-05-09 22:36:19 -07:00
Paul Eggert 75258a69e9 build: update gnulib submodule to latest 2025-05-09 22:12:45 -07:00
Paul Eggert 36e83a6bcd 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.
2025-05-09 21:02:56 -07:00
Paul Eggert dbdb44de56 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.
2025-05-09 15:57:13 -07:00
Paul Eggert 1fef50d07b 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.
2025-05-09 15:57:13 -07:00
Paul Eggert 16d5cf3e66 maint: fix Automake warning
* Makefile.am (prologue): Remove macro, as \# is not portable here
and Automake complains.  Replace its only use with its definiens.
2025-05-09 15:57:13 -07:00
Pádraig Brady 6218cb18b0 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
2025-05-03 09:59:16 +01:00
Pádraig Brady e7699b17b5 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.
2025-05-01 14:05:59 +01:00
Pádraig Brady 3a5c9c5537 tests: add a test case for negative relative date
* tests/date/date.pl: To exercise option processing.
2025-04-23 12:47:54 +01:00
Pádraig Brady 948f4713fd 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
2025-04-21 11:48:33 +01:00
Pádraig Brady ca863e3f63 maint: map Jim's new email address
.mailmap: Add meta.com as an alias.
2025-04-19 13:46:23 +01:00
Paul Eggert 0d04b985d6 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.
2025-04-12 13:00:24 -07:00
Pádraig Brady 356e40ff8e maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2025-04-09 12:14:12 +01:00
Pádraig Brady 8e075ff8ee version 9.7
* NEWS: Record release date.
v9.7
2025-04-09 11:44:57 +01:00