]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
4 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).

4 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

4 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.

4 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.

4 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.

5 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

5 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.

5 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.

5 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

5 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.

5 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

5 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

5 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.

5 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

5 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.

5 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.

5 months agotests: remove use of unprotected 'set'
Pádraig Brady [Mon, 20 Jan 2025 15:21:58 +0000 (15:21 +0000)] 
tests: remove use of unprotected 'set'

* cfg.mk (sc_prohibit_bare_set): A new syntax check to
ensure we protect use of set with '--', so that args
beginning with '-' are not interpreted as options,
and if no args are present, all existing args are cleared.
* tests/cp/symlink-slash.sh: Add -- to unprotected use of set.
* tests/ls/ls-time.sh: Likewise.
* tests/ls/symlink-slash.sh: Likewise.
* tests/mkdir/perm.sh: Likewise.
* tests/mkdir/selinux.sh: Likewise.
* tests/mkdir/smack-no-root.sh: Likewise.
* tests/mkdir/smack-root.sh: Likewise.
* tests/mv/part-hardlink.sh: Likewise.
* tests/nice/nice.sh: Likewise.
* tests/stty/stty-row-col.sh: Likewise.

5 months agotests: fix typo in tests/ls/ls-time.sh
Daniel Hofstetter [Sun, 19 Jan 2025 16:31:42 +0000 (16:31 +0000)] 
tests: fix typo in tests/ls/ls-time.sh

* tests/ls/ls-time.sh: s/--sort-name -t/-t --sort=name/.

5 months agodoc: fix superscript in Texinfo manual's math
G. Branden Robinson [Sun, 19 Jan 2025 06:41:48 +0000 (00:41 -0600)] 
doc: fix superscript in Texinfo manual's math

The numeral "3" in the exponent was set at full size on the baseline.

5 months agols: fix crash with --context
Pádraig Brady [Fri, 17 Jan 2025 17:29:34 +0000 (17:29 +0000)] 
ls: fix crash with --context

* src/ls.c (main): Flag that we need to stat()
if we're going to get security context (call file_has_aclinfo_cache).
(file_has_aclinfo_cache): Be defensive and only lookup the device
for the file if the stat has been performed.
(has_capability_cache): Likewise.
* tests/ls/selinux-segfault.sh: Add a test case.
* NEWS: Mention the bug fix.
Reported by Bruno Haible.

5 months agomaint: post-release administrivia
Pádraig Brady [Fri, 17 Jan 2025 15:22:34 +0000 (15:22 +0000)] 
maint: post-release administrivia

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

5 months agoversion 9.6 v9.6
Pádraig Brady [Fri, 17 Jan 2025 14:43:22 +0000 (14:43 +0000)] 
version 9.6

* NEWS: Record release date.

5 months agobuild: update gnulib submodule to latest
Pádraig Brady [Fri, 17 Jan 2025 13:33:39 +0000 (13:33 +0000)] 
build: update gnulib submodule to latest

Mainly to avoid make dist-check failure with --disable-nls

5 months agobuild: fix compilation error on CentOS 8 Stream
Bruno Haible [Thu, 16 Jan 2025 21:10:26 +0000 (22:10 +0100)] 
build: fix compilation error on CentOS 8 Stream

* configure.ac (USE_AVX512_CRC32): Set to false if the function
_mm512_set_epi8 does not exist.

5 months agotests: tail-c.sh: avoid failure on Linux kernels <= 2
Pádraig Brady [Thu, 16 Jan 2025 21:05:34 +0000 (21:05 +0000)] 
tests: tail-c.sh: avoid failure on Linux kernels <= 2

tests/tail/tail-c.sh: Exclude older kernels from timeout failure.

5 months agols: Fix compilation error on CentOS 6
Bruno Haible [Thu, 16 Jan 2025 19:31:08 +0000 (20:31 +0100)] 
ls: Fix compilation error on CentOS 6

* src/ls.c (XATTR_NAME_CAPS): Define fallback.

5 months agosort: fix --debug buffer overrun
Paul Eggert [Thu, 16 Jan 2025 17:20:45 +0000 (09:20 -0800)] 
sort: fix --debug buffer overrun

* src/sort.c (debug_key): Fix undefined behavior when a key ends
before it starts.  Problem reported by Bruno Haible
<https://bugs.gnu.org/75606>.

