]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
11 months agomaint: assume C89 escape sequences
Collin Funk [Wed, 4 Sep 2024 02:45:13 +0000 (19:45 -0700)] 
maint: assume C89 escape sequences

* src/ptx.c (unescape_string) [!__STDC__]: Assume compiler supports '\a'
and '\v' escape sequences.

11 months agobuild: update gnulib submodule to latest
Pádraig Brady [Thu, 29 Aug 2024 01:17:16 +0000 (02:17 +0100)] 
build: update gnulib submodule to latest

11 months agoall: fix error checking in gl/lib/xdectoint.c
Pádraig Brady [Wed, 28 Aug 2024 11:33:17 +0000 (12:33 +0100)] 
all: fix error checking in gl/lib/xdectoint.c

This issue was noticed with -flto on GCC 14.2.1

* gl/lib/xdectoint.c (__xnumtoint): Only inspect the
returned value if LONGINT_INVALID is not set,
as the returned value is uninitialized in that case.
Fixes https://bugs.gnu.org/72842

11 months agomaint: avoid a syntax check failure
Pádraig Brady [Sun, 25 Aug 2024 08:15:43 +0000 (09:15 +0100)] 
maint: avoid a syntax check failure

* tests/df/no-mtab-status.sh: mntent.h is always provided now by gnulib.
* tests/df/skip-duplicates.sh: Likewise.

11 months agomaint: adjust to Gnulib acl changes
Collin Funk [Sat, 24 Aug 2024 18:34:07 +0000 (11:34 -0700)] 
maint: adjust to Gnulib acl changes

* src/copy.c (copy_reg, copy_interal): Use xcopy_acl instead of
copy_acl.  Use xset_acl instead of set_acl.
* src/cp.c (re_protect): Likewise.

11 months agobuild: update gnulib submodule to latest
Collin Funk [Sat, 24 Aug 2024 18:21:00 +0000 (11:21 -0700)] 
build: update gnulib submodule to latest

* bootstrap: Update from Gnulib.

11 months agoinstall: dereference source symlinks when comparing
Pádraig Brady [Mon, 19 Aug 2024 11:43:09 +0000 (12:43 +0100)] 
install: dereference source symlinks when comparing

* NEWS: Mention the change in behavior.
* src/install.c (need_copy): s/lstat/stat/ for the source.
* tests/install/install-C.sh: Add test cases
(and improve existing test case which wan't valid
due to the existing non standard modes on test files).
Addresses https://bugs.gnu.org/72707

11 months agomaint: adjust to recent removal of verror.c
Paul Eggert [Thu, 15 Aug 2024 22:12:25 +0000 (15:12 -0700)] 
maint: adjust to recent removal of verror.c

* po/POTFILES.in: Remove lib/verror.c

11 months agobuild: update gnulib submodule to latest
Paul Eggert [Thu, 15 Aug 2024 07:22:05 +0000 (00:22 -0700)] 
build: update gnulib submodule to latest

* boostrap.conf (gnulib.modules): Add xvasprintf, which
had been omitted by mistake.
* src/copy.c, src/dd.c, src/test.c: Don't include verror.h,
as Gnulib removed it.

11 months agols: add support for explicit file name sorting
Pádraig Brady [Sun, 11 Aug 2024 19:34:08 +0000 (20:34 +0100)] 
ls: add support for explicit file name sorting

Support overriding previous sorting options
with an explicit --sort=name option.

* doc/coreutils.texi (ls invocation): Document the new option.
* src/ls.c (usage): Likewise.
(sort_args): Add the "name" entry, and sort to be consistent
with the ordering presented in --help.
* tests/ls/ls-time.sh: Add test cases.
* NEWS: Mention the new feature.
Suggested by: Tzvetelin Katchov

11 months agomaint: fix syntax-check failure
Pádraig Brady [Sun, 11 Aug 2024 14:08:32 +0000 (15:08 +0100)] 
maint: fix syntax-check failure

* gl/lib/xdectoint.h: Reinstate indentation enforced with cppi.
* src/head.c: Remove now redundant inclusion of "quote.h".

11 months agodoc: printf %b: clarify octal processing
Pádraig Brady [Sun, 11 Aug 2024 13:36:21 +0000 (14:36 +0100)] 
doc: printf %b: clarify octal processing

* src/printf.c: Remove redundant comment.
State explicitly that the leading 0 is the exception
from normal escape processing.  Remove a full stop for consistency.
* doc/coreutils.texi (printf invocation): Add a reference
to C99 string escapes since these are not mentioned
in the referenced glibc printf info. Also explicitly state
the leading 0 exception.  Also use NNN rather than OOO
to be consistent with the --help documentation.
Also remove and extraneous '\' and fix grammar in the info
regarding the ninth bit.
Addresses https://bugs.gnu.org/72657

11 months agomaint: adjust to Gnulib safe_read etc. changes
Paul Eggert [Sun, 11 Aug 2024 02:30:46 +0000 (19:30 -0700)] 
maint: adjust to Gnulib safe_read etc. changes

