mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
326 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e075ff8ee | ||
|
|
9ccabd8df3 | ||
|
|
7007c018de | ||
|
|
0954e91fcf | ||
|
|
42f6201aa5 | ||
|
|
dcfe04eab5 | ||
|
|
f1df3e703f | ||
|
|
905afc91a5 | ||
|
|
cb7c210d30 | ||
|
|
0311d45d5b | ||
|
|
14af8e34c9 | ||
|
|
dce566553c | ||
|
|
65b694257f | ||
|
|
4368d21fbd | ||
|
|
a3b862ece2 | ||
|
|
43873a660d | ||
|
|
026d0d7c40 | ||
|
|
9ed5770b5e | ||
|
|
8d44319fa1 | ||
|
|
31c97c31ff | ||
|
|
47204301f1 | ||
|
|
3160f8bfa8 | ||
|
|
446a4c95f9 | ||
|
|
cb2abbac7f | ||
|
|
76b8121d62 | ||
|
|
2b0887fdd5 | ||
|
|
37b085e567 | ||
|
|
66ee9f568b | ||
|
|
dcfe6b2064 | ||
|
|
afc41505e9 | ||
|
|
24450e5eec | ||
|
|
0a03735c71 | ||
|
|
4696724eb1 | ||
|
|
4a6ebb4613 | ||
|
|
3324344820 | ||
|
|
9c89359324 | ||
|
|
83fb600a21 | ||
|
|
0ed8b6f9de | ||
|
|
6ac924f319 | ||
|
|
785ba51591 | ||
|
|
50aa67f6a1 | ||
|
|
7eada35b4f | ||
|
|
c98e90b074 | ||
|
|
f2e3234301 | ||
|
|
7386c291be | ||
|
|
dff821d3e3 | ||
|
|
a6a8f687f8 | ||
|
|
3f7c36cbbb | ||
|
|
32125782a6 | ||
|
|
90a2a43935 | ||
|
|
a7defc41ec | ||
|
|
008bb4732b | ||
|
|
d7c6f85189 | ||
|
|
63b780afce | ||
|
|
f45202b7e0 | ||
|
|
fbfd886e59 | ||
|
|
d10cc94399 | ||
|
|
91d5a51236 | ||
|
|
dcc896e6c3 | ||
|
|
e6117526c3 | ||
|
|
3189c08cb7 | ||
|
|
915004f403 | ||
|
|
23fcbeff42 | ||
|
|
e2a405981f | ||
|
|
797f11e8dc | ||
|
|
354cf4a410 | ||
|
|
700690ebc3 | ||
|
|
0c195b63ea | ||
|
|
e07161d4af | ||
|
|
9c068dae76 | ||
|
|
039c355f71 | ||
|
|
0bd149403d | ||
|
|
678281539b | ||
|
|
261f13bcf8 | ||
|
|
d60e550ed0 | ||
|
|
c56890470e | ||
|
|
4bb1fc2445 | ||
|
|
868cd727df | ||
|
|
61d4935802 | ||
|
|
c12baacddc | ||
|
|
1555bcec6a | ||
|
|
8b05659ede | ||
|
|
b852461476 | ||
|
|
bf44993fb9 | ||
|
|
75e2224ae2 | ||
|
|
0032e336e5 | ||
|
|
527d331af4 | ||
|
|
a83615427b | ||
|
|
1e59fbf722 | ||
|
|
e6a1f5a4b0 | ||
|
|
5da2acc5e8 | ||
|
|
8482cb9451 | ||
|
|
b58e321c8d | ||
|
|
6b9e601a97 | ||
|
|
f169dc8b68 | ||
|
|
177fcec66d | ||
|
|
10406103b8 | ||
|
|
a6ab944e19 | ||
|
|
5572896137 | ||
|
|
28b176085f | ||
|
|
45bcc6aaaf | ||
|
|
6229ac946e | ||
|
|
02a24f8aad | ||
|
|
36e656390d | ||
|
|
e83385b526 | ||
|
|
a0c3e5648b | ||
|
|
9eb131e530 | ||
|
|
ff55921c43 | ||
|
|
7e5b6b6f07 | ||
|
|
c11d52f19a | ||
|
|
8b9fa9d074 | ||
|
|
c8bb7afcfb | ||
|
|
e331dcbc81 | ||
|
|
f5e1dfa122 | ||
|
|
d155be4a22 | ||
|
|
fd01fc8075 | ||
|
|
df71ac8343 | ||
|
|
205e7e4585 | ||
|
|
cb2774501d | ||
|
|
cc58b65736 | ||
|
|
96954f37a9 | ||
|
|
1a27008fe2 | ||
|
|
38823913e3 | ||
|
|
d92df29a21 | ||
|
|
6c69fd16bc | ||
|
|
c6be9649a7 | ||
|
|
ede23f4427 | ||
|
|
2a49f56906 | ||
|
|
e3ccd26aca | ||
|
|
60995c36f3 | ||
|
|
91e95f1f86 | ||
|
|
a665aa4f6d | ||
|
|
00a5f3dd83 | ||
|
|
c41ca2814d | ||
|
|
ea69c67796 | ||
|
|
1875e5c05d | ||
|
|
f21c74b48c | ||
|
|
1f0bf8d7c4 | ||
|
|
fc0ea5cb87 | ||
|
|
8f4fce1751 | ||
|
|
00c45be787 | ||
|
|
87b887f968 | ||
|
|
64a5d1092c | ||
|
|
45ba6c6f54 | ||
|
|
b048c4d37f | ||
|
|
f7c53095d2 | ||
|
|
6db4b33eb9 | ||
|
|
ab397c475a | ||
|
|
807c51e4fb | ||
|
|
8ba5c3493d | ||
|
|
96e101d03f | ||
|
|
59bfd5b53d | ||
|
|
ecb157940d | ||
|
|
ddb6f5f442 | ||
|
|
cd340ab21f | ||
|
|
61ab25c355 | ||
|
|
ba034afa6c | ||
|
|
c52553997d | ||
|
|
d00ab4d110 | ||
|
|
4cb726e4a6 | ||
|
|
612e64e132 | ||
|
|
3e1c94d273 | ||
|
|
bd39f96581 | ||
|
|
91a743bb85 | ||
|
|
901ba87ed5 | ||
|
|
9f017b69f3 | ||
|
|
3aaadf281f | ||
|
|
1932ca94d3 | ||
|
|
a824f50d96 | ||
|
|
7572abed94 | ||
|
|
b857d66b51 | ||
|
|
e9d294afb9 | ||
|
|
6e297e8855 | ||
|
|
e4edd48a2a | ||
|
|
97807bff17 | ||
|
|
7e86be8dbb | ||
|
|
ff9b85970b | ||
|
|
5af1b2662b | ||
|
|
fbfda4df1a | ||
|
|
a94929715c | ||
|
|
ee231019e1 | ||
|
|
f48123ef27 | ||
|
|
0c670beed9 | ||
|
|
69aaec486f | ||
|
|
f4fbc1a9f9 | ||
|
|
0c9d372c96 | ||
|
|
f082cb8284 | ||
|
|
58a88f30f8 | ||
|
|
0b5bcaed95 | ||
|
|
03a7242fc6 | ||
|
|
8083944484 | ||
|
|
0911361e79 | ||
|
|
a94a551ee0 | ||
|
|
96100139fc | ||
|
|
2a6bed9332 | ||
|
|
8fbb1076d5 | ||
|
|
a89896f8e7 | ||
|
|
75b34c77e4 | ||
|
|
8121021d05 | ||
|
|
ec0fe0d2b8 | ||
|
|
65c58007f7 | ||
|
|
647a8b8cf9 | ||
|
|
2606f5a043 | ||
|
|
851064b4c7 | ||
|
|
6f1ec80f31 | ||
|
|
e71b24cedc | ||
|
|
4d62d46a41 | ||
|
|
4ce432ad87 | ||
|
|
218001187b | ||
|
|
0619c4a491 | ||
|
|
d84afaa0a7 | ||
|
|
92902de118 | ||
|
|
335f6fa2ec | ||
|
|
74d791c4b0 | ||
|
|
d598ef7a6c | ||
|
|
666e226994 | ||
|
|
2bd3db74d5 | ||
|
|
7c1149359a | ||
|
|
d875200bbf | ||
|
|
b74ba189e8 | ||
|
|
6314313935 | ||
|
|
bb2a973fdc | ||
|
|
2da88ed179 | ||
|
|
f678de6f0e | ||
|
|
9cc3e786e6 | ||
|
|
e3f3670c7e | ||
|
|
5867465510 | ||
|
|
ac5213acba | ||
|
|
9e5274cd1b | ||
|
|
4da7daa01f | ||
|
|
7337076ecf | ||
|
|
afab48f23f | ||
|
|
5cecd703e5 | ||
|
|
408301e4bc | ||
|
|
a4617a5bc1 | ||
|
|
9b9763e6a7 | ||
|
|
ffc7b6a6e9 | ||
|
|
781b55cb57 | ||
|
|
eefd1c087b | ||
|
|
403cb48413 | ||
|
|
9e60f2db90 | ||
|
|
8271864537 | ||
|
|
84f8202287 | ||
|
|
9e448e8a51 | ||
|
|
296cc3ed96 | ||
|
|
586dfa995a | ||
|
|
5b4741dbc2 | ||
|
|
7633e82c88 | ||
|
|
8fe800a06e | ||
|
|
91657204c1 | ||
|
|
cb11d2ab5e | ||
|
|
0f9e2719e0 | ||
|
|
ad094f20ed | ||
|
|
67eff6359d | ||
|
|
22ac54858c | ||
|
|
f2c84fe630 | ||
|
|
495a35311c | ||
|
|
c5725c8c4b | ||
|
|
4e98e95df2 | ||
|
|
e397d3f1d3 | ||
|
|
1bb31793c2 | ||
|
|
440b40eece | ||
|
|
bead5b05d0 | ||
|
|
801792c698 | ||
|
|
0e5fe9e019 | ||
|
|
1ea7255f8b | ||
|
|
bfbb3ec7f7 | ||
|
|
1ae98dbda7 | ||
|
|
83ec7a706a | ||
|
|
65a46e9e21 | ||
|
|
10aabce247 | ||
|
|
94e8f2b012 | ||
|
|
ea1fe48b91 | ||
|
|
74ef0ac8a5 | ||
|
|
b655c09743 | ||
|
|
50e85d4812 | ||
|
|
2582db55f3 | ||
|
|
d3b4bc3080 | ||
|
|
7b3535388c | ||
|
|
fe7208b90d | ||
|
|
7cd5143819 | ||
|
|
b95c6ac7d2 | ||
|
|
72588b2915 | ||
|
|
28951eaa41 | ||
|
|
bbc972bc82 | ||
|
|
3ce31e6f19 | ||
|
|
9290066de0 | ||
|
|
2a72cf1e99 | ||
|
|
5691ff399e | ||
|
|
451de5d28a | ||
|
|
afb6ba4d2c | ||
|
|
52e024b7b7 | ||
|
|
26ba820157 | ||
|
|
23bf614e46 | ||
|
|
7b87c5c310 | ||
|
|
ed65a08f9b | ||
|
|
e9744ba058 | ||
|
|
44084a3ac2 | ||
|
|
684db6cb9b | ||
|
|
b5ce9fb177 | ||
|
|
ccf47cad93 | ||
|
|
dd976cae23 | ||
|
|
6480d59263 | ||
|
|
def6b33bf6 | ||
|
|
f069bb710a | ||
|
|
292cf89545 | ||
|
|
ecf7d12937 | ||
|
|
de49e993ea | ||
|
|
ba8a43c24d | ||
|
|
c06d767ada | ||
|
|
11fd227d95 | ||
|
|
49f84ecee7 | ||
|
|
adb6338bb5 | ||
|
|
555f9061ee | ||
|
|
fb543b6b82 | ||
|
|
9ab1f9db94 | ||
|
|
a9b78541fa | ||
|
|
f56ae60585 | ||
|
|
be3a216ab4 | ||
|
|
1116367581 | ||
|
|
8ff3903281 | ||
|
|
ac6b8d8224 | ||
|
|
225cb8d747 | ||
|
|
8f3989d586 | ||
|
|
e8c2b921c6 | ||
|
|
d2df669c9c |
2
.github/ISSUE_TEMPLATE.txt
vendored
2
.github/ISSUE_TEMPLATE.txt
vendored
@@ -68,7 +68,7 @@ When sending messages to coreutils@gnu.org or bug-coreutils@gnu.org :
|
||||
|
||||
|
||||
<!--
|
||||
Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2017-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.txt
vendored
2
.github/PULL_REQUEST_TEMPLATE.txt
vendored
@@ -88,7 +88,7 @@ in this matter.
|
||||
|
||||
|
||||
<!--
|
||||
Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2017-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -60,8 +60,10 @@
|
||||
/lib/config.h
|
||||
/lib/config.hin
|
||||
/lib/configmake.h
|
||||
/lib/crc-sliceby8.h
|
||||
/lib/ctype.h
|
||||
/lib/dirent.h
|
||||
/lib/endian.h
|
||||
/lib/errno.h
|
||||
/lib/error.h
|
||||
/lib/fcntl.h
|
||||
@@ -105,6 +107,7 @@
|
||||
/lib/stamp-h1
|
||||
/lib/stdarg.h
|
||||
/lib/stdbool.h
|
||||
/lib/stdbit.h
|
||||
/lib/stdckdint.h
|
||||
/lib/stddef.h
|
||||
/lib/stdint.h
|
||||
@@ -207,6 +210,7 @@
|
||||
/tests/*/*.trs
|
||||
/tests/.built-programs
|
||||
/tests/factor/t[0-9][0-9].sh
|
||||
/tests/init.sh
|
||||
/tests/t?
|
||||
/tests/test-suite.log
|
||||
/tight-scope.mk
|
||||
|
||||
@@ -1 +1 @@
|
||||
9.4
|
||||
9.6
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Suppress valgrind diagnostics we don't care about.
|
||||
|
||||
# Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
2
HACKING
2
HACKING
@@ -616,7 +616,7 @@ and root only tests, is to follow these steps (requires lcov to be installed):
|
||||
xdg-open doc/coverage/index.html
|
||||
|
||||
========================================================================
|
||||
Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2025 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make coreutils. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1990-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1990-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -82,14 +82,12 @@ BUILT_SOURCES = .version
|
||||
|
||||
# Have no read-only files in the tarball to allow easy removal.
|
||||
# Have .tarball-version based versions only in tarball builds.
|
||||
# Have .timestamp based dates only in tarball builds.
|
||||
# The perl substitution is to change some key uses of "rm" to "/bin/rm".
|
||||
# See the rm_subst comment for details.
|
||||
# The touch avoids a subtle, spurious "make distcheck" failure.
|
||||
dist-hook: gen-ChangeLog
|
||||
$(AM_V_GEN)chmod -R +rw $(distdir)
|
||||
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
|
||||
$(AM_V_GEN)date +%s > $(distdir)/.timestamp
|
||||
$(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/Makefile.in
|
||||
$(AM_V_at)touch $(distdir)/doc/constants.texi \
|
||||
$(distdir)/doc/coreutils.info
|
||||
@@ -135,7 +133,8 @@ check-ls-dircolors:
|
||||
|sed -n 's/^"\(..\)"/\1/p'|sort -u); \
|
||||
ls=$$(sed -n '/static.*indicator_name\[/,/};'/\p \
|
||||
$(srcdir)/src/ls.c \
|
||||
|sed -n '/^ *"/p'|tr , '\n'|sed 's/^ *//' \
|
||||
|sed -n '/^ *{/ { s/{.\([a-z]\).,.\([a-z]\).}/"\1\2"/g; p; }' \
|
||||
|tr , '\n'|sed 's/^ *//' \
|
||||
|sed -n 's/^"\(..\)"/\1/p'|sort -u); \
|
||||
test "$$dc" = "$$ls"
|
||||
|
||||
@@ -209,6 +208,7 @@ MOSTLYCLEANDIRS =
|
||||
|
||||
AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
|
||||
|
||||
include $(top_srcdir)/gl/local.mk
|
||||
include $(top_srcdir)/lib/local.mk
|
||||
include $(top_srcdir)/src/local.mk
|
||||
include $(top_srcdir)/doc/local.mk
|
||||
|
||||
170
NEWS
170
NEWS
@@ -1,5 +1,169 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 9.7 (2025-04-09) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
'cat' would fail with "input file is output file" if input and
|
||||
output are the same terminal device and the output is append-only.
|
||||
[bug introduced in coreutils-9.6]
|
||||
|
||||
'cksum -a crc' misbehaved on aarch64 with 32-bit uint_fast32_t.
|
||||
[bug introduced in coreutils-9.6]
|
||||
|
||||
dd with the 'nocache' flag will now detect all failures to drop the
|
||||
cache for the whole file. Previously it may have erroneously succeeded.
|
||||
[bug introduced with the "nocache" feature in coreutils-8.11]
|
||||
|
||||
'ls -Z dir' would crash on all systems, and 'ls -l' could crash
|
||||
on systems like Android with SELinux but without xattr support.
|
||||
[bug introduced in coreutils-9.6]
|
||||
|
||||
`ls -l` could output spurious "Not supported" errors in certain cases,
|
||||
like with dangling symlinks on cygwin.
|
||||
[bug introduced in coreutils-9.6]
|
||||
|
||||
timeout would fail to timeout commands with infinitesimal timeouts.
|
||||
For example `timeout 1e-5000 sleep inf` would never timeout.
|
||||
[bug introduced with timeout in coreutils-7.0]
|
||||
|
||||
sleep, tail, and timeout would sometimes sleep for slightly less
|
||||
time than requested.
|
||||
[bug introduced in coreutils-5.0]
|
||||
|
||||
'who -m' now outputs entries for remote logins. Previously login
|
||||
entries prefixed with the service (like "sshd") were not matched.
|
||||
[bug introduced in coreutils-9.4]
|
||||
|
||||
** Improvements
|
||||
|
||||
'logname' correctly returns the user who logged in the session,
|
||||
on more systems. Previously on musl or uclibc it would have merely
|
||||
output the LOGNAME environment variable.
|
||||
|
||||
|
||||
* Noteworthy changes in release 9.6 (2025-01-17) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp fixes support for --update=none-fail, which would have been
|
||||
rejected as an invalid option.
|
||||
[bug introduced in coreutils-9.5]
|
||||
|
||||
cp,mv --update no longer overrides --interactive or --force.
|
||||
[bug introduced in coreutils-9.3]
|
||||
|
||||
csplit no longer creates empty files given empty input.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
ls and printf fix shell quoted output in the edge case of escaped
|
||||
first and last characters, and single quotes in the string.
|
||||
[bug introduced in coreutils-8.26]
|
||||
|
||||
ls -l no longer outputs "Permission denied" errors on NFS
|
||||
which may happen with files without read permission, and which resulted
|
||||
in inaccurate indication of ACLs (missing '+' flag after mode).
|
||||
[bug introduced in coreutils-9.4]
|
||||
|
||||
ls -l no longer outputs "Not supported" errors on virtiofs.
|
||||
[bug introduced in coreutils-9.4]
|
||||
|
||||
mv works again with macFUSE file systems. Previously it would
|
||||
have exited with a "Function not implemented" error.
|
||||
[bug introduced in coreutils-8.28]
|
||||
|
||||
nproc gives more consistent results on systems with more than 1024 CPUs.
|
||||
Previously it would have ignored the affinity mask on such systems.
|
||||
[bug introduced with nproc in coreutils-8.1]
|
||||
|
||||
numfmt --from=iec-i now works with numbers without a suffix.
|
||||
Previously such numbers were rejected with an error.
|
||||
[bug introduced with numfmt in coreutils-8.21]
|
||||
|
||||
printf now diagnoses attempts to treat empty strings as numbers,
|
||||
as per POSIX. For example, "printf '%d' ''" now issues a diagnostic
|
||||
and fails instead of silently succeeding.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
pwd no longer outputs an erroneous double slash on systems
|
||||
where the system getcwd() was completely replaced.
|
||||
[bug introduced in coreutils-9.2]
|
||||
|
||||
'shuf' generates more-random output when the output is small.
|
||||
[bug introduced in coreutils-8.6]
|
||||
|
||||
`tail --follow=name` no longer waits indefinitely for watched
|
||||
file names that are moved elsewhere within the same file system.
|
||||
[bug introduced in coreutils-8.24]
|
||||
|
||||
`tail --follow` without --retry, will consistently exit with failure status
|
||||
where inotify is not used, when all followed files become inaccessible.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
`tail --follow --pid=PID` will now exit when the PID dies,
|
||||
even in the presence of blocking inputs like unopened fifos.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
'tail -c 4096 /dev/zero' no longer loops forever.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
'factor' now buffers output more efficiently in some cases.
|
||||
|
||||
install -C now dereferences symlink sources when comparing,
|
||||
rather than always treating as different and performing the copy.
|
||||
|
||||
kill -l and -t now list signal 0, as it's a valid signal to send.
|
||||
|
||||
ls's -f option now simply acts like -aU, instead of also ignoring
|
||||
some earlier options. For example 'ls -fl' and 'ls -lf' are now
|
||||
equivalent because -f no longer ignores an earlier -l. The new
|
||||
behavior is more orthogonal and is compatible with FreeBSD.
|
||||
|
||||
stat -f -c%T now reports the "fuseblk" file system type as "fuse",
|
||||
given that there is no longer a distinct "ctl" fuse variant file system.
|
||||
|
||||
** New Features
|
||||
|
||||
cksum -a now supports the "crc32b" option, which calculates the CRC
|
||||
of the input as defined by ITU V.42, as used by gzip for example.
|
||||
For performance pclmul instructions are used where supported.
|
||||
|
||||
ls now supports the --sort=name option,
|
||||
to explicitly select the default operation of sorting by file name.
|
||||
|
||||
printf now supports indexed arguments, using the POSIX:2024 specified
|
||||
%<i>$ format, where '<i>' is an integer referencing a particular argument,
|
||||
thus allowing repetition or reordering of printf arguments.
|
||||
|
||||
test supports the POSIX:2024 specified '<' and '>' operators with strings,
|
||||
to compare the string locale collating order.
|
||||
|
||||
timeout now supports the POSIX:2024 specified -f, and -p short options,
|
||||
corresponding to --foreground, and --preserve-status respectively.
|
||||
|
||||
** Improvements
|
||||
|
||||
cksum -a crc, makes use of AVX2, AVX512, and ARMv8 SIMD extensions
|
||||
for time reductions of up to 40%, 60%, and 80% respectively.
|
||||
|
||||
'head -c NUM', 'head -n NUM', 'nl -l NUM', 'nproc --ignore NUM',
|
||||
'tail -c NUM', 'tail -n NUM', and 'tail --max-unchanged-stats NUM’
|
||||
no longer fail merely because NUM stands for 2**64 or more.
|
||||
|
||||
sort operates more efficiently when used on pseudo files with
|
||||
an apparent size of 0, like those in /proc.
|
||||
|
||||
stat and tail now know about the "bcachefs", and "pidfs" file system types.
|
||||
stat -f -c%T now reports the file system type,
|
||||
and tail -f uses inotify for these file systems.
|
||||
|
||||
wc now reads a minimum of 256KiB at a time.
|
||||
This was previously 16KiB and increasing to 256KiB was seen to increase
|
||||
wc -l performance by about 10% when reading cached files on modern systems.
|
||||
|
||||
|
||||
* Noteworthy changes in release 9.5 (2024-03-28) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -944,7 +1108,7 @@ GNU coreutils NEWS -*- outline -*-
|
||||
env now supports '--list-signal-handling' to indicate non-default
|
||||
signal handling before executing a program.
|
||||
|
||||
** New commands
|
||||
** New programs
|
||||
|
||||
basenc is added to complement existing base64,base32 commands,
|
||||
and encodes and decodes printable text using various common encodings:
|
||||
@@ -1464,7 +1628,7 @@ GNU coreutils NEWS -*- outline -*-
|
||||
tail -F now works with initially non existent files on a remote file system.
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
** New commands
|
||||
** New programs
|
||||
|
||||
base32 is added to complement the existing base64 command,
|
||||
and encodes and decodes printable text as per RFC 4648.
|
||||
@@ -5896,7 +6060,7 @@ packages, see ./old/*/NEWS.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 2001-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
2
README
2
README
@@ -131,7 +131,7 @@ Please see the file COPYING for copying conditions.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -45,16 +45,17 @@ time and file system space requirements:
|
||||
|
||||
$ export GNULIB_SRCDIR=/path/to/gnulib
|
||||
|
||||
The next step is to get and check other files needed to build,
|
||||
which are extracted from other source packages:
|
||||
The next steps are to get and check other files needed to build,
|
||||
and complete the build:
|
||||
|
||||
$ make -f cfg.mk
|
||||
|
||||
For reference the above command runs the following steps,
|
||||
which can be done individually if required to give more control:
|
||||
|
||||
$ ./bootstrap
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure --quiet #[--disable-gcc-warnings] [*]
|
||||
$ make
|
||||
$ make check
|
||||
$ make #[check]
|
||||
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the Git master copy:
|
||||
@@ -101,7 +102,7 @@ each program. One way to do this is to use vc-dwim
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /bin/bash
|
||||
# Convert this package for use with valgrind.
|
||||
|
||||
# Copyright (C) 2002-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -140,6 +140,7 @@ Dameon G. Rogers dgr03@uark.edu
|
||||
Dan Hagerty hag@gnu.ai.it.edu
|
||||
Dan Pascu dan@services.iiruc.ro
|
||||
Daniel Bergstrom noa@melody.se
|
||||
Daniel Carpenter dansebpub@gmail.com
|
||||
Daniel Mach dmach@redhat.com
|
||||
Daniel P. Berrangé berrange@redhat.com
|
||||
Daniel Stavrovski d@stavrovski.net
|
||||
|
||||
2
TODO
2
TODO
@@ -143,7 +143,7 @@ pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
360
bootstrap
360
bootstrap
@@ -3,9 +3,9 @@
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
scriptversion=2023-12-10.18; # UTC
|
||||
scriptversion=2024-07-04.10; # UTC
|
||||
|
||||
# Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -37,9 +37,9 @@ medir=`dirname "$me"`
|
||||
|
||||
# A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
|
||||
|
||||
scriptlibversion=2023-12-10.18; # UTC
|
||||
scriptlibversion=2024-11-12.21; # UTC
|
||||
|
||||
# Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -478,10 +478,9 @@ find_tool ()
|
||||
# --------------------- Preparing GNULIB_SRCDIR for use. ---------------------
|
||||
# This is part of autopull.sh, but bootstrap needs it too, for self-upgrading.
|
||||
|
||||
# cleanup_gnulib fails, removing the directory $gnulib_path first.
|
||||
cleanup_gnulib() {
|
||||
status=$?
|
||||
# XXX It's a bad idea to erase the submodule directory if it contains local
|
||||
# modifications.
|
||||
rm -fr "$gnulib_path"
|
||||
exit $status
|
||||
}
|
||||
@@ -499,93 +498,141 @@ prepare_GNULIB_SRCDIR ()
|
||||
test -f "$GNULIB_SRCDIR/gnulib-tool" \
|
||||
|| die "Error: --gnulib-srcdir or \$GNULIB_SRCDIR is specified," \
|
||||
"but does not contain gnulib-tool"
|
||||
elif $use_git; then
|
||||
if test -n "$GNULIB_REVISION" && $use_git; then
|
||||
# The 'git checkout "$GNULIB_REVISION"' command succeeds if the
|
||||
# GNULIB_REVISION is a commit hash that exists locally, or if it is
|
||||
# branch name that can be fetched from origin. It fails, however,
|
||||
# if the GNULIB_REVISION is a commit hash that only exists in
|
||||
# origin. In this case, we need a 'git fetch' and then retry
|
||||
# 'git checkout "$GNULIB_REVISION"'.
|
||||
git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION" 2>/dev/null \
|
||||
|| { git -C "$GNULIB_SRCDIR" fetch origin \
|
||||
&& git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION"; } \
|
||||
|| exit $?
|
||||
fi
|
||||
else
|
||||
if ! $use_git; then
|
||||
die "Error: --no-git is specified," \
|
||||
"but neither --gnulib-srcdir nor \$GNULIB_SRCDIR is specified"
|
||||
fi
|
||||
if git submodule -h | grep -- --reference > /dev/null; then
|
||||
:
|
||||
else
|
||||
die "git version is too old, git >= 1.6.4 is required"
|
||||
fi
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
|
||||
# Get gnulib files. Populate $gnulib_path, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git \
|
||||
&& git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
# Use GNULIB_REFDIR as a reference.
|
||||
echo "$0: getting gnulib files..."
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||
git submodule update --init --reference "$GNULIB_REFDIR" \
|
||||
"$gnulib_path" || exit $?
|
||||
if test -n "$gnulib_path"; then
|
||||
# A submodule 'gnulib' is configured.
|
||||
# Get gnulib files. Populate $gnulib_path, updating the submodule.
|
||||
if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then
|
||||
# Use GNULIB_REFDIR as a reference.
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule update --init --reference "$GNULIB_REFDIR" "$gnulib_path"\
|
||||
|| exit $?
|
||||
else
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
# GNULIB_REFDIR is not set or not usable. Ignore it.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_REFDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
|| exit $?
|
||||
die "Error: submodule 'gnulib' has no configured url"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# GNULIB_REFDIR is not set or not usable. Ignore it.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
gnulib_path='gnulib'
|
||||
if test ! -d "$gnulib_path"; then
|
||||
# The subdirectory 'gnulib' does not yet exist. Clone into it.
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib HUP INT PIPE TERM
|
||||
|
||||
shallow=
|
||||
if test -z "$GNULIB_REVISION"; then
|
||||
if git clone -h 2>&1 | grep -- --depth > /dev/null; then
|
||||
shallow='--depth 2'
|
||||
fi
|
||||
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
||||
|| cleanup_gnulib
|
||||
gnulib_url=${GNULIB_URL:-$default_gnulib_url}
|
||||
if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then
|
||||
# Use GNULIB_REFDIR as a reference.
|
||||
git clone "$GNULIB_REFDIR" "$gnulib_path" \
|
||||
&& git -C "$gnulib_path" remote set-url origin "$gnulib_url" \
|
||||
&& if test -z "$GNULIB_REVISION"; then
|
||||
git -C "$gnulib_path" pull origin \
|
||||
&& {
|
||||
# We want the default branch of "$gnulib_url" (since that's
|
||||
# the behaviour if GNULIB_REFDIR is not specified), not the
|
||||
# current branch of "$GNULIB_REFDIR".
|
||||
default_branch=`LC_ALL=C git -C "$gnulib_path" \
|
||||
remote show origin \
|
||||
| sed -n -e 's/^ *HEAD branch: //p'`
|
||||
test -n "$default_branch" || default_branch='master'
|
||||
git -C "$gnulib_path" checkout "$default_branch"
|
||||
}
|
||||
else
|
||||
# The 'git checkout "$GNULIB_REVISION"' command succeeds if the
|
||||
# GNULIB_REVISION is a commit hash that exists locally, or if it
|
||||
# is a branch name that can be fetched from origin. It fails,
|
||||
# however, if the GNULIB_REVISION is a commit hash that only
|
||||
# exists in origin. In this case, we need a 'git fetch' and then
|
||||
# retry 'git checkout "$GNULIB_REVISION"'.
|
||||
git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \
|
||||
|| { git -C "$gnulib_path" fetch origin \
|
||||
&& git -C "$gnulib_path" checkout "$GNULIB_REVISION"; }
|
||||
fi \
|
||||
|| cleanup_gnulib
|
||||
else
|
||||
if git fetch -h 2>&1 | grep -- --depth > /dev/null; then
|
||||
shallow='--depth 2'
|
||||
# GNULIB_REFDIR is not set or not usable. Ignore it.
|
||||
shallow=
|
||||
if test -z "$GNULIB_REVISION"; then
|
||||
if git clone -h 2>&1 | grep -- --depth > /dev/null; then
|
||||
shallow='--depth 2'
|
||||
fi
|
||||
git clone $shallow "$gnulib_url" "$gnulib_path" \
|
||||
|| cleanup_gnulib
|
||||
else
|
||||
if git fetch -h 2>&1 | grep -- --depth > /dev/null; then
|
||||
shallow='--depth 2'
|
||||
fi
|
||||
mkdir -p "$gnulib_path"
|
||||
# Only want a shallow checkout of $GNULIB_REVISION, but git does not
|
||||
# support cloning by commit hash. So attempt a shallow fetch by
|
||||
# commit hash to minimize the amount of data downloaded and changes
|
||||
# needed to be processed, which can drastically reduce download and
|
||||
# processing time for checkout. If the fetch by commit fails, a
|
||||
# shallow fetch cannot be performed because we do not know what the
|
||||
# depth of the commit is without fetching all commits. So fall back
|
||||
# to fetching all commits.
|
||||
git -C "$gnulib_path" init
|
||||
git -C "$gnulib_path" remote add origin "$gnulib_url"
|
||||
git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
|
||||
|| git -C "$gnulib_path" fetch origin \
|
||||
|| cleanup_gnulib
|
||||
git -C "$gnulib_path" reset --hard FETCH_HEAD
|
||||
git -C "$gnulib_path" checkout "$GNULIB_REVISION" || cleanup_gnulib
|
||||
fi
|
||||
mkdir -p "$gnulib_path"
|
||||
# Only want a shallow checkout of $GNULIB_REVISION, but git does not
|
||||
# support cloning by commit hash. So attempt a shallow fetch by commit
|
||||
# hash to minimize the amount of data downloaded and changes needed to
|
||||
# be processed, which can drastically reduce download and processing
|
||||
# time for checkout. If the fetch by commit fails, a shallow fetch can
|
||||
# not be performed because we do not know what the depth of the commit
|
||||
# is without fetching all commits. So fall back to fetching all
|
||||
# commits.
|
||||
git -C "$gnulib_path" init
|
||||
git -C "$gnulib_path" remote add origin \
|
||||
${GNULIB_URL:-$default_gnulib_url}
|
||||
git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
|
||||
|| git -C "$gnulib_path" fetch origin \
|
||||
|| cleanup_gnulib
|
||||
git -C "$gnulib_path" reset --hard FETCH_HEAD
|
||||
fi
|
||||
|
||||
trap - HUP INT PIPE TERM
|
||||
else
|
||||
# The subdirectory 'gnulib' already exists.
|
||||
if test -n "$GNULIB_REVISION"; then
|
||||
if test -d "$gnulib_path/.git"; then
|
||||
# The 'git checkout "$GNULIB_REVISION"' command succeeds if the
|
||||
# GNULIB_REVISION is a commit hash that exists locally, or if it
|
||||
# is a branch name that can be fetched from origin. It fails,
|
||||
# however, if the GNULIB_REVISION is a commit hash that only
|
||||
# exists in origin. In this case, we need a 'git fetch' and then
|
||||
# retry 'git checkout "$GNULIB_REVISION"'.
|
||||
git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \
|
||||
|| { git -C "$gnulib_path" fetch origin \
|
||||
&& git -C "$gnulib_path" checkout "$GNULIB_REVISION"; } \
|
||||
|| exit $?
|
||||
else
|
||||
die "Error: GNULIB_REVISION is specified in bootstrap.conf," \
|
||||
"but '$gnulib_path' contains no git history"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
# Verify that the submodule contains a gnulib checkout.
|
||||
# Verify that $gnulib_path contains a gnulib checkout.
|
||||
test -f "$gnulib_path/gnulib-tool" \
|
||||
|| die "Error: $gnulib_path is supposed to contain a gnulib checkout," \
|
||||
|| die "Error: '$gnulib_path' is supposed to contain a gnulib checkout," \
|
||||
"but does not contain gnulib-tool"
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
fi
|
||||
|
||||
# XXX Should this be done if $use_git is false?
|
||||
if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
|
||||
&& ! git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
(cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
|
||||
fi
|
||||
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
}
|
||||
@@ -647,7 +694,8 @@ fi
|
||||
autopull_usage() {
|
||||
cat <<EOF
|
||||
Usage: $me [OPTION]...
|
||||
Bootstrap this package from the checked-out sources.
|
||||
Bootstrap this package from the checked-out sources, phase 1:
|
||||
Pull files from the network.
|
||||
|
||||
Optional environment variables:
|
||||
GNULIB_SRCDIR Specifies the local directory where gnulib
|
||||
@@ -664,18 +712,19 @@ Optional environment variables:
|
||||
which is Gnulib's upstream repository.
|
||||
|
||||
Options:
|
||||
--bootstrap-sync if this bootstrap script is not identical to
|
||||
|
||||
--bootstrap-sync If this bootstrap script is not identical to
|
||||
the version in the local gnulib sources,
|
||||
update this script, and then restart it with
|
||||
/bin/sh or the shell \$CONFIG_SHELL
|
||||
--no-bootstrap-sync do not check whether bootstrap is out of sync
|
||||
--force attempt to bootstrap even if the sources seem
|
||||
not to have been checked out
|
||||
--no-git do not use git to update gnulib. Requires that
|
||||
\$GNULIB_SRCDIR or the --gnulib-srcdir option
|
||||
points to a gnulib repository with the correct
|
||||
revision
|
||||
--skip-po do not download po files
|
||||
/bin/sh or the shell \$CONFIG_SHELL.
|
||||
--no-bootstrap-sync Do not check whether bootstrap is out of sync.
|
||||
|
||||
--force Attempt to bootstrap even if the sources seem
|
||||
not to have been checked out.
|
||||
--no-git Do not use git to update gnulib. Requires that
|
||||
\$GNULIB_SRCDIR points to a gnulib repository
|
||||
with the correct revision.
|
||||
--skip-po Do not download *.po files.
|
||||
EOF
|
||||
bootstrap_print_option_usage_hook
|
||||
cat <<EOF
|
||||
@@ -687,21 +736,21 @@ are honored.
|
||||
|
||||
Gnulib sources can be fetched in various ways:
|
||||
|
||||
* If the environment variable GNULIB_SRCDIR is set (either as an
|
||||
environment variable or via the --gnulib-srcdir option), then sources
|
||||
are fetched from that local directory. If it is a git repository and
|
||||
the configuration variable GNULIB_REVISION is set in bootstrap.conf,
|
||||
then that revision is checked out.
|
||||
* If the environment variable GNULIB_SRCDIR is set, then sources are
|
||||
fetched from that local directory. If it is a git repository and the
|
||||
configuration variable GNULIB_REVISION is set in bootstrap.conf, then
|
||||
that revision is checked out.
|
||||
|
||||
* Otherwise, if this package is in a git repository with a 'gnulib'
|
||||
submodule configured, then that submodule is initialized and updated
|
||||
and sources are fetched from there. If GNULIB_REFDIR is set (either
|
||||
as an environment variable or via the --gnulib-refdir option) and is
|
||||
a git repository, then it is used as a reference.
|
||||
and sources are fetched from there. If the environment variable
|
||||
GNULIB_REFDIR is set and is a git repository, then it is used as a
|
||||
reference.
|
||||
|
||||
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
|
||||
are cloned into that directory using git from \$GNULIB_URL, defaulting
|
||||
to $default_gnulib_url.
|
||||
to $default_gnulib_url; if GNULIB_REFDIR is set and is a git repository
|
||||
its contents may be used to accelerate the process.
|
||||
If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
|
||||
then that revision is checked out.
|
||||
|
||||
@@ -869,9 +918,7 @@ update_po_files() {
|
||||
&& ls "$ref_po_dir"/*.po 2>/dev/null |
|
||||
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
|
||||
|
||||
langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
|
||||
test "$langs" = '*' && langs=x
|
||||
for po in $langs; do
|
||||
for po in x $(ls $ref_po_dir | sed -n 's/\.po$//p'); do
|
||||
case $po in x) continue;; esac
|
||||
new_po="$ref_po_dir/$po.po"
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
@@ -890,7 +937,8 @@ update_po_files() {
|
||||
autogen_usage() {
|
||||
cat <<EOF
|
||||
Usage: $me [OPTION]...
|
||||
Bootstrap this package from the checked-out sources.
|
||||
Bootstrap this package from the checked-out sources, phase 2:
|
||||
Generate files from local files (no network access).
|
||||
|
||||
Optional environment variables:
|
||||
GNULIB_SRCDIR Specifies the local directory where gnulib
|
||||
@@ -899,9 +947,9 @@ Optional environment variables:
|
||||
you want to use these sources.
|
||||
|
||||
Options:
|
||||
--copy copy files instead of creating symbolic links
|
||||
--force attempt to bootstrap even if the sources seem
|
||||
not to have been checked out
|
||||
--copy Copy files instead of creating symbolic links.
|
||||
--force Attempt to bootstrap even if the sources seem
|
||||
not to have been checked out.
|
||||
EOF
|
||||
bootstrap_print_option_usage_hook
|
||||
cat <<EOF
|
||||
@@ -1234,6 +1282,20 @@ autogen()
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
|
||||
if test $with_gettext = yes && test ! -f $m4_base/gettext.m4; then
|
||||
# The gnulib-tool invocation has removed $m4_base/gettext.m4, that the
|
||||
# AUTOPOINT invocation had installed. This can occur when the gnulib
|
||||
# module 'gettext' was previously present but is now not present any more.
|
||||
# Repeat the AUTOPOINT invocation and the gnulib-tool invocation.
|
||||
|
||||
echo "$0: $AUTOPOINT --force"
|
||||
$AUTOPOINT --force || return
|
||||
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
fi
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
@@ -1319,7 +1381,7 @@ autogen()
|
||||
|| die 'cannot generate runtime-po/Makevars'
|
||||
|
||||
# Copy identical files from po to runtime-po.
|
||||
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
||||
cp -p po/Makefile.in.in po/*-quot po/*.header po/*.sed po/*.sin runtime-po
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1331,7 +1393,7 @@ autogen()
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Local Variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "scriptlibversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
@@ -1347,44 +1409,55 @@ Optional environment variables:
|
||||
GNULIB_SRCDIR Specifies the local directory where gnulib
|
||||
sources reside. Use this if you already
|
||||
have gnulib sources on your machine, and
|
||||
do not want to waste your bandwidth downloading
|
||||
them again.
|
||||
GNULIB_URL URL of the gnulib repository. The default is
|
||||
$default_gnulib_url,
|
||||
which is Gnulib's upstream repository.
|
||||
|
||||
Options:
|
||||
|
||||
--pull Do phase 1: pull files from network
|
||||
--gen Do phase 2: generate from local files.
|
||||
(The default is to do both phases.)
|
||||
|
||||
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
|
||||
sources reside. Use this if you already
|
||||
have gnulib sources on your machine, and
|
||||
you want to use these sources. Defaults
|
||||
to \$GNULIB_SRCDIR
|
||||
--gnulib-refdir=DIRNAME specify the local directory where a gnulib
|
||||
you want to use these sources.
|
||||
GNULIB_REFDIR Specifies the local directory where a gnulib
|
||||
repository (with a .git subdirectory) resides.
|
||||
Use this if you already have gnulib sources
|
||||
and history on your machine, and do not want
|
||||
to waste your bandwidth downloading them again.
|
||||
Defaults to \$GNULIB_REFDIR
|
||||
Only used for phase 1 (--pull).
|
||||
GNULIB_URL URL of the gnulib repository. The default is
|
||||
$default_gnulib_url,
|
||||
which is Gnulib's upstream repository.
|
||||
Only used for phase 1 (--pull).
|
||||
|
||||
--bootstrap-sync if this bootstrap script is not identical to
|
||||
Options:
|
||||
|
||||
--pull Do phase 1: Pull files from the network.
|
||||
--gen Do phase 2: Generate files from local files
|
||||
(no network access).
|
||||
(The default is to do both phases.)
|
||||
|
||||
--gnulib-srcdir=DIRNAME Specifies the local directory where gnulib
|
||||
sources reside. Use this if you already
|
||||
have gnulib sources on your machine, and
|
||||
you want to use these sources. Defaults
|
||||
to \$GNULIB_SRCDIR.
|
||||
--gnulib-refdir=DIRNAME Specifies the local directory where a gnulib
|
||||
repository (with a .git subdirectory) resides.
|
||||
Use this if you already have gnulib sources
|
||||
and history on your machine, and do not want
|
||||
to waste your bandwidth downloading them again.
|
||||
Defaults to \$GNULIB_REFDIR.
|
||||
Only used for phase 1 (--pull).
|
||||
|
||||
--bootstrap-sync If this bootstrap script is not identical to
|
||||
the version in the local gnulib sources,
|
||||
update this script, and then restart it with
|
||||
/bin/sh or the shell \$CONFIG_SHELL
|
||||
--no-bootstrap-sync do not check whether bootstrap is out of sync
|
||||
/bin/sh or the shell \$CONFIG_SHELL.
|
||||
--no-bootstrap-sync Do not check whether bootstrap is out of sync.
|
||||
|
||||
--copy copy files instead of creating symbolic links
|
||||
--force attempt to bootstrap even if the sources seem
|
||||
not to have been checked out
|
||||
--no-git do not use git to update gnulib. Requires that
|
||||
--copy Copy files instead of creating symbolic links.
|
||||
Only used for phase 2 (--gen).
|
||||
--force Attempt to bootstrap even if the sources seem
|
||||
not to have been checked out.
|
||||
--no-git Do not use git to update gnulib. Requires that
|
||||
\$GNULIB_SRCDIR or the --gnulib-srcdir option
|
||||
points to a gnulib repository with the correct
|
||||
revision
|
||||
--skip-po do not download po files
|
||||
revision.
|
||||
Only used for phase 1 (--pull).
|
||||
--skip-po Do not download *.po files.
|
||||
Only used for phase 1 (--pull).
|
||||
EOF
|
||||
bootstrap_print_option_usage_hook
|
||||
cat <<EOF
|
||||
@@ -1396,11 +1469,11 @@ are honored.
|
||||
|
||||
Gnulib sources can be fetched in various ways:
|
||||
|
||||
* If the environment variable GNULIB_SRCDIR is set (either as an
|
||||
environment variable or via the --gnulib-srcdir option), then sources
|
||||
are fetched from that local directory. If it is a git repository and
|
||||
the configuration variable GNULIB_REVISION is set in bootstrap.conf,
|
||||
then that revision is checked out.
|
||||
* If GNULIB_SRCDIR is set (either as an environment variable or via the
|
||||
--gnulib-srcdir option), then sources are fetched from that local
|
||||
directory. If it is a git repository and the configuration variable
|
||||
GNULIB_REVISION is set in bootstrap.conf, then that revision is
|
||||
checked out.
|
||||
|
||||
* Otherwise, if this package is in a git repository with a 'gnulib'
|
||||
submodule configured, then that submodule is initialized and updated
|
||||
@@ -1410,7 +1483,8 @@ Gnulib sources can be fetched in various ways:
|
||||
|
||||
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
|
||||
are cloned into that directory using git from \$GNULIB_URL, defaulting
|
||||
to $default_gnulib_url.
|
||||
to $default_gnulib_url; if GNULIB_REFDIR is set and is a git repository
|
||||
its contents may be used to accelerate the process.
|
||||
If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
|
||||
then that revision is checked out.
|
||||
|
||||
@@ -1521,16 +1595,16 @@ if $pull && { $use_git || test -z "$SKIP_PO"; }; then
|
||||
fi
|
||||
|
||||
if $gen; then
|
||||
autogen \
|
||||
`if $copy; then echo ' --copy'; fi` \
|
||||
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|
||||
|| die "could not generate auxiliary files"
|
||||
autogen \
|
||||
`if $copy; then echo ' --copy'; fi` \
|
||||
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|
||||
|| die "could not generate auxiliary files"
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Local Variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -28,6 +28,7 @@ avoided_gnulib_modules='
|
||||
gnulib_modules="
|
||||
$avoided_gnulib_modules
|
||||
acl
|
||||
acl-permissions
|
||||
alignalloc
|
||||
alignasof
|
||||
alloca
|
||||
@@ -45,9 +46,9 @@ gnulib_modules="
|
||||
backupfile
|
||||
base32
|
||||
base64
|
||||
bool
|
||||
btoc32
|
||||
buffer-lcm
|
||||
byteswap
|
||||
c-strcase
|
||||
c32iscntrl
|
||||
c32isspace
|
||||
@@ -64,7 +65,7 @@ gnulib_modules="
|
||||
config-h
|
||||
configmake
|
||||
copy-file-range
|
||||
count-leading-zeros
|
||||
crc-x86_64
|
||||
crypto/md5
|
||||
crypto/sha1
|
||||
crypto/sha256
|
||||
@@ -77,8 +78,10 @@ gnulib_modules="
|
||||
dirfd
|
||||
dirname
|
||||
do-release-commit-and-tag
|
||||
dtimespec-bound
|
||||
dtoastr
|
||||
dup2
|
||||
endian
|
||||
environ
|
||||
error
|
||||
euidaccess
|
||||
@@ -145,7 +148,7 @@ gnulib_modules="
|
||||
idx
|
||||
ignore-value
|
||||
inttostr
|
||||
inttypes
|
||||
inttypes-h
|
||||
isapipe
|
||||
isatty
|
||||
isblank
|
||||
@@ -213,7 +216,7 @@ gnulib_modules="
|
||||
pthread-mutex
|
||||
pthread-thread
|
||||
pthread_sigmask
|
||||
putenv
|
||||
putenv-gnu
|
||||
quote
|
||||
quotearg
|
||||
randint
|
||||
@@ -246,10 +249,12 @@ gnulib_modules="
|
||||
stat-macros
|
||||
stat-size
|
||||
stat-time
|
||||
stdbool
|
||||
stdckdint
|
||||
stdc_leading_zeros
|
||||
stdc_trailing_zeros
|
||||
stdckdint-h
|
||||
stdlib-safer
|
||||
stpcpy
|
||||
str_endswith
|
||||
strdup-posix
|
||||
strnlen
|
||||
strnumcmp
|
||||
@@ -257,13 +262,14 @@ gnulib_modules="
|
||||
strtoimax
|
||||
strtoumax
|
||||
symlinkat
|
||||
sys_ioctl
|
||||
sys_resource
|
||||
sys_stat
|
||||
sys_wait
|
||||
sys_ioctl-h
|
||||
sys_resource-h
|
||||
sys_stat-h
|
||||
sys_types-h
|
||||
sys_wait-h
|
||||
targetdir
|
||||
tempname
|
||||
termios
|
||||
termios-h
|
||||
time_rz
|
||||
timer-time
|
||||
timespec
|
||||
@@ -309,6 +315,7 @@ gnulib_modules="
|
||||
xstrtol-error
|
||||
xstrtold
|
||||
xstrtoumax
|
||||
xvasprintf
|
||||
year2038-recommended
|
||||
yesno
|
||||
"
|
||||
@@ -384,6 +391,9 @@ bootstrap_post_import_hook ()
|
||||
&& build-aux/gen-single-binary.sh src/local.mk >$tmp \
|
||||
&& chmod a-w $tmp \
|
||||
&& mv -f $tmp $mkf)
|
||||
|
||||
# Copy tests/init.sh from Gnulib.
|
||||
$gnulib_tool --copy-file tests/init.sh
|
||||
}
|
||||
|
||||
|
||||
|
||||
46
cfg.mk
46
cfg.mk
@@ -1,5 +1,5 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -48,7 +48,7 @@ export VERBOSE = yes
|
||||
# 4914152 9e
|
||||
export XZ_OPT = -8e
|
||||
|
||||
old_NEWS_hash = d66ee7a9fdb974017a4a17cf358d047d
|
||||
old_NEWS_hash = be5016485c56f34b60ba4e6d3b407489
|
||||
|
||||
# Add an exemption for sc_makefile_at_at_check.
|
||||
_makefile_at_at_check_exceptions = \
|
||||
@@ -57,6 +57,11 @@ _makefile_at_at_check_exceptions = \
|
||||
# Our help-version script is in a slightly different location.
|
||||
_hv_file ?= $(srcdir)/tests/misc/help-version
|
||||
|
||||
world:
|
||||
./bootstrap && \
|
||||
./configure --quiet && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) -j $$(nproc 2>/dev/null || echo 1)
|
||||
|
||||
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
|
||||
dd = $(srcdir)/src/dd.c
|
||||
sc_dd_O_FLAGS:
|
||||
@@ -116,7 +121,7 @@ sc_tests_list_consistency:
|
||||
cd $(top_srcdir); \
|
||||
$(SHELL) build-aux/vc-list-files tests \
|
||||
| grep -Ev '^tests/(factor/(run|create-test)|init)\.sh$$' \
|
||||
| grep -E "$$test_extensions_rx\$$"; \
|
||||
| grep -E "($$test_extensions_rx)$$"; \
|
||||
} | sort | uniq -u | grep . && exit 1; :
|
||||
|
||||
# Ensure that all version-controlled test scripts are executable.
|
||||
@@ -493,6 +498,12 @@ sc_prohibit_NULL:
|
||||
halt='use nullptr instead' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_bare_set:
|
||||
@prohibit='^ *set [`$$]' \
|
||||
in_vc_files='\.sh$$' \
|
||||
halt='use set -- $$args instead of set $$args' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
|
||||
sc_prohibit_emacs__indent_tabs_mode__setting:
|
||||
@prohibit='^( *[*#] *)?indent-tabs-mode:' \
|
||||
@@ -814,6 +825,21 @@ sc_gitignore_missing:
|
||||
# sort | uniq -d | grep . && { echo '$(ME): Remove above' \
|
||||
# 'entries from .gitignore' >&2; exit 1; } || :
|
||||
|
||||
# Ensure gl/ files are distributed
|
||||
sc_gldist_missing:
|
||||
@cd $(srcdir); \
|
||||
grep '^gl/' gl/local.mk > $@.a; \
|
||||
find gl '(' -name Makefile.am ')' -prune -o -type f \
|
||||
'!' '(' -name '*.orig' -or -name '*~' -or \
|
||||
-name 'ChangeLog.*' ')' -printf '%p\n' | \
|
||||
LC_ALL=C sort | tr '\012' @ | sed 's/@$$/%/;s/@/ \\@/g' | \
|
||||
tr @% '\012\012' > $@.e; \
|
||||
diff -u $@.a $@.e; diff=$$?; \
|
||||
rm -f $@.a $@.e; \
|
||||
test "$$diff" = 0 \
|
||||
|| { echo '$(ME): Inconsistent EXTRA_DIST in gl/local.mk'>&2; \
|
||||
exit 1; }
|
||||
|
||||
sc_prohibit-form-feed:
|
||||
@prohibit=$$'\f' \
|
||||
in_vc_files='\.[chly]$$' \
|
||||
@@ -900,7 +926,7 @@ exclude_file_name_regexp--sc_prohibit-gl-attributes = ^src/libstdbuf\.c$$
|
||||
exclude_file_name_regexp--sc_prohibit_uppercase_id_est = \.diff$$
|
||||
exclude_file_name_regexp--sc_ensure_dblspace_after_dot_before_id_est = \.diff$$
|
||||
exclude_file_name_regexp--sc_ensure_comma_after_id_est = \.diff|$(_ll)$$
|
||||
exclude_file_name_regexp--sc_long_lines = \.diff$$|$(_ll)|$(_cksum)
|
||||
exclude_file_name_regexp--sc_long_lines = \.diff$$|$(_ll)|$(_cksum)|bootstrap
|
||||
|
||||
# `grep . -q` is not exactly equivalent to `grep . >/dev/null`
|
||||
# and this difference is significant in the NEWS description
|
||||
@@ -923,13 +949,15 @@ _gl_TS_unmarked_extern_functions = main usage
|
||||
_gl_TS_unmarked_extern_functions += single_binary_main_.* _usage_.*
|
||||
# Headers to search for single line extern _data_ declarations.
|
||||
_gl_TS_other_headers = $(srcdir)/src/*.h src/*.h
|
||||
# Tell the tight_scope rule about an exceptional "extern" variable.
|
||||
# Normally, the rule would detect its declaration, but that uses a
|
||||
# different name, __clz_tab.
|
||||
_gl_TS_unmarked_extern_vars = factor_clz_tab
|
||||
# Avoid tight_scope rule stating these should be static
|
||||
# as there is no way to achieve that with the way these are defined.
|
||||
_gl_TS_unmarked_extern_vars += ptr_MD5_.*
|
||||
_gl_TS_unmarked_extern_vars = ptr_MD5_.*
|
||||
# Other tight_scope settings
|
||||
_gl_TS_dir = .
|
||||
_gl_TS_obj_files = src/*.$(OBJEXT)
|
||||
# Settings for running codespell.
|
||||
csiwl_1 = debbugs,clen,te,bu,shs,linke,fo,souch,inout,outin
|
||||
csiwl_2 = kno,ois,afile,whats,hda,indx,ot,nam
|
||||
codespell_ignore_words_list = $(csiwl_1),$(csiwl_2)
|
||||
exclude_file_name_regexp--sc_codespell = \
|
||||
^(THANKS\.in|tests/pr/.*(F|tn?|l(o|m|i)|bl))$$
|
||||
|
||||
127
configure.ac
127
configure.ac
@@ -1,7 +1,7 @@
|
||||
# -*- autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 1991-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -198,7 +198,6 @@ if test $gl_gcc_warnings != no; then
|
||||
nw="$nw -Wtraditional" # Warns on #elif which we use often
|
||||
nw="$nw -Wcast-qual" # Too many warnings for now
|
||||
nw="$nw -Wconversion" # Too many warnings for now
|
||||
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
|
||||
nw="$nw -Wsign-conversion" # Too many warnings for now
|
||||
nw="$nw -Wtraditional-conversion" # Too many warnings for now
|
||||
nw="$nw -Wunreachable-code" # Too many warnings for now
|
||||
@@ -206,8 +205,6 @@ if test $gl_gcc_warnings != no; then
|
||||
nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
|
||||
nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
|
||||
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
|
||||
nw="$nw -Wswitch-enum" # Too many warnings for now
|
||||
nw="$nw -Wswitch-default" # Too many warnings for now
|
||||
nw="$nw -Wstack-protector" # not worth working around
|
||||
nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 110333
|
||||
nw="$nw -Wformat-truncation=2" # False alarm in ls.c, probably related
|
||||
@@ -231,6 +228,7 @@ if test $gl_gcc_warnings != no; then
|
||||
# Code like that still infloops with gcc-4.6.0 and -O2. Scary indeed.
|
||||
|
||||
gl_MANYWARN_ALL_GCC([ws])
|
||||
AS_VAR_APPEND([ws], [' -Wswitch-enum'])
|
||||
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
|
||||
for w in $ws; do
|
||||
gl_WARN_ADD([$w])
|
||||
@@ -259,6 +257,7 @@ if test $gl_gcc_warnings != no; then
|
||||
nw=$ew
|
||||
nw="$nw -Wduplicated-branches" # Too many false alarms
|
||||
nw="$nw -Wformat-truncation=2"
|
||||
nw="$nw -Wmissing-variable-declarations"
|
||||
nw="$nw -Wstrict-overflow"
|
||||
nw="$nw -Wuninitialized"
|
||||
nw="$nw -Wunused-macros"
|
||||
@@ -283,6 +282,7 @@ if test $gl_gcc_warnings != no; then
|
||||
nw=
|
||||
nw="$nw -Wstrict-prototypes"
|
||||
# It's not worth being this picky about test programs.
|
||||
nw="$nw -Wsuggest-attribute=cold"
|
||||
nw="$nw -Wsuggest-attribute=const"
|
||||
nw="$nw -Wsuggest-attribute=format"
|
||||
nw="$nw -Wsuggest-attribute=pure"
|
||||
@@ -366,8 +366,8 @@ AS_CASE([$LIB_CRYPTO],
|
||||
[# Check for dlopen and libcrypto dynamic linking in one program,
|
||||
# as there's little point to checking them separately.
|
||||
AC_CACHE_CHECK([for dlopen and whether libcrypto is linked dynamically],
|
||||
[utils_cv_dlopen_libcrypto],
|
||||
[utils_cv_dlopen_libcrypto=no
|
||||
[utils_cv_libcrypto_soname],
|
||||
[utils_cv_libcrypto_soname=no
|
||||
saved_LIBS=$LIBS
|
||||
LIBS="$LIBS $LIB_DL $LIB_CRYPTO"
|
||||
AC_LINK_IFELSE(
|
||||
@@ -385,14 +385,14 @@ AS_CASE([$LIB_CRYPTO],
|
||||
sed -n 's/.*\(libcrypto\.so\.[[.0-9]]*\).*/\1/p'`"
|
||||
AS_CASE([$LIBCRYPTO_SONAME],
|
||||
[*libcrypto*],
|
||||
[utils_cv_dlopen_libcrypto=yes])])
|
||||
[utils_cv_libcrypto_soname=$LIBCRYPTO_SONAME])])
|
||||
LIBS=$saved_LIBS])
|
||||
AS_CASE([$utils_cv_dlopen_libcrypto],
|
||||
[yes],
|
||||
AS_CASE([$utils_cv_libcrypto_soname],
|
||||
[*libcrypto*],
|
||||
[AC_DEFINE([DLOPEN_LIBCRYPTO], [1],
|
||||
[Define to 1 if dlopen exists and libcrypto is
|
||||
linked dynamically.])
|
||||
AC_DEFINE_UNQUOTED([LIBCRYPTO_SONAME], ["$LIBCRYPTO_SONAME"],
|
||||
AC_DEFINE_UNQUOTED([LIBCRYPTO_SONAME], ["$utils_cv_libcrypto_soname"],
|
||||
[versioned libcrypto])
|
||||
])])
|
||||
|
||||
@@ -617,6 +617,40 @@ if test $utils_cv_brain_16_bit_supported = yes; then
|
||||
AC_DEFINE([BF16_SUPPORTED], [1], [Brain 16 bit float supported])
|
||||
fi
|
||||
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-march=armv8-a+crypto $CFLAGS"
|
||||
AC_MSG_CHECKING([if vmull intrinsic exists])
|
||||
AC_CACHE_VAL([utils_cv_vmull_intrinsic_exists],[
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <sys/auxv.h>
|
||||
#include <asm/hwcap.h>
|
||||
#include <arm_neon.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
uint64x2_t a;
|
||||
poly64_t shift64 = vget_lane_p64(vcreate_p64(0xB8BC6765), 0);
|
||||
a = vreinterpretq_u64_p128(vmull_p64(shift64, vreinterpretq_p128_u64(a)));
|
||||
return (getauxval(AT_HWCAP) & HWCAP_PMULL) > 0;
|
||||
}
|
||||
]])
|
||||
],[
|
||||
utils_cv_vmull_intrinsic_exists=yes
|
||||
],[
|
||||
utils_cv_vmull_intrinsic_exists=no
|
||||
])])
|
||||
AC_MSG_RESULT([$utils_cv_vmull_intrinsic_exists])
|
||||
if test $utils_cv_vmull_intrinsic_exists = yes; then
|
||||
AC_DEFINE([USE_VMULL_CRC32], [1],
|
||||
[CRC32 calculation by vmull hardware instruction enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([USE_VMULL_CRC32],
|
||||
[test $utils_cv_vmull_intrinsic_exists = yes])
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-mavx -mpclmul $CFLAGS"
|
||||
AC_MSG_CHECKING([if pclmul intrinsic exists])
|
||||
@@ -648,6 +682,74 @@ AM_CONDITIONAL([USE_PCLMUL_CRC32],
|
||||
[test $utils_cv_pclmul_intrinsic_exists = yes])
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS=" -mavx2 -mvpclmulqdq $CFLAGS"
|
||||
AC_MSG_CHECKING([if avx2 pclmul intrinsic exists])
|
||||
AC_CACHE_VAL([utils_cv_avx2_pclmul_intrinsic_exists],[
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <x86intrin.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
__m256i a, b;
|
||||
a = _mm256_clmulepi64_epi128 (a, b, 0x00);
|
||||
a = _mm256_shuffle_epi8 (a, b);
|
||||
return __builtin_cpu_supports ("avx2") &&
|
||||
__builtin_cpu_supports ("vpclmulqdq");
|
||||
}
|
||||
]])
|
||||
],[
|
||||
utils_cv_avx2_pclmul_intrinsic_exists=yes
|
||||
],[
|
||||
utils_cv_avx2_pclmul_intrinsic_exists=no
|
||||
])])
|
||||
AC_MSG_RESULT([$utils_cv_avx2_pclmul_intrinsic_exists])
|
||||
if test $utils_cv_avx2_pclmul_intrinsic_exists = yes; then
|
||||
AC_DEFINE([USE_AVX2_CRC32], [1],
|
||||
[CRC32 calculation by avx2 hardware instructions enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([USE_AVX2_CRC32],
|
||||
[test $utils_cv_avx2_pclmul_intrinsic_exists = yes])
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS=" -mavx512bw -mavx512f -mvpclmulqdq $CFLAGS"
|
||||
AC_MSG_CHECKING([if avx512 pclmul intrinsic exists])
|
||||
AC_CACHE_VAL([utils_cv_avx512_pclmul_intrinsic_exists],[
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <x86intrin.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
__m512i a, b;
|
||||
a = _mm512_set_epi8 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
a = _mm512_clmulepi64_epi128 (a, b, 0x00);
|
||||
a = _mm512_shuffle_epi8 (a, b);
|
||||
return __builtin_cpu_supports ("avx512bw") &&
|
||||
__builtin_cpu_supports ("avx512f");
|
||||
}
|
||||
]])
|
||||
],[
|
||||
utils_cv_avx512_pclmul_intrinsic_exists=yes
|
||||
],[
|
||||
utils_cv_avx512_pclmul_intrinsic_exists=no
|
||||
])])
|
||||
AC_MSG_RESULT([$utils_cv_avx512_pclmul_intrinsic_exists])
|
||||
if test $utils_cv_avx512_pclmul_intrinsic_exists = yes; then
|
||||
AC_DEFINE([USE_AVX512_CRC32], [1],
|
||||
[CRC32 calculation by avx512 hardware instructions enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([USE_AVX512_CRC32],
|
||||
[test $utils_cv_avx512_pclmul_intrinsic_exists = yes])
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
|
||||
CFLAGS="-mavx2 $CFLAGS"
|
||||
AC_MSG_CHECKING([for avx2 intrinsics])
|
||||
AC_CACHE_VAL([utils_cv_avx2_intrinsic_exists],[
|
||||
@@ -658,8 +760,9 @@ AC_LINK_IFELSE(
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
__m256i a, b;
|
||||
a = _mm256_sad_epu8 (a, b);
|
||||
__m256i matches = _mm256_setzero_si256 ();
|
||||
int mask = _mm256_movemask_epi8 (matches);
|
||||
int lines = __builtin_popcount (mask);
|
||||
return __builtin_cpu_supports ("avx2");
|
||||
}
|
||||
]])
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
This manual documents version @value{VERSION} of the GNU core
|
||||
utilities, including the standard programs for text and file manipulation.
|
||||
|
||||
Copyright @copyright{} 1994--2024 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1994--2025 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
@@ -1083,8 +1083,16 @@ apparent file sizes, whereas the @option{--block-size} option does.
|
||||
A @var{signal} may be a signal name like @samp{HUP}, or a signal
|
||||
number like @samp{1}, or an exit status of a process terminated by the
|
||||
signal. A signal name can be given in canonical form or prefixed by
|
||||
@samp{SIG}@. The case of the letters is ignored. The following signal names
|
||||
and numbers are supported on all POSIX compliant systems:
|
||||
@samp{SIG}@. The case of the letters is ignored.
|
||||
|
||||
@noindent
|
||||
The signal @samp{0} pseudo signal is synonymous with the name @samp{EXIT}
|
||||
with the GNU @command{kill} command, and @command{bash} at least,
|
||||
as @code{trap foo 0} and @code{trap foo EXIT} are equivalent.
|
||||
|
||||
@noindent
|
||||
The following signal names and numbers are supported
|
||||
on all POSIX compliant systems:
|
||||
|
||||
@table @samp
|
||||
@item HUP
|
||||
@@ -1552,7 +1560,7 @@ case-insensitive @code{inf}, @code{infinity}, and @code{NaN}, although
|
||||
whether such values are useful depends on the command in question.
|
||||
Modern C implementations also accept hexadecimal floating point
|
||||
numbers such as @code{-0x.ep-3}, which stands for @minus{}14/16 times
|
||||
@math{2^-3}, which equals @minus{}0.109375. @xref{Parsing of
|
||||
@math{2^{-3}}, which equals @minus{}0.109375. @xref{Parsing of
|
||||
Floats,,, libc, The GNU C Library Reference Manual}.
|
||||
|
||||
@vindex LC_NUMERIC
|
||||
@@ -4051,7 +4059,8 @@ and the file name unless no arguments were given.
|
||||
The 32-bit CRC used is based on the polynomial used
|
||||
for CRC error checking in the ISO/IEC 8802-3:1996 standard (Ethernet).
|
||||
Similar output formats are used for the other legacy checksums
|
||||
selectable with @option{--algorithm=sysv} or @option{--algorithm=bsd},
|
||||
selectable with @option{--algorithm=crc32b}, and
|
||||
@option{--algorithm=sysv} or @option{--algorithm=bsd}
|
||||
detailed at @ref{sum invocation}.
|
||||
|
||||
@item Tagged output format
|
||||
@@ -4100,6 +4109,7 @@ Supported legacy checksums (which are not supported by @option{--check}):
|
||||
@samp{sysv} equivalent to @command{sum -s}
|
||||
@samp{bsd} equivalent to @command{sum -r}
|
||||
@samp{crc} equivalent to @command{cksum} (the default)
|
||||
@samp{crc32b} only available through @command{cksum}
|
||||
@end example
|
||||
|
||||
Supported more modern digest algorithms are:
|
||||
@@ -4151,7 +4161,7 @@ as the length is automatically determined when checking.
|
||||
Print only the unencoded raw binary digest for a single input.
|
||||
Do not output the file name or anything else.
|
||||
Use network byte order (big endian) where applicable:
|
||||
for @samp{bsd}, @samp{crc}, and @samp{sysv}.
|
||||
for @samp{bsd}, @samp{crc}, @samp{crc32b}, and @samp{sysv}.
|
||||
This option works only with a single input.
|
||||
Unlike other output formats, @command{cksum} provides no way to
|
||||
@option{--check} a @option{--raw} checksum.
|
||||
@@ -4225,7 +4235,7 @@ a checksum inconsistent with the associated file, or if no valid
|
||||
line is found, @command{cksum} exits with nonzero status. Otherwise,
|
||||
it exits successfully.
|
||||
The @command{cksum} command does not support @option{--check}
|
||||
with the older @samp{sysv}, @samp{bsd}, or @samp{crc} algorithms.
|
||||
with the older @samp{sysv}, @samp{bsd}, @samp{crc} or @samp{crc32b} algorithms.
|
||||
|
||||
@item --ignore-missing
|
||||
@opindex --ignore-missing
|
||||
@@ -5151,12 +5161,22 @@ Use the common DSU, Decorate Sort Undecorate idiom to
|
||||
sort lines according to their length.
|
||||
|
||||
@example
|
||||
awk '@{print length, $0@}' /etc/passwd | sort -n | cut -f2- -d' '
|
||||
getent passwd |@/
|
||||
awk '@{print length, $0@}' | sort -n | cut -f2- -d' '
|
||||
@end example
|
||||
|
||||
In general this technique can be used to sort data that the @command{sort}
|
||||
command does not support, or is inefficient at, sorting directly.
|
||||
|
||||
@item
|
||||
Use the same DSU idiom as above to sort lines by their last field,
|
||||
and in this specific example the presented lines are users' full names.
|
||||
|
||||
@example
|
||||
getent passwd | grep -v nologin | cut -d: -f5 | grep ' ' |@/
|
||||
awk '@{print $NF, $0@}' | sort -k1,1 | cut -f2- -d' '
|
||||
@end example
|
||||
|
||||
@item
|
||||
Shuffle a list of directories, but preserve the order of files within
|
||||
each directory. For instance, one could use this to generate a music
|
||||
@@ -7630,7 +7650,8 @@ non-option argument is specified, @command{ls} operates on the current
|
||||
directory, acting as if it had been invoked with a single argument of @samp{.}.
|
||||
|
||||
@vindex LC_ALL
|
||||
By default, the output is sorted alphabetically, according to the locale
|
||||
By default, @command{ls} lists each directory's contents alphabetically,
|
||||
according to the locale
|
||||
settings in effect.@footnote{If you use a non-POSIX
|
||||
locale (e.g., by setting @env{LC_ALL} to @samp{en_US}), then @command{ls} may
|
||||
produce output that is sorted differently than you're accustomed to.
|
||||
@@ -7737,16 +7758,6 @@ or any of the following options is in effect:
|
||||
@option{--dereference} (@option{-L}), or
|
||||
@option{--dereference-command-line} (@option{-H})).
|
||||
|
||||
@item --group-directories-first
|
||||
@opindex --group-directories-first
|
||||
Group all the directories before the files and then sort the
|
||||
directories and the files separately using the selected sort key
|
||||
(see @option{--sort} option).
|
||||
That is, this option specifies a primary sort key,
|
||||
and the @option{--sort} option specifies a secondary key.
|
||||
However, any use of @option{--sort=none}
|
||||
(@option{-U}) disables this option altogether.
|
||||
|
||||
@item --hide=PATTERN
|
||||
@opindex --hide=@var{pattern}
|
||||
In directories, ignore files whose names match the shell pattern
|
||||
@@ -8073,6 +8084,10 @@ with a security context, but no other alternate access method.
|
||||
A file with any other combination of alternate access methods
|
||||
is marked with a @samp{+} character.
|
||||
|
||||
@command{ls} uses a @samp{?} character to indicate it is unable to determine
|
||||
whether alternate access methods apply to the file, which may happen for
|
||||
example with some NFS setups with files without read permission.
|
||||
|
||||
@item -n
|
||||
@itemx --numeric-uid-gid
|
||||
@opindex -n
|
||||
@@ -8127,9 +8142,12 @@ In long format, print the security context to the left of the size column.
|
||||
@subsection Sorting the output
|
||||
|
||||
@cindex sorting @command{ls} output
|
||||
These options change the order in which @command{ls} sorts the information
|
||||
it outputs. By default, sorting is done by character code
|
||||
(e.g., ASCII order).
|
||||
@vindex LC_COLLATE
|
||||
These options change the order in which @command{ls} outputs
|
||||
information for the files in a directory.
|
||||
(Command-line operands are always processed left to right.)
|
||||
By default, files are sorted alphabetically by name, using the
|
||||
character collating sequence specified by the @env{LC_COLLATE} locale.
|
||||
|
||||
@table @samp
|
||||
|
||||
@@ -8150,11 +8168,19 @@ sort according to the ctime. @xref{File timestamps}.
|
||||
@opindex -f
|
||||
@cindex unsorted directory listing
|
||||
@cindex directory order, listing by
|
||||
Produce an unsorted directory listing.
|
||||
This is like @option{--sort=none} (@option{-U}),
|
||||
but also enable @option{--all} (@option{-a}),
|
||||
while also disabling any previous use of @option{-l}, @option{--color}
|
||||
@option{--size}, or @option{--hyperlink}.
|
||||
Do not sort, and list all files.
|
||||
This is like @option{--sort=none} (@option{-U}) combined
|
||||
with @option{--all} (@option{-a}).
|
||||
|
||||
@item --group-directories-first
|
||||
@opindex --group-directories-first
|
||||
When listing a directory's files,
|
||||
group all subdirectories before non-directories
|
||||
and then sort the subdirectories and the non-directories separately.
|
||||
That is, this option specifies a primary sort key,
|
||||
and the other sorting options specify a secondary key.
|
||||
However, any use of @option{--sort=none}
|
||||
(@option{-U}) disables this option altogether.
|
||||
|
||||
@item -r
|
||||
@itemx --reverse
|
||||
@@ -8224,10 +8250,12 @@ sort according to the birth time.
|
||||
@opindex --sort
|
||||
@opindex none@r{, sorting option for @command{ls}}
|
||||
Do not sort; list the files in whatever order they are
|
||||
stored in the directory. (Do not do any of the other unrelated things
|
||||
that @option{-f} does.) This can be useful when listing large
|
||||
stored in the directory. This can be useful when listing large
|
||||
directories, where sorting can take some time.
|
||||
|
||||
Unlike @option{-f}, this option does not imply @option{--all}
|
||||
(@option{-a}).
|
||||
|
||||
@item -v
|
||||
@itemx --sort=version
|
||||
@opindex -v
|
||||
@@ -8237,6 +8265,13 @@ Sort by version name and number, lowest first. It behaves like a default
|
||||
sort, except that each sequence of decimal digits is treated numerically
|
||||
as an index/version number. @xref{Version sort ordering}.
|
||||
|
||||
@item --sort=name
|
||||
@opindex --sort
|
||||
@opindex name@r{, sorting option for @command{ls}}
|
||||
Sort by file name. This is the default operation of @command{ls},
|
||||
and can be explicitly specified to override any
|
||||
previously specified sorting option.
|
||||
|
||||
@item --sort=width
|
||||
@opindex --sort
|
||||
@opindex width@r{, sorting option for @command{ls}}
|
||||
@@ -8308,6 +8343,7 @@ Specifying @option{--color} and no @var{when} is equivalent to
|
||||
@option{--color=always}.
|
||||
If piping a colored listing through a pager like @command{less},
|
||||
use the pager's @option{-R} option to pass the color codes to the terminal.
|
||||
@xref{dircolors invocation} to configure the colors used.
|
||||
|
||||
@vindex LS_COLORS
|
||||
@vindex SHELL @r{environment variable, and color}
|
||||
@@ -8391,7 +8427,7 @@ Specifying @option{--hyperlink} and no @var{when} is equivalent to
|
||||
|
||||
@item --indicator-style=@var{word}
|
||||
@opindex --indicator-style
|
||||
Append a character indicator with style @var{word} to entry names,
|
||||
Append a character indicator with style @var{word} to file names,
|
||||
as follows:
|
||||
|
||||
@table @samp
|
||||
@@ -8419,6 +8455,7 @@ overriding any contrary specification in environment variables
|
||||
(@pxref{Block size}). If @option{--block-size},
|
||||
@option{--human-readable} (@option{-h}), or @option{--si} options are used,
|
||||
they take precedence even if @option{--kibibytes} (@option{-k}) is placed after
|
||||
the other options.
|
||||
|
||||
The @option{--kibibytes} (@option{-k}) option affects the
|
||||
per-directory block count written in long format,
|
||||
@@ -8692,7 +8729,7 @@ like @command{csh}.
|
||||
Quote strings for the shell, even if they would normally not require quoting.
|
||||
@item shell-escape
|
||||
Like @samp{shell}, but also quoting non-printable characters using the POSIX
|
||||
proposed @samp{$''} syntax suitable for most shells.
|
||||
@samp{$''} syntax suitable for most shells.
|
||||
@item shell-escape-always
|
||||
Like @samp{shell-escape}, but quote strings even if they would
|
||||
normally not require quoting.
|
||||
@@ -8700,6 +8737,9 @@ normally not require quoting.
|
||||
Quote strings as for C character string literals, including the
|
||||
surrounding double-quote characters; this is the same as the
|
||||
@option{--quote-name} (@option{-Q}) option.
|
||||
@item c-maybe
|
||||
Quote strings as for C character string literals, except omit the
|
||||
surrounding double-quote if no escaping is required.
|
||||
@item escape
|
||||
Quote strings as for C character string literals, except omit the
|
||||
surrounding double-quote
|
||||
@@ -10246,7 +10286,7 @@ The program accepts the following options. Also see @ref{Common options}.
|
||||
@opindex -f
|
||||
@opindex --force
|
||||
@cindex prompts, omitting
|
||||
Do not prompt the user before removing a destination file.
|
||||
Do not prompt the user before replacing a destination file.
|
||||
@macro mvOptsIfn
|
||||
If you specify more than one of the @option{-i}, @option{-f}, @option{-n}
|
||||
options, only the final one takes effect.
|
||||
@@ -13383,10 +13423,12 @@ printf @var{format} [@var{argument}]@dots{}
|
||||
|
||||
@command{printf} prints the @var{format} string, interpreting @samp{%}
|
||||
directives and @samp{\} escapes to format numeric and string arguments
|
||||
in a way that is mostly similar to the C @samp{printf} function.
|
||||
in a way that is mostly similar to the C @samp{printf} function,
|
||||
and C language escape sequence processing.
|
||||
@xref{Output Conversion Syntax,, @command{printf} format directives,
|
||||
libc, The GNU C Library Reference Manual}, for details.
|
||||
The differences are listed below.
|
||||
See also @uref{https://en.cppreference.com/w/c/language/escape,
|
||||
C99 string escapes:}. The differences are listed below.
|
||||
|
||||
@mayConflictWithShellBuiltIn{printf}
|
||||
|
||||
@@ -13402,6 +13444,15 @@ Missing @var{argument}s are treated as null strings or as zeros,
|
||||
depending on whether the context expects a string or a number. For
|
||||
example, the command @samp{printf %sx%d} prints @samp{x0}.
|
||||
|
||||
@item
|
||||
Indexed arguments referenced with @samp{%...$} formats, can be
|
||||
mixed with standard sequential argument references,
|
||||
in which case both index types are independent.
|
||||
For example, the command @samp{printf '%1$s%s' A} prints @samp{AA}.
|
||||
Also the highest referenced argument, either indexed or sequential,
|
||||
is considered to be the last one referenced, when determining
|
||||
unused arguments for reprocessing with the @var{format} argument.
|
||||
|
||||
@item
|
||||
@kindex \c
|
||||
An additional escape, @samp{\c}, causes @command{printf} to produce no
|
||||
@@ -13419,9 +13470,9 @@ one.
|
||||
@kindex %b
|
||||
An additional directive @samp{%b}, prints its
|
||||
argument string with @samp{\} escapes interpreted in the same way as in
|
||||
the @var{format} string, except that octal escapes are of the form
|
||||
@samp{\0@var{ooo}} where @var{ooo} is 0 to 3 octal digits. If
|
||||
@samp{\@var{ooo}} is nine-bit value, ignore the ninth bit.
|
||||
the @var{format} string, except that octal escapes should have a leading
|
||||
@samp{0} like @samp{\0@var{nnn}}.
|
||||
If @samp{@var{nnn}} is a nine-bit value, ignore the ninth bit.
|
||||
If a precision is also given, it limits the number of bytes printed
|
||||
from the converted string.
|
||||
|
||||
@@ -13429,7 +13480,7 @@ from the converted string.
|
||||
@kindex %q
|
||||
An additional directive @samp{%q}, prints its argument string
|
||||
in a format that can be reused as input by most shells.
|
||||
Non-printable characters are escaped with the POSIX proposed @samp{$''} syntax,
|
||||
Non-printable characters are escaped with the POSIX @samp{$''} syntax,
|
||||
and shell metacharacters are quoted appropriately.
|
||||
This is an equivalent format to @command{ls --quoting=shell-escape} output.
|
||||
|
||||
@@ -13696,7 +13747,7 @@ Exit status:
|
||||
* File type tests:: @code{-[bcdfhLpSt]}
|
||||
* Access permission tests:: @code{-[gkruwxOG]}
|
||||
* File characteristic tests:: @code{-e -s -nt -ot -ef}
|
||||
* String tests:: @code{-z -n = == !=}
|
||||
* String tests:: @code{-z -n = == != > <}
|
||||
* Numeric tests:: @code{-eq -ne -lt -le -gt -ge}
|
||||
* Connectives for test:: @code{! -a -o}
|
||||
@end menu
|
||||
@@ -13905,6 +13956,16 @@ shells and systems.
|
||||
@cindex not-equal string check
|
||||
True if the strings are not equal.
|
||||
|
||||
@item @var{string1} > @var{string2}
|
||||
@opindex >
|
||||
@cindex greater-than string check
|
||||
True if @var{string1} is greater than @var{string2} in the current locale.
|
||||
|
||||
@item @var{string1} < @var{string2}
|
||||
@opindex <
|
||||
@cindex less-than string check
|
||||
True if @var{string1} is less than @var{string2} in the current locale.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -14742,7 +14803,7 @@ and print its name. If given, @var{template} must include at least
|
||||
three consecutive @samp{X}s in the last component. If omitted, the template
|
||||
@samp{tmp.XXXXXXXXXX} is used, and option @option{--tmpdir} is
|
||||
implied. The final run of @samp{X}s in the @var{template} will be replaced
|
||||
by alpha-numeric characters; thus, on a case-sensitive file system,
|
||||
by alphanumeric characters; thus, on a case-sensitive file system,
|
||||
and with a @var{template} including a run of @var{n} instances of @samp{X},
|
||||
there are @samp{62**@var{n}} potential file names.
|
||||
|
||||
@@ -15818,13 +15879,14 @@ Set the output speed to @var{n}.
|
||||
@item rows @var{n}
|
||||
@opindex rows
|
||||
Tell the tty kernel driver that the terminal has @var{n} rows.
|
||||
Non-POSIX.
|
||||
|
||||
@item cols @var{n}
|
||||
@itemx columns @var{n}
|
||||
@opindex cols
|
||||
Tell the kernel that the terminal has @var{n} columns.
|
||||
|
||||
@item columns @var{n}
|
||||
@opindex columns
|
||||
Tell the kernel that the terminal has @var{n} columns. Non-POSIX.
|
||||
Same as @samp{cols}. Non-POSIX.
|
||||
|
||||
@item drain
|
||||
@opindex drain
|
||||
@@ -15849,7 +15911,6 @@ Print the number of rows and columns that the kernel thinks the
|
||||
terminal has. (Systems that don't support rows and columns in the kernel
|
||||
typically use the environment variables @env{LINES} and @env{COLUMNS}
|
||||
instead; however, GNU @command{stty} does not know anything about them.)
|
||||
Non-POSIX.
|
||||
|
||||
@item line @var{n}
|
||||
@opindex line
|
||||
@@ -16599,7 +16660,9 @@ It is normally at least two characters, but it may be more.
|
||||
@item %d
|
||||
day of month (e.g., @samp{01})
|
||||
@item %D
|
||||
date; same as @samp{%m/%d/%y}
|
||||
date; same as @samp{%m/%d/%y}.
|
||||
Although commonly used in the US, this format is confusing elsewhere,
|
||||
and it is ambiguous for dates in different centuries.
|
||||
@item %e
|
||||
day of month, space padded; same as @samp{%_d}
|
||||
@item %F
|
||||
@@ -16615,6 +16678,7 @@ year corresponding to the ISO week number, but without the century
|
||||
as @samp{%y}, except that if the ISO week number (see
|
||||
@samp{%V}) belongs
|
||||
to the previous or next year, that year is used instead.
|
||||
This format is ambiguous for dates in different centuries.
|
||||
@item %G
|
||||
year corresponding to the ISO week number. This has the
|
||||
same format and value as @samp{%Y}, except that if the ISO
|
||||
@@ -16653,9 +16717,11 @@ week number of year, with Monday as first day of week
|
||||
(@samp{00}@dots{}@samp{53}).
|
||||
Days in a new year preceding the first Monday are in week zero.
|
||||
@item %x
|
||||
locale's date representation (e.g., @samp{12/31/99})
|
||||
locale's date representation (e.g., @samp{12/31/99}).
|
||||
This format can be ambiguous for dates in different centuries.
|
||||
@item %y
|
||||
last two digits of year (@samp{00}@dots{}@samp{99})
|
||||
last two digits of year (@samp{00}@dots{}@samp{99}).
|
||||
This format is ambiguous for dates in different centuries.
|
||||
@item %Y
|
||||
year. This is normally at least four characters, but it may be more.
|
||||
Year @samp{0000} precedes year @samp{0001}, and year @samp{-001}
|
||||
@@ -18773,13 +18839,9 @@ The program accepts the following options. Also see @ref{Common options}.
|
||||
Options must precede operands.
|
||||
|
||||
@table @samp
|
||||
@item --preserve-status
|
||||
@opindex --preserve-status
|
||||
Return the exit status of the managed @var{command} on timeout, rather than
|
||||
a specific exit status indicating a timeout. This is useful if the
|
||||
managed @var{command} supports running for an indeterminate amount of time.
|
||||
|
||||
@item --foreground
|
||||
@item -f
|
||||
@itemx --foreground
|
||||
@opindex -f
|
||||
@opindex --foreground
|
||||
Don't create a separate background program group, so that
|
||||
the managed @var{command} can use the foreground TTY normally.
|
||||
@@ -18819,6 +18881,14 @@ either because the signal was blocked or ignored, or if the @var{command} takes
|
||||
too long (e.g. for cleanup work) to terminate itself within a certain amount
|
||||
of time.
|
||||
|
||||
@item -p
|
||||
@itemx --preserve-status
|
||||
@opindex -p
|
||||
@opindex --preserve-status
|
||||
Return the exit status of the managed @var{command} on timeout, rather than
|
||||
a specific exit status indicating a timeout. This is useful if the
|
||||
managed @var{command} supports running for an indeterminate amount of time.
|
||||
|
||||
@item -s @var{signal}
|
||||
@itemx --signal=@var{signal}
|
||||
@opindex -s
|
||||
@@ -18843,6 +18913,11 @@ C locale (@pxref{Floating point}) followed by an optional unit:
|
||||
@samp{h} for hours
|
||||
@samp{d} for days
|
||||
@end display
|
||||
@macro hexDuration
|
||||
A hexadecimal number can precede a @samp{d} suffix only if the number
|
||||
has a @samp{p} style exponent, e.g., @samp{0x1p0d} means one day.
|
||||
@end macro
|
||||
@hexDuration
|
||||
A duration of 0 disables the associated timeout.
|
||||
The actual timeout duration is dependent on system conditions,
|
||||
which should be especially considered when specifying sub-second timeouts.
|
||||
@@ -19019,6 +19094,8 @@ non-negative integer argument without a suffix, GNU @command{sleep}
|
||||
also accepts two or more arguments, unit suffixes, and floating-point
|
||||
numbers in either the current or the C locale. @xref{Floating point}.
|
||||
|
||||
@hexDuration
|
||||
|
||||
For instance, the following could be used to @command{sleep} for
|
||||
1 second, 234 milli-, 567 micro- and 890 nanoseconds:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Make coreutils documentation. -*-Makefile-*-
|
||||
# This is included by the top-level Makefile.am.
|
||||
|
||||
# Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@c File mode bits
|
||||
|
||||
@c Copyright (C) 1994--2024 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 1994--2025 Free Software Foundation, Inc.
|
||||
|
||||
@c Permission is granted to copy, distribute and/or modify this document
|
||||
@c under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@c GNU Version-sort ordering documentation
|
||||
|
||||
@c Copyright (C) 2019--2024 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 2019--2025 Free Software Foundation, Inc.
|
||||
|
||||
@c Permission is granted to copy, distribute and/or modify this document
|
||||
@c under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* buffer-lcm.c - compute a good buffer size for dealing with two files
|
||||
|
||||
Copyright (C) 2002-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Convert string to double in the current locale, falling back on the C locale.
|
||||
|
||||
Copyright 2019-2024 Free Software Foundation, Inc.
|
||||
Copyright 2019-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
3
gl/lib/dtimespec-bound.c
Normal file
3
gl/lib/dtimespec-bound.c
Normal file
@@ -0,0 +1,3 @@
|
||||
#include <config.h>
|
||||
#define DTIMESPEC_BOUND_INLINE _GL_EXTERN_INLINE
|
||||
#include "dtimespec-bound.h"
|
||||
76
gl/lib/dtimespec-bound.h
Normal file
76
gl/lib/dtimespec-bound.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* Compute a timespec-related bound for floating point.
|
||||
|
||||
Copyright 2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Paul Eggert */
|
||||
|
||||
#ifndef DTIMESPEC_BOUND_H
|
||||
# define DTIMESPEC_BOUND_H 1
|
||||
|
||||
/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */
|
||||
# if !_GL_CONFIG_H_INCLUDED
|
||||
# error "Please include config.h first."
|
||||
# endif
|
||||
|
||||
# include <errno.h>
|
||||
# include <float.h>
|
||||
# include <math.h>
|
||||
|
||||
_GL_INLINE_HEADER_BEGIN
|
||||
# ifndef DTIMESPEC_BOUND_INLINE
|
||||
# define DTIMESPEC_BOUND_INLINE _GL_INLINE
|
||||
# endif
|
||||
|
||||
/* If C is positive and finite, return the least floating point value
|
||||
greater than C. However, if 0 < C < (2 * DBL_TRUE_MIN) / (DBL_EPSILON**2),
|
||||
return a positive value less than 1e-9.
|
||||
|
||||
If C is +0.0, return a positive value < 1e-9 if ERR == ERANGE, C otherwise.
|
||||
If C is +Inf, return C.
|
||||
If C is negative, return -timespec_roundup(-C).
|
||||
If C is a NaN, return a NaN.
|
||||
|
||||
Assume round-to-even.
|
||||
|
||||
This function can be useful if some floating point operation
|
||||
rounded to C but we want a nearby bound on the true value, where
|
||||
the bound can be converted to struct timespec. If the operation
|
||||
underflowed to zero, ERR should be ERANGE a la strtod. */
|
||||
|
||||
DTIMESPEC_BOUND_INLINE double
|
||||
dtimespec_bound (double c, int err)
|
||||
{
|
||||
/* Do not use copysign or nextafter, as they link to -lm in GNU/Linux. */
|
||||
|
||||
/* Use DBL_TRUE_MIN for the special case of underflowing to zero;
|
||||
any positive value less than 1e-9 will do. */
|
||||
if (err == ERANGE && c == 0)
|
||||
return signbit (c) ? -DBL_TRUE_MIN : DBL_TRUE_MIN;
|
||||
|
||||
/* This is the first part of Algorithm 2 of:
|
||||
Rump SM, Zimmermann P, Boldo S, Melquiond G.
|
||||
Computing predecessor and successor in rounding to nearest.
|
||||
BIT Numerical Mathematics. 2009;49(419-431).
|
||||
<https://doi.org/10.1007/s10543-009-0218-z>
|
||||
The rest of Algorithm 2 is not needed because numbers less than
|
||||
the predecessor of 1e-9 merely need to stay less than 1e-9. */
|
||||
double phi = DBL_EPSILON / 2 * (1 + DBL_EPSILON);
|
||||
return c + phi * c;
|
||||
}
|
||||
|
||||
_GL_INLINE_HEADER_END
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Declare an access pattern hint for files.
|
||||
Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Declare an access pattern hint for files.
|
||||
Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Invoke open, but return either a desired file descriptor or -1.
|
||||
|
||||
Copyright (C) 2005-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Invoke open, but return either a desired file descriptor or -1.
|
||||
|
||||
Copyright (C) 2005-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Barebones heap implementation supporting only insert and pop.
|
||||
|
||||
Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,23 +25,23 @@
|
||||
#include "xalloc.h"
|
||||
|
||||
static int heap_default_compare (void const *, void const *);
|
||||
static size_t heapify_down (void **, size_t, size_t,
|
||||
int (*) (void const *, void const *));
|
||||
static void heapify_up (void **, size_t,
|
||||
static void heapify_down (void **, idx_t, idx_t,
|
||||
int (*) (void const *, void const *));
|
||||
static void heapify_up (void **, idx_t,
|
||||
int (*) (void const *, void const *));
|
||||
|
||||
struct heap
|
||||
{
|
||||
void **array; /* array[0] is not used */
|
||||
size_t capacity; /* Array size */
|
||||
size_t count; /* Used as index to last element. Also is num of items. */
|
||||
idx_t capacity; /* Array size */
|
||||
idx_t count; /* Used as index to last element. Also is num of items. */
|
||||
int (*compare) (void const *, void const *);
|
||||
};
|
||||
|
||||
/* Allocate memory for the heap. */
|
||||
|
||||
struct heap *
|
||||
heap_alloc (int (*compare) (void const *, void const *), size_t n_reserve)
|
||||
heap_alloc (int (*compare) (void const *, void const *), idx_t n_reserve)
|
||||
{
|
||||
struct heap *heap = xmalloc (sizeof *heap);
|
||||
|
||||
@@ -79,8 +79,8 @@ int
|
||||
heap_insert (struct heap *heap, void *item)
|
||||
{
|
||||
if (heap->capacity - 1 <= heap->count)
|
||||
heap->array = x2nrealloc (heap->array, &heap->capacity,
|
||||
sizeof *(heap->array));
|
||||
heap->array = xpalloc (heap->array, &heap->capacity, 1, -1,
|
||||
sizeof heap->array[0]);
|
||||
|
||||
heap->array[++heap->count] = item;
|
||||
heapify_up (heap->array, heap->count, heap->compare);
|
||||
@@ -107,16 +107,16 @@ heap_remove_top (struct heap *heap)
|
||||
|
||||
/* Move element down into appropriate position in heap. */
|
||||
|
||||
static size_t
|
||||
heapify_down (void **array, size_t count, size_t initial,
|
||||
static void
|
||||
heapify_down (void **array, idx_t count, idx_t initial,
|
||||
int (*compare) (void const *, void const *))
|
||||
{
|
||||
void *element = array[initial];
|
||||
|
||||
size_t parent = initial;
|
||||
while (parent <= count / 2)
|
||||
idx_t parent = initial;
|
||||
while (parent <= count >> 1)
|
||||
{
|
||||
size_t child = 2 * parent;
|
||||
idx_t child = 2 * parent;
|
||||
|
||||
if (child < count && compare (array[child], array[child + 1]) < 0)
|
||||
child++;
|
||||
@@ -129,22 +129,21 @@ heapify_down (void **array, size_t count, size_t initial,
|
||||
}
|
||||
|
||||
array[parent] = element;
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* Move element up into appropriate position in heap. */
|
||||
|
||||
static void
|
||||
heapify_up (void **array, size_t count,
|
||||
heapify_up (void **array, idx_t count,
|
||||
int (*compare) (void const *, void const *))
|
||||
{
|
||||
size_t k = count;
|
||||
idx_t k = count;
|
||||
void *new_element = array[k];
|
||||
|
||||
while (k != 1 && compare (array[k / 2], new_element) <= 0)
|
||||
while (k != 1 && compare (array[k >> 1], new_element) <= 0)
|
||||
{
|
||||
array[k] = array[k / 2];
|
||||
k /= 2;
|
||||
array[k] = array[k >> 1];
|
||||
k >>= 1;
|
||||
}
|
||||
|
||||
array[k] = new_element;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Barebones heap implementation supporting only insert and pop.
|
||||
|
||||
Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,13 +18,15 @@
|
||||
/* Full implementation: GDSL (http://gna.org/projects/gdsl/) by Nicolas
|
||||
Darnis <ndarnis@free.fr>. Adapted by Gene Auyeung. */
|
||||
|
||||
#include "idx.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct heap;
|
||||
|
||||
void heap_free (struct heap *) _GL_ATTRIBUTE_NONNULL ();
|
||||
|
||||
struct heap *heap_alloc (int (*) (void const *, void const *), size_t)
|
||||
struct heap *heap_alloc (int (*) (void const *, void const *), idx_t)
|
||||
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (heap_free, 1)
|
||||
_GL_ATTRIBUTE_RETURNS_NONNULL;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
|
||||
|
||||
Copyright (C) 1999-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Colin Plumb.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
|
||||
|
||||
Copyright (C) 1999-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Colin Plumb.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate random integers.
|
||||
|
||||
Copyright (C) 2006-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate random integers.
|
||||
|
||||
Copyright (C) 2006-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate random permutations.
|
||||
|
||||
Copyright (C) 2006-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -22,28 +22,15 @@
|
||||
#include "randperm.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdbit.h>
|
||||
#include <stdckdint.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "attribute.h"
|
||||
#include "count-leading-zeros.h"
|
||||
#include "hash.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
/* Return the floor of the log base 2 of N. If N is zero, return -1. */
|
||||
|
||||
ATTRIBUTE_CONST static int
|
||||
floor_lg (size_t n)
|
||||
{
|
||||
static_assert (SIZE_WIDTH <= ULLONG_WIDTH);
|
||||
return (n == 0 ? -1
|
||||
: SIZE_WIDTH <= UINT_WIDTH
|
||||
? UINT_WIDTH - 1 - count_leading_zeros (n)
|
||||
: SIZE_WIDTH <= ULONG_WIDTH
|
||||
? ULONG_WIDTH - 1 - count_leading_zeros_l (n)
|
||||
: ULLONG_WIDTH - 1 - count_leading_zeros_ll (n));
|
||||
}
|
||||
|
||||
/* Return an upper bound on the number of random bytes needed to
|
||||
generate the first H elements of a random permutation of N
|
||||
elements. H must not exceed N. */
|
||||
@@ -53,13 +40,15 @@ randperm_bound (size_t h, size_t n)
|
||||
{
|
||||
/* Upper bound on number of bits needed to generate the first number
|
||||
of the permutation. */
|
||||
uintmax_t lg_n = floor_lg (n) + 1;
|
||||
unsigned int lg_n = stdc_bit_width (n) + 1;
|
||||
|
||||
/* Upper bound on number of bits needed to generated the first H elements. */
|
||||
uintmax_t ar = lg_n * h;
|
||||
/* Upper bound on number of bits needed to generate the first H elements. */
|
||||
uintmax_t ar;
|
||||
if (ckd_mul (&ar, lg_n, h))
|
||||
return SIZE_MAX;
|
||||
|
||||
/* Convert the bit count to a byte count. */
|
||||
size_t bound = (ar + CHAR_BIT - 1) / CHAR_BIT;
|
||||
size_t bound = ar / CHAR_BIT + (ar % CHAR_BIT != 0);
|
||||
|
||||
return bound;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -189,9 +189,19 @@ randread_new (char const *name, size_t bytes_bound)
|
||||
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
|
||||
else
|
||||
{
|
||||
/* Fill the ISAAC buffer. Although it is tempting to read at
|
||||
most BYTES_BOUND bytes, this is incorrect for two reasons.
|
||||
First, BYTES_BOUND is just an estimate.
|
||||
Second, even if the estimate is correct
|
||||
ISAAC64 poorly randomizes when BYTES_BOUND is small
|
||||
and just the first few bytes of s->buf.isaac.state.m
|
||||
are random while the other bytes are all zero. See:
|
||||
Aumasson J-P. On the pseudo-random generator ISAAC.
|
||||
Cryptology ePrint Archive. 2006;438.
|
||||
<https://eprint.iacr.org/2006/438>. */
|
||||
s->buf.isaac.buffered = 0;
|
||||
if (! get_nonce (s->buf.isaac.state.m,
|
||||
MIN (sizeof s->buf.isaac.state.m, bytes_bound)))
|
||||
sizeof s->buf.isaac.state.m))
|
||||
{
|
||||
int e = errno;
|
||||
randread_free_body (s);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* root-dev-ino.c -- get the device and inode numbers for '/'.
|
||||
Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Root device and inode number checking.
|
||||
|
||||
Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Skipping sequences of characters satisfying a predicate
|
||||
|
||||
Copyright 2023-2024 Free Software Foundation, Inc.
|
||||
Copyright 2023-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Include and determine availability of smack routines
|
||||
Copyright (C) 2013-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compare integer strings.
|
||||
|
||||
Copyright (C) 2005-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compare numeric strings. This is an internal include file.
|
||||
|
||||
Copyright (C) 1988-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -22,21 +22,12 @@
|
||||
|
||||
# include "strnumcmp.h"
|
||||
|
||||
# include "c-ctype.h"
|
||||
# include <stddef.h>
|
||||
|
||||
# define NEGATION_SIGN '-'
|
||||
# define NUMERIC_ZERO '0'
|
||||
|
||||
/* ISDIGIT differs from isdigit, as follows:
|
||||
- Its arg may be any int or unsigned int; it need not be an unsigned char
|
||||
or EOF.
|
||||
- It's typically faster.
|
||||
POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
|
||||
isdigit unless it's important to use the locale's definition
|
||||
of 'digit' even when the host does not conform to POSIX. */
|
||||
# define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
|
||||
|
||||
|
||||
/* Compare strings A and B containing decimal fractions < 1.
|
||||
DECIMAL_POINT is the decimal point. Each string
|
||||
should begin with a decimal point followed immediately by the digits
|
||||
@@ -76,13 +67,13 @@ fraccompare (char const *a, char const *b, char decimal_point)
|
||||
if (*a == decimal_point && *b == decimal_point)
|
||||
{
|
||||
while (*++a == *++b)
|
||||
if (! ISDIGIT (*a))
|
||||
if (! c_isdigit (*a))
|
||||
return 0;
|
||||
if (ISDIGIT (*a) && ISDIGIT (*b))
|
||||
if (c_isdigit (*a) && c_isdigit (*b))
|
||||
return *a - *b;
|
||||
if (ISDIGIT (*a))
|
||||
if (c_isdigit (*a))
|
||||
goto a_trailing_nonzero;
|
||||
if (ISDIGIT (*b))
|
||||
if (c_isdigit (*b))
|
||||
goto b_trailing_nonzero;
|
||||
return 0;
|
||||
}
|
||||
@@ -91,14 +82,14 @@ fraccompare (char const *a, char const *b, char decimal_point)
|
||||
a_trailing_nonzero:
|
||||
while (*a == NUMERIC_ZERO)
|
||||
a++;
|
||||
return ISDIGIT (*a);
|
||||
return c_isdigit (*a);
|
||||
}
|
||||
else if (*b++ == decimal_point)
|
||||
{
|
||||
b_trailing_nonzero:
|
||||
while (*b == NUMERIC_ZERO)
|
||||
b++;
|
||||
return - ISDIGIT (*b);
|
||||
return - c_isdigit (*b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -131,7 +122,7 @@ numcompare (char const *a, char const *b,
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == NUMERIC_ZERO);
|
||||
if (ISDIGIT (tmpa))
|
||||
if (c_isdigit (tmpa))
|
||||
return -1;
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
|
||||
tmpb = *++b;
|
||||
@@ -139,13 +130,13 @@ numcompare (char const *a, char const *b,
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO);
|
||||
return - ISDIGIT (tmpb);
|
||||
return - c_isdigit (tmpb);
|
||||
}
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep);
|
||||
|
||||
while (tmpa == tmpb && ISDIGIT (tmpa))
|
||||
while (tmpa == tmpb && c_isdigit (tmpa))
|
||||
{
|
||||
do
|
||||
tmpa = *++a;
|
||||
@@ -155,18 +146,18 @@ numcompare (char const *a, char const *b,
|
||||
while (tmpb == thousands_sep);
|
||||
}
|
||||
|
||||
if ((tmpa == decimal_point && !ISDIGIT (tmpb))
|
||||
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
|
||||
if ((tmpa == decimal_point && !c_isdigit (tmpb))
|
||||
|| (tmpb == decimal_point && !c_isdigit (tmpa)))
|
||||
return fraccompare (b, a, decimal_point);
|
||||
|
||||
tmp = tmpb - tmpa;
|
||||
|
||||
for (log_a = 0; ISDIGIT (tmpa); ++log_a)
|
||||
for (log_a = 0; c_isdigit (tmpa); ++log_a)
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
|
||||
for (log_b = 0; ISDIGIT (tmpb); ++log_b)
|
||||
for (log_b = 0; c_isdigit (tmpb); ++log_b)
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
@@ -188,7 +179,7 @@ numcompare (char const *a, char const *b,
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO);
|
||||
if (ISDIGIT (tmpb))
|
||||
if (c_isdigit (tmpb))
|
||||
return 1;
|
||||
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep)
|
||||
tmpa = *++a;
|
||||
@@ -196,7 +187,7 @@ numcompare (char const *a, char const *b,
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == NUMERIC_ZERO);
|
||||
return ISDIGIT (tmpa);
|
||||
return c_isdigit (tmpa);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -205,7 +196,7 @@ numcompare (char const *a, char const *b,
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
|
||||
tmpb = *++b;
|
||||
|
||||
while (tmpa == tmpb && ISDIGIT (tmpa))
|
||||
while (tmpa == tmpb && c_isdigit (tmpa))
|
||||
{
|
||||
do
|
||||
tmpa = *++a;
|
||||
@@ -215,18 +206,18 @@ numcompare (char const *a, char const *b,
|
||||
while (tmpb == thousands_sep);
|
||||
}
|
||||
|
||||
if ((tmpa == decimal_point && !ISDIGIT (tmpb))
|
||||
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
|
||||
if ((tmpa == decimal_point && !c_isdigit (tmpb))
|
||||
|| (tmpb == decimal_point && !c_isdigit (tmpa)))
|
||||
return fraccompare (a, b, decimal_point);
|
||||
|
||||
tmp = tmpa - tmpb;
|
||||
|
||||
for (log_a = 0; ISDIGIT (tmpa); ++log_a)
|
||||
for (log_a = 0; c_isdigit (tmpa); ++log_a)
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
|
||||
for (log_b = 0; ISDIGIT (tmpb); ++log_b)
|
||||
for (log_b = 0; c_isdigit (tmpb); ++log_b)
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compare numeric strings.
|
||||
|
||||
Copyright (C) 2005-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Target directory operands for coreutils
|
||||
|
||||
Copyright 2004-2024 Free Software Foundation, Inc.
|
||||
Copyright 2004-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Target directory operands for coreutils
|
||||
|
||||
Copyright 2022-2024 Free Software Foundation, Inc.
|
||||
Copyright 2022-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
#define __xnumtoint xnumtoimax
|
||||
#define __xdectoint_t intmax_t
|
||||
#define __xstrtol xstrtoimax
|
||||
#define __xdectoint_signed 1
|
||||
#include "xdectoint.c"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Convert decimal strings with bounds checking and exit on error.
|
||||
|
||||
Copyright (C) 2014-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2014-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <error.h>
|
||||
@@ -29,50 +28,59 @@
|
||||
#include <xstrtol.h>
|
||||
|
||||
/* Parse numeric string N_STR of base BASE, and return the value.
|
||||
Exit on parse error or if MIN or MAX are exceeded.
|
||||
The value is between MIN and MAX.
|
||||
Strings can have multiplicative SUFFIXES if specified.
|
||||
ERR is printed along with N_STR on error. */
|
||||
On a parse error or out-of-range number, diagnose with N_STR and ERR, and
|
||||
exit with status ERR_EXIT if nonzero, EXIT_FAILURE otherwise.
|
||||
However, if FLAGS & XTOINT_MIN_QUIET, do not diagnose or exit
|
||||
for too-low numbers; return MIN and set errno instead.
|
||||
Similarly for XTOINT_MAX_QUIET and too-high numbers and MAX.
|
||||
The errno value and diagnostic for out-of-range values depend on
|
||||
whether FLAGS & XTOINT_MIN_RANGE and FLAGS & XTOINT_MAX_RANGE are set. */
|
||||
|
||||
__xdectoint_t
|
||||
__xnumtoint (char const *n_str, int base, __xdectoint_t min, __xdectoint_t max,
|
||||
char const *suffixes, char const *err, int err_exit)
|
||||
char const *suffixes, char const *err, int err_exit,
|
||||
int flags)
|
||||
{
|
||||
strtol_error s_err;
|
||||
__xdectoint_t tnum, r;
|
||||
strtol_error s_err = __xstrtol (n_str, nullptr, base, &tnum, suffixes);
|
||||
|
||||
__xdectoint_t tnum;
|
||||
s_err = __xstrtol (n_str, nullptr, base, &tnum, suffixes);
|
||||
/* Errno value to report if there is an overflow. */
|
||||
int overflow_errno;
|
||||
|
||||
if (s_err == LONGINT_OK)
|
||||
if (s_err != LONGINT_INVALID)
|
||||
{
|
||||
if (tnum < min || max < tnum)
|
||||
if (tnum < min)
|
||||
{
|
||||
s_err = LONGINT_OVERFLOW;
|
||||
/* Use have the INT range as a heuristic to distinguish
|
||||
type overflow rather than other min/max limits. */
|
||||
if (tnum > INT_MAX / 2)
|
||||
errno = EOVERFLOW;
|
||||
#if __xdectoint_signed
|
||||
else if (tnum < INT_MIN / 2)
|
||||
errno = EOVERFLOW;
|
||||
#endif
|
||||
else
|
||||
errno = ERANGE;
|
||||
r = min;
|
||||
overflow_errno = flags & XTOINT_MIN_RANGE ? ERANGE : EOVERFLOW;
|
||||
if (s_err == LONGINT_OK)
|
||||
s_err = LONGINT_OVERFLOW;
|
||||
}
|
||||
else if (max < tnum)
|
||||
{
|
||||
r = max;
|
||||
overflow_errno = flags & XTOINT_MAX_RANGE ? ERANGE : EOVERFLOW;
|
||||
if (s_err == LONGINT_OK)
|
||||
s_err = LONGINT_OVERFLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = tnum;
|
||||
overflow_errno = EOVERFLOW;
|
||||
}
|
||||
}
|
||||
else if (s_err == LONGINT_OVERFLOW)
|
||||
errno = EOVERFLOW;
|
||||
else if (s_err == LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW)
|
||||
errno = 0; /* Don't show ERANGE errors for invalid numbers. */
|
||||
|
||||
if (s_err != LONGINT_OK)
|
||||
{
|
||||
/* EINVAL error message is redundant in this context. */
|
||||
error (err_exit ? err_exit : EXIT_FAILURE, errno == EINVAL ? 0 : errno,
|
||||
"%s: %s", err, quote (n_str));
|
||||
unreachable ();
|
||||
}
|
||||
int e = s_err == LONGINT_OVERFLOW ? overflow_errno : 0;
|
||||
|
||||
return tnum;
|
||||
if (! (s_err == LONGINT_OK
|
||||
|| (s_err == LONGINT_OVERFLOW
|
||||
&& flags & (tnum < 0 ? XTOINT_MIN_QUIET : XTOINT_MAX_QUIET))))
|
||||
error (err_exit ? err_exit : EXIT_FAILURE, e, "%s: %s", err, quote (n_str));
|
||||
|
||||
errno = e;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Parse decimal string N_STR, and return the value.
|
||||
@@ -84,5 +92,5 @@ __xdectoint_t
|
||||
__xdectoint (char const *n_str, __xdectoint_t min, __xdectoint_t max,
|
||||
char const *suffixes, char const *err, int err_exit)
|
||||
{
|
||||
return __xnumtoint (n_str, 10, min, max, suffixes, err, err_exit);
|
||||
return __xnumtoint (n_str, 10, min, max, suffixes, err, err_exit, 0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Convert decimal strings with bounds checking and exit on error.
|
||||
|
||||
Copyright (C) 2014-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2014-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,13 +20,32 @@
|
||||
|
||||
# include <inttypes.h>
|
||||
|
||||
/* Flags for xnumtoimax and xnumtoumax. They can be ORed togethar. */
|
||||
enum
|
||||
{
|
||||
/* If the number is less than MIN, do not diagnose the problem;
|
||||
instead, return MIN and set errno to EOVERFLOW or ERANGE. */
|
||||
XTOINT_MIN_QUIET = 1 << 0,
|
||||
|
||||
/* Likewise for the MAX argument. */
|
||||
XTOINT_MAX_QUIET = 1 << 1,
|
||||
|
||||
/* The MIN argument is imposed by the caller, not by the type of
|
||||
the result. This causes the function to use ERANGE rather
|
||||
than EOVERFLOW behavior when issuing diagnostics or setting errno. */
|
||||
XTOINT_MIN_RANGE = 1 << 2,
|
||||
|
||||
/* Likewise for the MAX argument. */
|
||||
XTOINT_MAX_RANGE = 1 << 3
|
||||
};
|
||||
|
||||
# define _DECLARE_XDECTOINT(name, type) \
|
||||
type name (char const *n_str, type min, type max, \
|
||||
char const *suffixes, char const *err, int err_exit) \
|
||||
_GL_ATTRIBUTE_NONNULL ((1, 5));
|
||||
# define _DECLARE_XNUMTOINT(name, type) \
|
||||
type name (char const *n_str, int base, type min, type max, \
|
||||
char const *suffixes, char const *err, int err_exit) \
|
||||
char const *suffixes, char const *err, int err_exit, int flags) \
|
||||
_GL_ATTRIBUTE_NONNULL ((1, 6));
|
||||
|
||||
_DECLARE_XDECTOINT (xdectoimax, intmax_t)
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
#define __xnumtoint xnumtoumax
|
||||
#define __xdectoint_t uintmax_t
|
||||
#define __xstrtol xstrtoumax
|
||||
#define __xdectoint_signed 0
|
||||
#include "xdectoint.c"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* xfts.c -- a wrapper for fts_open
|
||||
|
||||
Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
81
gl/local.mk
Normal file
81
gl/local.mk
Normal file
@@ -0,0 +1,81 @@
|
||||
# Make coreutils programs. -*-Makefile-*-
|
||||
# This is included by the top-level Makefile.am.
|
||||
|
||||
## Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
EXTRA_DIST += \
|
||||
gl/lib/buffer-lcm.c \
|
||||
gl/lib/buffer-lcm.h \
|
||||
gl/lib/cl-strtod.c \
|
||||
gl/lib/cl-strtod.h \
|
||||
gl/lib/cl-strtold.c \
|
||||
gl/lib/dtimespec-bound.c \
|
||||
gl/lib/dtimespec-bound.h \
|
||||
gl/lib/fadvise.c \
|
||||
gl/lib/fadvise.h \
|
||||
gl/lib/fd-reopen.c \
|
||||
gl/lib/fd-reopen.h \
|
||||
gl/lib/heap.c \
|
||||
gl/lib/heap.h \
|
||||
gl/lib/rand-isaac.c \
|
||||
gl/lib/rand-isaac.h \
|
||||
gl/lib/randint.c \
|
||||
gl/lib/randint.h \
|
||||
gl/lib/randperm.c \
|
||||
gl/lib/randperm.h \
|
||||
gl/lib/randread.c \
|
||||
gl/lib/randread.h \
|
||||
gl/lib/root-dev-ino.c \
|
||||
gl/lib/root-dev-ino.h \
|
||||
gl/lib/skipchars.c \
|
||||
gl/lib/skipchars.h \
|
||||
gl/lib/smack.h \
|
||||
gl/lib/strintcmp.c \
|
||||
gl/lib/strnumcmp-in.h \
|
||||
gl/lib/strnumcmp.c \
|
||||
gl/lib/strnumcmp.h \
|
||||
gl/lib/targetdir.c \
|
||||
gl/lib/targetdir.h \
|
||||
gl/lib/xdectoimax.c \
|
||||
gl/lib/xdectoint.c \
|
||||
gl/lib/xdectoint.h \
|
||||
gl/lib/xdectoumax.c \
|
||||
gl/lib/xfts.c \
|
||||
gl/lib/xfts.h \
|
||||
gl/local.mk \
|
||||
gl/modules/buffer-lcm \
|
||||
gl/modules/cl-strtod \
|
||||
gl/modules/cl-strtold \
|
||||
gl/modules/dtimespec-bound \
|
||||
gl/modules/fadvise \
|
||||
gl/modules/fadvise-tests \
|
||||
gl/modules/fd-reopen \
|
||||
gl/modules/heap \
|
||||
gl/modules/link-tests.diff \
|
||||
gl/modules/randint \
|
||||
gl/modules/randperm \
|
||||
gl/modules/randread \
|
||||
gl/modules/randread-tests \
|
||||
gl/modules/rename-tests.diff \
|
||||
gl/modules/root-dev-ino \
|
||||
gl/modules/skipchars \
|
||||
gl/modules/smack \
|
||||
gl/modules/strnumcmp \
|
||||
gl/modules/targetdir \
|
||||
gl/modules/xdectoint \
|
||||
gl/modules/xfts \
|
||||
gl/tests/test-fadvise.c \
|
||||
gl/tests/test-rand-isaac.c
|
||||
@@ -6,7 +6,7 @@ lib/buffer-lcm.c
|
||||
lib/buffer-lcm.h
|
||||
|
||||
Depends-on:
|
||||
stddef
|
||||
stddef-h
|
||||
|
||||
configure.ac:
|
||||
|
||||
|
||||
24
gl/modules/dtimespec-bound
Normal file
24
gl/modules/dtimespec-bound
Normal file
@@ -0,0 +1,24 @@
|
||||
Description:
|
||||
Adjust a double to provide a timespec bound.
|
||||
|
||||
Files:
|
||||
lib/dtimespec-bound.c
|
||||
lib/dtimespec-bound.h
|
||||
|
||||
Depends-on:
|
||||
float-h
|
||||
signbit
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += dtimespec-bound.c
|
||||
|
||||
Include:
|
||||
"dtimespec-bound.h"
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
all
|
||||
@@ -6,6 +6,7 @@ lib/heap.c
|
||||
lib/heap.h
|
||||
|
||||
Depends-on:
|
||||
idx
|
||||
stdlib-safer
|
||||
xalloc
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ lib/randperm.h
|
||||
|
||||
Depends-on:
|
||||
assert-h
|
||||
count-leading-zeros
|
||||
randint
|
||||
stdint
|
||||
stdc_bit_width
|
||||
stdint-h
|
||||
xalloc
|
||||
hash
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ lib/randread.h
|
||||
|
||||
Depends-on:
|
||||
alignasof
|
||||
bool
|
||||
error
|
||||
exitfail
|
||||
inline
|
||||
@@ -16,8 +17,7 @@ fopen-safer
|
||||
getrandom
|
||||
quote
|
||||
minmax
|
||||
stdbool
|
||||
stdint
|
||||
stdint-h
|
||||
unlocked-io
|
||||
xalloc
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@ lib/strnumcmp.h
|
||||
lib/strnumcmp-in.h
|
||||
|
||||
Depends-on:
|
||||
c-ctype
|
||||
inline
|
||||
stddef
|
||||
stddef-h
|
||||
|
||||
configure.ac:
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ lib/targetdir.h
|
||||
|
||||
Depends-on:
|
||||
attribute
|
||||
bool
|
||||
fcntl-h
|
||||
stdbool
|
||||
|
||||
configure.ac:
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ lib/xdectoimax.c
|
||||
lib/xdectoumax.c
|
||||
|
||||
Depends-on:
|
||||
bool
|
||||
error
|
||||
errno
|
||||
errno-h
|
||||
quote
|
||||
stdbool
|
||||
verify
|
||||
xstrtoimax
|
||||
xstrtoumax
|
||||
|
||||
@@ -6,7 +6,7 @@ lib/xfts.c
|
||||
lib/xfts.h
|
||||
|
||||
Depends-on:
|
||||
stddef
|
||||
stddef-h
|
||||
|
||||
configure.ac:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Test that fadvise works as advertised.
|
||||
Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Test the ISAAC or ISAAC64 pseudorandom number generator.
|
||||
|
||||
Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
2
gnulib
2
gnulib
Submodule gnulib updated: 259829e78b...41e7b7e0d1
26
init.cfg
26
init.cfg
@@ -1,6 +1,6 @@
|
||||
# This file is sourced by init.sh, *before* its initialization.
|
||||
|
||||
# Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -178,6 +178,8 @@ ulimit_supported_()
|
||||
v="$1"
|
||||
shift
|
||||
|
||||
local ulimit_start_=$(date +%s) || skip_ 'ulimit: date error'
|
||||
|
||||
(
|
||||
# Try to disable core dumps which may
|
||||
# occur with memory constraints
|
||||
@@ -185,6 +187,16 @@ ulimit_supported_()
|
||||
|
||||
ulimit -v $v && "$@"
|
||||
) >/dev/null 2>&1
|
||||
|
||||
ret=$?
|
||||
|
||||
local ulimit_end_=$(date +%s) || skip_ 'ulimit: date error'
|
||||
|
||||
# This can happen on Solaris 11 at least where fork() can give EAGAIN
|
||||
# and bash will retry for at least 16 seconds
|
||||
test $(($ulimit_end_ - $ulimit_start_)) -ge 10 && skip_ 'ulimit too slow'
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Determine the minimum required VM limit to run the given command.
|
||||
@@ -200,11 +212,15 @@ get_min_ulimit_v_()
|
||||
page_size=$(($page_size / 1024))
|
||||
|
||||
for v in $( seq 5000 5000 50000 ); do
|
||||
if ulimit_supported_ $v "$@"; then
|
||||
ulimit_supported_ $v "$@"; ret=$?
|
||||
test $ret = 77 && break;
|
||||
if test $ret = 0; then
|
||||
local prev_v
|
||||
prev_v=$v
|
||||
for v in $( seq $(($prev_v-1000)) -1000 1000 ); do
|
||||
ulimit_supported_ $v "$@" ||
|
||||
ulimit_supported_ $v "$@"; ret=$?
|
||||
test $ret = 77 && break 2;
|
||||
test $ret = 0 ||
|
||||
{
|
||||
ret_v=$((prev_v + $page_size))
|
||||
echo $ret_v
|
||||
@@ -570,7 +586,7 @@ seek_data_capable_()
|
||||
# We saw FreeBSD 9.1 take 35s to return from SEEK_DATA for a 1TiB empty file.
|
||||
# Note lseek() is uninterruptible on FreeBSD 9.1, but it does eventually
|
||||
# return, and the timeout will ensure a failure return from the process.
|
||||
timeout --version >/dev/null && TIMEOUT_='timeout 10'
|
||||
timeout 1 true >/dev/null && TIMEOUT_='timeout 10'
|
||||
|
||||
$TIMEOUT_ $PYTHON_ "$abs_srcdir"/tests/seek-data-capable "$@"
|
||||
}
|
||||
@@ -660,7 +676,7 @@ mkfifo_or_skip_()
|
||||
|
||||
trap_sigpipe_or_skip_()
|
||||
{
|
||||
timeout --version >/dev/null ||
|
||||
timeout 1 true >/dev/null ||
|
||||
skip_ 'trapping SIGPIPE cannot be safely checked'
|
||||
|
||||
(trap '' PIPE && timeout 10 yes |:) 2>&1 | grep 'Broken pipe' >/dev/null ||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Exercise chdir-long's sample main program.
|
||||
|
||||
# Copyright (C) 2005-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#serial 27
|
||||
# Check declarations for this package.
|
||||
|
||||
dnl Copyright (C) 1997-2024 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 1997-2025 Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#serial 2
|
||||
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#serial 115 -*- autoconf -*-
|
||||
#serial 116 -*- autoconf -*-
|
||||
|
||||
dnl Misc type-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -215,18 +215,25 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
|
||||
AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
|
||||
|
||||
AC_REQUIRE([AC_TYPE_GETGROUPS])
|
||||
|
||||
dnl FIXME is this section still needed?
|
||||
dnl These types are universally available now.
|
||||
AC_REQUIRE([AC_TYPE_MBSTATE_T])
|
||||
AC_REQUIRE([AC_TYPE_MODE_T])
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])
|
||||
AC_REQUIRE([AC_TYPE_PID_T])
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])
|
||||
AC_REQUIRE([AC_TYPE_UID_T])
|
||||
AC_CHECK_TYPE([ino_t], [unsigned long int])
|
||||
AC_CHECK_TYPE([ino_t], [],
|
||||
[AC_DEFINE([ino_t], [unsigned long int],
|
||||
[Type of file serial numbers, also known as inode numbers.])])
|
||||
|
||||
dnl This relies on the fact that Autoconf's implementation of
|
||||
dnl AC_CHECK_TYPE checks includes unistd.h.
|
||||
AC_CHECK_TYPE([major_t], [unsigned int])
|
||||
AC_CHECK_TYPE([minor_t], [unsigned int])
|
||||
AC_CHECK_TYPE([major_t], [],
|
||||
[AC_DEFINE([major_t], [unsigned int], [Type of major device numbers.])])
|
||||
AC_CHECK_TYPE([minor_t], [],
|
||||
[AC_DEFINE([minor_t], [unsigned int], [Type of minor device numbers.])])
|
||||
|
||||
AC_REQUIRE([AC_HEADER_MAJOR])
|
||||
])
|
||||
|
||||
@@ -7,7 +7,7 @@ m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
|
||||
# directory of the coreutils package.
|
||||
|
||||
|
||||
# Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# stat-prog.m4 serial 7
|
||||
# Record the prerequisites of src/stat.c from the coreutils package.
|
||||
|
||||
# Copyright (C) 2002-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 2018-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 2018-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
2
man/df.x
2
man/df.x
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
2
man/du.x
2
man/du.x
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
23
man/env.x
23
man/env.x
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
@@ -7,11 +7,10 @@
|
||||
env \- run a program in a modified environment
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[OPTIONS]
|
||||
.SS "\-S/\-\-split\-string usage in scripts"
|
||||
[SCRIPT OPTION HANDLING]
|
||||
The
|
||||
.B \-S
|
||||
option allows specifying multiple parameters in a script.
|
||||
option allows specifying multiple arguments in a script.
|
||||
Running a script named
|
||||
.B 1.pl
|
||||
containing the following first line:
|
||||
@@ -24,7 +23,7 @@ containing the following first line:
|
||||
.RE
|
||||
.PP
|
||||
Will execute
|
||||
.B "perl \-w \-T 1.pl".
|
||||
.B "perl \-w \-T 1.pl"
|
||||
.PP
|
||||
Without the
|
||||
.B '\-S'
|
||||
@@ -38,20 +37,6 @@ parameter the script will likely fail with:
|
||||
.PP
|
||||
See the full documentation for more details.
|
||||
.PP
|
||||
.SS "\-\-default-signal[=SIG]" usage
|
||||
This option allows setting a signal handler to its default
|
||||
action, which is not possible using the traditional shell
|
||||
trap command. The following example ensures that seq
|
||||
will be terminated by SIGPIPE no matter how this signal
|
||||
is being handled in the process invoking the command.
|
||||
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
sh \-c 'env \-\-default-signal=PIPE seq inf | head \-n1'
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
|
||||
[NOTES]
|
||||
POSIX's exec(3p) pages says:
|
||||
|
||||
84
man/help2man
84
man/help2man
@@ -2,8 +2,8 @@
|
||||
|
||||
# Generate a short man page from --help and --version output.
|
||||
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009,
|
||||
# 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2020, 2021 Free Software
|
||||
# Foundation, Inc.
|
||||
# 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2020, 2021, 2022, 2025
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -29,7 +29,7 @@ use Text::Tabs qw(expand);
|
||||
use POSIX qw(strftime setlocale LC_ALL);
|
||||
|
||||
my $this_program = 'help2man';
|
||||
my $this_version = '1.48.5';
|
||||
my $this_version = '1.50.1';
|
||||
|
||||
sub _ { $_[0] }
|
||||
sub configure_locale
|
||||
@@ -49,13 +49,14 @@ sub program_basename;
|
||||
sub get_option_value;
|
||||
sub convert_option;
|
||||
sub fix_italic_spacing;
|
||||
sub set_indent;
|
||||
|
||||
my $version_info = enc_user sprintf _(<<'EOT'), $this_program, $this_version;
|
||||
GNU %s %s
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009,
|
||||
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2020, 2021 Free Software
|
||||
Foundation, Inc.
|
||||
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2020, 2021, 2022, 2025 Free
|
||||
Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
@@ -78,6 +79,7 @@ Usage: %s [OPTION]... EXECUTABLE
|
||||
-p, --info-page=TEXT name of Texinfo manual
|
||||
-N, --no-info suppress pointer to Texinfo manual
|
||||
-l, --libtool exclude the `lt-' from the program name
|
||||
--loose-indent relax matching of indented continuation lines
|
||||
-b, --bold-refs apply bold style to references
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
@@ -87,8 +89,8 @@ stdout although alternatives may be specified using:
|
||||
|
||||
-h, --help-option=STRING help option string
|
||||
-v, --version-option=STRING version option string
|
||||
--version-string=STRING version string
|
||||
--no-discard-stderr include stderr when parsing option output
|
||||
--version-string=STRING version string
|
||||
--no-discard-stderr include stderr when parsing option output
|
||||
|
||||
Report bugs to <bug-help2man@gnu.org>.
|
||||
EOT
|
||||
@@ -98,6 +100,7 @@ my $manual = '';
|
||||
my $source = '';
|
||||
my $help_option = '--help';
|
||||
my $version_option = '--version';
|
||||
my $loose_indent = 0;
|
||||
my $discard_stderr = 1;
|
||||
my ($opt_name, @opt_include, $opt_output, $opt_info, $opt_no_info, $opt_libtool,
|
||||
$opt_bold_refs, $version_text);
|
||||
@@ -114,6 +117,7 @@ my %opt_def = (
|
||||
'p|info-page=s' => \$opt_info,
|
||||
'N|no-info' => \$opt_no_info,
|
||||
'l|libtool' => \$opt_libtool,
|
||||
'loose-indent!' => \$loose_indent,
|
||||
'b|bold-refs' => \$opt_bold_refs,
|
||||
'help' => sub { print $help_info; exit },
|
||||
'version' => sub { print $version_info; exit },
|
||||
@@ -180,13 +184,13 @@ while (@opt_include)
|
||||
$key =~ s/^\s+//;
|
||||
$key =~ s/\s+$//;
|
||||
$hash = \%include;
|
||||
# Handle explicit [<section], [=section] and [>section]
|
||||
# Handle explicit [<section], [=section] and [>section].
|
||||
if ($key =~ s/^([<>=])\s*//)
|
||||
{
|
||||
if ($1 eq '>') { $hash = \%append; }
|
||||
elsif ($1 eq '=') { $hash = \%replace; }
|
||||
}
|
||||
# NAME/SYNOPSIS replace by default
|
||||
# NAME/SYNOPSIS replace by default.
|
||||
elsif ($key eq _('NAME') or $key eq _('SYNOPSIS'))
|
||||
{
|
||||
$hash = \%replace;
|
||||
@@ -222,7 +226,7 @@ while (@opt_include)
|
||||
# revision info.
|
||||
unless ($key)
|
||||
{
|
||||
# handle options
|
||||
# Handle options.
|
||||
if (/^-/)
|
||||
{
|
||||
local @ARGV = shellwords $_;
|
||||
@@ -267,7 +271,7 @@ if (exists $ENV{SOURCE_DATE_EPOCH} and $ENV{SOURCE_DATE_EPOCH} =~ /^(\d+)$/)
|
||||
# the English version expands to the month as a word and the full year. It
|
||||
# is used on the footer of the generated manual pages. If in doubt, you may
|
||||
# just use %x as the value (which should be the full locale-specific date).
|
||||
my $date = enc strftime _("%B %Y"), localtime $epoch_secs;
|
||||
my $date = strftime _("%B %Y"), localtime $epoch_secs;
|
||||
my $program = program_basename $ARGV[0];
|
||||
my $package = $program;
|
||||
my $version;
|
||||
@@ -342,15 +346,15 @@ for ($replace{_('NAME')} || ($include{_('NAME')} ||= ''))
|
||||
# Man pages traditionally have the page title in caps.
|
||||
my $PROGRAM = uc $program;
|
||||
|
||||
# Set default page head/footers
|
||||
# Set default page head/footers.
|
||||
$source ||= "$package $version";
|
||||
unless ($manual)
|
||||
{
|
||||
for ($section)
|
||||
{
|
||||
if (/^(1[Mm]|8)/) { $manual = enc _('System Administration Utilities') }
|
||||
elsif (/^6/) { $manual = enc _('Games') }
|
||||
else { $manual = enc _('User Commands') }
|
||||
if (/^(1[Mm]|8)/) { $manual = _('System Administration Utilities') }
|
||||
elsif (/^6/) { $manual = _('Games') }
|
||||
else { $manual = _('User Commands') }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,6 +446,7 @@ s/([^\n])\n($PAT_BUGS|$PAT_AUTHOR|$PAT_SEE_ALSO) /$1\n\n$2 /og;
|
||||
# character.
|
||||
s/^Copyright +(?:\xa9|\([Cc]\))/Copyright \\(co/mg;
|
||||
|
||||
my $require_mono = 0;
|
||||
while (length)
|
||||
{
|
||||
# Convert some standard paragraph names.
|
||||
@@ -500,15 +505,16 @@ while (length)
|
||||
}
|
||||
|
||||
# Examples, indicated by an indented leading $, % or > are
|
||||
# rendered in a constant width font.
|
||||
# rendered in a monospace font when using groff in troff mode.
|
||||
if (/^( +)([\$\%>] )\S/)
|
||||
{
|
||||
my $indent = $1;
|
||||
my $spaces = $1;
|
||||
my $prefix = $2;
|
||||
my $break = '.IP';
|
||||
while (s/^$indent\Q$prefix\E(\S.*)\n*//)
|
||||
while (s/^$spaces\Q$prefix\E(\S.*)\n*//)
|
||||
{
|
||||
$include{$sect} .= "$break\n\\f(CW$prefix$1\\fR\n";
|
||||
$include{$sect} .= "$break\n\\*[mono]$prefix$1\\*[/mono]\n";
|
||||
$require_mono++;
|
||||
$break = '.br';
|
||||
}
|
||||
|
||||
@@ -531,12 +537,12 @@ while (length)
|
||||
if (s/^( {1,10}([+-]\S.*?))(?:( +(?!-))|\n( {20,}))(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append_match;
|
||||
$indent = length ($4 || "$1$3");
|
||||
$indent = set_indent length ($4 || "$1$3");
|
||||
$content = ".TP\n\x84$2\n\x84$5\n";
|
||||
unless ($4)
|
||||
{
|
||||
# Indent may be different on second line.
|
||||
$indent = length $& if /^ {20,}/;
|
||||
$indent = set_indent length $& if /^ {20,}/;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,14 +551,14 @@ while (length)
|
||||
{
|
||||
$matched .= $& if %append_match;
|
||||
$content = ".HP\n\x84$1\n";
|
||||
$indent = 80; # not continued
|
||||
$indent = 80; # not continued
|
||||
}
|
||||
|
||||
# Indented paragraph with tag.
|
||||
elsif (s/^( +(\S.*?) +)(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append_match;
|
||||
$indent = length $1;
|
||||
$indent = set_indent length $1;
|
||||
$content = ".TP\n\x84$2\n\x84$3\n";
|
||||
}
|
||||
|
||||
@@ -560,7 +566,7 @@ while (length)
|
||||
elsif (s/^( +)(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append_match;
|
||||
$indent = length $1;
|
||||
$indent = set_indent length $1;
|
||||
$content = ".IP\n\x84$2\n";
|
||||
}
|
||||
|
||||
@@ -681,7 +687,8 @@ EOT
|
||||
# Append additional text.
|
||||
while (my ($sect, $text) = each %append)
|
||||
{
|
||||
$include{$sect} .= $append{$sect};
|
||||
$require_mono++ if $text =~ /\\\*\[mono\]/;
|
||||
$include{$sect} .= $text;
|
||||
}
|
||||
|
||||
# Replace sections.
|
||||
@@ -691,11 +698,20 @@ while (my ($sect, $text) = each %replace)
|
||||
}
|
||||
|
||||
# Output header.
|
||||
print <<EOT;
|
||||
print enc <<EOT;
|
||||
.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
|
||||
.TH $PROGRAM "$section" "$date" "$source" "$manual"
|
||||
EOT
|
||||
|
||||
# If monospace was used emit macros for groff.
|
||||
print enc <<'EOT' if $require_mono;
|
||||
.\" Define monospaced roman font for groff in troff mode.
|
||||
.if t .if \n(.g \{\
|
||||
. ds mono \f(CR
|
||||
. ds /mono \fP
|
||||
.\}
|
||||
EOT
|
||||
|
||||
# Section ordering.
|
||||
my @pre = (_('NAME'), _('SYNOPSIS'), _('DESCRIPTION'), _('OPTIONS'),
|
||||
_('EXAMPLES'));
|
||||
@@ -730,8 +746,8 @@ for my $sect (@pre, (grep !$filter{$_}, @sections), @post)
|
||||
s/\x82/\\e/g;
|
||||
s/\x83/\\-/g;
|
||||
|
||||
# Convert some latin1 chars to troff equivalents
|
||||
s/\xa0/\\ /g; # non-breaking space
|
||||
# Convert some latin1 chars to troff equivalents.
|
||||
s/\xa0/\\ /g; # non-breaking space
|
||||
|
||||
print enc $_;
|
||||
}
|
||||
@@ -800,3 +816,15 @@ sub fix_italic_spacing
|
||||
s!\\fI(.*?)\\f([BRP])!\\fI\\,$1\\/\\f$2!g;
|
||||
return $_;
|
||||
}
|
||||
|
||||
# Return indent to use: either the value passed in, or $v,$v+4 if
|
||||
# loose index matching is used. The resulting string is used in a
|
||||
# regex as " {$indent}", so will match either the exact number of
|
||||
# spaces passed in, or up to four more. See the --loose-indent
|
||||
# option.
|
||||
sub set_indent
|
||||
{
|
||||
my $i = $_[0];
|
||||
$i .= ',' . ($_[0] + 4) if $loose_indent;
|
||||
return $i;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Make coreutils man pages. -*-Makefile-*-
|
||||
# This is included by the top-level Makefile.am.
|
||||
|
||||
# Copyright (C) 2002-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -27,7 +27,7 @@ if HAVE_PERL
|
||||
if BOLD_MAN_REFS
|
||||
help2man_OPTS=--bold-refs
|
||||
endif
|
||||
run_help2man = $(PERL) -- $(srcdir)/man/help2man $(help2man_OPTS)
|
||||
run_help2man = $(PERL) -- $(srcdir)/man/help2man --loose-indent $(help2man_OPTS)
|
||||
else
|
||||
run_help2man = $(SHELL) $(srcdir)/man/dummy-man
|
||||
endif
|
||||
@@ -194,7 +194,8 @@ endif
|
||||
&& $(MKDIR_P) $$t \
|
||||
&& (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
|
||||
$$argv$(EXEEXT)) \
|
||||
&& : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
|
||||
&& : $${SOURCE_DATE_EPOCH=`date -r $(srcdir)/.tarball-version +%s \
|
||||
2>/dev/null || :`} \
|
||||
&& : $${TZ=UTC0} && export TZ \
|
||||
&& export SOURCE_DATE_EPOCH && $(run_help2man) \
|
||||
--source='$(PACKAGE_STRING)' \
|
||||
|
||||
2
man/rm.x
2
man/rm.x
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 2009-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2025 Free Software Foundation, Inc.
|
||||
'\"
|
||||
'\" This is free software. You may redistribute copies of it under the terms
|
||||
'\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# List of files which contain translatable strings.
|
||||
# Copyright (C) 1996-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
|
||||
# These are nominally temporary...
|
||||
lib/argmatch.c
|
||||
@@ -24,7 +24,6 @@ lib/siglist.h
|
||||
lib/strsignal.c
|
||||
lib/unicodeio.c
|
||||
lib/userspec.c
|
||||
lib/verror.c
|
||||
lib/version-etc.c
|
||||
lib/xalloc-die.c
|
||||
lib/xbinary-io.c
|
||||
@@ -110,6 +109,7 @@ src/rmdir.c
|
||||
src/runcon.c
|
||||
src/seq.c
|
||||
src/set-fields.c
|
||||
src/show-date.c
|
||||
src/shred.c
|
||||
src/shuf.c
|
||||
src/sleep.c
|
||||
|
||||
@@ -164,7 +164,7 @@ By adding the directory to your $PATH, older versions can be easily used:
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 2019-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2019-2025 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2019-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2019-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# are permitted in any medium without royalty provided the copyright
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* basename -- strip directory and suffix from file names
|
||||
Copyright (C) 1990-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
14
src/basenc.c
14
src/basenc.c
@@ -1,5 +1,5 @@
|
||||
/* Base64, base32, and similar encoding/decoding strings or files.
|
||||
Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2004-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -325,10 +325,8 @@ static void
|
||||
prepare_inbuf (struct base_decode_context *ctx, idx_t inlen)
|
||||
{
|
||||
if (ctx->bufsize < inlen)
|
||||
{
|
||||
ctx->bufsize = inlen * 2;
|
||||
ctx->inbuf = xnrealloc (ctx->inbuf, ctx->bufsize, sizeof (char));
|
||||
}
|
||||
ctx->inbuf = xpalloc (ctx->inbuf, &ctx->bufsize,
|
||||
inlen - ctx->bufsize, -1, sizeof *ctx->inbuf);
|
||||
}
|
||||
|
||||
|
||||
@@ -628,7 +626,7 @@ static void
|
||||
base16_encode (char const *restrict in, idx_t inlen,
|
||||
char *restrict out, idx_t outlen)
|
||||
{
|
||||
static const char base16[16] = "0123456789ABCDEF";
|
||||
static const char base16[16] _GL_ATTRIBUTE_NONSTRING = "0123456789ABCDEF";
|
||||
|
||||
while (inlen && outlen)
|
||||
{
|
||||
@@ -713,7 +711,7 @@ isuz85 (unsigned char ch)
|
||||
return c_isalnum (ch) || strchr (".-:+=^!/*?&<>()[]{}@%$#", ch) != nullptr;
|
||||
}
|
||||
|
||||
static char const z85_encoding[85] =
|
||||
static char const z85_encoding[85] _GL_ATTRIBUTE_NONSTRING =
|
||||
"0123456789"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
@@ -1138,7 +1136,7 @@ do_decode (FILE *in, char const *infile, FILE *out, bool ignore_garbage)
|
||||
idx_t sum;
|
||||
struct base_decode_context ctx;
|
||||
|
||||
char padbuf[8] = "========";
|
||||
char padbuf[8] _GL_ATTRIBUTE_NONSTRING = "========";
|
||||
inbuf = xmalloc (BASE_LENGTH (DEC_BLOCKSIZE));
|
||||
outbuf = xmalloc (DEC_BLOCKSIZE);
|
||||
|
||||
|
||||
54
src/cat.c
54
src/cat.c
@@ -1,5 +1,5 @@
|
||||
/* cat -- concatenate files and print on the standard output.
|
||||
Copyright (C) 1988-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -161,8 +161,8 @@ simple_cat (char *buf, idx_t bufsize)
|
||||
{
|
||||
/* Read a block of input. */
|
||||
|
||||
size_t n_read = safe_read (input_desc, buf, bufsize);
|
||||
if (n_read == SAFE_READ_ERROR)
|
||||
ptrdiff_t n_read = safe_read (input_desc, buf, bufsize);
|
||||
if (n_read < 0)
|
||||
{
|
||||
error (0, errno, "%s", quotef (infile));
|
||||
return false;
|
||||
@@ -310,8 +310,8 @@ cat (char *inbuf, idx_t insize, char *outbuf, idx_t outsize,
|
||||
|
||||
/* Read more input into INBUF. */
|
||||
|
||||
size_t n_read = safe_read (input_desc, inbuf, insize);
|
||||
if (n_read == SAFE_READ_ERROR)
|
||||
ptrdiff_t n_read = safe_read (input_desc, inbuf, insize);
|
||||
if (n_read < 0)
|
||||
{
|
||||
error (0, errno, "%s", quotef (infile));
|
||||
write_pending (outbuf, &bpout);
|
||||
@@ -645,9 +645,16 @@ main (int argc, char **argv)
|
||||
/* Optimal size of i/o operations of output. */
|
||||
idx_t outsize = io_blksize (&stat_buf);
|
||||
|
||||
/* Device and I-node number of the output. */
|
||||
dev_t out_dev = stat_buf.st_dev;
|
||||
ino_t out_ino = stat_buf.st_ino;
|
||||
/* Device, I-node number and lazily-acquired flags of the output. */
|
||||
dev_t out_dev;
|
||||
ino_t out_ino;
|
||||
int out_flags = -2;
|
||||
bool have_out_dev = ! (S_TYPEISSHM (&stat_buf) || S_TYPEISTMO (&stat_buf));
|
||||
if (have_out_dev)
|
||||
{
|
||||
out_dev = stat_buf.st_dev;
|
||||
out_ino = stat_buf.st_ino;
|
||||
}
|
||||
|
||||
/* True if the output is a regular file. */
|
||||
bool out_isreg = S_ISREG (stat_buf.st_mode) != 0;
|
||||
@@ -701,17 +708,30 @@ main (int argc, char **argv)
|
||||
|
||||
fdadvise (input_desc, 0, 0, FADVISE_SEQUENTIAL);
|
||||
|
||||
/* Don't copy a nonempty regular file to itself, as that would
|
||||
merely exhaust the output device. It's better to catch this
|
||||
error earlier rather than later. */
|
||||
/* Don't copy a file to itself if that would merely exhaust the
|
||||
output device. It's better to catch this error earlier
|
||||
rather than later. */
|
||||
|
||||
if (out_isreg
|
||||
&& stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino
|
||||
&& lseek (input_desc, 0, SEEK_CUR) < stat_buf.st_size)
|
||||
if (! (S_ISFIFO (stat_buf.st_mode) || S_ISSOCK (stat_buf.st_mode)
|
||||
|| S_TYPEISSHM (&stat_buf) || S_TYPEISTMO (&stat_buf))
|
||||
&& have_out_dev
|
||||
&& stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino)
|
||||
{
|
||||
error (0, 0, _("%s: input file is output file"), quotef (infile));
|
||||
ok = false;
|
||||
goto contin;
|
||||
off_t in_pos = lseek (input_desc, 0, SEEK_CUR);
|
||||
if (0 <= in_pos)
|
||||
{
|
||||
if (out_flags < -1)
|
||||
out_flags = fcntl (STDOUT_FILENO, F_GETFL);
|
||||
int whence = (0 <= out_flags && out_flags & O_APPEND
|
||||
? SEEK_END : SEEK_CUR);
|
||||
if (in_pos < lseek (STDOUT_FILENO, 0, whence))
|
||||
{
|
||||
error (0, 0, _("%s: input file is output file"),
|
||||
quotef (infile));
|
||||
ok = false;
|
||||
goto contin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Pointer to the input buffer. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* chcon -- change security context of files
|
||||
Copyright (C) 2005-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* chmod -- change permission modes of files
|
||||
Copyright (C) 1989-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -170,7 +170,7 @@ describe_change (char const *file, struct change_status const *ch)
|
||||
printf (_("%s could not be accessed\n"), quoted_file);
|
||||
return;
|
||||
|
||||
default:
|
||||
case CH_FAILED: case CH_NO_CHANGE_REQUESTED: case CH_SUCCEEDED:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ describe_change (char const *file, struct change_status const *ch)
|
||||
fmt = _("mode of %s retained as %04lo (%s)\n");
|
||||
printf (fmt, quoted_file, m, &perms[1]);
|
||||
return;
|
||||
default:
|
||||
case CH_NO_STAT: case CH_NOT_APPLIED: default:
|
||||
affirm (false);
|
||||
}
|
||||
printf (fmt, quoted_file, old_m, &old_perms[1], m, &perms[1]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* chown-core.c -- core functions for changing ownership.
|
||||
Copyright (C) 2000-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -197,6 +197,7 @@ describe_change (char const *file, enum Change_status changed,
|
||||
: group ? _("group of %s retained as %s\n")
|
||||
: _("ownership of %s retained\n"));
|
||||
break;
|
||||
case CH_NOT_APPLIED:
|
||||
default:
|
||||
affirm (false);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* chown-core.h -- types and prototypes shared by chown and chgrp.
|
||||
|
||||
Copyright (C) 2000-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* chown, chgrp -- change user and group ownership of files
|
||||
Copyright (C) 1989-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -121,7 +121,7 @@ With --reference, change the group of each FILE to that of RFILE.\n\
|
||||
--preserve-root fail to operate recursively on '/'\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
--reference=RFILE use RFILE's ownership rather than specifying values\n\
|
||||
--reference=RFILE use RFILE's ownership rather than specifying values.\n\
|
||||
RFILE is always dereferenced if a symbolic link.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
|
||||
17
src/chroot.c
17
src/chroot.c
@@ -1,5 +1,5 @@
|
||||
/* chroot -- run command or shell with special root directory
|
||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -93,11 +93,11 @@ setgroups (size_t size, MAYBE_UNUSED gid_t const *list)
|
||||
|
||||
static int
|
||||
parse_additional_groups (char const *groups, GETGROUPS_T **pgids,
|
||||
size_t *pn_gids, bool show_errors)
|
||||
idx_t *pn_gids, bool show_errors)
|
||||
{
|
||||
GETGROUPS_T *gids = nullptr;
|
||||
size_t n_gids_allocated = 0;
|
||||
size_t n_gids = 0;
|
||||
idx_t n_gids_allocated = 0;
|
||||
idx_t n_gids = 0;
|
||||
char *buffer = xstrdup (groups);
|
||||
char const *tmp;
|
||||
int ret = 0;
|
||||
@@ -143,7 +143,7 @@ parse_additional_groups (char const *groups, GETGROUPS_T **pgids,
|
||||
}
|
||||
|
||||
if (n_gids == n_gids_allocated)
|
||||
gids = X2NREALLOC (gids, &n_gids_allocated);
|
||||
gids = xpalloc (gids, &n_gids_allocated, 1, -1, sizeof *gids);
|
||||
gids[n_gids++] = value;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ main (int argc, char **argv)
|
||||
uid_t uid = -1;
|
||||
gid_t gid = -1;
|
||||
GETGROUPS_T *out_gids = nullptr;
|
||||
size_t n_gids = 0;
|
||||
idx_t n_gids = 0;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -251,7 +251,7 @@ main (int argc, char **argv)
|
||||
/* Treat 'user:' just like 'user'
|
||||
as we lookup the primary group by default
|
||||
(and support doing so for UIDs as well as names. */
|
||||
size_t userlen = strlen (userspec);
|
||||
idx_t userlen = strlen (userspec);
|
||||
if (userlen && userspec[userlen - 1] == ':')
|
||||
userspec[userlen - 1] = '\0';
|
||||
break;
|
||||
@@ -375,7 +375,8 @@ main (int argc, char **argv)
|
||||
else if (gid_unset (gid))
|
||||
{
|
||||
error (EXIT_CANCELED, errno,
|
||||
_("no group specified for unknown uid: %d"), (int) uid);
|
||||
_("no group specified for unknown uid: %ju"),
|
||||
(uintmax_t) uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
206
src/cksum.c
206
src/cksum.c
@@ -1,5 +1,5 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 1992-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,7 +25,7 @@
|
||||
do something like the following:
|
||||
|
||||
cc -I../lib -DCRCTAB -o crctab cksum.c
|
||||
crctab > crctab.c
|
||||
./crctab > crctab.c
|
||||
|
||||
This software is compatible with neither the System V nor the BSD
|
||||
'sum' program. It is supposed to conform to POSIX, except perhaps
|
||||
@@ -34,21 +34,11 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <byteswap.h>
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define SWAP(n) (n)
|
||||
#else
|
||||
# define SWAP(n) bswap_32 (n)
|
||||
#endif
|
||||
|
||||
#ifdef CRCTAB
|
||||
|
||||
# define BIT(x) ((uint_fast32_t) 1 << (x))
|
||||
# include <stdio.h>
|
||||
|
||||
# define BIT(x) (1u << (x))
|
||||
# define SBIT BIT (31)
|
||||
|
||||
/* The generating polynomial is
|
||||
@@ -62,7 +52,7 @@
|
||||
| BIT (11) | BIT (10) | BIT (8) | BIT (7) | BIT (5) \
|
||||
| BIT (4) | BIT (2) | BIT (1) | BIT (0))
|
||||
|
||||
static uint_fast32_t r[8];
|
||||
static unsigned int r[8];
|
||||
|
||||
static void
|
||||
fill_r (void)
|
||||
@@ -72,10 +62,10 @@ fill_r (void)
|
||||
r[i] = (r[i - 1] << 1) ^ ((r[i - 1] & SBIT) ? GEN : 0);
|
||||
}
|
||||
|
||||
static uint_fast32_t
|
||||
static unsigned int
|
||||
crc_remainder (int m)
|
||||
{
|
||||
uint_fast32_t rem = 0;
|
||||
unsigned int rem = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
if (BIT (i) & m)
|
||||
@@ -87,15 +77,12 @@ crc_remainder (int m)
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int i;
|
||||
static uint_fast32_t crctab[8][256];
|
||||
static unsigned int crctab[8][256];
|
||||
|
||||
fill_r ();
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
crctab[0][i] = crc_remainder (i);
|
||||
}
|
||||
for (int i = 0; i < 256; i++)
|
||||
crctab[0][i] = crc_remainder (i);
|
||||
|
||||
/* CRC(0x11 0x22 0x33 0x44)
|
||||
is equal to
|
||||
@@ -104,25 +91,26 @@ main (void)
|
||||
We precompute the CRC values for the offset values into
|
||||
separate CRC tables. We can then use them to speed up
|
||||
CRC calculation by processing multiple bytes at the time. */
|
||||
for (i = 0; i < 256; i++)
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
uint32_t crc = 0;
|
||||
unsigned int crc = 0;
|
||||
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ (i & 0xFF)) & 0xFF];
|
||||
for (idx_t offset = 1; offset < 8; offset++)
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ i) & 0xFF];
|
||||
for (int offset = 1; offset < 8; offset++)
|
||||
{
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ 0x00) & 0xFF];
|
||||
crctab[offset][i] = crc;
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ 0) & 0xFF];
|
||||
crctab[offset][i] = crc & 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
printf ("#include <config.h>\n");
|
||||
printf ("#include <stdint.h>\n");
|
||||
printf ("\nuint_fast32_t const crctab[8][256] = {\n");
|
||||
printf ("#include \"cksum.h\"\n");
|
||||
printf ("\n");
|
||||
printf ("uint_fast32_t const crctab[8][256] = {\n");
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
printf ("{\n 0x%08x", crctab[y][0]);
|
||||
for (i = 0; i < 51; i++)
|
||||
for (int i = 0; i < 51; i++)
|
||||
{
|
||||
printf (",\n 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x",
|
||||
crctab[y][i * 5 + 1], crctab[y][i * 5 + 2],
|
||||
@@ -132,32 +120,105 @@ main (void)
|
||||
printf ("\n},\n");
|
||||
}
|
||||
printf ("};\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#else /* !CRCTAB */
|
||||
|
||||
# include "cksum.h"
|
||||
# include <sys/types.h>
|
||||
# include <endian.h>
|
||||
# include "system.h"
|
||||
|
||||
# ifdef USE_VMULL_CRC32
|
||||
# include <sys/auxv.h>
|
||||
# include <asm/hwcap.h>
|
||||
# endif
|
||||
|
||||
# include "crc.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
# define BUFLEN (1 << 16)
|
||||
|
||||
# if USE_PCLMUL_CRC32
|
||||
static bool
|
||||
typedef bool (*cksum_fp_t) (FILE *, uint_fast32_t *, uintmax_t *);
|
||||
|
||||
static cksum_fp_t
|
||||
pclmul_supported (void)
|
||||
{
|
||||
# if USE_PCLMUL_CRC32 || GL_CRC_X86_64_PCLMUL
|
||||
bool pclmul_enabled = (0 < __builtin_cpu_supports ("pclmul")
|
||||
&& 0 < __builtin_cpu_supports ("avx"));
|
||||
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(pclmul_enabled
|
||||
? _("using pclmul hardware support")
|
||||
: _("pclmul support not detected")));
|
||||
if (pclmul_enabled)
|
||||
return cksum_pclmul;
|
||||
# endif
|
||||
|
||||
return pclmul_enabled;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static cksum_fp_t
|
||||
avx2_supported (void)
|
||||
{
|
||||
/* AVX512 processors will not set vpclmulqdq unless they support
|
||||
the avx512 version, but it implies that the avx2 version
|
||||
is supported */
|
||||
# if USE_AVX2_CRC32
|
||||
bool avx2_enabled = (0 < __builtin_cpu_supports ("vpclmulqdq")
|
||||
&& 0 < __builtin_cpu_supports ("avx2"));
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(avx2_enabled
|
||||
? _("using avx2 hardware support")
|
||||
: _("avx2 support not detected")));
|
||||
if (avx2_enabled)
|
||||
return cksum_avx2;
|
||||
# endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static cksum_fp_t
|
||||
avx512_supported (void)
|
||||
{
|
||||
/* vpclmulqdq for multiplication
|
||||
mavx512f for most of the avx512 functions we're using
|
||||
mavx512bw for byte swapping */
|
||||
# if USE_AVX512_CRC32
|
||||
bool avx512_enabled = (0 < __builtin_cpu_supports ("vpclmulqdq")
|
||||
&& 0 < __builtin_cpu_supports ("avx512bw")
|
||||
&& 0 < __builtin_cpu_supports ("avx512f"));
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(avx512_enabled
|
||||
? _("using avx512 hardware support")
|
||||
: _("avx512 support not detected")));
|
||||
if (avx512_enabled)
|
||||
return cksum_avx512;
|
||||
# endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static cksum_fp_t
|
||||
vmull_supported (void)
|
||||
{
|
||||
/* vmull for multiplication */
|
||||
# if USE_VMULL_CRC32
|
||||
bool vmull_enabled = (getauxval (AT_HWCAP) & HWCAP_PMULL) > 0;
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(vmull_enabled
|
||||
? _("using vmull hardware support")
|
||||
: _("vmull support not detected")));
|
||||
if (vmull_enabled)
|
||||
return cksum_vmull;
|
||||
# endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
# endif /* USE_PCLMUL_CRC32 */
|
||||
|
||||
static bool
|
||||
cksum_slice8 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
|
||||
@@ -186,8 +247,8 @@ cksum_slice8 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
|
||||
while (bytes_read >= 8)
|
||||
{
|
||||
uint32_t first = *datap++, second = *datap++;
|
||||
crc ^= SWAP (first);
|
||||
second = SWAP (second);
|
||||
crc ^= htobe32 (first);
|
||||
second = htobe32 (second);
|
||||
crc = (crctab[7][(crc >> 24) & 0xFF]
|
||||
^ crctab[6][(crc >> 16) & 0xFF]
|
||||
^ crctab[5][(crc >> 8) & 0xFF]
|
||||
@@ -222,13 +283,17 @@ crc_sum_stream (FILE *stream, void *resstream, uintmax_t *length)
|
||||
uintmax_t total_bytes = 0;
|
||||
uint_fast32_t crc = 0;
|
||||
|
||||
# if USE_PCLMUL_CRC32
|
||||
static bool (*cksum_fp) (FILE *, uint_fast32_t *, uintmax_t *);
|
||||
static cksum_fp_t cksum_fp;
|
||||
if (! cksum_fp)
|
||||
cksum_fp = pclmul_supported () ? cksum_pclmul : cksum_slice8;
|
||||
# else
|
||||
bool (*cksum_fp) (FILE *, uint_fast32_t *, uintmax_t *) = cksum_slice8;
|
||||
# endif
|
||||
cksum_fp = avx512_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = avx2_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = pclmul_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = vmull_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = cksum_slice8;
|
||||
|
||||
if (! cksum_fp (stream, &crc, &total_bytes))
|
||||
return -1;
|
||||
@@ -245,6 +310,48 @@ crc_sum_stream (FILE *stream, void *resstream, uintmax_t *length)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Calculate the crc32b checksum and length in bytes of stream STREAM.
|
||||
Return -1 on error, 0 on success. */
|
||||
|
||||
int
|
||||
crc32b_sum_stream (FILE *stream, void *resstream, uintmax_t *reslen)
|
||||
{
|
||||
uint32_t buf[BUFLEN / sizeof (uint32_t)];
|
||||
uint32_t crc = 0;
|
||||
uintmax_t len = 0;
|
||||
size_t bytes_read;
|
||||
|
||||
if (!stream || !resstream || !reslen)
|
||||
return -1;
|
||||
|
||||
# if GL_CRC_X86_64_PCLMUL
|
||||
if (cksum_debug)
|
||||
(void) pclmul_supported ();
|
||||
# endif
|
||||
|
||||
while ((bytes_read = fread (buf, 1, BUFLEN, stream)) > 0)
|
||||
{
|
||||
if (len + bytes_read < len)
|
||||
{
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
len += bytes_read;
|
||||
|
||||
crc = crc32_update (crc, (char const *)buf, bytes_read);
|
||||
|
||||
if (feof (stream))
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned int crc_out = crc;
|
||||
memcpy (resstream, &crc_out, sizeof crc_out);
|
||||
|
||||
*reslen = len;
|
||||
|
||||
return ferror (stream) ? -1 : 0;
|
||||
}
|
||||
|
||||
/* Print the checksum and size to stdout.
|
||||
If ARGS is true, also print the FILE name. */
|
||||
|
||||
@@ -255,13 +362,12 @@ output_crc (char const *file, int binary_file, void const *digest, bool raw,
|
||||
if (raw)
|
||||
{
|
||||
/* Output in network byte order (big endian). */
|
||||
uint32_t out_int = SWAP (*(uint32_t *)digest);
|
||||
uint32_t out_int = htobe32 (*(uint32_t *)digest);
|
||||
fwrite (&out_int, 1, 32/8, stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
char length_buf[INT_BUFSIZE_BOUND (uintmax_t)];
|
||||
printf ("%u %s", *(unsigned int *)digest, umaxtostr (length, length_buf));
|
||||
printf ("%u %ju", *(unsigned int *)digest, length);
|
||||
if (args)
|
||||
printf (" %s", file);
|
||||
putchar (delim);
|
||||
|
||||
31
src/cksum.h
31
src/cksum.h
@@ -1,19 +1,50 @@
|
||||
/* Calculate checksums and sizes of files
|
||||
Copyright 2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef __CKSUM_H__
|
||||
# define __CKSUM_H__
|
||||
|
||||
# include <stdint.h>
|
||||
# include <stdio.h>
|
||||
|
||||
extern bool cksum_debug;
|
||||
|
||||
extern int
|
||||
crc_sum_stream (FILE *stream, void *resstream, uintmax_t *length);
|
||||
|
||||
extern int
|
||||
crc32b_sum_stream (FILE *stream, void *resstream, uintmax_t *length);
|
||||
|
||||
extern void
|
||||
output_crc (char const *file, int binary_file, void const *digest, bool raw,
|
||||
bool tagged, unsigned char delim, bool args, uintmax_t length)
|
||||
_GL_ATTRIBUTE_NONNULL ((3));
|
||||
|
||||
extern bool
|
||||
cksum_vmull (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
|
||||
|
||||
extern bool
|
||||
cksum_pclmul (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
|
||||
|
||||
extern bool
|
||||
cksum_avx2 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
|
||||
|
||||
extern bool
|
||||
cksum_avx512 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
|
||||
|
||||
extern uint_fast32_t const crctab[8][256];
|
||||
|
||||
#endif
|
||||
|
||||
196
src/cksum_avx2.c
Normal file
196
src/cksum_avx2.c
Normal file
@@ -0,0 +1,196 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cksum.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <x86intrin.h>
|
||||
#include "system.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
#define BUFLEN (1 << 16)
|
||||
|
||||
bool
|
||||
cksum_avx2 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
|
||||
{
|
||||
__m256i buf[BUFLEN / sizeof (__m256i)];
|
||||
uint_fast32_t crc = 0;
|
||||
uintmax_t length = 0;
|
||||
size_t bytes_read;
|
||||
__m256i single_mult_constant;
|
||||
__m256i four_mult_constant;
|
||||
__m256i shuffle_constant;
|
||||
|
||||
if (!fp || !crc_out || !length_out)
|
||||
return false;
|
||||
|
||||
/* These constants and general algorithms are taken from the Intel whitepaper
|
||||
"Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction"
|
||||
*/
|
||||
single_mult_constant = _mm256_set_epi64x (0x569700E5, 0x75BE46B7,
|
||||
0x569700E5, 0x75BE46B7);
|
||||
four_mult_constant = _mm256_set_epi64x (0x10BD4D7C, 0x567FDDEB,
|
||||
0x10BD4D7C, 0x567FDDEB);
|
||||
|
||||
/* Constant to byteswap a full AVX2 register */
|
||||
shuffle_constant = _mm256_set_epi8 (0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15);
|
||||
while ((bytes_read = fread (buf, 1, BUFLEN, fp)) > 0)
|
||||
{
|
||||
__m256i data;
|
||||
__m256i data2;
|
||||
__m256i data3;
|
||||
__m256i data4;
|
||||
__m256i data5;
|
||||
__m256i data6;
|
||||
__m256i data7;
|
||||
__m256i data8;
|
||||
__m256i fold_data;
|
||||
__m256i xor_crc;
|
||||
|
||||
__m256i *datap;
|
||||
|
||||
if (length + bytes_read < length)
|
||||
{
|
||||
errno = EOVERFLOW;
|
||||
return false;
|
||||
}
|
||||
length += bytes_read;
|
||||
|
||||
datap = (__m256i *)buf;
|
||||
|
||||
/* Fold in parallel 16x 16-byte blocks into 8x 16-byte blocks */
|
||||
if (bytes_read >= 16 * 8 * 2)
|
||||
{
|
||||
data = _mm256_loadu_si256 (datap);
|
||||
data = _mm256_shuffle_epi8 (data, shuffle_constant);
|
||||
/* XOR in initial CRC value (for us 0 so no effect), or CRC value
|
||||
calculated for previous BUFLEN buffer from fread */
|
||||
xor_crc = _mm256_set_epi32 (0, 0, 0, 0, crc, 0, 0, 0);
|
||||
crc = 0;
|
||||
data = _mm256_xor_si256 (data, xor_crc);
|
||||
data3 = _mm256_loadu_si256 (datap + 1);
|
||||
data3 = _mm256_shuffle_epi8 (data3, shuffle_constant);
|
||||
data5 = _mm256_loadu_si256 (datap + 2);
|
||||
data5 = _mm256_shuffle_epi8 (data5, shuffle_constant);
|
||||
data7 = _mm256_loadu_si256 (datap + 3);
|
||||
data7 = _mm256_shuffle_epi8 (data7, shuffle_constant);
|
||||
|
||||
while (bytes_read >= 16 * 8 * 2)
|
||||
{
|
||||
datap += 4;
|
||||
|
||||
/* Do multiplication here for 8x consecutive 16 byte blocks */
|
||||
data2 = _mm256_clmulepi64_epi128 (data, four_mult_constant,
|
||||
0x00);
|
||||
data = _mm256_clmulepi64_epi128 (data, four_mult_constant,
|
||||
0x11);
|
||||
data4 = _mm256_clmulepi64_epi128 (data3, four_mult_constant,
|
||||
0x00);
|
||||
data3 = _mm256_clmulepi64_epi128 (data3, four_mult_constant,
|
||||
0x11);
|
||||
data6 = _mm256_clmulepi64_epi128 (data5, four_mult_constant,
|
||||
0x00);
|
||||
data5 = _mm256_clmulepi64_epi128 (data5, four_mult_constant,
|
||||
0x11);
|
||||
data8 = _mm256_clmulepi64_epi128 (data7, four_mult_constant,
|
||||
0x00);
|
||||
data7 = _mm256_clmulepi64_epi128 (data7, four_mult_constant,
|
||||
0x11);
|
||||
|
||||
/* Now multiplication results for the 8x blocks is xor:ed with
|
||||
next 8x 16 byte blocks from the buffer. This effectively
|
||||
"consumes" the first 8x blocks from the buffer.
|
||||
Keep xor result in variables for multiplication in next
|
||||
round of loop. */
|
||||
data = _mm256_xor_si256 (data, data2);
|
||||
data2 = _mm256_loadu_si256 (datap);
|
||||
data2 = _mm256_shuffle_epi8 (data2, shuffle_constant);
|
||||
data = _mm256_xor_si256 (data, data2);
|
||||
|
||||
data3 = _mm256_xor_si256 (data3, data4);
|
||||
data4 = _mm256_loadu_si256 (datap + 1);
|
||||
data4 = _mm256_shuffle_epi8 (data4, shuffle_constant);
|
||||
data3 = _mm256_xor_si256 (data3, data4);
|
||||
|
||||
data5 = _mm256_xor_si256 (data5, data6);
|
||||
data6 = _mm256_loadu_si256 (datap + 2);
|
||||
data6 = _mm256_shuffle_epi8 (data6, shuffle_constant);
|
||||
data5 = _mm256_xor_si256 (data5, data6);
|
||||
|
||||
data7 = _mm256_xor_si256 (data7, data8);
|
||||
data8 = _mm256_loadu_si256 (datap + 3);
|
||||
data8 = _mm256_shuffle_epi8 (data8, shuffle_constant);
|
||||
data7 = _mm256_xor_si256 (data7, data8);
|
||||
|
||||
bytes_read -= (16 * 4 * 2);
|
||||
}
|
||||
/* At end of loop we write out results from variables back into
|
||||
the buffer, for use in single fold loop */
|
||||
data = _mm256_shuffle_epi8 (data, shuffle_constant);
|
||||
_mm256_storeu_si256 (datap, data);
|
||||
data3 = _mm256_shuffle_epi8 (data3, shuffle_constant);
|
||||
_mm256_storeu_si256 (datap + 1, data3);
|
||||
data5 = _mm256_shuffle_epi8 (data5, shuffle_constant);
|
||||
_mm256_storeu_si256 (datap + 2, data5);
|
||||
data7 = _mm256_shuffle_epi8 (data7, shuffle_constant);
|
||||
_mm256_storeu_si256 (datap + 3, data7);
|
||||
}
|
||||
|
||||
/* Fold two 32-byte blocks into one 32-byte block */
|
||||
if (bytes_read >= 64)
|
||||
{
|
||||
data = _mm256_loadu_si256 (datap);
|
||||
data = _mm256_shuffle_epi8 (data, shuffle_constant);
|
||||
xor_crc = _mm256_set_epi32 (0, 0, 0, 0, crc, 0, 0, 0);
|
||||
crc = 0;
|
||||
data = _mm256_xor_si256 (data, xor_crc);
|
||||
while (bytes_read >= 64)
|
||||
{
|
||||
datap++;
|
||||
|
||||
data2 = _mm256_clmulepi64_epi128 (data, single_mult_constant,
|
||||
0x00);
|
||||
data = _mm256_clmulepi64_epi128 (data, single_mult_constant,
|
||||
0x11);
|
||||
fold_data = _mm256_loadu_si256 (datap);
|
||||
fold_data = _mm256_shuffle_epi8 (fold_data, shuffle_constant);
|
||||
data = _mm256_xor_si256 (data, data2);
|
||||
data = _mm256_xor_si256 (data, fold_data);
|
||||
bytes_read -= 32;
|
||||
}
|
||||
data = _mm256_shuffle_epi8 (data, shuffle_constant);
|
||||
_mm256_storeu_si256 (datap, data);
|
||||
}
|
||||
|
||||
/* And finish up last 0-63 bytes in a byte by byte fashion */
|
||||
unsigned char *cp = (unsigned char *)datap;
|
||||
while (bytes_read--)
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ *cp++) & 0xFF];
|
||||
if (feof (fp))
|
||||
break;
|
||||
}
|
||||
|
||||
*crc_out = crc;
|
||||
*length_out = length;
|
||||
|
||||
return !ferror (fp);
|
||||
}
|
||||
205
src/cksum_avx512.c
Normal file
205
src/cksum_avx512.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cksum.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <x86intrin.h>
|
||||
#include "system.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
#define BUFLEN (1 << 16)
|
||||
|
||||
bool
|
||||
cksum_avx512 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
|
||||
{
|
||||
__m512i buf[BUFLEN / sizeof (__m512i)];
|
||||
uint_fast32_t crc = 0;
|
||||
uintmax_t length = 0;
|
||||
size_t bytes_read;
|
||||
__m512i single_mult_constant;
|
||||
__m512i four_mult_constant;
|
||||
__m512i shuffle_constant;
|
||||
|
||||
if (!fp || !crc_out || !length_out)
|
||||
return false;
|
||||
|
||||
/* These constants and general algorithms are taken from the Intel whitepaper
|
||||
"Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction"
|
||||
*/
|
||||
single_mult_constant = _mm512_set_epi64 (0x8833794C, 0xE6228B11,
|
||||
0x8833794C, 0xE6228B11,
|
||||
0x8833794C, 0xE6228B11,
|
||||
0x8833794C, 0xE6228B11);
|
||||
four_mult_constant = _mm512_set_epi64 (0xCBCF3BCB, 0x88FE2237,
|
||||
0xCBCF3BCB, 0x88FE2237,
|
||||
0xCBCF3BCB, 0x88FE2237,
|
||||
0xCBCF3BCB, 0x88FE2237);
|
||||
|
||||
/* Constant to byteswap a full AVX512 register */
|
||||
shuffle_constant = _mm512_set_epi8 (0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15);
|
||||
while ((bytes_read = fread (buf, 1, BUFLEN, fp)) > 0)
|
||||
{
|
||||
__m512i data;
|
||||
__m512i data2;
|
||||
__m512i data3;
|
||||
__m512i data4;
|
||||
__m512i data5;
|
||||
__m512i data6;
|
||||
__m512i data7;
|
||||
__m512i data8;
|
||||
__m512i fold_data;
|
||||
__m512i xor_crc;
|
||||
|
||||
__m512i *datap;
|
||||
|
||||
if (length + bytes_read < length)
|
||||
{
|
||||
errno = EOVERFLOW;
|
||||
return false;
|
||||
}
|
||||
length += bytes_read;
|
||||
|
||||
datap = (__m512i *)buf;
|
||||
|
||||
/* Fold in parallel 32x 16-byte blocks into 16x 16-byte blocks */
|
||||
if (bytes_read >= 16 * 8 * 4)
|
||||
{
|
||||
data = _mm512_loadu_si512 (datap);
|
||||
data = _mm512_shuffle_epi8 (data, shuffle_constant);
|
||||
/* XOR in initial CRC value (for us 0 so no effect), or CRC value
|
||||
calculated for previous BUFLEN buffer from fread */
|
||||
xor_crc = _mm512_set_epi32 (0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, crc, 0, 0, 0);
|
||||
crc = 0;
|
||||
data = _mm512_xor_si512 (data, xor_crc);
|
||||
data3 = _mm512_loadu_si512 (datap + 1);
|
||||
data3 = _mm512_shuffle_epi8 (data3, shuffle_constant);
|
||||
data5 = _mm512_loadu_si512 (datap + 2);
|
||||
data5 = _mm512_shuffle_epi8 (data5, shuffle_constant);
|
||||
data7 = _mm512_loadu_si512 (datap + 3);
|
||||
data7 = _mm512_shuffle_epi8 (data7, shuffle_constant);
|
||||
|
||||
while (bytes_read >= 16 * 8 * 4)
|
||||
{
|
||||
datap += 4;
|
||||
|
||||
/* Do multiplication here for 16x consecutive 16 byte blocks */
|
||||
data2 = _mm512_clmulepi64_epi128 (data, four_mult_constant,
|
||||
0x00);
|
||||
data = _mm512_clmulepi64_epi128 (data, four_mult_constant,
|
||||
0x11);
|
||||
data4 = _mm512_clmulepi64_epi128 (data3, four_mult_constant,
|
||||
0x00);
|
||||
data3 = _mm512_clmulepi64_epi128 (data3, four_mult_constant,
|
||||
0x11);
|
||||
data6 = _mm512_clmulepi64_epi128 (data5, four_mult_constant,
|
||||
0x00);
|
||||
data5 = _mm512_clmulepi64_epi128 (data5, four_mult_constant,
|
||||
0x11);
|
||||
data8 = _mm512_clmulepi64_epi128 (data7, four_mult_constant,
|
||||
0x00);
|
||||
data7 = _mm512_clmulepi64_epi128 (data7, four_mult_constant,
|
||||
0x11);
|
||||
|
||||
/* Now multiplication results for the 16x blocks is xor:ed with
|
||||
next 16x 16 byte blocks from the buffer. This effectively
|
||||
"consumes" the first 16x blocks from the buffer.
|
||||
Keep xor result in variables for multiplication in next
|
||||
round of loop. */
|
||||
data = _mm512_xor_si512 (data, data2);
|
||||
data2 = _mm512_loadu_si512 (datap);
|
||||
data2 = _mm512_shuffle_epi8 (data2, shuffle_constant);
|
||||
data = _mm512_xor_si512 (data, data2);
|
||||
|
||||
data3 = _mm512_xor_si512 (data3, data4);
|
||||
data4 = _mm512_loadu_si512 (datap + 1);
|
||||
data4 = _mm512_shuffle_epi8 (data4, shuffle_constant);
|
||||
data3 = _mm512_xor_si512 (data3, data4);
|
||||
|
||||
data5 = _mm512_xor_si512 (data5, data6);
|
||||
data6 = _mm512_loadu_si512 (datap + 2);
|
||||
data6 = _mm512_shuffle_epi8 (data6, shuffle_constant);
|
||||
data5 = _mm512_xor_si512 (data5, data6);
|
||||
|
||||
data7 = _mm512_xor_si512 (data7, data8);
|
||||
data8 = _mm512_loadu_si512 (datap + 3);
|
||||
data8 = _mm512_shuffle_epi8 (data8, shuffle_constant);
|
||||
data7 = _mm512_xor_si512 (data7, data8);
|
||||
|
||||
bytes_read -= (16 * 4 * 4);
|
||||
}
|
||||
/* At end of loop we write out results from variables back into
|
||||
the buffer, for use in single fold loop */
|
||||
data = _mm512_shuffle_epi8 (data, shuffle_constant);
|
||||
_mm512_storeu_si512 (datap, data);
|
||||
data3 = _mm512_shuffle_epi8 (data3, shuffle_constant);
|
||||
_mm512_storeu_si512 (datap + 1, data3);
|
||||
data5 = _mm512_shuffle_epi8 (data5, shuffle_constant);
|
||||
_mm512_storeu_si512 (datap + 2, data5);
|
||||
data7 = _mm512_shuffle_epi8 (data7, shuffle_constant);
|
||||
_mm512_storeu_si512 (datap + 3, data7);
|
||||
}
|
||||
|
||||
/* Fold two 64-byte blocks into one 64-byte block */
|
||||
if (bytes_read >= 128)
|
||||
{
|
||||
data = _mm512_loadu_si512 (datap);
|
||||
data = _mm512_shuffle_epi8 (data, shuffle_constant);
|
||||
xor_crc = _mm512_set_epi32 (0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, crc, 0, 0, 0);
|
||||
crc = 0;
|
||||
data = _mm512_xor_si512 (data, xor_crc);
|
||||
while (bytes_read >= 128)
|
||||
{
|
||||
datap++;
|
||||
|
||||
data2 = _mm512_clmulepi64_epi128 (data, single_mult_constant,
|
||||
0x00);
|
||||
data = _mm512_clmulepi64_epi128 (data, single_mult_constant,
|
||||
0x11);
|
||||
fold_data = _mm512_loadu_si512 (datap);
|
||||
fold_data = _mm512_shuffle_epi8 (fold_data, shuffle_constant);
|
||||
data = _mm512_xor_si512 (data, data2);
|
||||
data = _mm512_xor_si512 (data, fold_data);
|
||||
bytes_read -= 64;
|
||||
}
|
||||
data = _mm512_shuffle_epi8 (data, shuffle_constant);
|
||||
_mm512_storeu_si512 (datap, data);
|
||||
}
|
||||
|
||||
/* And finish up last 0-127 bytes in a byte by byte fashion */
|
||||
unsigned char *cp = (unsigned char *)datap;
|
||||
while (bytes_read--)
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ *cp++) & 0xFF];
|
||||
if (feof (fp))
|
||||
break;
|
||||
}
|
||||
|
||||
*crc_out = crc;
|
||||
*length_out = length;
|
||||
|
||||
return !ferror (fp);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 1992-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2021-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -16,20 +16,16 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cksum.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <x86intrin.h>
|
||||
#include "system.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
#define BUFLEN (1 << 16)
|
||||
|
||||
extern uint_fast32_t const crctab[8][256];
|
||||
|
||||
extern bool
|
||||
cksum_pclmul (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
|
||||
|
||||
/* Calculate CRC32 using PCLMULQDQ CPU instruction found in x86/x64 CPUs */
|
||||
|
||||
bool
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user