5 months agotests: avoid false failure with replaced readdir
Pádraig Brady [Thu, 16 Jan 2025 14:56:22 +0000 (14:56 +0000)] 
tests: avoid false failure with replaced readdir

* tests/rm/rm-readdir-fail.sh: Simulate EIO rather than ENOENT,
as gnulib absorbs the latter since commit 5a2d28df.

5 months agols: suppress ENOTSUP errors on virtiofs
Pádraig Brady [Thu, 16 Jan 2025 12:09:43 +0000 (12:09 +0000)] 
ls: suppress ENOTSUP errors on virtiofs

* gnulib: Update to latest to pick up commit caf76886.
* NEWS: Mention the bug fix.

5 months agotests: misc/write-errors.sh: increase memory limit
Pádraig Brady [Wed, 15 Jan 2025 22:47:50 +0000 (22:47 +0000)] 
tests: misc/write-errors.sh: increase memory limit

* tests/head/head-c.sh: Use a larger VM limit to avoid
mem allocation failures, which were seen on CheriBSD.

5 months agotests: head: avoid false failure on some systems
Pádraig Brady [Wed, 15 Jan 2025 22:43:18 +0000 (22:43 +0000)] 
tests: head: avoid false failure on some systems

* tests/head/head-c.sh: Pass a more similar operation
to get_min_ulimit_v_, so we get a more appropriate limit.
This was seen to be significant with CheriBSD.

5 months agoyes: avoid failure on CHERI protected systems
Pádraig Brady [Wed, 15 Jan 2025 22:08:07 +0000 (22:08 +0000)] 
yes: avoid failure on CHERI protected systems

* src/yes.c (main): Don't reuse the argv array as CHERI's
capability bounds do not allow for that, failing like:
  $ yes $(seq 156) | head -n1
  In-address space security exception (core dumped)

5 months agotac: avoid out of bounds access
Pádraig Brady [Wed, 15 Jan 2025 17:42:55 +0000 (17:42 +0000)] 
tac: avoid out of bounds access

This was flagged on CheriBSD on ARM Morello with the error:
"In-address space security exception (core dumped)"
triggered with: tac -s '' /dev/null

* src/tac.c (main): Ensure we don't read beyond the
end of the supplied optarg.

5 months agotests: avoid ERRORs with no mntent.h
Pádraig Brady [Wed, 15 Jan 2025 16:12:49 +0000 (16:12 +0000)] 
tests: avoid ERRORs with no mntent.h

* tests/df/skip-duplicates.sh: Just skip this test if we fail
to build the shared lib.  This fails on Solaris 11 at least
due to no HAVE_MNTENT_H.  Note HAVE_SYS_MNTENT_H does not
suffice for this wrapper code.
* tests/df/no-mtab-status.sh: Likewise.

5 months agotests: avoid false failure with many mountpoints
Pádraig Brady [Wed, 15 Jan 2025 11:52:23 +0000 (11:52 +0000)] 
tests: avoid false failure with many mountpoints

* tests/ls/readdir-mountpoint-inode.sh: Only take the first 64.

5 months agotests: printf: avoid false failure
Pádraig Brady [Wed, 15 Jan 2025 01:36:13 +0000 (01:36 +0000)] 
tests: printf: avoid false failure

* tests/printf/printf-surprise.sh: Increase the VM limit
to avoid false failures in rare cases.

5 months agotests: avoid slow ulimit -v behavior
Pádraig Brady [Wed, 15 Jan 2025 15:13:00 +0000 (15:13 +0000)] 
tests: avoid slow ulimit -v behavior

* init.cfg (ulimit_supported_): skip_ if the ulimit -v
takes too long, which was seen with bash 5.2 on Solaris 11,
where fork() returned EAGAIN under memory constraints,
and bash retried for about 16 seconds.
(get_min_ulimit_v_): Break early if skipped.
* tests/misc/write-errors.sh: Be more conservative and
skip on failure to determine min ulimit.

5 months agotests: use more portable timeout presence check
Pádraig Brady [Tue, 14 Jan 2025 22:45:55 +0000 (22:45 +0000)] 
tests: use more portable timeout presence check

* init.cfg: timeout(1) on FreeBSD doesn't support --version
(or --help with success status), so use syntax compatible
with both FreeBSD and GNU.