Although these patches don’t affect user-visible behavior,
they do clean up the source code a bit, and the
machine code should be a tiny bit more efficient.
* src/cat.c (simple_cat, cat):
* src/csplit.c (read_input):
* src/head.c (copy_fd, elide_tail_bytes_pipe)
(elide_tail_lines_pipe, elide_tail_lines_seekable, head_bytes)
(head_lines):
* src/install.c (have_same_content):
* src/tac-pipe.c (buf_init_from_stdin):
* src/tac.c (tac_seekable, copy_to_temp):
* src/tail.c (dump_remainder, file_lines, pipe_lines)
(pipe_bytes, start_bytes, start_lines, tail_forever_inotify):
* src/tr.c (plain_read):
Adjust to recent Gnulib changes by using new types
for safe_read, safe_write, full_read, full_write.

11 months agomaint: list Gnulib sys_types directly
Paul Eggert [Fri, 9 Aug 2024 15:51:53 +0000 (08:51 -0700)] 
maint: list Gnulib sys_types directly

* bootstrap.conf (gnulib_modules): Add sys_types.
Although it’s already brought in indirectly, coreutils
code includes <sys/types.h> directly.

11 months agobuild: update gnulib submodule to latest
Paul Eggert [Fri, 9 Aug 2024 23:50:44 +0000 (16:50 -0700)] 
build: update gnulib submodule to latest

11 months agohead: fix overflows in elide_tail_bytes_pipe
Paul Eggert [Sun, 11 Aug 2024 05:19:17 +0000 (22:19 -0700)] 
head: fix overflows in elide_tail_bytes_pipe

Not clear that the overflows could be exploited,
but they made the code confusing.
* src/head.c (elide_tail_bytes_pipe): Don’t convert uintmax_t
to size_t first thing; wait until it’s known the value will fit,
and then use idx_t rather than size_t to prefer signed types.
Prefer idx_t in nearby code, too.
Rename locals n_elide_0 to n_elide (for consistency elsewhere)
and n_elide to in_elide.
Remove bogus (SIZE_MAX < n_elide + READ_BUFSIZE) test;
in the typical case where n_elide’s type was the same as
that of SIZE_MAX, the test never succeeded, and in the
less-common case where n_elide was wider than size_t,
the addition could silently overflow, causing the test
to fail when it should succeed.  The test is not needed anyway now.
Add static asserts to document code assumptions.
Redo the ! (n_elide <= HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD) case
so that it works with enormous values of n_elide even on
32-bit platforms; for example, n_bufs is now uintmax_t not size_t.
Simplify by using xpalloc instead of by-hand code.
Remove bogus ‘if (rem)’ test, as rem is always nonzero.

11 months agohead: new test for big count
Paul Eggert [Sun, 11 Aug 2024 02:28:37 +0000 (19:28 -0700)] 
head: new test for big count

* tests/head/head-c.sh: Also test head -c with a number
much bigger than UINTMAX_MAX.

11 months agotail: support counts > 2**64
Paul Eggert [Sun, 11 Aug 2024 02:02:44 +0000 (19:02 -0700)] 
tail: support counts > 2**64

* src/tail.c (tail_lines): If skipping all input, use lseek if
possible.
(parse_options): Allow counts to exceed 2**64.
(main): Don’t subtract 1 from UINTMAX_MAX, since it stands
for infinity in this context.
(main): Also don’t read anything when given infinite elisions.
* tests/tail/tail.pl: Adjust to match new behavior.  Rename err-5
test to big-c and expect the invocation to succeed, since ‘tail
-c99999999999999999999’ now succeeds instead of (unnecessarily)
failing.

11 months agohead: off_t not uintmax_t for file offset
Paul Eggert [Sun, 11 Aug 2024 01:55:09 +0000 (18:55 -0700)] 
head: off_t not uintmax_t for file offset

* src/head.c (elide_tail_lines_pipe):
Use off_t, not uintmax_t, for a local var that is
a file offset.

11 months agonproc: support --ignore counts > 2**64
Paul Eggert [Sun, 11 Aug 2024 01:53:34 +0000 (18:53 -0700)] 
nproc: support --ignore counts > 2**64

* src/nproc.c (main): Allow --ignore arg to exceed 2**64.

11 months agonl: support -l counts > 2**64
Paul Eggert [Sun, 11 Aug 2024 01:51:50 +0000 (18:51 -0700)] 
nl: support -l counts > 2**64

* src/nl.c (main): Allow -l arg to exceed 2**64.

11 months agohead: support counts > 2**64
Paul Eggert [Sun, 11 Aug 2024 01:49:54 +0000 (18:49 -0700)] 
head: support counts > 2**64

* src/head.c (head): Optimize for -n-HUGE, where HUGE exceeds
2**64 - 2.
(string_to_integer): Return UINTMAX_MAX for too-large numbers,
instead of failing.
(main): Omit no-lnger-necessary test for byte count overflow.

11 months agodigest: improve -l overflow diagnostic
Paul Eggert [Sun, 11 Aug 2024 01:24:15 +0000 (18:24 -0700)] 
digest: improve -l overflow diagnostic

* src/digest.c (main): Use better diagnostic for -l overflow,
by using XTOINT_MAX_QUIET to suppress the worse diagnostic.

11 months agomaint: distinguish EOVERFLOW vs ERANGE better
Paul Eggert [Sat, 10 Aug 2024 20:00:33 +0000 (13:00 -0700)] 
maint: distinguish EOVERFLOW vs ERANGE better