5 months agotests: tail: avoid failure on Solaris 11
Pádraig Brady [Tue, 14 Jan 2025 21:14:50 +0000 (21:14 +0000)] 
tests: tail: avoid failure on Solaris 11

* tests/tail/tail-c.sh: On Solaris 11, tail -c 4096 /dev/urandom,
will induce an lseek(,-4096,SEEK_END) which returns -4096 without
setting errno, and a subsequent read() then gives EINVAL.
Since tailing the end of a psuedo device is an edge case,
we just verify that we don't spin reading the device forever.

5 months agomaint: avoid syntax-check failure
Pádraig Brady [Wed, 15 Jan 2025 12:06:48 +0000 (12:06 +0000)] 
maint: avoid syntax-check failure

* src/cksum.c: Use spaces to indent, not tabs.

5 months agocksum: port to Oracle Developer Studio 12.6
Paul Eggert [Wed, 15 Jan 2025 03:44:01 +0000 (19:44 -0800)] 
cksum: port to Oracle Developer Studio 12.6

* src/cksum.c (cksum_fp_t): New typedef.
(pclmul_supported, avx2_supported, avx512_supported)
(vmull_supported): Return this new type instead of bool.
All callers changed.  That way, callers do not need to
refer to functions like cksum_avx512 that might not
exist on this platform.  Although GCC optimizes such
references away, the C standard does not require this
optimization.

5 months agobuild: update gnulib submodule to latest
Paul Eggert [Wed, 15 Jan 2025 03:00:48 +0000 (19:00 -0800)] 
build: update gnulib submodule to latest

5 months agotests: env-S.pl: unset GNU/Hurd env vars
Collin Funk [Tue, 14 Jan 2025 03:43:12 +0000 (19:43 -0800)] 
tests: env-S.pl: unset GNU/Hurd env vars

* tests/misc/env-S.pl: Unset LD_ORIGIN_PATH.

5 months agols: readdir errno fixes
Paul Eggert [Mon, 13 Jan 2025 18:43:06 +0000 (10:43 -0800)] 
ls: readdir errno fixes

* src/ls.c (print_dir): Fix bug: file_failure can set errno to
something other than EOVERFLOW but the code assumed it didn’t.
Also, omit ENOENT bug workaround with glibc 2.3 and later,
for consistency with Gnulib.

5 months agotail: fix regression in open() flags used
Pádraig Brady [Mon, 13 Jan 2025 16:37:06 +0000 (16:37 +0000)] 
tail: fix regression in open() flags used

* src/tail.c (tail_file): Fix precedence issue introduced
in commit v9.5-231-g177fcec66 so that we pass correct flags to open().
Effectively this meant we would have dropped the O_BINARY flag
on windows, since O_RDONLY is generally 0.
Issue spotted by coverity.

5 months agobuild: update to latest gnulib
Pádraig Brady [Mon, 13 Jan 2025 10:56:52 +0000 (10:56 +0000)] 
build: update to latest gnulib

Ensure WCOREDUMP is always defined,
and ensure --enable-silent-rules is honored with crc code generation.

5 months agoall: fix program name with --enable-single-binary=shebangs
Pádraig Brady [Sun, 12 Jan 2025 21:36:33 +0000 (21:36 +0000)] 
all: fix program name with --enable-single-binary=shebangs

* gnulib: Pick up gnulib commit f11caad4fd which ensures
we diagnose the actual utility name, and not just "coreutils"
when in single binary mode.  This adjustment is required
since gnulib commit 959152ba37 which enforced use of gnulib's
error() once verror is used, and gnulib's error() always
outputs the base name of the command, which the new gnulib
commit now keeps up to date.

5 months agotests: make misc/write-errors.sh immune to default signal disposition
Pádraig Brady [Sun, 12 Jan 2025 12:44:37 +0000 (12:44 +0000)] 
tests: make misc/write-errors.sh immune to default signal disposition

* tests/misc/write-errors.sh: Reset SIGPIPE to the default (terminate)
disposition, so that the test doesn't erroneously fail due to an
ignored SIGPIPE in the test environment.

6 months agols: fix inaccurate indication of ACLs on NFS
Pádraig Brady [Sat, 11 Jan 2025 20:32:20 +0000 (20:32 +0000)] 
ls: fix inaccurate indication of ACLs on NFS

* gnulib: Update to latest to pick up gnulib commit 05c63bc908
which ensures accurate determination of the presence of NFSv4 ACLs.
* NEWS: Adjust accordingly.
Related to https://bugs.gnu.org/74692

6 months agocsplit: avoid extraenous output files given empty input
Pádraig Brady [Thu, 9 Jan 2025 19:29:01 +0000 (19:29 +0000)] 
csplit: avoid extraenous output files given empty input

* src/csplit.c (get_first_line_in_buffer): Don't exit here
upon empty input, rather indicate no input in the return
to let callers handle in a more consistent fashion.
* NEWS: Mention the bug fix.
* tests/csplit/csplit.sh: Add a test case.
Reported by Daniel Hofstetter.

6 months agols: suppress "Permission denied" errors on NFS
Pádraig Brady [Wed, 8 Jan 2025 21:46:05 +0000 (21:46 +0000)] 
ls: suppress "Permission denied" errors on NFS

NFS (on Linux 6.12 at least) was seen to return EACCES
from listxattr() for files without read access.
We started using listxattr() in coreutils 9.4.

* src/ls.c (gobble_file): Map EACCES from file_has_aclinfo()
to '?', rather than displaying the error.
* doc/coreutils.texi (ls invocation): Document the '?' flag.
* NEWS: Mention the bug fix.
Addresses https://bugs.gnu.org/74692

6 months agobuild: update gnulib submodule to latest
Paul Eggert [Fri, 10 Jan 2025 04:40:22 +0000 (20:40 -0800)] 
build: update gnulib submodule to latest

6 months agols: update comment
Paul Eggert [Wed, 8 Jan 2025 19:13:54 +0000 (11:13 -0800)] 
ls: update comment

* src/ls.c (file_has_aclinfo_cache): Fix comment.

6 months agotail: honor --pid with fifos
Pádraig Brady [Fri, 18 Oct 2024 12:40:13 +0000 (13:40 +0100)] 
tail: honor --pid with fifos

* src/tail.c (tail_file): Open files with O_NONBLOCK
if we might need async processing.
(pipe_bytes): Ignore EAGAIN read() errors.
(pipe_lines): Likewise.
* tests/tail/pid-pipe.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Reported by Berhard Voelker.

6 months agocp,mv: decouple --update from -f,-i,-n options
Pádraig Brady [Mon, 6 Jan 2025 15:48:02 +0000 (15:48 +0000)] 
cp,mv: decouple --update from -f,-i,-n options

* src/copy.h: Change update member from bool to enum.
* src/copy.c: s/interactive == I_ALWAYS_NO/update == UPDATE_NONE_FAIL/;
              s/interactive == I_ALWAYS_SKIP/update == UPDATE_NONE/;
              s/update/update == UPDATE_OLDER/;
* src/install.c: Init with UPDATE_ALL, rather than false.
* src/cp.c: Likewise.  Simply parse -f,-i,-n to x.interactive,
and parse --update to x.update.
* src/mv.c: Likewise.
* tests/cp/cp-i.sh: Add a test case where -n --update -i
honors the --update option, which would previously have been
ignored due to the preceding -n.

6 months agocp,mv: ensure -i,f are not overridden by -u
Pádraig Brady [Sun, 12 May 2024 11:21:19 +0000 (12:21 +0100)] 
cp,mv: ensure -i,f are not overridden by -u

Since coreutils 9.3 we had --update={all,older} override -i.
In coreutils 9.5 this was expanded to -u
(to make it consistent with --update=older).

This patch reinstates things so that -i combines with -u instead.
I.e. have -i be protective, rather than selective (like -u).

The -f option of mv is similarly adjusted in this patch,
so now --update does not override any of -f,-i,-n.

* NEWS: Mention the bug fix.
* src/cp.c (main): Don't have -u disable prompting.
* src/mv.c (main): Likewise.
* tests/cp/cp-i.sh: Add a test case for -i.
* tests/mv/update.sh: Likewise.
* tests/mv/i-3.sh. Add a test case for -f.
Fixes https://bugs.gnu.org/70887

6 months agodoc: clarify mv -f operation in texinfo
Pádraig Brady [Mon, 6 Jan 2025 13:01:47 +0000 (13:01 +0000)] 
doc: clarify mv -f operation in texinfo

* doc/coreutils.texi (mv invocation): Be less ambiguous,
in that -f is significant for any replacement operation
on the destination, not just unlinking.