Also, prepare for allowing some arguments to overflow
without that being an error.
* gl/lib/xdectoint.c: Do not include stddef.h,
since we no longer use ‘unreachable’.
(xnumtoimax, xnumtoumax, __xnumtoint):
New arg FLAGS.  All callers changed.
Stop using __xdectoint_signed.  All definers removed.
* gl/lib/xdectoint.h (XTOINT_MIN_QUIET, XTOINT_MAX_QUIET)
(XTOINT_MIN_RANGE, XTOINT_MAX_RANGE): New flag constants.
* src/fmt.c (main):
* src/fold.c (main):
* src/nl.c (main):
* src/pr.c (getoptnum):
* src/split.c (main):
Use XTOINT_MIN_RANGE and XTOINT_MAX_RANGE if appropriate.
* src/pr.c (getoptnum): Return int rather than returning void
and storing through int *.
* src/stty.c (apply_settings):
Use ckd_add to check for overflow instead of doing it by hand.
(integer_arg): Accept and return uintmax_t, not unsigned long.

11 months agotests: df-P.sh: fix intermittent false failure
Richard Purdie [Thu, 8 Aug 2024 17:37:48 +0000 (18:37 +0100)] 
tests: df-P.sh: fix intermittent false failure

The test writes to the disk and means the space used changes. If this
crosses a number boundary, the heading spacing can change:

-Filesystem     1024-blocks  Used Available Capacity Mounted on
+Filesystem     1024-blocks   Used Available Capacity Mounted on

* tests/df/df-P.sh: Squash spaces with tr to avoid alignment variations.

12 months agobuild: modernize AC_CHECK_TYPE usage
Paul Eggert [Sun, 4 Aug 2024 22:32:33 +0000 (15:32 -0700)] 
build: modernize AC_CHECK_TYPE usage

* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES):
Use current form of AC_CHECK_TYPE instead of the
no-longer-documented obsolescent form.

12 months agomaint: avoid warning on older GCC compilers
Pádraig Brady [Sun, 4 Aug 2024 10:45:34 +0000 (11:45 +0100)] 
maint: avoid warning on older GCC compilers

* src/shuf.c: Avoid -Werror=maybe-uninitialized on GCC 10.2.1 at least.
This issue does seem to be addressed on GCC 12.

12 months agotests: limit mem usage on potentially expensive test
Pádraig Brady [Sat, 3 Aug 2024 13:13:43 +0000 (14:13 +0100)] 
tests: limit mem usage on potentially expensive test

* tests/misc/write-errors.sh: Limit mem usage if possible,
as some implementations may use unbounded memory for
the tests cases used here.

12 months agotests: ensure utils support writing to a closed pipe
Pádraig Brady [Sat, 3 Aug 2024 12:37:33 +0000 (13:37 +0100)] 
tests: ensure utils support writing to a closed pipe

* tests/misc/write-errors.sh: A closed pipe is a common scenario,
and should not induce an error.  The general case is discussed at:
https://www.pixelbeat.org/programming/sigpipe_handling.html

12 months agodoc: reference 'dircolors invocation' from ls --color info
Pádraig Brady [Sat, 3 Aug 2024 11:48:21 +0000 (12:48 +0100)] 
doc: reference 'dircolors invocation' from ls --color info

* doc/coreutils.texi: Reference how to configure colors,
from the ls --color description.

12 months agodoc: clarify which ls color attributes don't apply to dirs
Pádraig Brady [Sat, 3 Aug 2024 11:35:26 +0000 (12:35 +0100)] 
doc: clarify which ls color attributes don't apply to dirs

* src/dircolors.hin: Clarify that SETUID, SETGID, CAPABILITY, and EXEC
coloring, only apply to regular files.

12 months agoshuf: tiny simplification
Paul Eggert [Sun, 4 Aug 2024 06:00:08 +0000 (23:00 -0700)] 
shuf: tiny simplification

* src/shuf.c (main): Omit redundant assignment.

12 months agoshuf: avoid integer overflow on huge inputs
Paul Eggert [Sun, 4 Aug 2024 05:59:12 +0000 (22:59 -0700)] 
shuf: avoid integer overflow on huge inputs

* gl/lib/randperm.c: Include <stdckdint.h>.
(randperm_bound): Return SIZE_MAX if the multiplication overflows.
Do not overflow when converting bit count to byte count.

12 months agoshuf: fix randomness bug
Paul Eggert [Sun, 4 Aug 2024 05:31:20 +0000 (22:31 -0700)] 
shuf: fix randomness bug

Problem reported by Daniel Carpenter <https://bugs.gnu.org/72445>.
* gl/lib/randread.c (randread_new): Fill the ISAAC buffer
instead of storing at most BYTES_BOUND bytes into it.

12 months agomaint: remove unnecessary inttostr usage in printf
Collin Funk [Tue, 30 Jul 2024 04:16:36 +0000 (21:16 -0700)] 
maint: remove unnecessary inttostr usage in printf

* src/cksum.c (output_crc): Use '%ju' instead of umaxtostr.
* src/shred.c (dopass): Likewise.
* src/csplit.c (handle_line_error, regexp_error, close_output_file)
(parse_patterns): Use '%jd' instead of offtostr.
* src/tail.c (xlseek): Likewise.
* src/head.c (elseek): Likewise.
* src/group-list.c (gidtostr_ptr): Remove function.
(gidtostr): Remove macro.
(print_group): Use '%ju' instead of umaxtostr.
* src/id.c (gidtostr_ptr, uidtostr_ptr): Remove functions.
(gidtostr, uidtostr): Remove macros.
(print_user, print_full_info): Use '%ju' instead of umaxtostr.
* src/sort.c (specify_nmerge): Use '%u' instead of uinttostr.