6 months agomaint: update all copyright year number ranges
Pádraig Brady [Wed, 1 Jan 2025 09:14:56 +0000 (09:14 +0000)] 
maint: update all copyright year number ranges

Update to latest gnulib with new copyright year.
Run "make update-copyright" and then...

* gnulib: Update included in this commit as copyright years
are the only change from the previous gnulib commit.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* tests/sample-test: Adjust to use the single most recent year.

6 months agopwd: fix erroneous leading slash on some systems
Pádraig Brady [Wed, 1 Jan 2025 08:48:27 +0000 (08:48 +0000)] 
pwd: fix erroneous leading slash on some systems

* gnulib: Pull in the fix to getcwd() from gnulib.
* NEWS: Mention the fix.

6 months agonumfmt: don't require a suffix with --from=iec-i
Pádraig Brady [Mon, 30 Dec 2024 22:48:14 +0000 (22:48 +0000)] 
numfmt: don't require a suffix with --from=iec-i

* src/numfmt.c (simple_strtod_human): Only look for 'i'
after detecting a suffix.
* tests/misc/numfmt.pl: Add a test case.
* NEWS: Mention the bug fix.
Reported at https://bugs.debian.org/1091758

6 months agomaint: fix syntax-check error
Pádraig Brady [Mon, 30 Dec 2024 20:33:17 +0000 (20:33 +0000)] 
maint: fix syntax-check error

* src/seq.c: Adjust line length.

6 months agomaint: adjust to Gnulib module renaming
Paul Eggert [Mon, 30 Dec 2024 19:51:25 +0000 (11:51 -0800)] 
maint: adjust to Gnulib module renaming

* bootstrap.conf, gl/modules/buffer-lcm, gl/modules/randperm:
* gl/modules/randread, gl/modules/strnumcmp, gl/modules/targetdir:
* gl/modules/xdectoint, gl/modules/xfts:
Adjust to recent renaming of Gnulib modules, e.g., stdbool → bool,
inttypes → inttypes-h.

6 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 30 Dec 2024 19:39:48 +0000 (11:39 -0800)] 
build: update gnulib submodule to latest

6 months agodate: improve doc for ambiguous formats
Paul Eggert [Mon, 30 Dec 2024 19:38:56 +0000 (11:38 -0800)] 
date: improve doc for ambiguous formats

Problem reported by Tim Connors <https://bugs.gnu.org/75208>.
* doc/coreutils.texi (Date conversion specifiers):
* src/date.c (usage):
Warn about ambiguous formats like %D.

6 months agomaint: ISDIGIT → c_isdigit
Paul Eggert [Mon, 30 Dec 2024 18:45:54 +0000 (10:45 -0800)] 
maint: ISDIGIT → c_isdigit

* gl/lib/strnumcmp-in.h (ISDIGIT):
* src/system.h (ISDIGIT): Remove.  All uses replaced by c_isdigit,
with appropriate inclusions of c-ctype.h.  This is more regular,
and is more portable to existing (but unlikely) platforms where
INT_MAX == UINT_MAX.

6 months agotests: improve the chmod/symlinks.sh test
Sylvestre Ledru [Mon, 30 Dec 2024 09:41:23 +0000 (10:41 +0100)] 
tests: improve the chmod/symlinks.sh test

The variable of the loop isn't passed to the command making
it less interesting

* tests/chmod/symlinks.sh: Fix the test case.

6 months agokill: with -l,-t list signal 0
Pádraig Brady [Sat, 21 Dec 2024 12:54:59 +0000 (12:54 +0000)] 
kill: with -l,-t list signal 0

The 0 (EXIT) signal is valid as input
(and useful to determine existence of a pid),
so list it along with other signals.

* doc/coreutils.texi (signal specifications): Document 0, "EXIT".
* src/kill.c (list_signals): Start loops at 0, not 1.
* tests/misc/kill.sh: Add a test case.
* NEWS: Mention the change in behavior.

6 months agomaint: correct © dates for hardware optimized crc routines
Pádraig Brady [Sat, 21 Dec 2024 12:17:06 +0000 (12:17 +0000)] 
maint: correct © dates for hardware optimized crc routines

* src/cksum_pclmul.c: 2021-2024.
* src/cksum_avx2.c: 2024.
* src/cksum_avx512.c: 2024.
* src/cksum_vmull.c: 2024.