12 months agobuild: support creating reproducible tarball contents
Pádraig Brady [Sun, 21 Jul 2024 17:25:05 +0000 (18:25 +0100)] 
build: support creating reproducible tarball contents

We already support reproducible builds since commit v8.24-99-gc1b3d6587,
and this adjusts that change to also support reproducible
tarball contents with subsequent runs of `make dist`.

* Makefile.am: Don't create a varying .timestamp file, instead ...
* man/local.mk: Rely on the timestamp of the .tarball-version file.
Fixes https://bugs.gnu.org/72232

12 months agotests: port to noatime file systems
Paul Eggert [Tue, 16 Jul 2024 01:53:46 +0000 (18:53 -0700)] 
tests: port to noatime file systems

On these file systems the atime is always zero.
Problem found with ZFS on Ubuntu 24.04 LTS.
* tests/stat/stat-birthtime.sh (check_timestamps_updated):
* tests/stat/stat-nanoseconds.sh:
Work even if atimes are always zero.
* tests/stat/stat-nanoseconds.sh:
Fix typo: print_ver_ called before init.sh sourced.

12 months agomaint: update bootstrap from Gnulib
Paul Eggert [Mon, 15 Jul 2024 22:28:26 +0000 (15:28 -0700)] 
maint: update bootstrap from Gnulib

12 months agomaint: adjust to Gnulib -Wsystem-headers change
Paul Eggert [Mon, 15 Jul 2024 22:27:38 +0000 (15:27 -0700)] 
maint: adjust to Gnulib -Wsystem-headers change

* configure.ac: Don’t suppress -Wsystem-headers since Gnulib no
longer enables it.

12 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 15 Jul 2024 22:01:08 +0000 (15:01 -0700)] 
build: update gnulib submodule to latest

12 months agotests: add fold(1) test for non-existent files
Bernhard Voelker [Wed, 10 Jul 2024 07:07:27 +0000 (09:07 +0200)] 
tests: add fold(1) test for non-existent files

* tests/misc/fold.pl: Add 'enoent' test.

13 months agomaint: import tests/init.sh from Gnulib during bootstrap
Collin Funk [Thu, 4 Jul 2024 00:50:14 +0000 (17:50 -0700)] 
maint: import tests/init.sh from Gnulib during bootstrap

* bootstrap.conf (bootstrap_post_import_hook): Use gnulib-tool
--copy-file to import tests/init.sh.
* tests/init.sh: Remove file.
* .gitignore (/tests/init.sh): Add entry.

13 months agodoc: remove 'proposed' in regard to $'' descriptions
Pádraig Brady [Tue, 2 Jul 2024 22:39:59 +0000 (23:39 +0100)] 
doc: remove 'proposed' in regard to $'' descriptions

$'' is POSIX standard syntax as of POSIX.1-2024, as per:
https://www.austingroupbugs.net/view.php?id=249

* doc/coreutils.texi (quotingStyles): Remove 'proposed'.
* src/printf.c: Likewwise.
Reported at https://bugs.debian.org/1074776

13 months agotests: fix improper use of grep -v
Pádraig Brady [Tue, 2 Jul 2024 08:53:46 +0000 (09:53 +0100)] 
tests: fix improper use of grep -v

* tests/cksum/cksum-c.sh: Remove improper use of `grep -v`.

13 months agotests: cksum: check when several files are missing or incorrect
Sylvestre Ledru [Mon, 1 Jul 2024 21:45:09 +0000 (23:45 +0200)] 
tests: cksum: check when several files are missing or incorrect

 * tests/cksum/cksum-c.sh: Add test cases when several files with errors

13 months agomaint: silence deprecated module warning
Collin Funk [Mon, 1 Jul 2024 03:54:58 +0000 (20:54 -0700)] 
maint: silence deprecated module warning

* bootstrap.conf (gnulib_modules): Use putenv-gnu instead of putenv.

13 months agomaint: prefer endian.h for byte order conversions
Collin Funk [Sat, 29 Jun 2024 11:36:38 +0000 (04:36 -0700)] 
maint: prefer endian.h for byte order conversions

* bootstrap.conf (gnulib_modules): Remove byteswap. Add endian.
* src/cksum.c: Include endian.h instead of byteswap.h.
(SWAP): Remove macro.
(cksum_slice8): Use htobe32 instead of SWAP.
(output_crc): Likewise.
* src/sum.c: Include endian.h instead of byteswap.h.
(SWAP): Remove macro.
(output_bsd): Use htobe16 instead of SWAP.
(output_sysv): Use htobe16 instead of SWAP.
* .gitignore: Add /lib/endian.h.

13 months agobuild: update gnulib submodule to latest
Collin Funk [Sat, 29 Jun 2024 15:10:21 +0000 (16:10 +0100)] 
build: update gnulib submodule to latest

* gnulib: Update to latest