6 months agotail: always fail when followed files become inaccessible
Pádraig Brady [Fri, 20 Dec 2024 14:28:11 +0000 (14:28 +0000)] 
tail: always fail when followed files become inaccessible

* src/tail.c (tail_forever): Without --retry, exit with failure
status like we do for the inotify case (since v8.11-15-g61de57cd2).
This is also consistent with the failure exit if no file was
accessible at tail startup.
* tests/tail/follow-stdin.sh: Tweak due to earlier exit.
* tests/tail/follow-name.sh: Test with and without inotify.
* NEWS: Mention the bug fix.

6 months agocksum: update to pclmul optimized crc32b from gnulib
Pádraig Brady [Wed, 18 Dec 2024 12:39:47 +0000 (12:39 +0000)] 
cksum: update to pclmul optimized crc32b from gnulib

* bootstrap.conf: Depend on crc-x86_64 rather than crc.
* gnulib: Update to latest.
* src/cksum.c (crc32b_sum_stream): Add --debug info.
* NEWS: Mention the performance improvement.

6 months agomaint: tests: update deprecated perl backreference syntax
Daniel Hofstetter [Mon, 16 Dec 2024 18:11:01 +0000 (18:11 +0000)] 
maint: tests: update deprecated perl backreference syntax

* tests/basenc/basenc.pl: perl warns that $1 is better than \1,
so update to the preferred form.

7 months agomaint: sync help2man to latest version
Paul Eggert [Thu, 12 Dec 2024 03:59:24 +0000 (19:59 -0800)] 
maint: sync help2man to latest version

* man/help2man: sync changes from version 1.48.5 through 1.49.3.
This doesn't materially change the generated man pages.

7 months agocksum: use ARMv8 SIMD extensions
Sam Russell [Thu, 28 Nov 2024 19:28:21 +0000 (20:28 +0100)] 
cksum: use ARMv8 SIMD extensions

* configure.ac: Add check for ARMv8 VMULL support.
* src/cksum.c: Add ARMv8 VMULL detection function.
* src/cksum.h: Add ARMv8 VMULL implementation declaration.
* src/cksum_vmull.c: ARMv8 VMULL implementation.
* src/local.mk: Add build flags for ARMv8 VMULL.
* NEWS: Mention the ARMv8 SIMD improvement.

7 months agotail: ensure --follow=name unfollows renamed files
Pádraig Brady [Wed, 4 Dec 2024 19:40:55 +0000 (19:40 +0000)] 
tail: ensure --follow=name unfollows renamed files

Require --retry to continue to track files upon rename.
We already unfollowed a file if it was renamed
to another file system (unlinked), so this makes the behavior
consistent if renaming to a file in the same file system.
I.e. --follow=name without --retry, means unfollow if the
name is unlinked or moved, so this change ensures that
behavior for all rename cases.
Related commits: v8.0-121-g3b997a9bcv8.23-161-gd313a0b24

* src/tail.c (tail_forever_notify): Remove watch for a renamed file
if --retry is not specified.
* tests/tail/F-vs-rename.sh: Related test cleanup.
* tests/tail/follow-name.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/74653

7 months agocksum: use AVX2 and AVX512 for speedup
Sam Russell [Mon, 25 Nov 2024 23:25:00 +0000 (00:25 +0100)] 
cksum: use AVX2 and AVX512 for speedup

* configure.ac: Add checks for avx2 and avx512 support.
* src/cksum_avx2.c: AVX2 implementation.
* src/cksum_avx512.c: AVX512 implementation.
* src/local.mk: Add build flags for avx2 and avx512.
* src/cksum.c: Add avx2 and avx512 detection functions.
* src/cksum.h: Add avx2 and avx512 implementation declarations.
* NEWS: Mention the AVX2 and AVX512 improvement.

7 months agotail,tee: fix broken pipe detection on darwin 9
Pádraig Brady [Tue, 26 Nov 2024 14:04:32 +0000 (14:04 +0000)] 
tail,tee: fix broken pipe detection on darwin 9

* src/iopoll.c (): Restrict use of poll() on macOS
to >= 11 (darwin 20), as it was seen to fail on macOS 10.5.
Fixes https://bugs.gnu.org/74503

7 months agotests: avoid false failure with unicode decomposed file systems
Pádraig Brady [Sun, 24 Nov 2024 12:51:43 +0000 (12:51 +0000)] 
tests: avoid false failure with unicode decomposed file systems