13 months agols: treat --time=mtime consistently with other time selectors
Pádraig Brady [Thu, 27 Jun 2024 17:15:02 +0000 (18:15 +0100)] 
ls: treat --time=mtime consistently with other time selectors

* src/ls.c: Track if --time=mtime is explicitly specified,
so that we can apply the GNU extension of sorting by the
specified time, when not displaying (-l not specified),
and not explicitly sorting (-t not specified).
* tests/ls/ls-time.sh: Add / Update test cases.
Fixes https://bugs.gnu.org/71803

13 months agodoc: document the c-maybe quoting style
Pádraig Brady [Wed, 26 Jun 2024 22:17:12 +0000 (23:17 +0100)] 
doc: document the c-maybe quoting style

* doc/coreutils.texi (ls invocation): Document the "c-maybe"
--quoting-style, which was added as an option in 2008.
Reported at https://bugs.debian.org/1074334

13 months agostat: reactivate a translator comment (lost on 2012-01-09)
Bruno Haible [Tue, 25 Jun 2024 10:18:40 +0000 (12:18 +0200)] 
stat: reactivate a translator comment (lost on 2012-01-09)

* src/stat.c (default_format): Move translator comment to immediately
precede the _() invocation.

14 months agomaint: improve ERE in sc_tests_list_consistency
Bernhard Voelker [Sat, 1 Jun 2024 14:00:30 +0000 (16:00 +0200)] 
maint: improve ERE in sc_tests_list_consistency

The ERE used lacks the grouping of the extensions and therefore would
also match files where the first two patterns are not at the end of
the line:
  grep -E '\.sh|\.pl|\.xpl$'

* cfg.mk (sc_tests_list_consistency): Add grouping (...) around the
sub-patterns.  While at it, also remove the redundant escaping, i.e.,
\$$ -> $$ to be consistent with the rest of this file.

14 months agostat,tail: sync with latest Linux file systems
Pádraig Brady [Tue, 28 May 2024 12:29:15 +0000 (13:29 +0100)] 
stat,tail: sync with latest Linux file systems

* src/stat.c (human_fstype): Rename "FUSEBLK" to "FUSE" to sync with
kernel adjustments.  Add "bcachefs", and "pidfs".  Both are local,
with the latter being similar to "proc" which is also local.
* NEWS: Mention the change in behavior, and the improvement.

14 months agols: improve sorting doc
Paul Eggert [Fri, 24 May 2024 15:42:14 +0000 (08:42 -0700)] 
ls: improve sorting doc

Problem reported by Dan Jaobson (Bug#71171).
* doc/coreutils.texi: Clarify that directory entries are sorted,
not command-line arguments.
* src/ls.c (usage): Be less chatty about -U and
about --group-directories-first.

14 months agotests: cksum: extend with --status, --ignore-missing and --warn
Sylvestre Ledru [Tue, 21 May 2024 22:52:18 +0000 (00:52 +0200)] 
tests: cksum: extend with --status, --ignore-missing and --warn

* tests/cksum/cksum-c.sh: Add test cases for these option combinations.

14 months agobuild: fix build failure in --enable-single-binary mode
Pádraig Brady [Tue, 21 May 2024 12:08:45 +0000 (13:08 +0100)] 
build: fix build failure in --enable-single-binary mode

* src/local.mk: Avoid overriding automake generated DEPENDENCIES,
so that it applies its adjustments to LDADD to avoid propagating
flags (like -Wl,-rpath) into make targets.  This was seen on FreeBSD
where LIBINTL is set to:
/usr/local/lib/libintl.so -Wl,-rpath -Wl,/usr/local/lib
Instead let automake generate a sanitized src_coreutils_DEPENDENCIES
(based on LDADD), which we then augment with the EXTRA_... variable.

14 months agomaint: add lib/stdbit.h to .gitignore
Pádraig Brady [Tue, 21 May 2024 09:13:22 +0000 (10:13 +0100)] 
maint: add lib/stdbit.h to .gitignore

Following recent gnulib update

14 months agostty: port test to Alpine Linux
Paul Eggert [Mon, 20 May 2024 22:14:44 +0000 (15:14 -0700)] 
stty: port test to Alpine Linux

* tests/stty/stty.sh: Port to Alpine Linux 3.20.0_rc1, whose musl
implementation’s printf invokes ioctl on stdout, so --version
does an ioctl.

14 months agodd: skip some alloc tests on ZFS
Paul Eggert [Fri, 17 May 2024 06:30:33 +0000 (23:30 -0700)] 
dd: skip some alloc tests on ZFS

* tests/dd/sparse.sh: Skip some tests on ZFS.

14 months agomaint: prefer stdbit.h to count-leading-zeros.h
Paul Eggert [Fri, 17 May 2024 04:33:08 +0000 (21:33 -0700)] 
maint: prefer stdbit.h to count-leading-zeros.h

<stdbit.h> is in C23 and should be more portable in the long run,
now that Gnulib supports it.
* bootstrap.conf (gnulib_modules): Remove count-leading-zeros.
Add stdc_leading_zeros.
* gl/lib/randperm.c, src/ioblksize.h:
Include stdbit.h instead of count-leading-zeros.h.
* gl/lib/randperm.c (floor_lg): Remove; no longer needed.
(randperm_bound): Use stdc_bit_width instead of floor_lg;
* gl/modules/randperm (Depends-on): Remove count-leading-zeros.
Add stdc_bit_width.
* src/ioblksize.h (io_blksize): Use stdc_leading_zeros_ull
instead of count_leading_zeros_ll.

14 months agomaint: port test warnings to GCC 14
Paul Eggert [Fri, 17 May 2024 05:44:23 +0000 (22:44 -0700)] 
maint: port test warnings to GCC 14

* configure.ac: Disable GCC 14’s -Wmissing-variable-declarations
in the test directory, as it’s not worth the aggravation there.
Likewise for GCC's -Wsuggest-attribute=cold.

14 months agomaint: update bootstrap from Gnulib
Paul Eggert [Fri, 17 May 2024 04:36:43 +0000 (21:36 -0700)] 
maint: update bootstrap from Gnulib

14 months agobuild: update gnulib submodule to latest
Paul Eggert [Fri, 17 May 2024 04:34:59 +0000 (21:34 -0700)] 
build: update gnulib submodule to latest

14 months agosort: better -Wmissing-variable-declarations
Paul Eggert [Fri, 17 May 2024 04:09:28 +0000 (21:09 -0700)] 
sort: better -Wmissing-variable-declarations

* src/sort.c: Ignore -Wmissing-variable-declarations only
with GCC 14 and newer, since it didn’t exist earlier.
Ignore the warning only when including md5.h, where it
needs to be ignored, as the warning might be useful elsewhere.

14 months agocksum: improve API consistency checking
Paul Eggert [Fri, 17 May 2024 04:06:58 +0000 (21:06 -0700)] 
cksum: improve API consistency checking

* src/cksum.c (main) [CRCTAB]: Generate updated crctab.c (see below).
* src/crctab.c: Include cksum.h, to check consistency
between decl and defn.  Include stdio.h since cksum.h needs it.

14 months agodoc: improve the man page for sleep
Nikolaos Chatzikonstantinou [Tue, 14 May 2024 16:25:47 +0000 (12:25 -0400)] 
doc: improve the man page for sleep

This patch is part of work done for a project from Google Summer of
Code, see the project details at
<https://summerofcode.withgoogle.com/programs/2024/projects/E9Jp7RUx>.

* src/sleep.c (usage): Directly mention the floating-point option,
which is typical for sleeping milliseconds.
Also reorganize the text to be 3 lines rather than 4.

14 months agotests: cksum: add incorrect data to verify --check & --strict
Sylvestre Ledru [Fri, 10 May 2024 20:57:11 +0000 (22:57 +0200)] 
tests: cksum: add incorrect data to verify --check & --strict

* tests/cksum/cksum-c.sh: Add test cases.

14 months agowc: increase I/O size from 16 KiB to 256KiB
Pádraig Brady [Thu, 9 May 2024 13:03:38 +0000 (14:03 +0100)] 
wc: increase I/O size from 16 KiB to 256KiB

Similarly to commit v9.4-143-gfcfba90d0,
and enabled for AVX by commit v9.5-25-g0e4450103.

This was seen to improve AVX performance by about 10%
on an AMD 7800X3D (Ryzen 7 (2023)) CPU,
while having neutral AVX performance,
on an Intel i7-5600U (Broadwell-U (2015)) CPU.
With avx not enabled, this gives about a 3% performance boost,
on an Intel i7-5600U.

* src/wc.c: Use the centrally configured optimum buffer size.
* src/wc_avx2.c: Likewise.
* NEWS: Mention the change in performance.

14 months agowc: simplify and generalize AVX code
Evgeny Nizhibitsky [Sun, 31 Mar 2024 11:23:32 +0000 (12:23 +0100)] 
wc: simplify and generalize AVX code

* src/wc_avx2.c (wc_lines_avx2): Change from
_mm256_sub_epi8() + _mm256_sad_epu8() to
_mm256_movemask_epi8() + __builtin_popcount().
This will allow adjusting the I/O size above 16KiB.
* configure.ac: Align check with routines used in wc_avx2.c.

15 months agodoc: pwd: improve the -P help description
Bruce Jerrick [Tue, 7 May 2024 12:31:44 +0000 (13:31 +0100)] 
doc: pwd: improve the -P help description

* src/pwd.c (usage): Say that symlinks are resolved,
rather than the somewhat ambiguous "avoided".

15 months agomaint: rename octhexdigits macros
Nikolay Nechaev [Sun, 5 May 2024 09:55:00 +0000 (12:55 +0300)] 
maint: rename octhexdigits macros

isodigit -> isoct; octtobin -> fromoct; hextobin -> fromhex.
* src/octhexdigits.h: Rename macros.
* src/stat.c, src/printf.c: Use new macros.

15 months agomaint: factor out common macros of stat and printf
Nikolay Nechaev [Sun, 5 May 2024 09:54:59 +0000 (12:54 +0300)] 
maint: factor out common macros of stat and printf

* src/octhexdigits.h: isodigit, hextobin, octtobin macros.
* src/stat.c, src/printf.c: Use octhexdigits.h.
* src/local.mk: Corresponding adjustments.

15 months agomaint: factor out the common show_date functionality
Nikolay Nechaev [Sun, 5 May 2024 09:06:18 +0000 (12:06 +0300)] 
maint: factor out the common show_date functionality

* src/show-date.{h,c}: Declaration and definition of show_date.
* src/du.c: Wse the common show_date instead of the previous local
function.
* src/date.c: Wse the common show_date via a wrapper show_date_helper.
* src/local.mk: Corresponding adjustments.

15 months agocksum: add tests to verify the presence of "*"
Sylvestre Ledru [Fri, 3 May 2024 17:48:13 +0000 (19:48 +0200)] 
cksum: add tests to verify the presence of "*"

* tests/cksum/cksum-a.sh: Add a test case.

15 months agocp: actually support --update=none-fail
Pádraig Brady [Fri, 3 May 2024 09:18:50 +0000 (10:18 +0100)] 
cp: actually support --update=none-fail

* src/cp.c: Add the entries for the --update=none-fail option.
* tests/mv/update.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/70727

15 months agomaint: pacify GCC 14 -Wmissing-variable-declarations
Collin Funk [Wed, 1 May 2024 13:15:56 +0000 (14:15 +0100)] 
maint: pacify GCC 14 -Wmissing-variable-declarations

* src/local.mk: Include extern decl for 'Version'.
* src/crctab.c (crctab): Add an extern decl.
* src/cksum.c: Generate an extern decl.

15 months agomaint: pacify GCC 14 -Wmissing-variable-declarations wrt md5.h
Pádraig Brady [Wed, 1 May 2024 13:15:28 +0000 (14:15 +0100)] 
maint: pacify GCC 14 -Wmissing-variable-declarations wrt md5.h

* src/sort.c: Use pragmas to avoid warnings with our
openssl adjustment and to minimize coupling with openssl.

15 months agomaint: avoid syntax check failure with long lines
Pádraig Brady [Wed, 1 May 2024 13:31:35 +0000 (14:31 +0100)] 
maint: avoid syntax check failure with long lines

* cfk.mk: Exclude bootstrap from sc_long_lines
as it comes from gnulib.

15 months agobuild: bootstrap with python gnulib-tool by default
Pádraig Brady [Sat, 27 Apr 2024 12:03:45 +0000 (13:03 +0100)] 
build: bootstrap with python gnulib-tool by default

* gnulib: Update to support bootstrapping with python by default.
* bootstrap: Sync with gnulib.
* cfg.mk: Don't force python implementation with `make world`,
rather rely on the auto selection of python if appropriate.

15 months agodoc: sort: give example for sorting on the last field
Pádraig Brady [Tue, 23 Apr 2024 11:58:17 +0000 (12:58 +0100)] 
doc: sort: give example for sorting on the last field

* doc/coreutils.texi (sort invocation): Give a DSU example
for sorting names which may have a variable number of fields.
Addresses https://bugs.gnu.org/70532

15 months agobuild: provide way to bootstrap with python gnulib-tool
Pádraig Brady [Sat, 20 Apr 2024 09:40:06 +0000 (10:40 +0100)] 
build: provide way to bootstrap with python gnulib-tool

* cfg.mk: Add a new "world" default target so that one
can bootstrap (using the python implementation), configure,
and make, by using `make -f cfg.mk`.
* gnulib: Update to latest primarily to test the
bootstrap python implementation which is now in beta test.
* README-hacking: Document the `make -f cfg.mk` shortcut.

15 months agotail: avoid infloop with -c on /dev/zero
Paul Eggert [Sat, 20 Apr 2024 04:44:32 +0000 (21:44 -0700)] 
tail: avoid infloop with -c on /dev/zero

Problem reported by Ionut Nicula in:
https://bugs.gnu.org/70477
* src/tail.c (tail_bytes): Do not loop forever on commands
like 'tail -c 4096 /dev/zero'.
* tests/tail/tail-c.sh: Test this fix.

15 months agols: -f now means -a -U
Paul Eggert [Wed, 17 Apr 2024 20:40:46 +0000 (13:40 -0700)] 
ls: -f now means -a -U

Problem reported by Toby Kelsey <https://bugs.gnu.org/70418>.
* src/ls.c (decode_switches): -f now simply means -a -U.
(usage): Adjust to match.

15 months agomaint: remove unnecessary stdbool.h include
Collin Funk [Tue, 16 Apr 2024 20:38:06 +0000 (13:38 -0700)] 
maint: remove unnecessary stdbool.h include

* src/temp-stream.c: Don't include <stdbool.h> since it is defined in
config.h if the compiler does not support the C23 keyword.

15 months agojoin: fix error message for -a and -v
Pádraig Brady [Fri, 12 Apr 2024 19:25:21 +0000 (20:25 +0100)] 
join: fix error message for -a and -v

* src/join.c (main): s/field/file/ in the error message
for -a and -v, introduced in TEXTUTILS-1_13-24-g6f63d53e1.
Reported at https://bugs.debian.org/1068864

16 months agodoc: NEWS: mention sort being more efficient with /proc files
Pádraig Brady [Sun, 7 Apr 2024 12:50:13 +0000 (13:50 +0100)] 
doc: NEWS: mention sort being more efficient with /proc files

* NEWS: Mention the improvement in commit v9.5-6-g8ff390328

16 months agosplit: don’t trust st_size on /proc files
Paul Eggert [Sat, 6 Apr 2024 22:18:04 +0000 (15:18 -0700)] 
split: don’t trust st_size on /proc files

* src/split.c (create): Don’t trust st_size == 0.

16 months agosort: don’t trust st_size on /proc files
Paul Eggert [Sat, 6 Apr 2024 22:17:14 +0000 (15:17 -0700)] 
sort: don’t trust st_size on /proc files

Problem and fix reported by Takashi Kusumi in:
https://bugs.gnu.org/70231
* src/sort.c (sort_buffer_size): Don’t trust st_size == 0.

16 months agodd: don’t trust st_size on /proc/files
Paul Eggert [Sat, 6 Apr 2024 22:15:04 +0000 (15:15 -0700)] 
dd: don’t trust st_size on /proc/files

* src/dd.c (skip): Don’t trust st_size == 0.

16 months agocat: don’t trust st_size on /proc files
Paul Eggert [Sat, 6 Apr 2024 22:13:23 +0000 (15:13 -0700)] 
cat: don’t trust st_size on /proc files

* src/cat.c (main):
Improve test for when copying will exhaust the output device.
Do not rely on st_size, which is unreliable in /proc.
Use lseek instead; this is good enough here.
* tests/cat/cat-self.sh: Test the relaxation of the heuristic
for self-copying.

16 months agobuild: update gnulib submodule to latest
Pádraig Brady [Thu, 4 Apr 2024 10:19:40 +0000 (11:19 +0100)] 
build: update gnulib submodule to latest

* gnulib: Update to latest.
* NEWS: Document 2 bugs fixed.

16 months agodoc: chown,chgrp: fix missing full stop in --help
Pádraig Brady [Mon, 1 Apr 2024 19:24:55 +0000 (20:24 +0100)] 
doc: chown,chgrp: fix missing full stop in --help

* src/chown.c (usage): Add a missing full stop.
Fixes https://bugs.gnu.org/70126

16 months agomaint: post-release administrivia
Pádraig Brady [Thu, 28 Mar 2024 15:13:45 +0000 (15:13 +0000)] 
maint: post-release administrivia

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

16 months agoversion 9.5 v9.5
Pádraig Brady [Thu, 28 Mar 2024 14:47:20 +0000 (14:47 +0000)] 
version 9.5

* NEWS: Record release date.

16 months agotests: od: avoid outputting undefined floating point values
Bruno Haible [Wed, 27 Mar 2024 12:30:31 +0000 (12:30 +0000)] 
tests: od: avoid outputting undefined floating point values

od was seen to abort() on glibc on ia64 and m68k with the error:
Fatal glibc error: printf_fp.c:501 (__printf_fp_buffer_1):
assertion failed:
  cy == 1 || (p.frac[p.fracsize - 2] == 0 && p.frac[0] == 0)

* tests/od/od-multiple-t.sh: Avoid outputting long double floats
to avoid undefined behavior. 'float' and 'double' are standardized
by IEEE 754 (except on Linux/m68k) and don't have undefined values.

16 months agobuild: update with gnulib fixes
Pádraig Brady [Tue, 26 Mar 2024 21:39:11 +0000 (21:39 +0000)] 
build: update with gnulib fixes

* gnulib: Update to incorporate gnulib fixes
from Bruno Haible

16 months agotests: numfmt: fix false failures on some systems
Pádraig Brady [Tue, 26 Mar 2024 19:17:16 +0000 (19:17 +0000)] 
tests: numfmt: fix false failures on some systems

* tests/misc/numfmt.pl: Verify that printf field width specs
count characters and not bytes before enabling locale tests.
This was seen on FreeBSD 14.0 and Solaris 11 OpenIndiana.
Reported by Bruno Haible

16 months agols: avoid ENOENT from readdir() on FreeBSD 14
Pádraig Brady [Tue, 26 Mar 2024 18:27:00 +0000 (18:27 +0000)] 
ls: avoid ENOENT from readdir() on FreeBSD 14

* src/ls.c (print_dir): readdir() on FreeBSD 14 was
seen to pass ENOENT through.  ENOENT in this context
means "Directory unlinked but still open".
Reported by Bruno Haible with tests/ls/removed-directory.sh

16 months agotests: avoid false failure due to mismatched isblank()
Pádraig Brady [Tue, 26 Mar 2024 15:02:17 +0000 (15:02 +0000)] 
tests: avoid false failure due to mismatched isblank()

There is a mismatch between isblank() used by tr and c32isblank() now
used by uniq on Solaris 11 OpenIndiana. isblank() was seen to return
true for non breaking space, while c32isblank() returned false.
Interestingly on Solaris, non breaking space is considered a blank
character, and isblank() and c32isblank() honor this in all locales.

* tests/uniq/uniq.pl: Adjust the blank check to use join(1) rather than
tr(1), as join uses the same blank determination routines as uniq(1).

16 months agocp: with --no-preserve=mode ensure set-group-ID bits maintained on dirs
Pádraig Brady [Mon, 25 Mar 2024 22:17:35 +0000 (22:17 +0000)] 
cp: with --no-preserve=mode ensure set-group-ID bits maintained on dirs

This issue was introduced in commit v8.19-145-g24ebca6

* src/copy.c (copy_internal): On systems that don't support ACLs,
the fallback default chmod done on directories should maintain
the set-group-ID, as that's generally auto-set by the system.
* NEWS: Mention the fix.
Reported by Bruno Haible on Alpine (with tests/cp/preserve-mode.sh)