* tests/ls/dired.sh: macOS normalizes unicode characters to decomposed
(NFD) form when storing names in the file system, which breaks the
round-trip comparison employed by the test.  So instead use a character
which does not decompose; verified with:
  echo æ | uconv -f utf8 -t utf8 -x nfd | od -Ax -tx1z

7 months agodd: port big-offset test to macOS 12.6
Paul Eggert [Wed, 20 Nov 2024 19:11:54 +0000 (11:11 -0800)] 
dd: port big-offset test to macOS 12.6

* tests/dd/skip-seek-past-file.sh: Do not assume that
seek to exactly OFF_T_MAX should fail; it works on macOS 12.6
and POSIX allows this.  Come to think of it, it should work
on Solaris too, if someone ever comes across a Solaris host
with a file system that allows such files.

7 months agomaint: update .gitignore
Collin Funk [Wed, 20 Nov 2024 02:50:27 +0000 (18:50 -0800)] 
maint: update .gitignore

* .gitignore (/lib/crc-sliceby8.h): Add file generated by Gnulib.

7 months agomaint: prefer mbszero over memset
Collin Funk [Wed, 20 Nov 2024 02:43:19 +0000 (18:43 -0800)] 
maint: prefer mbszero over memset

* src/df.c (replace_invalid_chars): Use mbszero.

7 months agols: port to Oracle Developer Studio 12.6
Paul Eggert [Wed, 20 Nov 2024 06:55:48 +0000 (22:55 -0800)] 
ls: port to Oracle Developer Studio 12.6

Oracle Developer Studio 12.6 for sparc mishandles
‘sizeof ((char []) {'x', 'y'})’: it says
“warning: null dimension: sizeof()” and then generates
the wrong length in data.  Work around the compiler bug
by counting sizes by hand, which may be a bit clearer anyway,
if a bit more error-prone.
* src/ls.c (BIN_STR): Remove.
(color_indicator): Spell out instead of using BIN_STR.

7 months agofactor: fix ‘return’ typo
Paul Eggert [Wed, 20 Nov 2024 06:22:57 +0000 (22:22 -0800)] 
factor: fix ‘return’ typo

* src/factor.c (lbuf_putint): Don’t use ‘return E;’ in
a void function’s body, fixing a recently-introduced typo.

7 months agodoc: mention "printf %d ''" change
Paul Eggert [Tue, 19 Nov 2024 22:01:32 +0000 (14:01 -0800)] 
doc: mention "printf %d ''" change

7 months agotests: fix inconsistent use of getlimits_
Pádraig Brady [Tue, 19 Nov 2024 20:03:01 +0000 (20:03 +0000)] 
tests: fix inconsistent use of getlimits_

* tests/dd/skip-seek-past-file.sh: s/eval $(getlimits)/getlimits_/

7 months agotests: printf: avoid iconv issues on macOS
Pádraig Brady [Tue, 19 Nov 2024 19:57:53 +0000 (19:57 +0000)] 
tests: printf: avoid iconv issues on macOS

* tests/printf/printf-cov.pl: Since gnulib commit v1.0-1103-ge5b82978e2
we avoid iconv() on ASCII range 0x32 - 0x7F inclusive, so adjust
this test to fall within that range.
Addresses https://bugs.gnu.org/74428

7 months agochown: port test to macOS 12.6 nogroup user
Paul Eggert [Tue, 19 Nov 2024 17:53:17 +0000 (09:53 -0800)] 
chown: port test to macOS 12.6 nogroup user

* tests/chown/preserve-root.sh (id_g): Set to empty if id -gn
reports that it is nogroup, and skip that part of the test.

7 months agomaint: omit unnecessary to_uchar
Paul Eggert [Tue, 19 Nov 2024 17:18:50 +0000 (09:18 -0800)] 
maint: omit unnecessary to_uchar

* src/df.c (replace_control_chars):
* src/dircolors.c (parse_line):
* src/printf.c (print_esc):
* src/ptx.c (unescape_string):
* src/stat.c (print_it):
* src/tr.c (star_digits_closebracket):
Omit to_uchar calls that aren’t needed, because the parent
expression works with ‘char’ as well as with ‘unsigned char’.

7 months agotests: Remove stray ‘i’
Paul Eggert [Tue, 19 Nov 2024 16:55:41 +0000 (08:55 -0800)] 
tests: Remove stray ‘i’

7 months agoprintf: diagnose empty args correctly
Paul Eggert [Tue, 19 Nov 2024 02:19:54 +0000 (18:19 -0800)] 
printf: diagnose empty args correctly

Also, port better to macOS.
* src/printf.c (verify_numeric): Don’t assume that when s == end
then errno is zero; it is EINVAL on macOS, and POSIX allows this.
(print_direc): Treat missing arg as zero for numeric conversions,
and as an empty string for the others.
(print_formatted): Use null pointer, not an empty string,
to represent missing arg.
* tests/printf/printf.sh: Test empty and space widths and precisions.

7 months agoprintf: do n$ overflow checking by hand
Paul Eggert [Mon, 18 Nov 2024 21:46:33 +0000 (13:46 -0800)] 
printf: do n$ overflow checking by hand

* src/printf.c (get_curr_arg): Mark as pure to pacify GCC 14.
Do overflow checking by hand rather than relying on strspn
and strtoimax.

7 months agoprintf: refactor macros to function
Paul Eggert [Mon, 18 Nov 2024 19:24:10 +0000 (11:24 -0800)] 
printf: refactor macros to function

* src/printf.c (struct arg_cursor): New struct.
(get_curr_arg): New function.
(print_formatted): Use it instead of ...
(GET_CURR_ARG, SET_CURR_ARG): ... these removed macros.
This makes the code a bit easier to follow, and any efficiency
cost should be minimal.

7 months agomaint: avoid a syntax-check failure
Pádraig Brady [Mon, 18 Nov 2024 16:17:10 +0000 (16:17 +0000)] 
maint: avoid a syntax-check failure

This was also updated in gnulib.

* bootstrap: s/can not/cannot/

7 months agodoc: describe "New programs" consistently in NEWS
Pádraig Brady [Mon, 18 Nov 2024 16:13:12 +0000 (16:13 +0000)] 
doc: describe "New programs" consistently in NEWS

* NEWS: s/New commands/New programs/

7 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 18 Nov 2024 07:00:34 +0000 (23:00 -0800)] 
build: update gnulib submodule to latest

Also, copy bootstrap from gnulib/build-aux/bootstrap.

7 months agofactor: pacify -Wunused-macros
Paul Eggert [Sat, 16 Nov 2024 20:45:34 +0000 (13:45 -0700)] 
factor: pacify -Wunused-macros

* src/factor.c: Also use __GMP_GNUC_PREREQ

7 months agols: refactor gobble_file get_scontext
Paul Eggert [Fri, 15 Nov 2024 01:35:49 +0000 (17:35 -0800)] 
ls: refactor gobble_file get_scontext

* src/ls.c (gobble_file): Simplify by pulling get_scontext
out of ‘if’.

8 months agotests: ls: also test security context output for symlinks
Pádraig Brady [Tue, 12 Nov 2024 11:34:07 +0000 (11:34 +0000)] 
tests: ls: also test security context output for symlinks

* tests/ls/selinux.sh: Test symlinks as well as files.

8 months agotests: avoid false failure with --disable-selinux
Pádraig Brady [Mon, 11 Nov 2024 19:54:18 +0000 (19:54 +0000)] 
tests: avoid false failure with --disable-selinux

* tests/ls/selinux-segfault.sh: Move recent addition to ...
* tests/ls/selinux.sh: ... this new test that uses require_selinux_
to skip appropriately when we've built without selinux support.
Also add a non root test that checks we output '.' along with the
mode for files, to indicate a security context is present.
* tests/local.mk (Reference the new test).

8 months agols: fix security context indication in --long mode
Pádraig Brady [Mon, 11 Nov 2024 18:55:19 +0000 (18:55 +0000)] 
ls: fix security context indication in --long mode

* src/ls.c (gobble_file): Always get the security context with -l
so that we can indicate a context with '.' if present.

8 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 11 Nov 2024 16:52:12 +0000 (08:52 -0800)] 
build: update gnulib submodule to latest

This also fixes a problem with ls -Z when configured with
--disable-acl, reported by Pádraig Brady
<https://bugs.gnu.org/73418#52>.
* src/ls.c (gobble_file): Pass ACL_GET_SCONTEXT to
file_has_aclinfo, if -Z is used.