mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
260 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d13292a73 | ||
|
|
c8539d36c7 | ||
|
|
0ea65e29dc | ||
|
|
f2034aa9bb | ||
|
|
ab305f746e | ||
|
|
04e2b9b1a6 | ||
|
|
5cdab9f26b | ||
|
|
e840c78685 | ||
|
|
ea1c1b7515 | ||
|
|
de73a867ca | ||
|
|
54bf2c2f1a | ||
|
|
516cdf38af | ||
|
|
cc4c55e4bc | ||
|
|
8de80feb51 | ||
|
|
05a99f7d7f | ||
|
|
93db70867d | ||
|
|
ead8464e3a | ||
|
|
9134993562 | ||
|
|
75f79010cd | ||
|
|
8e81d44b52 | ||
|
|
61c49d3693 | ||
|
|
3150f4a82e | ||
|
|
b96b1a4728 | ||
|
|
304bc557af | ||
|
|
d7da53c47e | ||
|
|
fa6d154b7b | ||
|
|
ab108667ba | ||
|
|
1f443fe572 | ||
|
|
709b4d9d8d | ||
|
|
18c9382801 | ||
|
|
2cecc3cc99 | ||
|
|
dda53d75a8 | ||
|
|
fbbf81ec00 | ||
|
|
0d77e1b7ea | ||
|
|
ff2f85273a | ||
|
|
aaba82431c | ||
|
|
7490e94aa7 | ||
|
|
ec5ab42604 | ||
|
|
5118a2e392 | ||
|
|
ad591a52b4 | ||
|
|
0103fb0244 | ||
|
|
04b136e298 | ||
|
|
ed2db6886b | ||
|
|
74163ea677 | ||
|
|
565dd395c3 | ||
|
|
6716a79773 | ||
|
|
c1e19656c8 | ||
|
|
a99ab26611 | ||
|
|
86ee5548c1 | ||
|
|
ba1ea8caee | ||
|
|
ac2b4a43e6 | ||
|
|
bb23a7563f | ||
|
|
1c8050cc4d | ||
|
|
49b1010cc0 | ||
|
|
f2dfea7e99 | ||
|
|
b8609c7cf2 | ||
|
|
a3d070fa32 | ||
|
|
725c8d6bed | ||
|
|
3cbddd58fd | ||
|
|
961d668eea | ||
|
|
becf0db0da | ||
|
|
eb5a9ebaf1 | ||
|
|
a574029110 | ||
|
|
0e2d4e1425 | ||
|
|
07f811a3c0 | ||
|
|
c0f2219d3a | ||
|
|
3264d4ca0d | ||
|
|
a1a5e9a32e | ||
|
|
3ae38a5995 | ||
|
|
a3a454b9d9 | ||
|
|
0b9bac90d8 | ||
|
|
0251229bfd | ||
|
|
6cc35de16f | ||
|
|
bb481a0c1d | ||
|
|
738a746d82 | ||
|
|
00d72e6122 | ||
|
|
4c223ab4b6 | ||
|
|
3b1046f80f | ||
|
|
3a87ad5124 | ||
|
|
4f38974aaf | ||
|
|
a60af87f24 | ||
|
|
de54e1a809 | ||
|
|
5f261e239f | ||
|
|
5b96efab90 | ||
|
|
6e97d361b4 | ||
|
|
6f4c2e06ae | ||
|
|
2fd0be3621 | ||
|
|
a970a97737 | ||
|
|
39073add8f | ||
|
|
7d8adb20f6 | ||
|
|
6d78a28078 | ||
|
|
ebf70f297c | ||
|
|
ba36d5118f | ||
|
|
59e01d13e6 | ||
|
|
ae61b10663 | ||
|
|
1a69508711 | ||
|
|
3e0dff3925 | ||
|
|
4a21102470 | ||
|
|
6a707feee8 | ||
|
|
6bd78f27fd | ||
|
|
5b9d747261 | ||
|
|
ab8c604765 | ||
|
|
cf28242fd5 | ||
|
|
5f47cda3ab | ||
|
|
a971cd4ff7 | ||
|
|
66e2daa689 | ||
|
|
a376de95c3 | ||
|
|
daa46dbe7d | ||
|
|
b918a20234 | ||
|
|
bf2f64c7d5 | ||
|
|
4bb49f04a1 | ||
|
|
16358bc19c | ||
|
|
4bbbe49074 | ||
|
|
efa3e5dda6 | ||
|
|
7c35a36bf4 | ||
|
|
6bf6d7f461 | ||
|
|
95adadd9a4 | ||
|
|
186896d65f | ||
|
|
811493e2a9 | ||
|
|
0d6be4b01f | ||
|
|
4ae1369516 | ||
|
|
a5202bd585 | ||
|
|
2ab2f7a422 | ||
|
|
d5c820109e | ||
|
|
3e7fd6650e | ||
|
|
b1e7af28eb | ||
|
|
c50c4ab9e1 | ||
|
|
44af84263e | ||
|
|
36b99b6113 | ||
|
|
f473489f48 | ||
|
|
b1ac478653 | ||
|
|
5e1a554712 | ||
|
|
636cbdb77b | ||
|
|
620112526b | ||
|
|
2193e0b9fb | ||
|
|
03fbb5ecec | ||
|
|
027eeec7b0 | ||
|
|
2e8f885a2a | ||
|
|
90933c8eb0 | ||
|
|
001897e7e2 | ||
|
|
ca80339454 | ||
|
|
8adc7ccf7c | ||
|
|
eb73e23f31 | ||
|
|
3fe8bc09be | ||
|
|
3cd48057c7 | ||
|
|
643a7325ec | ||
|
|
fa50623394 | ||
|
|
17983b2cb3 | ||
|
|
d26dece5d8 | ||
|
|
94fa0aa0d0 | ||
|
|
f114495e3e | ||
|
|
39ca7731e2 | ||
|
|
d5ab4cbe42 | ||
|
|
d045ce5166 | ||
|
|
daaae12e3b | ||
|
|
8dfcf38af1 | ||
|
|
1f9152a50f | ||
|
|
67c537b91c | ||
|
|
d1de5857c7 | ||
|
|
2f438fa9f5 | ||
|
|
21c59d6845 | ||
|
|
69df9e20e2 | ||
|
|
a6756257ef | ||
|
|
4711c49312 | ||
|
|
94d364f157 | ||
|
|
806b0d1580 | ||
|
|
d9a4d98371 | ||
|
|
bdd54b4ee0 | ||
|
|
8d328706c6 | ||
|
|
1a674a036b | ||
|
|
7fd7709a7a | ||
|
|
88c32fa68e | ||
|
|
6bc89f5f85 | ||
|
|
8ea92f2a1d | ||
|
|
571f63f501 | ||
|
|
cbc427485e | ||
|
|
9c3730e601 | ||
|
|
4d5db7193c | ||
|
|
dedb3973e3 | ||
|
|
a32a756a58 | ||
|
|
7262994810 | ||
|
|
f7b2502100 | ||
|
|
e5dae2c6b0 | ||
|
|
25c74a37ca | ||
|
|
1ecf7abe4a | ||
|
|
437555061c | ||
|
|
46d6bd0c0a | ||
|
|
49b682bdd8 | ||
|
|
4397410532 | ||
|
|
351ac1256b | ||
|
|
19ceb7b89e | ||
|
|
83322567de | ||
|
|
53793cd35f | ||
|
|
89f7fcd055 | ||
|
|
3246bc08a6 | ||
|
|
68cf7ad5ad | ||
|
|
1755ffb7b6 | ||
|
|
a68efd1283 | ||
|
|
4b7595d751 | ||
|
|
d542945c3a | ||
|
|
6d6095f33a | ||
|
|
91d78a570f | ||
|
|
3e5dcddba7 | ||
|
|
2ed7c28679 | ||
|
|
932ec637a6 | ||
|
|
da07736952 | ||
|
|
07df260421 | ||
|
|
5fb8eb091f | ||
|
|
cb1f253e63 | ||
|
|
ac7bd90cee | ||
|
|
c932e5c9ec | ||
|
|
163df41d45 | ||
|
|
668306ed86 | ||
|
|
a0118a71bb | ||
|
|
068b46e73b | ||
|
|
24053fbd8f | ||
|
|
c744c65f50 | ||
|
|
77517a9917 | ||
|
|
21682faa5e | ||
|
|
de73c801f3 | ||
|
|
5e7b8928b7 | ||
|
|
c8eb21c9c0 | ||
|
|
fb1ca34140 | ||
|
|
c732388fa1 | ||
|
|
d3daa95096 | ||
|
|
a391007511 | ||
|
|
694d10b71e | ||
|
|
a5d158ab8f | ||
|
|
f6cb50cc99 | ||
|
|
ea7ae28b10 | ||
|
|
3299901cde | ||
|
|
9781fcd532 | ||
|
|
e0566c5fea | ||
|
|
ad9b283247 | ||
|
|
22424dde74 | ||
|
|
3968f28dfd | ||
|
|
e6017741e9 | ||
|
|
a8a52e2f05 | ||
|
|
d1a754c827 | ||
|
|
30e91a10ea | ||
|
|
8d6acfd853 | ||
|
|
49b126bfc5 | ||
|
|
5ed2018360 | ||
|
|
0753c3f6dc | ||
|
|
b1fa4aa63c | ||
|
|
2eaf3a14a5 | ||
|
|
1f52607fc3 | ||
|
|
0a85449dde | ||
|
|
33f17ab9db | ||
|
|
4bc50727f0 | ||
|
|
bedd9bb652 | ||
|
|
29baf25aa0 | ||
|
|
bc2fd97964 | ||
|
|
b88f8d1101 | ||
|
|
7e244891b0 | ||
|
|
3f9b1b86b1 | ||
|
|
7597cfa482 | ||
|
|
bd4dd61a17 | ||
|
|
ece7157933 | ||
|
|
1d7db19cba |
4
.github/ISSUE_TEMPLATE.txt
vendored
4
.github/ISSUE_TEMPLATE.txt
vendored
@@ -28,7 +28,7 @@ Before reporting a new bug, please check the following resources:
|
||||
https://lists.gnu.org/archive/html/bug-coreutils/
|
||||
|
||||
* Open Bugs:
|
||||
https://debbugs.gnu.org/cgi/pkgreport.cgi?which=pkg&data=coreitils
|
||||
https://debbugs.gnu.org/cgi/pkgreport.cgi?which=pkg&data=coreutils
|
||||
|
||||
* Translation related issues:
|
||||
https://translationproject.org/domain/coreutils.html
|
||||
@@ -68,7 +68,7 @@ When sending messages to coreutils@gnu.org or bug-coreutils@gnu.org :
|
||||
|
||||
|
||||
<!--
|
||||
Copyright (C) 2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2017-2020 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
.github/PULL_REQUEST_TEMPLATE.txt
vendored
4
.github/PULL_REQUEST_TEMPLATE.txt
vendored
@@ -36,7 +36,7 @@ contributing to the GNU Project, please read
|
||||
* Bug reports Mailing List:
|
||||
https://lists.gnu.org/archive/html/bug-coreutils/
|
||||
|
||||
* Open Bugs: https://debbugs.gnu.org/cgi/pkgreport.cgi?which=pkg&data=coreitils
|
||||
* Open Bugs: https://debbugs.gnu.org/cgi/pkgreport.cgi?which=pkg&data=coreutils
|
||||
|
||||
* Translation related issues:
|
||||
https://translationproject.org/domain/coreutils.html
|
||||
@@ -88,7 +88,7 @@ in this matter.
|
||||
|
||||
|
||||
<!--
|
||||
Copyright (C) 2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2017-2020 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
|
||||
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -4,9 +4,9 @@
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.o
|
||||
*/.deps/
|
||||
*~
|
||||
._bootmp
|
||||
.deps
|
||||
.gdb-history
|
||||
.kludge-stamp
|
||||
.version
|
||||
@@ -45,7 +45,10 @@
|
||||
/lib/.dirstamp
|
||||
/lib/.gitignore
|
||||
/lib/alloca.h
|
||||
/lib/arg-nonnull.h
|
||||
/lib/arpa/inet.h
|
||||
/lib/byteswap.h
|
||||
/lib/c++defs.h
|
||||
/lib/charset.alias
|
||||
/lib/config.h
|
||||
/lib/config.hin
|
||||
@@ -65,6 +68,7 @@
|
||||
/lib/iconv_open-irix.h
|
||||
/lib/iconv_open-osf.h
|
||||
/lib/iconv_open-solaris.h
|
||||
/lib/iconv_open-zos.h
|
||||
/lib/inttypes.h
|
||||
/lib/langinfo.h
|
||||
/lib/libcoreutils.a
|
||||
@@ -104,7 +108,9 @@
|
||||
/lib/unitypes.h
|
||||
/lib/uniwidth
|
||||
/lib/uniwidth.h
|
||||
/lib/unused-parameter.h
|
||||
/lib/utime.h
|
||||
/lib/warn-on-use.h
|
||||
/lib/wchar.h
|
||||
/lib/wctype.h
|
||||
/m4/.cvsignore
|
||||
@@ -170,6 +176,9 @@
|
||||
/src/coreutils_shebangs
|
||||
/src/cu-progs.mk
|
||||
/src/fs-latest-magic.h
|
||||
/src/fs-def
|
||||
/src/fs-kernel-magic
|
||||
/src/fs-magic
|
||||
/src/libsinglebin_*.a
|
||||
/src/make-prime-list
|
||||
/src/primes.h
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.28
|
||||
8.31
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Suppress valgrind diagnostics we don't care about.
|
||||
|
||||
# Copyright (C) 2003-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2020 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
AUTHORS
3
AUTHORS
@@ -6,6 +6,7 @@ b2sum: Padraig Brady, Samuel Neves
|
||||
base32: Simon Josefsson
|
||||
base64: Simon Josefsson
|
||||
basename: David MacKenzie
|
||||
basenc: Simon Josefsson, Assaf Gordon
|
||||
cat: Torbjorn Granlund, Richard M. Stallman
|
||||
chcon: Russell Coker, Jim Meyering
|
||||
chgrp: David MacKenzie, Jim Meyering
|
||||
@@ -26,7 +27,7 @@ dircolors: H. Peter Anvin
|
||||
dirname: David MacKenzie, Jim Meyering
|
||||
du: Torbjorn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
|
||||
echo: Brian Fox, Chet Ramey
|
||||
env: Richard Mlynarik, David MacKenzie
|
||||
env: Richard Mlynarik, David MacKenzie, Assaf Gordon
|
||||
expand: David MacKenzie
|
||||
expr: Mike Parker, James Youngman, Paul Eggert
|
||||
factor: Paul Rubin, Torbjörn Granlund, Niels Möller
|
||||
|
||||
8
COPYING
8
COPYING
@@ -1,7 +1,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
2
HACKING
2
HACKING
@@ -617,7 +617,7 @@ and root only tests, is to follow these steps (requires lcov to be installed):
|
||||
xdg-open doc/coverage/index.html
|
||||
|
||||
========================================================================
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2020 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-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1990-2020 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,7 +93,7 @@ dist-hook: gen-ChangeLog
|
||||
$(AM_V_at)touch $(distdir)/doc/constants.texi \
|
||||
$(distdir)/doc/coreutils.info
|
||||
|
||||
gen_start_ver = 8.20
|
||||
gen_start_ver = 8.23
|
||||
.PHONY: gen-ChangeLog
|
||||
gen-ChangeLog:
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
|
||||
301
NEWS
301
NEWS
@@ -1,5 +1,290 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 8.32 (2020-03-05) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp now copies /dev/fd/N correctly on platforms like Solaris where
|
||||
it is a character-special file whose minor device number is N.
|
||||
[bug introduced in fileutils-4.1.6]
|
||||
|
||||
dd conv=fdatasync no longer reports a "Bad file descriptor" error
|
||||
when fdatasync is interrupted, and dd now retries interrupted calls
|
||||
to close, fdatasync, fstat and fsync instead of incorrectly
|
||||
reporting an "Interrupted system call" error.
|
||||
[bugs introduced in coreutils-6.0]
|
||||
|
||||
df now correctly parses the /proc/self/mountinfo file for unusual entries
|
||||
like ones with '\r' in a field value ("mount -t tmpfs tmpfs /foo$'\r'bar"),
|
||||
when the source field is empty ('mount -t tmpfs "" /mnt'), and when the
|
||||
filesystem type contains characters like a blank which need escaping.
|
||||
[bugs introduced in coreutils-8.24 with the introduction of reading
|
||||
the /proc/self/mountinfo file]
|
||||
|
||||
factor again outputs immediately when stdout is a tty but stdin is not.
|
||||
[bug introduced in coreutils-8.24]
|
||||
|
||||
ln works again on old systems without O_DIRECTORY support (like Solaris 10),
|
||||
and on systems where symlink ("x", ".") fails with errno == EINVAL
|
||||
(like Solaris 10 and Solaris 11).
|
||||
[bug introduced in coreutils-8.31]
|
||||
|
||||
rmdir --ignore-fail-on-non-empty now works correctly for directories
|
||||
that fail to be removed due to permission issues. Previously the exit status
|
||||
was reversed, failing for non empty and succeeding for empty directories.
|
||||
[bug introduced in coreutils-6.11]
|
||||
|
||||
'shuf -r -n 0 file' no longer mistakenly reads from standard input.
|
||||
[bug introduced with the --repeat feature in coreutils-8.22]
|
||||
|
||||
split no longer reports a "output file suffixes exhausted" error
|
||||
when the specified number of files is evenly divisible by 10, 16, 26,
|
||||
for --numeric, --hex, or default alphabetic suffixes respectively.
|
||||
[bug introduced in coreutils-8.24]
|
||||
|
||||
seq no longer prints an extra line under certain circumstances (such as
|
||||
'seq -f "%g " 1000000 1000000').
|
||||
[bug introduced in coreutils-6.10]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
Several programs now check that numbers end properly. For example,
|
||||
'du -d 1x' now reports an error instead of silently ignoring the 'x'.
|
||||
Affected programs and options include du -d, expr's numeric operands
|
||||
on non-GMP builds, install -g and -o, ls's TABSIZE environment
|
||||
variable, mknod b and c, ptx -g and -w, shuf -n, and sort --batch-size
|
||||
and --parallel.
|
||||
|
||||
date now parses military time zones in accordance with common usage:
|
||||
"A" to "M" are equivalent to UTC+1 to UTC+12
|
||||
"N" to "Y" are equivalent to UTC-1 to UTC-12
|
||||
"Z" is "zulu" time (UTC).
|
||||
For example, 'date -d "09:00B" is now equivalent to 9am in UTC+2 time zone.
|
||||
Previously, military time zones were parsed according to the obsolete
|
||||
rfc822, with their value negated (e.g., "B" was equivalent to UTC-2).
|
||||
[The old behavior was introduced in sh-utils 2.0.15 ca. 1999, predating
|
||||
coreutils package.]
|
||||
|
||||
ls issues an error message on a removed directory, on GNU/Linux systems.
|
||||
Previously no error and no entries were output, and so indistinguishable
|
||||
from an empty directory, with default ls options.
|
||||
|
||||
uniq no longer uses strcoll() to determine string equivalence,
|
||||
and so will operate more efficiently and consistently.
|
||||
|
||||
** New Features
|
||||
|
||||
ls now supports the --time=birth option to display and sort by
|
||||
file creation time, where available.
|
||||
|
||||
od --skip-bytes now can use lseek even if the input is not a regular
|
||||
file, greatly improving performance in some cases.
|
||||
|
||||
stat(1) supports a new --cached= option, used on systems with statx(2)
|
||||
to control cache coherency of file system attributes,
|
||||
useful on network file systems.
|
||||
|
||||
** Improvements
|
||||
|
||||
stat and ls now use the statx() system call where available, which can
|
||||
operate more efficiently by only retrieving requested attributes.
|
||||
|
||||
stat and tail now know about the "binderfs", "dma-buf-fs", "erofs",
|
||||
"ppc-cmm-fs", and "z3fold" file systems.
|
||||
stat -f -c%T now reports the file system type, and tail -f uses inotify.
|
||||
|
||||
** Build-related
|
||||
|
||||
gzip-compressed tarballs are distributed once again
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.31 (2019-03-10) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
'base64 a b' now correctly diagnoses 'b' as the extra operand, not 'a'.
|
||||
[bug introduced in coreutils-5.3.0]
|
||||
|
||||
When B already exists, 'cp -il A B' no longer immediately fails
|
||||
after asking the user whether to proceed.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
df no longer corrupts displayed multibyte characters on macOS.
|
||||
[bug introduced with coreutils-8.18]
|
||||
|
||||
seq no longer outputs inconsistent decimal point characters
|
||||
for the last number, when locales are misconfigured.
|
||||
[bug introduced in coreutils-7.0]
|
||||
|
||||
shred, sort, and split no longer falsely report ftruncate errors
|
||||
when outputting to less-common file types. For example, the shell
|
||||
command 'sort /dev/null -o /dev/stdout | cat' no longer fails with
|
||||
an "error truncating" diagnostic.
|
||||
[bug was introduced with coreutils-8.18 for sort and split, and
|
||||
(for shared memory objects only) with fileutils-4.1 for shred]
|
||||
|
||||
sync no longer fails for write-only file arguments.
|
||||
[bug introduced with argument support to sync in coreutils-8.24]
|
||||
|
||||
'tail -f file | filter' no longer exits immediately on AIX.
|
||||
[bug introduced in coreutils-8.28]
|
||||
|
||||
'tail -f file | filter' no longer goes into an infinite loop
|
||||
if filter exits and SIGPIPE is ignored.
|
||||
[bug introduced in coreutils-8.28]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
cksum, dd, hostid, hostname, link, logname, sleep, tsort, unlink,
|
||||
uptime, users, whoami, yes: now always process --help and --version options,
|
||||
regardless of any other arguments present before any optional '--'
|
||||
end-of-options marker.
|
||||
|
||||
nohup now processes --help and --version as first options even if other
|
||||
parameters follow.
|
||||
|
||||
'yes a -- b' now outputs 'a b' instead of including the end-of-options
|
||||
marker as before: 'a -- b'.
|
||||
|
||||
echo now always processes backslash escapes when the POSIXLY_CORRECT
|
||||
environment variable is set.
|
||||
|
||||
When possible 'ln A B' now merely links A to B and reports an error
|
||||
if this fails, instead of statting A and B before linking. This
|
||||
uses fewer system calls and avoids some races. The old statting
|
||||
approach is still used in situations where hard links to directories
|
||||
are allowed (e.g., NetBSD when superuser).
|
||||
|
||||
ls --group-directories-first will also group symlinks to directories.
|
||||
|
||||
'test -a FILE' is not supported anymore. Long ago, there were concerns about
|
||||
the high probability of humans confusing the -a primary with the -a binary
|
||||
operator, so POSIX changed this to 'test -e FILE'. Scripts using it were
|
||||
already broken and non-portable; the -a unary operator was never documented.
|
||||
|
||||
wc now treats non breaking space characters as word delimiters
|
||||
unless the POSIXLY_CORRECT environment variable is set.
|
||||
|
||||
** New features
|
||||
|
||||
id now supports specifying multiple users.
|
||||
|
||||
'date' now supports the '+' conversion specification flag,
|
||||
introduced in POSIX.1-2017.
|
||||
|
||||
printf, seq, sleep, tail, and timeout now accept floating point
|
||||
numbers in either the current or the C locale. For example, if the
|
||||
current locale's decimal point is ',', 'sleep 0,1' and 'sleep 0.1'
|
||||
now mean the same thing. Previously, these commands accepted only
|
||||
C-locale syntax with '.' as the decimal point. The new behavior is
|
||||
more compatible with other implementations in non-C locales.
|
||||
|
||||
test now supports the '-N FILE' unary operator (like e.g. bash) to check
|
||||
whether FILE exists and has been modified since it was last read.
|
||||
|
||||
env now supports '--default-signal[=SIG]', '--ignore-signal[=SIG]', and
|
||||
'--block-signal[=SIG], to setup signal handling before executing a program.
|
||||
|
||||
env now supports '--list-signal-handling' to indicate non-default
|
||||
signal handling before executing a program.
|
||||
|
||||
** New commands
|
||||
|
||||
basenc is added to complement existing base64,base32 commands,
|
||||
and encodes and decodes printable text using various common encodings:
|
||||
base64,base64url,base32,base32hex,base16,base2,z85.
|
||||
|
||||
** Improvements
|
||||
|
||||
ls -l now better aligns abbreviated months containing digits,
|
||||
which is common in Asian locales.
|
||||
|
||||
stat and tail now know about the "sdcardfs" file system on Android.
|
||||
stat -f -c%T now reports the file system type, and tail -f uses inotify.
|
||||
|
||||
stat now prints file creation time when supported by the file system,
|
||||
on GNU Linux systems with glibc >= 2.28 and kernel >= 4.11.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.30 (2018-07-01) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
'cp --symlink SRC DST' will again correctly validate DST.
|
||||
If DST is a regular file and SRC is a symlink to DST,
|
||||
then cp will no longer allow that operation to clobber DST.
|
||||
Also with -d, if DST is a symlink, then it can always be replaced,
|
||||
even if it points to SRC on a separate device.
|
||||
[bugs introduced with coreutils-8.27]
|
||||
|
||||
'cp -n -u' and 'mv -n -u' now consistently ignore the -u option.
|
||||
Previously, this option combination suffered from race conditions
|
||||
that caused -u to sometimes override -n.
|
||||
[bug introduced with coreutils-7.1]
|
||||
|
||||
'cp -a --no-preserve=mode' now sets appropriate default permissions
|
||||
for non regular files like fifos and character device nodes etc.,
|
||||
and leaves mode bits of existing files unchanged.
|
||||
Previously it would have set executable bits on created special files,
|
||||
and set mode bits for existing files as if they had been created.
|
||||
[bug introduced with coreutils-8.20]
|
||||
|
||||
'cp --remove-destination file symlink' now removes the symlink
|
||||
even if it can't be traversed.
|
||||
[bug introduced with --remove-destination in fileutils-4.1.1]
|
||||
|
||||
ls no longer truncates the abbreviated month names that have a
|
||||
display width between 6 and 12 inclusive. Previously this would have
|
||||
output ambiguous months for Arabic or Catalan locales.
|
||||
|
||||
'ls -aA' is now equivalent to 'ls -A', since -A now overrides -a.
|
||||
[bug introduced in coreutils-5.3.0]
|
||||
|
||||
'mv -n A B' no longer suffers from a race condition that can
|
||||
overwrite a simultaneously-created B. This bug fix requires
|
||||
platform support for the renameat2 or renameatx_np syscalls, found
|
||||
in recent Linux and macOS kernels. As a side effect, 'mv -n A A'
|
||||
now silently does nothing if A exists.
|
||||
[bug introduced with coreutils-7.1]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
'cp --force file symlink' now removes the symlink even if
|
||||
it is self referential.
|
||||
|
||||
ls --color now matches file extensions case insensitively.
|
||||
|
||||
** New features
|
||||
|
||||
cp --reflink now supports --reflink=never to enforce a standard copy.
|
||||
|
||||
env supports a new -v/--debug option to show verbose information about
|
||||
each processing step.
|
||||
|
||||
env supports a new -S/--split-string=S option to split a single argument
|
||||
string into multiple arguments. Used to pass multiple arguments in scripts
|
||||
(shebang lines).
|
||||
|
||||
md5sum accepts a new option: --zero (-z) to delimit the output lines with a
|
||||
NUL instead of a newline character. This also disables file name escaping.
|
||||
This also applies to sha*sum and b2sum.
|
||||
|
||||
rm --preserve-root now supports the --preserve-root=all option to
|
||||
reject any command line argument that is mounted to a separate file system.
|
||||
|
||||
** Improvements
|
||||
|
||||
cut supports line lengths up to the max file size on 32 bit systems.
|
||||
Previously only offsets up to SIZE_MAX-1 were supported.
|
||||
|
||||
stat and tail now know about the "exfs" file system, which is a
|
||||
version of XFS. stat -f --format=%T now reports the file system type,
|
||||
and tail -f uses inotify.
|
||||
|
||||
wc avoids redundant processing of ASCII text in multibyte locales,
|
||||
which is especially significant on macOS.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.29 (2017-12-27) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -152,6 +437,13 @@ GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
expr supports multibyte strings for all string operations.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
tail -f now exits immediately if the output is piped and the reader of
|
||||
the pipe terminates. That allows `tail -f file | grep -q foo` to return
|
||||
responsively, but does make `tail -f file | :` exit immediately without
|
||||
waiting for data. Instead one should now `tail -f file | grep -q .`
|
||||
|
||||
** Improvements
|
||||
|
||||
mv --verbose now distinguishes rename and copy operations.
|
||||
@@ -159,9 +451,6 @@ GNU coreutils NEWS -*- outline -*-
|
||||
stat -f -c %l, used to output the max file name length on a file system,
|
||||
is now supported on FreeBSD and OpenBSD.
|
||||
|
||||
tail -f now exits immediately if the output is piped
|
||||
and the reader of the pipe terminates.
|
||||
|
||||
tail -f no longer erroneously warns about being ineffective
|
||||
when following a single tty, as the simple blocking loop used
|
||||
is effective in this case.
|
||||
@@ -1743,7 +2032,9 @@ GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
** New features
|
||||
|
||||
split accepts the --number option to generate a specific number of files.
|
||||
split accepts the --number/-n option to generate a specific number of
|
||||
files, as well as the --elide-empty-files/-e and --unbuffered/-u
|
||||
options to fine-tune the resulting output.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.7 (2010-11-13) [stable]
|
||||
@@ -4849,7 +5140,7 @@ packages, see ./old/*/NEWS.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2020 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
|
||||
|
||||
20
README
20
README
@@ -7,15 +7,15 @@ arbitrary limits.
|
||||
|
||||
The programs that can be built with this package are:
|
||||
|
||||
[ arch b2sum base32 base64 basename cat chcon chgrp chmod chown chroot cksum
|
||||
comm coreutils cp csplit cut date dd df dir dircolors dirname du echo env
|
||||
expand expr factor false fmt fold groups head hostid hostname id install
|
||||
join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl
|
||||
nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd
|
||||
readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum
|
||||
sha512sum shred shuf sleep sort split stat stdbuf stty sum sync tac tail
|
||||
tee test timeout touch tr true truncate tsort tty uname unexpand uniq
|
||||
unlink uptime users vdir wc who whoami yes
|
||||
[ arch b2sum base32 base64 basename basenc cat chcon chgrp chmod chown
|
||||
chroot cksum comm coreutils cp csplit cut date dd df dir dircolors dirname
|
||||
du echo env expand expr factor false fmt fold groups head hostid hostname
|
||||
id install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp
|
||||
mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx
|
||||
pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum
|
||||
sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty sum sync
|
||||
tac tail tee test timeout touch tr true truncate tsort tty uname unexpand
|
||||
uniq unlink uptime users vdir wc who whoami yes
|
||||
|
||||
See the file NEWS for a list of major changes in the current release.
|
||||
|
||||
@@ -232,7 +232,7 @@ the address on the last line of --help output.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2020 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
|
||||
|
||||
@@ -93,7 +93,7 @@ each program. One way to do this is to use vc-dwim
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2020 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-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2020 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,6 @@ Adam Klein aklein@debian.org
|
||||
Adam Sampson ats@offog.org
|
||||
Adrian Bunk bunk@stusta.de
|
||||
AIDA Shinra shinra@j10n.org
|
||||
Akim Demaille demaille@inf.enst.fr
|
||||
Alain Magloire alain@qnx.com
|
||||
Alan Iwi iwi@atm.ox.ac.uk
|
||||
Alan Jenkins alan-jenkins@tuffmail.co.uk
|
||||
@@ -261,6 +260,7 @@ Ian Kent ikent@redhat.com
|
||||
Ian Lance Taylor ian@cygnus.com
|
||||
Ian Turner vectro@pipeline.com
|
||||
Iida Yosiaki iida@gnu.org
|
||||
Illia Bobyr ibobyr@google.com
|
||||
Ilya N. Golubev gin@mo.msk.ru
|
||||
Ingo Saitz ingo@debian.org
|
||||
Ivan Labath labath3@st.fmph.uniba.sk
|
||||
@@ -279,12 +279,12 @@ Jamie McClelland jm@mayfirst.org
|
||||
Jan Engelhardt jengelh@medozas.de
|
||||
Jan Fedak J.Fedak@sh.cvut.cz
|
||||
Jan Moringen jan.moringen@uni-bielefeld.de
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Janos Farkas chexum@shadow.banki.hu
|
||||
Jan-Pawel Wrozstinski jpwroz@gmail.com
|
||||
Jari Aalto jari.aalto@cante.net
|
||||
Jarkko Hietaniemi jhi@epsilon.hut.fi
|
||||
Jarod Wilson jwilson@redhat.com
|
||||
Jason Smith jasonmsmith@google.com
|
||||
Jean Charles Delepine delepine@u-picardie.fr
|
||||
Jean-Pierre Tosoni jpt.7196@gmail.com
|
||||
Jeff Moore jbm@mordor.com
|
||||
@@ -309,6 +309,7 @@ Joerg Sonnenberger joerg@britannica.bec.de
|
||||
Joey Hess joeyh@debian.org
|
||||
Johan Boule bohan@bohan.dyndns.org
|
||||
Johan Danielsson joda@pdc.kth.se
|
||||
Johannes Altmanninger aclopte@gmail.com
|
||||
John Bley jbb6@acpub.duke.edu
|
||||
John Gatewood Ham zappaman@alphabox.compsci.buu.ac.th
|
||||
John Gotts jgotts@umich.edu
|
||||
@@ -348,7 +349,7 @@ Karsten Thygesen karthy@kom.auc.dk
|
||||
Kaveh R. Ghazi ghazi@caip.rutgers.edu
|
||||
Keith M. Briggs keith.briggs@bt.com
|
||||
Keith Owens kaos@audio.apana.org.au
|
||||
Keith Thompson kst@cts.com
|
||||
Keith Thompson Keith.S.Thompson@gmail.com
|
||||
Ken Irving ken.irving@alaska.edu
|
||||
Ken Pizzini kenp@halcyon.com
|
||||
Kevin Mudrick kmudrick@healthmarketscience.com
|
||||
@@ -419,6 +420,7 @@ Matthew Arnison maffew@cat.org.au
|
||||
Matthew Braun matthew@ans.net
|
||||
Matthew Clarke Matthew_Clarke@mindlink.bc.ca
|
||||
Matthew M. Boedicker matthewm@boedicker.org
|
||||
Matthew Pfeiffer spferical@gmail.com
|
||||
Matthew S. Levine mslevine@theory.lcs.mit.edu
|
||||
Matthew Smith matts@bluesguitar.org
|
||||
Matthew Swift swift@alum.mit.edu
|
||||
|
||||
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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2020 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
|
||||
|
||||
297
bootstrap
297
bootstrap
@@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2017-09-19.08; # UTC
|
||||
scriptversion=2019-01-04.17; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2020 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
|
||||
@@ -47,6 +47,8 @@ PERL="${PERL-perl}"
|
||||
|
||||
me=$0
|
||||
|
||||
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $me [OPTION]...
|
||||
@@ -76,6 +78,37 @@ contents are read as shell variables to configure the bootstrap.
|
||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||
are honored.
|
||||
|
||||
Gnulib sources can be fetched in various ways:
|
||||
|
||||
* 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_SRCDIR is set (directly or via
|
||||
--gnulib-srcdir) and is a git repository, then it is used as a reference.
|
||||
|
||||
* Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
|
||||
then sources are fetched from that local directory. If it is a git
|
||||
repository and \$GNULIB_REVISION is set, 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.
|
||||
|
||||
* 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.
|
||||
If \$GNULIB_REVISION is set, then that revision is checked out.
|
||||
|
||||
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
|
||||
used. If it is a git repository and \$GNULIB_REVISION is set, then that
|
||||
revision is checked out.
|
||||
|
||||
If you maintain a package and want to pin a particular revision of the
|
||||
Gnulib sources that has been tested with your package, then there are two
|
||||
possible approaches: either configure a 'gnulib' submodule with the
|
||||
appropriate revision, or set \$GNULIB_REVISION (and if necessary
|
||||
\$GNULIB_URL) in $me.conf.
|
||||
|
||||
Running without arguments will suffice in most cases.
|
||||
EOF
|
||||
}
|
||||
@@ -129,18 +162,11 @@ bootstrap_post_import_hook() { :; }
|
||||
# Override it via your own definition in bootstrap.conf.
|
||||
bootstrap_epilogue() { :; }
|
||||
|
||||
# The command to download all .po files for a specified domain into
|
||||
# a specified directory. Fill in the first %s is the domain name, and
|
||||
# the second with the destination directory. Use rsync's -L and -r
|
||||
# options because the latest/%s directory and the .po files within are
|
||||
# all symlinks.
|
||||
# The command to download all .po files for a specified domain into a
|
||||
# specified directory. Fill in the first %s with the destination
|
||||
# directory and the second with the domain name.
|
||||
po_download_command_format=\
|
||||
"rsync --delete --exclude '*.s1' -Lrtvz \
|
||||
'translationproject.org::tp/latest/%s/' '%s'"
|
||||
|
||||
# Fallback for downloading .po files (if rsync fails).
|
||||
po_download_command_format2=\
|
||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||
"wget --mirror --level=1 -nd -nv -A.po -P '%s' \
|
||||
https://translationproject.org/latest/%s/"
|
||||
|
||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||
@@ -170,7 +196,15 @@ source_base=lib
|
||||
m4_base=m4
|
||||
doc_base=doc
|
||||
tests_base=tests
|
||||
gnulib_extra_files=''
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
||||
gnulib_tool_option_extras=
|
||||
@@ -264,24 +298,18 @@ case "$0" in
|
||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||
esac
|
||||
|
||||
# Extra files from gnulib, which override files from other sources.
|
||||
test -z "${gnulib_extra_files}" && \
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
if test "$vc_ignore" = auto; then
|
||||
vc_ignore=
|
||||
test -d .git && vc_ignore=.gitignore
|
||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||
fi
|
||||
|
||||
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
|
||||
use_gnulib=false
|
||||
else
|
||||
use_gnulib=true
|
||||
fi
|
||||
|
||||
# Translate configuration into internal form.
|
||||
|
||||
# Parse options.
|
||||
@@ -612,95 +640,101 @@ git_modules_config () {
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
fi
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
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 $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
if $use_gnulib; then
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR directly or as a reference.
|
||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
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_SRCDIR" \
|
||||
"$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.
|
||||
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_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
|| exit $?
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
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 $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
if test -z "$GNULIB_REVISION"; then
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
fi
|
||||
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
||||
|| cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR directly or as a reference.
|
||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
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_SRCDIR" \
|
||||
"$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.
|
||||
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_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
|| exit $?
|
||||
fi
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
||||
;;
|
||||
esac
|
||||
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
case $(sh -c 'echo "$1"' -- a) in
|
||||
a) ignored=--;;
|
||||
*) ignored=ignored;;
|
||||
esac
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
case $(sh -c 'echo "$1"' -- a) in
|
||||
a) ignored=--;;
|
||||
*) ignored=ignored;;
|
||||
esac
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
fi
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
fi
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
|
||||
# Get translations.
|
||||
|
||||
download_po_files() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
echo "$me: getting translations into $subdir for $domain..."
|
||||
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||
eval "$cmd" && return
|
||||
# Fallback to HTTPS.
|
||||
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
@@ -898,36 +932,47 @@ fi
|
||||
|
||||
# Import from gnulib.
|
||||
|
||||
gnulib_tool_options="\
|
||||
--import\
|
||||
--no-changelog\
|
||||
--aux-dir $build_aux\
|
||||
--doc-base $doc_base\
|
||||
--lib $gnulib_name\
|
||||
--m4-base $m4_base/\
|
||||
--source-base $source_base/\
|
||||
--tests-base $tests_base\
|
||||
--local-dir $local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
if $use_gnulib; then
|
||||
gnulib_tool_options="\
|
||||
--no-changelog\
|
||||
--aux-dir=$build_aux\
|
||||
--doc-base=$doc_base\
|
||||
--lib=$gnulib_name\
|
||||
--m4-base=$m4_base/\
|
||||
--source-base=$source_base/\
|
||||
--tests-base=$tests_base\
|
||||
--local-dir=$local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
fi
|
||||
|
||||
bootstrap_post_import_hook \
|
||||
|| die "bootstrap_post_import_hook failed"
|
||||
|
||||
# Don't proceed if there are uninitialized submodules. In particular,
|
||||
# the next step will remove dangling links, which might be links into
|
||||
# uninitialized submodules.
|
||||
#
|
||||
# Uninitialized submodules are listed with an initial dash.
|
||||
if $use_git && git submodule | grep '^-' >/dev/null; then
|
||||
die "some git submodules are not initialized. " \
|
||||
"Run 'git submodule init' and bootstrap again."
|
||||
fi
|
||||
|
||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||
# The following requires GNU find 4.2.3 or newer. Considering the usual
|
||||
@@ -1020,7 +1065,7 @@ bootstrap_epilogue
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# 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-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2020 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
|
||||
@@ -38,14 +38,17 @@ gnulib_modules="
|
||||
backup-rename
|
||||
base32
|
||||
base64
|
||||
btowc
|
||||
buffer-lcm
|
||||
c-strcase
|
||||
c-strtod
|
||||
c-strtold
|
||||
cl-strtod
|
||||
cl-strtold
|
||||
calloc-gnu
|
||||
canon-host
|
||||
canonicalize
|
||||
chmodat
|
||||
chown
|
||||
chownat
|
||||
cloexec
|
||||
closein
|
||||
closeout
|
||||
@@ -74,8 +77,6 @@ gnulib_modules="
|
||||
faccessat
|
||||
fadvise
|
||||
fchdir
|
||||
fchmodat
|
||||
fchownat
|
||||
fclose
|
||||
fcntl
|
||||
fcntl-safer
|
||||
@@ -100,7 +101,6 @@ gnulib_modules="
|
||||
fstatat
|
||||
fsusage
|
||||
fsync
|
||||
ftello
|
||||
ftoastr
|
||||
ftruncate
|
||||
fts
|
||||
@@ -165,6 +165,7 @@ gnulib_modules="
|
||||
memcmp2
|
||||
mempcpy
|
||||
memrchr
|
||||
minmax
|
||||
mgetgroups
|
||||
mkancesdirs
|
||||
mkdir
|
||||
@@ -183,6 +184,7 @@ gnulib_modules="
|
||||
nstrftime
|
||||
obstack
|
||||
open
|
||||
openat-safer
|
||||
parse-datetime
|
||||
pathmax
|
||||
perl
|
||||
@@ -195,7 +197,10 @@ gnulib_modules="
|
||||
priv-set
|
||||
progname
|
||||
propername
|
||||
pthread
|
||||
pthread-cond
|
||||
pthread-mutex
|
||||
pthread-thread
|
||||
pthread_sigmask
|
||||
putenv
|
||||
quote
|
||||
quotearg
|
||||
@@ -211,7 +216,7 @@ gnulib_modules="
|
||||
remove
|
||||
rename
|
||||
renameat
|
||||
renameat2
|
||||
renameatu
|
||||
rmdir
|
||||
root-dev-ino
|
||||
rpmatch
|
||||
@@ -220,6 +225,7 @@ gnulib_modules="
|
||||
save-cwd
|
||||
savedir
|
||||
savewd
|
||||
select
|
||||
selinux-at
|
||||
setenv
|
||||
settime
|
||||
@@ -238,9 +244,7 @@ gnulib_modules="
|
||||
strdup-posix
|
||||
strncat
|
||||
strnumcmp
|
||||
strpbrk
|
||||
strsignal
|
||||
strtod
|
||||
strtoimax
|
||||
strtoumax
|
||||
symlinkat
|
||||
@@ -259,6 +263,7 @@ gnulib_modules="
|
||||
unistd-safer
|
||||
unlink-busy
|
||||
unlinkat
|
||||
unlinkdir
|
||||
unlocked-io
|
||||
unsetenv
|
||||
update-copyright
|
||||
@@ -272,6 +277,7 @@ gnulib_modules="
|
||||
verify
|
||||
verror
|
||||
version-etc-fsf
|
||||
wchar-single
|
||||
wcswidth
|
||||
wcwidth
|
||||
winsz-ioctl
|
||||
@@ -292,6 +298,7 @@ gnulib_modules="
|
||||
xstrtod
|
||||
xstrtoimax
|
||||
xstrtol
|
||||
xstrtol-error
|
||||
xstrtold
|
||||
xstrtoumax
|
||||
year2038
|
||||
|
||||
@@ -45,6 +45,7 @@ normal_progs='
|
||||
b2sum
|
||||
base64
|
||||
base32
|
||||
basenc
|
||||
basename
|
||||
cat
|
||||
chcon
|
||||
|
||||
70
cfg.mk
70
cfg.mk
@@ -1,5 +1,5 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2003-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2020 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 = 8c2a749f657a6bd541e8b9c5227fe26f
|
||||
old_NEWS_hash = d914d8ae972de9e5f77e9398a39de945
|
||||
|
||||
# Add an exemption for sc_makefile_at_at_check.
|
||||
_makefile_at_at_check_exceptions = ' && !/^cu_install_prog/ && !/dynamic-dep/'
|
||||
@@ -121,6 +121,7 @@ sc_tests_list_consistency:
|
||||
# Ensure that all version-controlled test scripts are executable.
|
||||
sc_tests_executable:
|
||||
@set -o noglob 2>/dev/null || set -f; \
|
||||
cd $(srcdir); \
|
||||
find_ext="-name '' "`printf -- "-o -name *%s " $(TEST_EXTENSIONS)`;\
|
||||
find $(srcdir)/tests/ \( $$find_ext \) \! -perm -u+x -print \
|
||||
| { sed "s|^$(srcdir)/||"; git ls-files $(srcdir)/tests/; } \
|
||||
@@ -138,8 +139,8 @@ sc_ensure_gl_diffs_apply_cleanly:
|
||||
|
||||
# Avoid :>file which doesn't propagate errors
|
||||
sc_prohibit_colon_redirection:
|
||||
@cd $(srcdir)/tests && GIT_PAGER= git grep -n ': *>.*||' \
|
||||
&& { echo '$(ME): '"The leading colon in :> will hide errors" 1>&2; \
|
||||
@cd $(srcdir)/tests && GIT_PAGER= git grep -En ': *>.*\|\|' \
|
||||
&& { echo '$(ME): '"The leading colon in :> will hide errors" >&2; \
|
||||
exit 1; } \
|
||||
|| :
|
||||
|
||||
@@ -250,6 +251,11 @@ sc_prohibit-quotearg:
|
||||
halt='Unstyled diagnostic quoting detected' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit-skip:
|
||||
@prohibit='\|\| skip ' \
|
||||
halt='Use skip_ not skip' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_sun_os_names:
|
||||
@grep -nEi \
|
||||
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||
@@ -402,7 +408,7 @@ check-programs-vs-x:
|
||||
|
||||
# Ensure we can check out on case insensitive file systems
|
||||
sc_case_insensitive_file_names: src/uniq
|
||||
@git ls-files | sort -f | src/uniq -Di | grep . && \
|
||||
@git -C $(srcdir) ls-files | sort -f | src/uniq -Di | grep . && \
|
||||
{ echo "$(ME): the above file(s) conflict on case insensitive" \
|
||||
" file systems" 1>&2; exit 1; } || :
|
||||
|
||||
@@ -440,20 +446,22 @@ sc_prohibit_stat_macro_address:
|
||||
# Ensure that date's --help output stays in sync with the info
|
||||
# documentation for GNU strftime. The only exception is %N and %q,
|
||||
# which date accepts but GNU strftime does not.
|
||||
#
|
||||
# "info foo" fails with error, but not "info foo >/dev/null".
|
||||
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||
sc_strftime_check:
|
||||
@if test -f $(srcdir)/src/date.c; then \
|
||||
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||
| $(extract_char) > $@-src; \
|
||||
{ echo N; echo q; \
|
||||
info libc date calendar format 2>/dev/null \
|
||||
| grep "^ *['\`]%.'$$"| $(extract_char); }| sort >$@-info;\
|
||||
if test $$(stat --format %s $@-info) != 2; then \
|
||||
if info libc date calendar format 2>/dev/null | \
|
||||
grep "^ *['\`]%.'$$" >$@-tmp; then \
|
||||
{ echo N; echo q; $(extract_char) $@-tmp; }| sort \
|
||||
>$@-info; \
|
||||
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||
| $(extract_char) > $@-src; \
|
||||
diff -u $@-src $@-info || exit 1; \
|
||||
else \
|
||||
echo '$(ME): skipping $@: libc info not installed' 1>&2; \
|
||||
fi; \
|
||||
rm -f $@-src $@-info; \
|
||||
rm -f $@-info $@-src $@-tmp; \
|
||||
fi
|
||||
|
||||
# Indent only with spaces.
|
||||
@@ -511,6 +519,14 @@ sc_prohibit_and_fail_1:
|
||||
in_vc_files='^tests/' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Ensure that tests don't use `cmd ... || fail` as that's a noop.
|
||||
sc_prohibit_or_fail:
|
||||
@prohibit='\|\| fail$$' \
|
||||
exclude=':#' \
|
||||
halt='|| fail detected. Please use: || fail=1' \
|
||||
in_vc_files='^tests/' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Ensure that env vars are not passed through returns_ as
|
||||
# that was seen to fail on FreeBSD /bin/sh at least
|
||||
sc_prohibit_env_returns:
|
||||
@@ -603,7 +619,8 @@ sc_prohibit_expr_unsigned:
|
||||
# Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h.
|
||||
# In those programs, ensure that EXIT_FAILURE is not used by mistake.
|
||||
sc_some_programs_must_avoid_exit_failure:
|
||||
@grep -nw EXIT_FAILURE \
|
||||
@cd $(srcdir) \
|
||||
&& grep -nw EXIT_FAILURE \
|
||||
$$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' $(srcdir)/src) \
|
||||
| grep -vE '= EXIT_FAILURE|return .* \?' | grep . \
|
||||
&& { echo '$(ME): do not use EXIT_FAILURE in the above' \
|
||||
@@ -611,22 +628,22 @@ sc_some_programs_must_avoid_exit_failure:
|
||||
|
||||
# Ensure that tests call the get_min_ulimit_v_ function if using ulimit -v
|
||||
sc_prohibit_test_ulimit_without_require_:
|
||||
@(git grep -l get_min_ulimit_v_ $(srcdir)/tests; \
|
||||
git grep -l 'ulimit -v' $(srcdir)/tests) \
|
||||
@(git -C $(srcdir) grep -l get_min_ulimit_v_ tests; \
|
||||
git -C $(srcdir) grep -l 'ulimit -v' tests) \
|
||||
| sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
|
||||
" should match get_min_ulimit_v_ with ulimit -v" 1>&2; exit 1; } || :
|
||||
|
||||
# Ensure that tests call the cleanup_ function if using background processes
|
||||
sc_prohibit_test_background_without_cleanup_:
|
||||
@(git grep -El '( &$$|&[^&]*=\$$!)' $(srcdir)/tests; \
|
||||
git grep -l 'cleanup_()' $(srcdir)/tests | sed p) \
|
||||
@(git -C $(srcdir) grep -El '( &$$|&[^&]*=\$$!)' tests; \
|
||||
git -C $(srcdir) grep -l 'cleanup_()' tests | sed p) \
|
||||
| sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
|
||||
" should use cleanup_ for background processes" 1>&2; exit 1; } || :
|
||||
|
||||
# Ensure that tests call the print_ver_ function for programs which are
|
||||
# actually used in that test.
|
||||
sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
|
||||
@git grep -w print_ver_ $(srcdir)/tests \
|
||||
@git -C $(srcdir) grep -w print_ver_ tests \
|
||||
| sed 's#:print_ver_##' \
|
||||
| { fail=0; \
|
||||
while read file name; do \
|
||||
@@ -738,7 +755,7 @@ sc_preprocessor_indentation:
|
||||
# someone who was initially listed only in THANKS.in later authors a commit,
|
||||
# this rule detects that their pair may now be removed from THANKS.in.
|
||||
sc_THANKS_in_duplicates:
|
||||
@{ git log --pretty=format:%aN | sort -u; \
|
||||
@{ git -C $(srcdir) log --pretty=format:%aN | sort -u; \
|
||||
cut -b-36 $(srcdir)/THANKS.in \
|
||||
| sed '/^$$/,/^$$/!d;/^$$/d;s/ *$$//'; } \
|
||||
| sort | uniq -d | grep . \
|
||||
@@ -787,11 +804,13 @@ sc_gitignore_missing:
|
||||
'entries to .gitignore' >&2; exit 1; } || :
|
||||
|
||||
# Flag redundant entries in .gitignore
|
||||
sc_gitignore_redundant:
|
||||
@{ grep ^/lib $(srcdir)/.gitignore; \
|
||||
sed 's|^|/lib|' $(srcdir)/lib/.gitignore; } | \
|
||||
sort | uniq -d | grep . && { echo '$(ME): Remove above' \
|
||||
'entries from .gitignore' >&2; exit 1; } || :
|
||||
# Disabled for now as too aggressive flagging
|
||||
# entries like /lib/arg-nonnull.h
|
||||
#sc_gitignore_redundant:
|
||||
# @{ grep ^/lib $(srcdir)/.gitignore; \
|
||||
# sed 's|^|/lib|' $(srcdir)/lib/.gitignore; } | \
|
||||
# sort | uniq -d | grep . && { echo '$(ME): Remove above' \
|
||||
# 'entries from .gitignore' >&2; exit 1; } || :
|
||||
|
||||
sc_prohibit-form-feed:
|
||||
@prohibit=$$'\f' \
|
||||
@@ -821,8 +840,9 @@ exclude_file_name_regexp--sc_system_h_headers = \
|
||||
^src/((die|system|copy)\.h|make-prime-list\.c)$$
|
||||
|
||||
_src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
|
||||
_gl_src = (xdecto.max|cl-strtold)
|
||||
exclude_file_name_regexp--sc_require_config_h_first = \
|
||||
(^lib/buffer-lcm\.c|gl/lib/xdecto.max\.c|src/$(_src)\.c)$$
|
||||
(^lib/buffer-lcm\.c|gl/lib/$(_gl_src)\.c|src/$(_src)\.c)$$
|
||||
exclude_file_name_regexp--sc_require_config_h = \
|
||||
$(exclude_file_name_regexp--sc_require_config_h_first)
|
||||
|
||||
|
||||
49
configure.ac
49
configure.ac
@@ -1,7 +1,7 @@
|
||||
# -*- autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2020 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
|
||||
@@ -35,8 +35,7 @@ AC_CONFIG_SRCDIR([src/ls.c])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.11.2 no-dist-gzip dist-xz color-tests parallel-tests
|
||||
subdir-objects])
|
||||
AM_INIT_AUTOMAKE([1.11.2 dist-xz color-tests parallel-tests subdir-objects])
|
||||
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
|
||||
|
||||
dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
|
||||
@@ -60,6 +59,7 @@ AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_LN_S
|
||||
gl_EARLY
|
||||
gl_SET_CRYPTO_CHECK_DEFAULT([auto-gpl-compat])
|
||||
gl_INIT
|
||||
coreutils_MACROS
|
||||
|
||||
@@ -128,14 +128,11 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
nw="$nw -Wunreachable-code" # Too many warnings for now
|
||||
nw="$nw -Wpadded" # Our structs are not padded
|
||||
nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
|
||||
nw="$nw -Wlogical-op" # Too many warnings until GCC 4.8.0
|
||||
nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
|
||||
nw="$nw -Wvla" # warnings in gettext.h
|
||||
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 -Wtype-limits" # False alarms for portable code
|
||||
nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 80776
|
||||
nw="$nw -Wformat-truncation=2" # False alarm in ls.c, probably related
|
||||
# things I might fix soon:
|
||||
@@ -144,6 +141,8 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
|
||||
nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
|
||||
nw="$nw -Wsuggest-attribute=format" # warns about copy.c and factor.c
|
||||
nw="$nw -Wvector-operation-performance" # warns about randperm.c
|
||||
|
||||
|
||||
# Using -Wstrict-overflow is a pain, but the alternative is worse.
|
||||
# For an example, see the code that provoked this report:
|
||||
@@ -156,15 +155,9 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
gl_WARN_ADD([$w])
|
||||
done
|
||||
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-type-limits]) # False alarms for portable code
|
||||
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-format-nonliteral])
|
||||
|
||||
# Enable this warning only with gcc-4.8 and newer. Before that
|
||||
# bounds checking as done in truncate.c was incorrectly flagged.
|
||||
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
|
||||
gl_GCC_VERSION_IFELSE([4], [8], [gl_WARN_ADD([-Wlogical-op])])
|
||||
|
||||
# clang is unduly picky about some things.
|
||||
AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
|
||||
[AC_COMPILE_IFELSE(
|
||||
@@ -208,6 +201,11 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
# FIXME: it may be easy to remove this, since it affects only one file:
|
||||
# the snprintf call at ftoastr.c:132.
|
||||
nw="$nw -Wdouble-promotion"
|
||||
|
||||
# FIXME: remove this line when gcc improves
|
||||
# FP in careadlinkat.c w/gcc 10.0.1 20200205
|
||||
gl_WARN_ADD([-Wno-return-local-addr])
|
||||
|
||||
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
|
||||
AC_SUBST([GNULIB_WARN_CFLAGS])
|
||||
|
||||
@@ -318,6 +316,9 @@ if test $ac_cv_func_getattrat = yes; then
|
||||
AC_SUBST([LIB_NVPAIR])
|
||||
fi
|
||||
|
||||
# glibc >= 2.28 and linux kernel >= 4.11
|
||||
AC_CHECK_FUNCS([statx])
|
||||
|
||||
# SCO-ODT-3.0 is reported to need -los to link programs using initgroups
|
||||
AC_CHECK_FUNCS([initgroups])
|
||||
if test $ac_cv_func_initgroups = no; then
|
||||
@@ -351,6 +352,15 @@ case $utils_cv_func_setpriority,$ac_cv_func_nice in
|
||||
gl_ADD_PROG([optional_bin_progs], [nice])
|
||||
esac
|
||||
|
||||
if test "$cross_compiling" = yes || test -c /dev/stdin <.; then
|
||||
AC_DEFINE([DEV_FD_MIGHT_BE_CHR], [1],
|
||||
[Define to 1 if /dev/std{in,out,err} and /dev/fd/N, if they exist, might be
|
||||
character-special devices whose minor device number is the file
|
||||
descriptor number, such as on Solaris. Leave undefined if they are
|
||||
definitely the actual files. This determination should be done after any
|
||||
symbolic links are followed.])
|
||||
fi
|
||||
|
||||
AC_DEFUN([coreutils_DUMMY_1],
|
||||
[
|
||||
AC_REQUIRE([gl_READUTMP])
|
||||
@@ -474,6 +484,8 @@ fi
|
||||
# Build stdbuf only if supported
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
ac_save_LDFLAGS=$LDFLAGS
|
||||
cu_save_c_werror_flag=$ac_c_werror_flag
|
||||
AC_LANG_WERROR
|
||||
# Detect warnings about ignored "constructor" attributes.
|
||||
gl_WARN_ADD([-Werror], [CFLAGS])
|
||||
gl_WARN_ADD([-errwarn], [CFLAGS])
|
||||
@@ -502,18 +514,7 @@ if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
|
||||
fi
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
LDFLAGS=$ac_save_LDFLAGS
|
||||
|
||||
# Detect when using xlc to determine whether to use -qinclude=
|
||||
AC_CACHE_CHECK([whether the system supports xlc include], [utils_cv_xlc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#ifndef __xlc__
|
||||
#error "not xlc"
|
||||
#endif
|
||||
]])],
|
||||
[utils_cv_xlc=yes],
|
||||
[utils_cv_xlc=no])])
|
||||
AM_CONDITIONAL([USE_XLC_INCLUDE], [test "$utils_cv_xlc" = yes])
|
||||
ac_c_werror_flag=$cu_save_c_werror_flag
|
||||
|
||||
############################################################################
|
||||
|
||||
|
||||
1238
doc/coreutils.texi
1238
doc/coreutils.texi
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
# Make coreutils documentation. -*-Makefile-*-
|
||||
# This is included by the top-level Makefile.am.
|
||||
|
||||
# Copyright (C) 1995-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-2020 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,7 +22,8 @@ doc_coreutils_TEXINFOS = \
|
||||
doc/perm.texi \
|
||||
doc/parse-datetime.texi \
|
||||
doc/constants.texi \
|
||||
doc/fdl.texi
|
||||
doc/fdl.texi \
|
||||
doc/sort-version.texi
|
||||
|
||||
# The following is necessary if the package name is 8 characters or longer.
|
||||
# If the info documentation would be split into 10 or more separate files,
|
||||
|
||||
114
doc/perm.texi
114
doc/perm.texi
@@ -1,6 +1,6 @@
|
||||
@c File mode bits
|
||||
|
||||
@c Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 1994-2020 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
|
||||
@@ -70,38 +70,36 @@ In addition to the three sets of three permissions listed above, the
|
||||
file mode bits have three special components, which affect only
|
||||
executable files (programs) and, on most systems, directories:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
@table @asis
|
||||
@item The @dfn{set-user-ID bit} (@dfn{setuid bit}).
|
||||
@cindex set-user-ID
|
||||
@cindex setuid
|
||||
Set the process's effective user ID to that of the file upon execution
|
||||
(called the @dfn{set-user-ID bit}, or sometimes the @dfn{setuid bit}).
|
||||
On execution, set the process's effective user ID to that of the file.
|
||||
For directories on a few systems, give files created in the directory
|
||||
the same owner as the directory, no matter who creates them, and set
|
||||
the set-user-ID bit of newly-created subdirectories.
|
||||
@item
|
||||
|
||||
@item The @dfn{set-group-ID bit} (@dfn{setgid bit}).
|
||||
@cindex set-group-ID
|
||||
@cindex setgid
|
||||
Set the process's effective group ID to that of the file upon execution
|
||||
(called the @dfn{set-group-ID bit}, or sometimes the @dfn{setgid bit}).
|
||||
On execution, set the process's effective group ID to that of the file.
|
||||
For directories on most systems, give files created in the directory
|
||||
the same group as the directory, no matter what group the user who
|
||||
creates them is in, and set the set-group-ID bit of newly-created
|
||||
subdirectories.
|
||||
@item
|
||||
|
||||
@item The @dfn{restricted deletion flag} or @dfn{sticky bit}.
|
||||
@cindex sticky
|
||||
@cindex swap space, saving text image in
|
||||
@cindex text image, saving in swap space
|
||||
@cindex restricted deletion flag
|
||||
Prevent unprivileged users from removing or renaming a file in a directory
|
||||
unless they own the file or the directory; this is called the
|
||||
@dfn{restricted deletion flag} for the directory, and is commonly
|
||||
unless they own the file or the directory; this is commonly
|
||||
found on world-writable directories like @file{/tmp}.
|
||||
|
||||
For regular files on some older systems, save the program's text image on the
|
||||
swap device so it will load more quickly when run; this is called the
|
||||
@dfn{sticky bit}.
|
||||
@end enumerate
|
||||
swap device so it will load more quickly when run, so that the image
|
||||
is ``sticky''.
|
||||
@end table
|
||||
|
||||
In addition to the file mode bits listed above, there may be file attributes
|
||||
specific to the file system, e.g., access control lists (ACLs), whether a
|
||||
@@ -494,10 +492,47 @@ the file to all users.
|
||||
As an
|
||||
alternative to giving a symbolic mode, you can give an octal (base 8)
|
||||
number that represents the mode.
|
||||
This number is always interpreted in octal; you do not have to add a
|
||||
leading @samp{0}, as you do in C. Mode @samp{0055} is the same as
|
||||
mode @samp{55}. (However, modes of five digits or more, such as
|
||||
@samp{00055}, are sometimes special. @xref{Directory Setuid and Setgid}.)
|
||||
|
||||
The permissions granted to the user,
|
||||
to other users in the file's group,
|
||||
and to other users not in the file's group each require three
|
||||
bits: one bit for read, one for write, and one for execute/search permission.
|
||||
These three bits are represented as one octal digit;
|
||||
for example, if all three are present, the resulting 111 (in binary)
|
||||
is represented as the digit 7 (in octal). The three special
|
||||
mode bits also require one bit each, and they are as a group
|
||||
represented as another octal digit. Here is how the bits are arranged,
|
||||
starting with the highest valued bit:
|
||||
|
||||
@example
|
||||
Value in Corresponding
|
||||
Mode Mode Bit
|
||||
|
||||
Special mode bits:
|
||||
4000 Set user ID
|
||||
2000 Set group ID
|
||||
1000 Restricted deletion flag or sticky bit
|
||||
|
||||
The file's owner:
|
||||
400 Read
|
||||
200 Write
|
||||
100 Execute/search
|
||||
|
||||
Other users in the file's group:
|
||||
40 Read
|
||||
20 Write
|
||||
10 Execute/search
|
||||
|
||||
Other users not in the file's group:
|
||||
4 Read
|
||||
2 Write
|
||||
1 Execute/search
|
||||
@end example
|
||||
|
||||
For example, numeric mode @samp{4751} corresponds to symbolic mode
|
||||
@samp{u=srwx,g=rx,o=x}, and numeric mode @samp{664} corresponds to symbolic mode
|
||||
@samp{ug=rw,o=r}. Numeric mode @samp{0} corresponds to symbolic mode
|
||||
@samp{a=}.
|
||||
|
||||
A numeric mode is usually shorter than the corresponding symbolic
|
||||
mode, but it is limited in that normally it cannot take into account the
|
||||
@@ -507,43 +542,10 @@ to this general limitation. @xref{Directory Setuid and Setgid}.
|
||||
Also, operator numeric modes can take previous file mode bits into
|
||||
account. @xref{Operator Numeric Modes}.
|
||||
|
||||
The permissions granted to the user,
|
||||
to other users in the file's group,
|
||||
and to other users not in the file's group each require three
|
||||
bits, which are represented as one octal digit. The three special
|
||||
mode bits also require one bit each, and they are as a group
|
||||
represented as another octal digit. Here is how the bits are arranged,
|
||||
starting with the lowest valued bit:
|
||||
|
||||
@example
|
||||
Value in Corresponding
|
||||
Mode Mode Bit
|
||||
|
||||
Other users not in the file's group:
|
||||
1 Execute/search
|
||||
2 Write
|
||||
4 Read
|
||||
|
||||
Other users in the file's group:
|
||||
10 Execute/search
|
||||
20 Write
|
||||
40 Read
|
||||
|
||||
The file's owner:
|
||||
100 Execute/search
|
||||
200 Write
|
||||
400 Read
|
||||
|
||||
Special mode bits:
|
||||
1000 Restricted deletion flag or sticky bit
|
||||
2000 Set group ID on execution
|
||||
4000 Set user ID on execution
|
||||
@end example
|
||||
|
||||
For example, numeric mode @samp{4755} corresponds to symbolic mode
|
||||
@samp{u=rwxs,go=rx}, and numeric mode @samp{664} corresponds to symbolic mode
|
||||
@samp{ug=rw,o=r}. Numeric mode @samp{0} corresponds to symbolic mode
|
||||
@samp{a=}.
|
||||
Numeric modes are always interpreted in octal; you do not have to add a
|
||||
leading @samp{0}, as you do in C@. Mode @samp{0055} is the same as
|
||||
mode @samp{55}. However, modes of five digits or more, such as
|
||||
@samp{00055}, are sometimes special (@pxref{Directory Setuid and Setgid}).
|
||||
|
||||
@node Operator Numeric Modes
|
||||
@section Operator Numeric Modes
|
||||
|
||||
905
doc/sort-version.texi
Normal file
905
doc/sort-version.texi
Normal file
@@ -0,0 +1,905 @@
|
||||
@c GNU Version-sort ordering documentation
|
||||
|
||||
@c Copyright (C) 2019-2020 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
|
||||
@c any later version published by the Free Software Foundation; with no
|
||||
@c Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
@c Texts. A copy of the license is included in the ``GNU Free
|
||||
@c Documentation License'' file as part of this distribution.
|
||||
|
||||
@c Written by Assaf Gordon
|
||||
|
||||
@node Version sort ordering
|
||||
@chapter Version sort ordering
|
||||
|
||||
|
||||
|
||||
@node Version sort overview
|
||||
@section Version sort overview
|
||||
|
||||
@dfn{version sort} ordering (and similarly, @dfn{natural sort}
|
||||
ordering) is a method to sort items such as file names and lines of
|
||||
text in an order that feels more natural to people, when the text
|
||||
contains a mixture of letters and digits.
|
||||
|
||||
Standard sorting usually does not produce the order that one expects
|
||||
because comparisons are made on a character-by-character basis.
|
||||
|
||||
Compare the sorting of the following items:
|
||||
|
||||
@example
|
||||
Alphabetical sort: Version Sort:
|
||||
|
||||
a1 a1
|
||||
a120 a2
|
||||
a13 a13
|
||||
a2 a120
|
||||
@end example
|
||||
|
||||
version sort functionality in GNU coreutils is available in the @samp{ls -v},
|
||||
@samp{ls --sort=version}, @samp{sort -V}, @samp{sort --version-sort} commands.
|
||||
|
||||
|
||||
|
||||
@node Using version sort in GNU coreutils
|
||||
@subsection Using version sort in GNU coreutils
|
||||
|
||||
Two GNU coreutils programs use version sort: @command{ls} and @command{sort}.
|
||||
|
||||
To list files in version sort order, use @command{ls}
|
||||
with @option{-v} or @option{--sort=version} options:
|
||||
|
||||
@example
|
||||
default sort: version sort:
|
||||
|
||||
$ ls -1 $ ls -1 -v
|
||||
a1 a1
|
||||
a100 a1.4
|
||||
a1.13 a1.13
|
||||
a1.4 a1.40
|
||||
a1.40 a2
|
||||
a2 a100
|
||||
@end example
|
||||
|
||||
To sort text files in version sort order, use @command{sort} with
|
||||
the @option{-V} option:
|
||||
|
||||
@example
|
||||
$ cat input
|
||||
b3
|
||||
b11
|
||||
b1
|
||||
b20
|
||||
|
||||
|
||||
alphabetical order: version sort order:
|
||||
|
||||
$ sort input $ sort -V input
|
||||
b1 b1
|
||||
b11 b3
|
||||
b20 b11
|
||||
b3 b20
|
||||
@end example
|
||||
|
||||
To sort a specific column in a file use @option{-k/--key} with @samp{V}
|
||||
ordering option:
|
||||
|
||||
@example
|
||||
$ cat input2
|
||||
1000 b3 apples
|
||||
2000 b11 oranges
|
||||
3000 b1 potatoes
|
||||
4000 b20 bananas
|
||||
|
||||
$ sort -k2V,2 input2
|
||||
3000 b1 potatoes
|
||||
1000 b3 apples
|
||||
2000 b11 oranges
|
||||
4000 b20 bananas
|
||||
@end example
|
||||
|
||||
@node Origin of version sort and differences from natural sort
|
||||
@subsection Origin of version sort and differences from natural sort
|
||||
|
||||
In GNU coreutils, the name @dfn{version sort} was chosen because it is based
|
||||
on Debian GNU/Linux's algorithm of sorting packages' versions.
|
||||
|
||||
Its goal is to answer the question
|
||||
``which package is newer, @file{firefox-60.7.2} or @file{firefox-60.12.3} ?''
|
||||
|
||||
In coreutils this algorithm was slightly modified to work on more
|
||||
general input such as textual strings and file names
|
||||
(see @ref{Differences from the official Debian Algorithm}).
|
||||
|
||||
In other contexts, such as other programs and other programming
|
||||
languages, a similar sorting functionality is called
|
||||
@uref{https://en.wikipedia.org/wiki/Natural_sort_order,natural sort}.
|
||||
|
||||
|
||||
@node Correct/Incorrect ordering and Expected/Unexpected results
|
||||
@subsection Correct/Incorrect ordering and Expected/Unexpected results
|
||||
|
||||
Currently there is no standard for version/natural sort ordering.
|
||||
|
||||
That is: there is no one correct way or universally agreed-upon way to
|
||||
order items. Each program and each programming language can decide its
|
||||
own ordering algorithm and call it 'natural sort' (or other various
|
||||
names).
|
||||
|
||||
See @ref{Other version/natural sort implementations} for many examples of
|
||||
differing sorting possibilities, each with its own rules and variations.
|
||||
|
||||
If you do suspect a bug in coreutils' implementation of version-sort,
|
||||
see @ref{Reporting bugs or incorrect results} on how to report them.
|
||||
|
||||
|
||||
@node Implementation Details
|
||||
@section Implementation Details
|
||||
|
||||
GNU coreutils' version sort algorithm is based on
|
||||
@uref{https://www.debian.org/doc/debian-policy/ch-controlfields.html#version,
|
||||
Debian's versioning scheme}, specifically on the "upstream version"
|
||||
part.
|
||||
|
||||
This section describes the ordering rules.
|
||||
|
||||
The next section (@ref{Differences from the official Debian
|
||||
Algorithm}) describes some differences between GNU coreutils
|
||||
implementation and Debian's official algorithm.
|
||||
|
||||
|
||||
@node Version-sort ordering rules
|
||||
@subsection Version-sort ordering rules
|
||||
|
||||
The version sort ordering rules are:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
The strings are compared from left to right.
|
||||
|
||||
@item
|
||||
First the initial part of each string consisting entirely of non-digit
|
||||
characters is determined.
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
These two parts (one of which may be empty) are compared lexically.
|
||||
If a difference is found it is returned.
|
||||
|
||||
@item
|
||||
The lexical comparison is a comparison of ASCII values modified so that:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
all the letters sort earlier than all the non-letters and
|
||||
@item
|
||||
so that a tilde sorts before anything, even the end of a part.
|
||||
@end enumerate
|
||||
@end enumerate
|
||||
|
||||
@item
|
||||
Then the initial part of the remainder of each string which consists
|
||||
entirely of digit characters is determined. The numerical values of
|
||||
these two parts are compared, and any difference found is returned as
|
||||
the result of the comparison.
|
||||
@enumerate
|
||||
@item
|
||||
For these purposes an empty string (which can only occur at the end of
|
||||
one or both version strings being compared) counts as zero.
|
||||
@end enumerate
|
||||
|
||||
@item
|
||||
These two steps (comparing and removing initial non-digit strings and
|
||||
initial digit strings) are repeated until a difference is found or
|
||||
both strings are exhausted.
|
||||
@end enumerate
|
||||
|
||||
Consider the version-sort comparison of two file names:
|
||||
@file{foo07.7z} and @file{foo7a.7z}. The two strings will be broken
|
||||
down to the following parts, and the parts compared respectively from
|
||||
each string:
|
||||
|
||||
@example
|
||||
foo @r{vs} foo @r{(rule 2, non-digits characters)}
|
||||
07 @r{vs} 7 @r{(rule 3, digits characters)}
|
||||
. @r{vs} a. @r{(rule 2)}
|
||||
7 @r{vs} 7 @r{(rule 3)}
|
||||
z @r{vs} z @r{(rule 2)}
|
||||
@end example
|
||||
|
||||
Comparison flow based on above algorithm:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
The first parts (@code{foo}) are identical in both strings.
|
||||
|
||||
@item
|
||||
The second parts (@code{07} and @code{7}) are compared numerically,
|
||||
and are identical.
|
||||
|
||||
@item
|
||||
The third parts (@samp{@code{.}} vs @samp{@code{a.}}) are compared
|
||||
lexically by ASCII value (rule 2.2).
|
||||
|
||||
@item
|
||||
The first character of the first string (@samp{@code{.}}) is compared
|
||||
to the first character of the second string (@samp{@code{a}}).
|
||||
|
||||
@item
|
||||
Rule 2.2.1 dictates that "all letters sorts earlier than all non-letters".
|
||||
Hence, @samp{@code{a}} comes before @samp{@code{.}}.
|
||||
|
||||
@item
|
||||
The returned result is that @file{foo7a.7z} comes before @file{foo07.7z}.
|
||||
@end enumerate
|
||||
|
||||
Result when using sort:
|
||||
|
||||
@example
|
||||
$ cat input3
|
||||
foo07.7z
|
||||
foo7a.7z
|
||||
|
||||
$ sort -V input3
|
||||
foo7a.7z
|
||||
foo07.7z
|
||||
@end example
|
||||
|
||||
See @ref{Differences from the official Debian Algorithm} for
|
||||
additional rules that extend the Debian algorithm in coreutils.
|
||||
|
||||
|
||||
@node Version sort is not the same as numeric sort
|
||||
@subsection Version sort is not the same as numeric sort
|
||||
|
||||
Consider the following text file:
|
||||
|
||||
@example
|
||||
$ cat input4
|
||||
8.10
|
||||
8.5
|
||||
8.1
|
||||
8.01
|
||||
8.010
|
||||
8.100
|
||||
8.49
|
||||
|
||||
|
||||
|
||||
Numerical Sort: Version Sort:
|
||||
|
||||
$ sort -n input4 $ sort -V input4
|
||||
8.01 8.01
|
||||
8.010 8.1
|
||||
8.1 8.5
|
||||
8.10 8.010
|
||||
8.100 8.10
|
||||
8.49 8.49
|
||||
8.5 8.100
|
||||
@end example
|
||||
|
||||
Numeric sort (@samp{sort -n}) treats the entire string as a single numeric
|
||||
value, and compares it to other values. For example, @code{8.1}, @code{8.10} and
|
||||
@code{8.100} are numerically equivalent, and are ordered together. Similarly,
|
||||
@code{8.49} is numerically smaller than @code{8.5}, and appears before first.
|
||||
|
||||
Version sort (@samp{sort -V}) first breaks down the string into digits and
|
||||
non-digits parts, and only then compares each part (see annotated
|
||||
example in Version-sort ordering rules).
|
||||
|
||||
Comparing the string @code{8.1} to @code{8.01}, first the
|
||||
@samp{@code{8}} characters are compared (and are identical), then the
|
||||
dots (@samp{@code{.}}) are compared and are identical, and lastly the
|
||||
remaining digits are compared numerically (@code{1} and @code{01}) -
|
||||
which are numerically equivalent. Hence, @code{8.01} and @code{8.1}
|
||||
are grouped together.
|
||||
|
||||
Similarly, comparing @code{8.5} to @code{8.49} - the @samp{@code{8}}
|
||||
and @samp{@code{.}} parts are identical, then the numeric values @code{5} and
|
||||
@code{49} are compared. The resulting @code{5} appears before @code{49}.
|
||||
|
||||
This sorting order (where @code{8.5} comes before @code{8.49}) is common when
|
||||
assigning versions to computer programs (while perhaps not intuitive
|
||||
or 'natural' for people).
|
||||
|
||||
@node Punctuation Characters
|
||||
@subsection Punctuation Characters
|
||||
|
||||
Punctuation characters are sorted by ASCII order (rule 2.2).
|
||||
|
||||
@example
|
||||
$ touch 1.0.5_src.tar.gz 1.0_src.tar.gz
|
||||
|
||||
$ ls -v -1
|
||||
1.0.5_src.tar.gz
|
||||
1.0_src.tar.gz
|
||||
@end example
|
||||
|
||||
Why is @file{1.0.5_src.tar.gz} listed before @file{1.0_src.tar.gz} ?
|
||||
|
||||
Based on the @ref{Version-sort ordering rules,algorithm,algorithm}
|
||||
above, the strings are broken down into the following parts:
|
||||
|
||||
@example
|
||||
1 @r{vs} 1 @r{(rule 3, all digit characters)}
|
||||
. @r{vs} . @r{(rule 2, all non-digit characters)}
|
||||
0 @r{vs} 0 @r{(rule 3)}
|
||||
. @r{vs} _src.tar.gz @r{(rule 2)}
|
||||
5 @r{vs} empty string @r{(no more character in the file name)}
|
||||
_src.tar.gz @r{vs} empty string
|
||||
@end example
|
||||
|
||||
The fourth parts (@samp{@code{.}} and @code{_src.tar.gz}) are compared
|
||||
lexically by ASCII order. The character @samp{@code{.}} (ASCII value 46) is
|
||||
smaller than @samp{@code{_}} (ASCII value 95) - and should be listed before it.
|
||||
|
||||
Hence, @file{1.0.5_src.tar.gz} is listed first.
|
||||
|
||||
If a different character appears instead of the underscore (for
|
||||
example, percent sign @samp{@code{%}} ASCII value 37, which is smaller
|
||||
than dot's ASCII value of 46), that file will be listed first:
|
||||
|
||||
@example
|
||||
$ touch 1.0.5_src.tar.gz 1.0%zzzzz.gz
|
||||
1.0%zzzzz.gz
|
||||
1.0.5_src.tar.gz
|
||||
@end example
|
||||
|
||||
The same reasoning applies to the following example: The character
|
||||
@samp{@code{.}} has ASCII value 46, and is smaller than slash
|
||||
character @samp{@code{/}} ASCII value 47:
|
||||
|
||||
@example
|
||||
$ cat input5
|
||||
3.0/
|
||||
3.0.5
|
||||
|
||||
$ sort -V input5
|
||||
3.0.5
|
||||
3.0/
|
||||
@end example
|
||||
|
||||
|
||||
@node Punctuation Characters vs letters
|
||||
@subsection Punctuation Characters vs letters
|
||||
|
||||
Rule 2.2.1 dictates that letters sorts earlier than all non-letters
|
||||
(after breaking down a string to digits and non-digits parts).
|
||||
|
||||
@example
|
||||
$ cat input6
|
||||
a%
|
||||
az
|
||||
|
||||
$ sort -V input6
|
||||
az
|
||||
a%
|
||||
@end example
|
||||
|
||||
The input strings consist entirely of non-digits, and based on the
|
||||
above algorithm have only one part, all non-digit characters
|
||||
(@samp{@code{a%}} vs @samp{@code{az}}).
|
||||
|
||||
Each part is then compared lexically,
|
||||
character-by-character. @samp{@code{a}} compares identically in both
|
||||
strings.
|
||||
|
||||
Rule 2.2.1 dictates that letters (@samp{@code{z}}) sorts earlier than all
|
||||
non-letters (@samp{@code{%}}) - hence @samp{@code{az}} appears first (despite
|
||||
@samp{@code{z}} having ASCII value of 122, much bigger than @samp{@code{%}}
|
||||
with ASCII value 37).
|
||||
|
||||
@node Tilde @samp{~} character
|
||||
@subsection Tilde @samp{~} character
|
||||
|
||||
Rule 2.2.2 dictates that tilde character @samp{@code{~}} (ASCII 126) sorts
|
||||
before all other non-digit characters, including an empty part.
|
||||
|
||||
@example
|
||||
$ cat input7
|
||||
1
|
||||
1%
|
||||
1.2
|
||||
1~
|
||||
~
|
||||
|
||||
$ sort -V input7
|
||||
~
|
||||
1~
|
||||
1
|
||||
1%
|
||||
1.2
|
||||
@end example
|
||||
|
||||
The sorting algorithm starts by breaking down the string into
|
||||
non-digits (rule 2) and digits parts (rule 3).
|
||||
|
||||
In the above input file, only the last line in the input file starts
|
||||
with a non-digit (@samp{@code{~}}). This is the first part. All other lines
|
||||
in the input file start with a digit - their first non-digit part is
|
||||
empty.
|
||||
|
||||
Based on rule 2.2.2, tilde @samp{@code{~}} sorts before all other non-digits
|
||||
including the empty part - hence it comes before all other strings,
|
||||
and is listed first in the sorted output.
|
||||
|
||||
The remaining lines (@code{1}, @code{1%}, @code{1.2}, @code{1~})
|
||||
follow similar logic: The digit part is extracted (1 for all strings)
|
||||
and compares identical. The following extracted parts for the remaining
|
||||
input lines are: empty part, @code{%}, @code{.}, @code{~}.
|
||||
|
||||
Tilde sorts before all others, hence the line @code{1~} appears next.
|
||||
|
||||
The remaining lines (@code{1}, @code{1%}, @code{1.2}) are sorted based
|
||||
on previously explained rules.
|
||||
|
||||
@node Version sort ignores locale
|
||||
@subsection Version sort uses ASCII order, ignores locale, unicode characters
|
||||
|
||||
In version sort, unicode characters are compared byte-by-byte according
|
||||
to their binary representation, ignoring their unicode value or the
|
||||
current locale.
|
||||
|
||||
Most commonly, unicode characters (e.g. Greek Small Letter Alpha
|
||||
U+03B1 @samp{α}) are encoded as UTF-8 bytes (e.g. @samp{α} is encoded as UTF-8
|
||||
sequence @code{0xCE 0xB1}). The encoding will be compared byte-by-byte,
|
||||
e.g. first @code{0xCE} (decimal value 206) then @code{0xB1} (decimal value 177).
|
||||
|
||||
@example
|
||||
$ touch aa az "a%" "aα"
|
||||
|
||||
$ ls -1 -v
|
||||
aa
|
||||
az
|
||||
a%
|
||||
aα
|
||||
@end example
|
||||
|
||||
Ignoring the first letter (@code{a}) which is identical in all
|
||||
strings, the compared values are:
|
||||
|
||||
@samp{@code{a}} and @samp{@code{z}} are letters, and sort earlier than
|
||||
all other non-digit characters.
|
||||
|
||||
Then, percent sign @samp{@code{%}} (ASCII value 37) is compared to the
|
||||
first byte of the UTF-8 sequence of @samp{@code{α}}, which is 0xCE or 206). The
|
||||
value 37 is smaller, hence @samp{@code{a%}} is listed before @samp{@code{aα}}.
|
||||
|
||||
@node Differences from the official Debian Algorithm
|
||||
@section Differences from the official Debian Algorithm
|
||||
|
||||
The GNU coreutils' version sort algorithm differs slightly from the
|
||||
official Debian algorithm, in order to accommodate more general usage
|
||||
and file name listing.
|
||||
|
||||
|
||||
@node Minus/Hyphen and Colon characters
|
||||
@subsection Minus/Hyphen @samp{-} and Colon @samp{:} characters
|
||||
|
||||
In Debian's version string syntax the version consists of three parts:
|
||||
@example
|
||||
[epoch:]upstream_version[-debian_revision]
|
||||
@end example
|
||||
The @code{epoch} and @code{debian_revision} parts are optional.
|
||||
|
||||
Example of such version strings:
|
||||
|
||||
@example
|
||||
60.7.2esr-1~deb9u1
|
||||
52.9.0esr-1~deb9u1
|
||||
1:2.3.4-1+b2
|
||||
327-2
|
||||
1:1.0.13-3
|
||||
2:1.19.2-1+deb9u5
|
||||
@end example
|
||||
|
||||
If the @code{debian_revision part} is not present,
|
||||
hyphen characters @samp{-} are not allowed.
|
||||
If epoch is not present, colons @samp{:} are not allowed.
|
||||
|
||||
If these parts are present, hyphen and/or colons can appear only once
|
||||
in valid Debian version strings.
|
||||
|
||||
In GNU coreutils, such restrictions are not reasonable (a file name can
|
||||
have many hyphens, a line of text can have many colons).
|
||||
|
||||
As a result, in GNU coreutils hyphens and colons are treated exactly
|
||||
like all other punctuation characters (i.e., they are sorted after
|
||||
letters. See Punctuation Characters above).
|
||||
|
||||
In Debian, these characters are treated differently than in coreutils:
|
||||
a version string with hyphen will sort before similar strings without
|
||||
hyphens.
|
||||
|
||||
Compare:
|
||||
|
||||
@example
|
||||
$ touch abb ab-cd
|
||||
|
||||
$ ls -v -1
|
||||
abb
|
||||
ab-cd
|
||||
@end example
|
||||
|
||||
With Debian's @command{dpkg} they will be listed as @code{ab-cd} first and
|
||||
@code{abb} second.
|
||||
|
||||
For further technical details see @uref{https://bugs.gnu.org/35939,bug35939}.
|
||||
|
||||
@node Additional hard-coded priorities in GNU coreutils' version sort
|
||||
@subsection Additional hard-coded priorities in GNU coreutils' version sort
|
||||
|
||||
In GNU coreutils' version sort algorithm, the following items have
|
||||
special priority and sort earlier than all other characters (listed in
|
||||
order);
|
||||
|
||||
@enumerate
|
||||
@item The empty string
|
||||
|
||||
@item The string @samp{@code{.}} (a single dot character, ASCII 46)
|
||||
|
||||
@item The string @samp{@code{..}} (two dot characters)
|
||||
|
||||
@item Strings start with a dot (@samp{@code{.}}) sort earlier than
|
||||
strings starting with any other characters.
|
||||
@end enumerate
|
||||
|
||||
Example:
|
||||
|
||||
@example
|
||||
$ printf "%s\n" a "" b "." c ".." ".d20" ".d3" | sort -V
|
||||
|
||||
.
|
||||
..
|
||||
.d3
|
||||
.d20
|
||||
a
|
||||
b
|
||||
c
|
||||
@end example
|
||||
|
||||
These priorities make perfect sense for @samp{ls -v}: The special
|
||||
files dot @samp{@code{.}} and dot-dot @samp{@code{..}} will be listed
|
||||
first, followed by any hidden files (files starting with a dot),
|
||||
followed by non-hidden files.
|
||||
|
||||
For @samp{sort -V} these priorities might seem arbitrary. However,
|
||||
because the sorting code is shared between the @command{ls} and @command{sort}
|
||||
program, the ordering rules are the same.
|
||||
|
||||
@node Special handling of file extensions
|
||||
@subsection Special handling of file extensions
|
||||
|
||||
GNU coreutils' version sort algorithm implements specialized handling
|
||||
of file extensions (or strings that look like file names with
|
||||
extensions).
|
||||
|
||||
This nuanced implementation enables slightly more natural ordering of files.
|
||||
|
||||
The additional rules are:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
A suffix (i.e., a file extension) is defined as: a dot, followed by a
|
||||
letter or tilde, followed by one or more letters, digits, or tildes
|
||||
(possibly repeated more than once), until the end of the string
|
||||
(technically, matching the regular expression
|
||||
@code{(\.[A-Za-z~][A-Za-z0-9~]*)*}).
|
||||
|
||||
@item
|
||||
If the strings contains suffixes, the suffixes are temporarily
|
||||
removed, and the strings are compared without them (using the
|
||||
@ref{Version-sort ordering rules,algorithm,algorithm} above).
|
||||
|
||||
@item
|
||||
If the suffix-less strings are identical, the suffix is restored and
|
||||
the entire strings are compared.
|
||||
|
||||
@item
|
||||
If the non-suffixed strings differ, the result is returned and the
|
||||
suffix is effectively ignored.
|
||||
@end enumerate
|
||||
|
||||
Examples for rule 1:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@code{hello-8.txt}: the suffix is @code{.txt}
|
||||
|
||||
@item
|
||||
@code{hello-8.2.txt}: the suffix is @code{.txt}
|
||||
(@samp{@code{.2}} is not included because the dot is not followed by a letter)
|
||||
|
||||
@item
|
||||
@code{hello-8.0.12.tar.gz}: the suffix is @code{.tar.gz} (@samp{@code{.0.12}}
|
||||
is not included)
|
||||
|
||||
@item
|
||||
@code{hello-8.2}: no suffix (suffix is an empty string)
|
||||
|
||||
@item
|
||||
@code{hello.foobar65}: the suffix is @code{.foobar65}
|
||||
|
||||
@item
|
||||
@code{gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2}: the suffix is
|
||||
@code{.fc9.tar.bz2} (@code{.7rc2} is not included as it begins with a digit)
|
||||
@end itemize
|
||||
|
||||
Examples for rule 2:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Comparing @code{hello-8.txt} to @code{hello-8.2.12.txt}, the
|
||||
@code{.txt} suffix is temporarily removed from both strings.
|
||||
|
||||
@item
|
||||
Comparing @code{foo-10.3.tar.gz} to @code{foo-10.tar.xz}, the suffixes
|
||||
@code{.tar.gz} and @code{.tar.xz} are temporarily removed from the
|
||||
strings.
|
||||
@end itemize
|
||||
|
||||
Example for rule 3:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Comparing @code{hello.foobar65} to @code{hello.foobar4}, the suffixes
|
||||
(@code{.foobar65} and @code{.foobar4}) are temporarily removed. The
|
||||
remaining strings are identical (@code{hello}). The suffixes are then
|
||||
restored, and the entire strings are compared (@code{hello.foobar4} comes
|
||||
first).
|
||||
@end itemize
|
||||
|
||||
Examples for rule 4:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
When comparing the strings @code{hello-8.2.txt} and @code{hello-8.10.txt}, the
|
||||
suffixes (@code{.txt}) are temporarily removed. The remaining strings
|
||||
(@code{hello-8.2} and @code{hello-8.10}) are compared as previously described
|
||||
(@code{hello-8.2} comes first).
|
||||
@slanted{(In this case the suffix removal algorithm
|
||||
does not have a noticeable effect on the resulting order.)}
|
||||
@end itemize
|
||||
|
||||
@b{How does the suffix-removal algorithm effect ordering results?}
|
||||
|
||||
Consider the comparison of hello-8.txt and hello-8.2.txt.
|
||||
|
||||
Without the suffix-removal algorithm, the strings will be broken down
|
||||
to the following parts:
|
||||
|
||||
@example
|
||||
hello- @r{vs} hello- @r{(rule 2, all non-digit characters)}
|
||||
8 @r{vs} 8 @r{(rule 3, all digit characters)}
|
||||
.txt @r{vs} . @r{(rule 2)}
|
||||
empty @r{vs} 2
|
||||
empty @r{vs} .txt
|
||||
@end example
|
||||
|
||||
The comparison of the third parts (@samp{@code{.}} vs
|
||||
@samp{@code{.txt}}) will determine that the shorter string comes first -
|
||||
resulting in @file{hello-8.2.txt} appearing first.
|
||||
|
||||
Indeed this is the order in which Debian's @command{dpkg} compares the strings.
|
||||
|
||||
A more natural result is that @file{hello-8.txt} should come before
|
||||
@file{hello-8.2.txt}, and this is where the suffix-removal comes into play:
|
||||
|
||||
The suffixes (@code{.txt}) are removed, and the remaining strings are
|
||||
broken down into the following parts:
|
||||
|
||||
@example
|
||||
hello- @r{vs} hello- @r{(rule 2, all non-digit characters)}
|
||||
8 @r{vs} 8 @r{(rule 3, all digit characters)}
|
||||
empty @r{vs} . @r{(rule 2)}
|
||||
empty @r{vs} 2
|
||||
@end example
|
||||
|
||||
As empty strings sort before non-empty strings, the result is @code{hello-8}
|
||||
being first.
|
||||
|
||||
A real-world example would be listing files such as:
|
||||
@file{gcc_10.fc9.tar.gz}
|
||||
and @file{gcc_10.8.12.7rc2.fc9.tar.bz2}: Debian's algorithm would list
|
||||
@file{gcc_10.8.12.7rc2.fc9.tar.bz2} first, while @samp{ls -v} will list
|
||||
@file{gcc_10.fc9.tar.gz} first.
|
||||
|
||||
These priorities make sense for @samp{ls -v}:
|
||||
Versioned files will be listed in a more natural order.
|
||||
|
||||
For @samp{sort -V} these priorities might seem arbitrary. However,
|
||||
because the sorting code is shared between the @command{ls} and @command{sort}
|
||||
program, the ordering rules are the same.
|
||||
|
||||
|
||||
@node Advanced Topics
|
||||
@section Advanced Topics
|
||||
|
||||
|
||||
@node Comparing two strings using Debian's algorithm
|
||||
@subsection Comparing two strings using Debian's algorithm
|
||||
|
||||
The Debian program @command{dpkg} (available on all Debian and Ubuntu
|
||||
installations) can compare two strings using the @option{--compare-versions}
|
||||
option.
|
||||
|
||||
To use it, create a helper shell function (simply copy & paste the
|
||||
following snippet to your shell command-prompt):
|
||||
|
||||
@example
|
||||
compver() @{
|
||||
dpkg --compare-versions "$1" lt "$2" \
|
||||
&& printf "%s\n" "$1" "$2" \
|
||||
|| printf "%s\n" "$2" "$1" ; \
|
||||
@}
|
||||
@end example
|
||||
|
||||
Then compare two strings by calling compver:
|
||||
|
||||
@example
|
||||
$ compver 8.49 8.5
|
||||
8.5
|
||||
8.49
|
||||
@end example
|
||||
|
||||
Note that @command{dpkg} will warn if the strings have invalid syntax:
|
||||
|
||||
@example
|
||||
$ compver "foo07.7z" "foo7a.7z"
|
||||
dpkg: warning: version 'foo07.7z' has bad syntax:
|
||||
version number does not start with digit
|
||||
dpkg: warning: version 'foo7a.7z' has bad syntax:
|
||||
version number does not start with digit
|
||||
foo7a.7z
|
||||
foo07.7z
|
||||
|
||||
$ compver "3.0/" "3.0.5"
|
||||
dpkg: warning: version '3.0/' has bad syntax:
|
||||
invalid character in version number
|
||||
3.0.5
|
||||
3.0/
|
||||
@end example
|
||||
|
||||
To illustrate the different handling of hyphens between Debian and
|
||||
coreutils' algorithms (see
|
||||
@ref{Minus/Hyphen and Colon characters}):
|
||||
|
||||
@example
|
||||
$ compver abb ab-cd 2>/dev/null $ printf "abb\nab-cd\n" | sort -V
|
||||
ab-cd abb
|
||||
abb ab-cd
|
||||
@end example
|
||||
|
||||
To illustrate the different handling of file extension: (see @ref{Special
|
||||
handling of file extensions}):
|
||||
|
||||
@example
|
||||
$ compver hello-8.txt hello-8.2.txt 2>/dev/null
|
||||
hello-8.2.txt
|
||||
hello-8.txt
|
||||
|
||||
$ printf "%s\n" hello-8.txt hello-8.2.txt | sort -V
|
||||
hello-8.txt
|
||||
hello-8.2.txt
|
||||
@end example
|
||||
|
||||
|
||||
|
||||
@node Reporting bugs or incorrect results
|
||||
@subsection Reporting bugs or incorrect results
|
||||
|
||||
If you suspect a bug in GNU coreutils' version sort (i.e., in the
|
||||
output of @samp{ls -v} or @samp{sort -V}), please first check the following:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Is the result consistent with Debian's own ordering (using @command{dpkg}, see
|
||||
@ref{Comparing two strings using Debian's algorithm}) ? If it is, then this
|
||||
is not a bug - please do not report it.
|
||||
|
||||
@item
|
||||
If the result differs from Debian's, is it explained by one of the
|
||||
sections in @ref{Differences from the official Debian Algorithm}? If it is,
|
||||
then this is not a bug - please do not report it.
|
||||
|
||||
@item
|
||||
If you have a question about specific ordering which is not explained
|
||||
here, please write to @email{coreutils@@gnu.org}, and provide a
|
||||
concise example that will help us diagnose the issue.
|
||||
|
||||
@item
|
||||
If you still suspect a bug which is not explained by the above, please
|
||||
write to @email{bug-coreutils@@gnu.org} with a concrete example of the
|
||||
suspected incorrect output, with details on why you think it is
|
||||
incorrect.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@node Other version/natural sort implementations
|
||||
@subsection Other version/natural sort implementations
|
||||
|
||||
As previously mentioned, there are multiple variations on
|
||||
version/natural sort, each with its own rules. Some examples are:
|
||||
|
||||
@itemize
|
||||
|
||||
@item
|
||||
Natural Sorting variants in
|
||||
@uref{https://rosettacode.org/wiki/Natural_sorting,Rosetta Code}.
|
||||
|
||||
@item
|
||||
Python's @uref{https://pypi.org/project/natsort/,natsort package}
|
||||
(includes detailed description of their sorting rules:
|
||||
@uref{https://natsort.readthedocs.io/en/master/howitworks.html,
|
||||
natsort - how it works}).
|
||||
|
||||
@item
|
||||
Ruby's @uref{https://github.com/github/version_sorter,version_sorter}.
|
||||
|
||||
@item
|
||||
Perl has multiple packages for natual and version sorts
|
||||
(each likely with its own rules and nuances):
|
||||
@uref{https://metacpan.org/pod/Sort::Naturally,Sort::Naturally},
|
||||
@uref{https://metacpan.org/pod/Sort::Versions,Sort::Versions},
|
||||
@uref{https://metacpan.org/pod/CPAN::Version,CPAN::Version}.
|
||||
|
||||
@item
|
||||
PHP has a built-in function
|
||||
@uref{https://www.php.net/manual/en/function.natsort.php,natsort}.
|
||||
|
||||
@item
|
||||
NodeJS's @uref{https://www.npmjs.com/package/natural-sort,natural-sort package}.
|
||||
|
||||
@item
|
||||
In zsh, the
|
||||
@uref{http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers,
|
||||
glob modifier} @code{*(n)} will expand to files in natural sort order.
|
||||
|
||||
@item
|
||||
When writing @code{C} programs, the GNU libc library (@code{glibc})
|
||||
provides the
|
||||
@uref{http://man7.org/linux/man-pages/man3/strverscmp.3.html,
|
||||
strvercmp(3)} function to compare two strings, and
|
||||
@uref{http://man7.org/linux/man-pages/man3/versionsort.3.html,versionsort(3)}
|
||||
function to compare two directory entries (despite the names, they are
|
||||
not identical to GNU coreutils' version sort ordering).
|
||||
|
||||
@item
|
||||
Using Debian's sorting algorithm in:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
python: @uref{https://stackoverflow.com/a/4957741,
|
||||
Stack Overflow Example #4957741}.
|
||||
|
||||
@item
|
||||
NodeJS: @uref{https://www.npmjs.com/package/deb-version-compare,
|
||||
deb-version-compare}.
|
||||
@end itemize
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Related Source code
|
||||
@subsection Related Source code
|
||||
|
||||
@itemize
|
||||
|
||||
@item
|
||||
Debian's code which splits a version string into
|
||||
@code{epoch/upstream_version/debian_revision} parts:
|
||||
@uref{https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/parsehelp.c#n191,
|
||||
parsehelp.c:parseversion()}.
|
||||
|
||||
@item
|
||||
Debian's code which performs the @code{upstream_version} comparison:
|
||||
@uref{https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/version.c#n140,
|
||||
version.c}.
|
||||
|
||||
@item
|
||||
GNULIB code (used by GNU coreutils) which performs the version comparison:
|
||||
@uref{https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/filevercmp.c,
|
||||
filevercmp.c}.
|
||||
@end itemize
|
||||
@@ -1,6 +1,6 @@
|
||||
/* buffer-lcm.c - compute a good buffer size for dealing with two files
|
||||
|
||||
Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2020 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
|
||||
|
||||
76
gl/lib/cl-strtod.c
Normal file
76
gl/lib/cl-strtod.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/* Convert string to double in the current locale, falling back on the C locale.
|
||||
|
||||
Copyright 2019-2020 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. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cl-strtod.h"
|
||||
|
||||
#include <c-strtod.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if LONG
|
||||
# define CL_STRTOD cl_strtold
|
||||
# define DOUBLE long double
|
||||
# define C_STRTOD c_strtold
|
||||
# define STRTOD strtold
|
||||
#else
|
||||
# define CL_STRTOD cl_strtod
|
||||
# define DOUBLE double
|
||||
# define C_STRTOD c_strtod
|
||||
# define STRTOD strtod
|
||||
#endif
|
||||
|
||||
/* This function acts like strtod or strtold, except that it falls
|
||||
back on the C locale if the initial prefix is not parsable in
|
||||
the current locale. If the prefix is parsable in both locales,
|
||||
it uses the longer parse, breaking ties in favor of the current locale.
|
||||
|
||||
Parse the initial prefix of NPTR as a floating-point number in the
|
||||
current locale or in the C locale (preferring the locale that
|
||||
yields the longer parse, or the current locale if there is a tie).
|
||||
If ENDPTR is not NULL, set *ENDPTR to the first unused byte, or to
|
||||
NPTR if the prefix cannot be parsed.
|
||||
|
||||
If successful, return a number without changing errno.
|
||||
If the prefix cannot be parsed, return 0 and possibly set errno to EINVAL.
|
||||
If the number overflows, return an extreme value and set errno to ERANGE.
|
||||
If the number underflows, return a value close to 0 and set errno to ERANGE.
|
||||
If there is some other error, return 0 and set errno. */
|
||||
|
||||
DOUBLE
|
||||
CL_STRTOD (char const *nptr, char **restrict endptr)
|
||||
{
|
||||
char *end;
|
||||
DOUBLE d = STRTOD (nptr, &end);
|
||||
if (*end)
|
||||
{
|
||||
int strtod_errno = errno;
|
||||
char *c_end;
|
||||
DOUBLE c = C_STRTOD (nptr, &c_end);
|
||||
if (end < c_end)
|
||||
d = c, end = c_end;
|
||||
else
|
||||
errno = strtod_errno;
|
||||
}
|
||||
if (endptr)
|
||||
*endptr = end;
|
||||
return d;
|
||||
}
|
||||
2
gl/lib/cl-strtod.h
Normal file
2
gl/lib/cl-strtod.h
Normal file
@@ -0,0 +1,2 @@
|
||||
double cl_strtod (char const *, char **restrict);
|
||||
long double cl_strtold (char const *, char **restrict);
|
||||
2
gl/lib/cl-strtold.c
Normal file
2
gl/lib/cl-strtold.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#define LONG 1
|
||||
#include "cl-strtod.c"
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Declare an access pattern hint for files.
|
||||
Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2020 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 @@
|
||||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2020 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 @@
|
||||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2020 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 @@
|
||||
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
|
||||
|
||||
Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2020 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
|
||||
@@ -19,24 +19,29 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "hash.h"
|
||||
#include "randperm.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "count-leading-zeros.h"
|
||||
#include "hash.h"
|
||||
#include "verify.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
/* Return the ceiling of the log base 2 of N. If N is zero, return
|
||||
an unspecified value. */
|
||||
/* Return the floor of the log base 2 of N. If N is zero, return -1. */
|
||||
|
||||
static size_t _GL_ATTRIBUTE_CONST
|
||||
ceil_lg (size_t n)
|
||||
static int _GL_ATTRIBUTE_CONST
|
||||
floor_lg (size_t n)
|
||||
{
|
||||
size_t b = 0;
|
||||
for (n--; n != 0; n /= 2)
|
||||
b++;
|
||||
return b;
|
||||
verify (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
|
||||
@@ -48,10 +53,10 @@ randperm_bound (size_t h, size_t n)
|
||||
{
|
||||
/* Upper bound on number of bits needed to generate the first number
|
||||
of the permutation. */
|
||||
size_t lg_n = ceil_lg (n);
|
||||
uintmax_t lg_n = floor_lg (n) + 1;
|
||||
|
||||
/* Upper bound on number of bits needed to generated the first H elements. */
|
||||
size_t ar = lg_n * h;
|
||||
uintmax_t ar = lg_n * h;
|
||||
|
||||
/* Convert the bit count to a byte count. */
|
||||
size_t bound = (ar + CHAR_BIT - 1) / CHAR_BIT;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2020 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 buffers of random data.
|
||||
|
||||
Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2020 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.
|
||||
|
||||
Copyright (C) 2005-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2020 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 decimal strings with bounds checking and exit on error.
|
||||
|
||||
Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2014-2020 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 decimal strings with bounds checking and exit on error.
|
||||
|
||||
Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2014-2020 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 @@
|
||||
/* xfts.c -- a wrapper for fts_open
|
||||
|
||||
Copyright (C) 2003-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2020 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
|
||||
|
||||
24
gl/modules/cl-strtod
Normal file
24
gl/modules/cl-strtod
Normal file
@@ -0,0 +1,24 @@
|
||||
Description:
|
||||
Convert string to double in current or C locale.
|
||||
|
||||
Files:
|
||||
lib/cl-strtod.c
|
||||
lib/cl-strtod.h
|
||||
|
||||
Depends-on:
|
||||
c-strtod
|
||||
|
||||
configure.ac:
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += cl-strtod.c
|
||||
|
||||
Include:
|
||||
"cl-strtod.h"
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
all
|
||||
25
gl/modules/cl-strtold
Normal file
25
gl/modules/cl-strtold
Normal file
@@ -0,0 +1,25 @@
|
||||
Description:
|
||||
Convert string to long double in current or C locale.
|
||||
|
||||
Files:
|
||||
lib/cl-strtod.c
|
||||
lib/cl-strtod.h
|
||||
lib/cl-strtold.c
|
||||
|
||||
Depends-on:
|
||||
c-strtold
|
||||
|
||||
configure.ac:
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += cl-strtold.c
|
||||
|
||||
Include:
|
||||
"cl-strtod.h"
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
all
|
||||
@@ -6,7 +6,9 @@ lib/randperm.c
|
||||
lib/randperm.h
|
||||
|
||||
Depends-on:
|
||||
count-leading-zeros
|
||||
randint
|
||||
stdint
|
||||
xalloc
|
||||
hash
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ diff --git a/modules/tempname b/modules/tempname
|
||||
index 570ea54..f1be8ff 100644
|
||||
--- a/modules/tempname
|
||||
+++ b/modules/tempname
|
||||
@@ -12,6 +12,8 @@
|
||||
fcntl-h
|
||||
@@ -13,6 +13,8 @@
|
||||
gettimeofday
|
||||
lstat
|
||||
mkdir
|
||||
+randint
|
||||
+stdbool
|
||||
stdint
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Test that fadvise works as advertised.
|
||||
Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2020 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 @@
|
||||
/* Test that mbsalign works as advertised.
|
||||
Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2020 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-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2020 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: 21d224dc9e...d279bc6d9f
38
init.cfg
38
init.cfg
@@ -1,6 +1,6 @@
|
||||
# This file is sourced by init.sh, *before* its initialization.
|
||||
|
||||
# Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2010-2020 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
|
||||
@@ -492,7 +492,7 @@ require_membership_in_two_groups_()
|
||||
*' '*) ;;
|
||||
*) skip_ 'requires membership in two groups
|
||||
this test requires that you be a member of more than one group,
|
||||
but running 'id -G'\'' either failed or found just one. If you really
|
||||
but running '\''id -G'\'' either failed or found just one. If you really
|
||||
are a member of at least two groups, then rerun this test with
|
||||
COREUTILS_GROUPS set in your environment to the space-separated list
|
||||
of group names or numbers. E.g.,
|
||||
@@ -576,6 +576,9 @@ require_sparse_support_()
|
||||
fi
|
||||
}
|
||||
|
||||
# Libraries needed when we compile a shared library.
|
||||
gcc_shared_libs_=
|
||||
|
||||
# Compile a shared lib using the GCC options for doing so.
|
||||
# Pass input and output file as parameters respectively.
|
||||
# Any other optional parmeters are passed to $CC.
|
||||
@@ -585,7 +588,7 @@ gcc_shared_()
|
||||
local out=$2
|
||||
shift 2 || return 1
|
||||
|
||||
$CC -Wall -shared --std=gnu99 -fPIC -O2 $* "$in" -o "$out" -ldl
|
||||
$CC -Wall -shared --std=gnu99 -fPIC -O2 $* "$in" -o "$out" $gcc_shared_libs_
|
||||
}
|
||||
|
||||
# There are a myriad of ways to build shared libs,
|
||||
@@ -593,8 +596,18 @@ gcc_shared_()
|
||||
# on platforms that support building them as follows.
|
||||
require_gcc_shared_()
|
||||
{
|
||||
gcc_shared_ '-' 'd.so' -xc < /dev/null 2>&1 \
|
||||
|| skip_ '$CC -shared ... failed to build a shared lib'
|
||||
# Try two different values for gcc_shared_libs_.
|
||||
gcc_shared_libs_='-ldl'
|
||||
if gcc_shared_ '-' 'd.so' -xc < /dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
gcc_shared_libs_=
|
||||
if gcc_shared_ '-' 'd.so' -xc < /dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
skip_ '$CC -shared ... failed to build a shared lib'
|
||||
fi
|
||||
fi
|
||||
rm -f d.so
|
||||
}
|
||||
|
||||
@@ -610,6 +623,21 @@ mkfifo_or_skip_()
|
||||
fi
|
||||
}
|
||||
|
||||
trap_sigpipe_or_skip_()
|
||||
{
|
||||
(trap '' PIPE && yes | :) 2>&1 | grep -qF 'Broken pipe' ||
|
||||
skip_ 'trapping SIGPIPE is not supported'
|
||||
}
|
||||
|
||||
require_bash_as_SHELL_()
|
||||
{
|
||||
if bash --version >/dev/null 2>&1; then
|
||||
SHELL='bash'
|
||||
else
|
||||
skip_ 'bash is required'
|
||||
fi
|
||||
}
|
||||
|
||||
# Disable the current test if the working directory seems to have
|
||||
# the setgid bit set.
|
||||
skip_if_setgid_()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Exercise chdir-long's sample main program.
|
||||
|
||||
# Copyright (C) 2005-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2020 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 @@
|
||||
# boottime.m4 serial 4
|
||||
# Determine whether this system has infrastructure for obtaining the boot time.
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 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 26
|
||||
# Check declarations for this package.
|
||||
|
||||
dnl Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 1997-2020 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,6 +1,6 @@
|
||||
# Tests for GNU GMP (or any compatible replacement).
|
||||
|
||||
dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2008-2020 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-2017 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2007-2020 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.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
dnl Misc type-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998-2020 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
|
||||
@@ -41,6 +41,10 @@ AC_DEFUN([coreutils_MACROS],
|
||||
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
|
||||
[Define to the declaration of the xargmatch failure function.])
|
||||
|
||||
# Ensure VLAs are not used.
|
||||
# Note -Wvla is implicitly added by gl_MANYWARN_ALL_GCC
|
||||
AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs])
|
||||
|
||||
# used by shred
|
||||
AC_CHECK_FUNCS_ONCE([directio])
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
|
||||
# directory of the coreutils package.
|
||||
|
||||
|
||||
# Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998-2020 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-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2020 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 @@
|
||||
# xattr.m4 - check for Extended Attributes (Linux)
|
||||
# serial 3
|
||||
|
||||
# Copyright (C) 2003-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2020 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
1
man/.gitignore
vendored
1
man/.gitignore
vendored
@@ -3,6 +3,7 @@ Makefile.in
|
||||
b2sum.1
|
||||
base32.1
|
||||
base64.1
|
||||
basenc.1
|
||||
basename.1
|
||||
cat.1
|
||||
chgrp.1
|
||||
|
||||
38
man/basenc.x
Normal file
38
man/basenc.x
Normal file
@@ -0,0 +1,38 @@
|
||||
'\" Copyright (C) 2018-2020 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>.
|
||||
'\" There is NO WARRANTY, to the extent permitted by law.
|
||||
[NAME]
|
||||
basenc \- Encode/decode data and print to standard output
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[ENCODINGS EXAMPLES]
|
||||
.PP
|
||||
.nf
|
||||
.RS
|
||||
$ printf '\\376\\117\\202' | basenc \-\-base64
|
||||
/k+C
|
||||
|
||||
$ printf '\\376\\117\\202' | basenc \-\-base64url
|
||||
_k-C
|
||||
|
||||
$ printf '\\376\\117\\202' | basenc \-\-base32
|
||||
7ZHYE===
|
||||
|
||||
$ printf '\\376\\117\\202' | basenc \-\-base32hex
|
||||
VP7O4===
|
||||
|
||||
$ printf '\\376\\117\\202' | basenc \-\-base16
|
||||
FE4F82
|
||||
|
||||
$ printf '\\376\\117\\202' | basenc \-\-base2lsbf
|
||||
011111111111001001000001
|
||||
|
||||
$ printf '\\376\\117\\202' | basenc \-\-base2msbf
|
||||
111111100100111110000010
|
||||
|
||||
$ printf '\\376\\117\\202\\000' | basenc \-\-z85
|
||||
@.FaC
|
||||
.RE
|
||||
.fi
|
||||
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2020 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-2017 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2020 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-2017 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2020 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>.
|
||||
|
||||
14
man/du.x
14
man/du.x
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2020 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>.
|
||||
@@ -9,20 +9,20 @@ du \- estimate file space usage
|
||||
.\" Add any additional description here
|
||||
[PATTERNS]
|
||||
PATTERN is a shell pattern (not a regular expression). The pattern
|
||||
.BR ?
|
||||
.B ?\&
|
||||
matches any one character, whereas
|
||||
.BR *
|
||||
.B *
|
||||
matches any string (composed of zero, one or multiple characters). For
|
||||
example,
|
||||
.BR *.o
|
||||
.B *.o
|
||||
will match any files whose names end in
|
||||
.BR .o .
|
||||
Therefore, the command
|
||||
.IP
|
||||
.B du --exclude=\(aq*.o\(aq
|
||||
.B du \-\-exclude=\(aq*.o\(aq
|
||||
.PP
|
||||
will skip all files and subdirectories ending in
|
||||
.BR .o
|
||||
.B .o
|
||||
(including the file
|
||||
.BR .o
|
||||
.B .o
|
||||
itself).
|
||||
|
||||
63
man/env.x
63
man/env.x
@@ -1,4 +1,67 @@
|
||||
'\" Copyright (C) 1998-2020 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>.
|
||||
'\" There is NO WARRANTY, to the extent permitted by law.
|
||||
[NAME]
|
||||
env \- run a program in a modified environment
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[OPTIONS]
|
||||
.SS "\-S/\-\-split\-string usage in scripts"
|
||||
The
|
||||
.B \-S
|
||||
option allows specifying multiple parameters in a script.
|
||||
Running a script named
|
||||
.B 1.pl
|
||||
containing the following first line:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
#!/usr/bin/env \-S perl \-w \-T
|
||||
\&...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
Will execute
|
||||
.B "perl \-w \-T 1.pl".
|
||||
.PP
|
||||
Without the
|
||||
.B '\-S'
|
||||
parameter the script will likely fail with:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
/usr/bin/env: 'perl \-w \-T': No such file or directory
|
||||
.fi
|
||||
.RE
|
||||
.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(2) pages says:
|
||||
.RS
|
||||
"many existing applications wrongly assume that they start with certain
|
||||
signals set to the default action and/or unblocked.... Therefore, it is best
|
||||
not to block or ignore signals across execs without explicit reason to do so,
|
||||
and especially not to block signals across execs of arbitrary (not closely
|
||||
cooperating) programs."
|
||||
.RE
|
||||
|
||||
[SEE ALSO]
|
||||
sigaction(2), sigprocmask(2), signal(7)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Make coreutils man pages. -*-Makefile-*-
|
||||
# This is included by the top-level Makefile.am.
|
||||
|
||||
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2020 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
|
||||
@@ -69,6 +69,7 @@ man/b2sum.1: src/b2sum$(EXEEXT)
|
||||
man/base32.1: src/base32$(EXEEXT)
|
||||
man/base64.1: src/base64$(EXEEXT)
|
||||
man/basename.1: src/basename$(EXEEXT)
|
||||
man/basenc.1: src/basenc$(EXEEXT)
|
||||
man/cat.1: src/cat$(EXEEXT)
|
||||
man/chcon.1: src/chcon$(EXEEXT)
|
||||
man/chgrp.1: src/chgrp$(EXEEXT)
|
||||
|
||||
6
man/rm.x
6
man/rm.x
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 1998-2020 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>.
|
||||
@@ -13,7 +13,7 @@ documents the GNU version of
|
||||
removes each specified file. By default, it does not remove
|
||||
directories.
|
||||
.P
|
||||
If the \fI\-I\fR or \fI\-\-interactive\=once\fR option is given,
|
||||
If the \fI\-I\fR or \fI\-\-interactive=once\fR option is given,
|
||||
and there are more than three files or the \fI\-r\fR, \fI\-R\fR,
|
||||
or \fI\-\-recursive\fR are given, then
|
||||
.B rm
|
||||
@@ -22,7 +22,7 @@ the response is not affirmative, the entire command is aborted.
|
||||
.P
|
||||
Otherwise, if a file is unwritable, standard input is a terminal, and
|
||||
the \fI\-f\fR or \fI\-\-force\fR option is not given, or the
|
||||
\fI\-i\fR or \fI\-\-interactive\=always\fR option is given,
|
||||
\fI\-i\fR or \fI\-\-interactive=always\fR option is given,
|
||||
.B rm
|
||||
prompts the user for whether to remove the file. If the response is
|
||||
not affirmative, the file is skipped.
|
||||
|
||||
@@ -3,4 +3,4 @@ stat \- display file or file system status
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[SEE ALSO]
|
||||
stat(2), statfs(2)
|
||||
stat(2), statfs(2), statx(2)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'\" Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
'\" Copyright (C) 2009-2020 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>.
|
||||
|
||||
15
man/test.x
15
man/test.x
@@ -1,4 +1,19 @@
|
||||
[NAME]
|
||||
test \- check file types and compare values
|
||||
[SYNOPSIS]
|
||||
.B test
|
||||
.I EXPRESSION
|
||||
.br
|
||||
.B test
|
||||
.br
|
||||
.\" \& tells doclifter the brackets are literal (Bug#31803).
|
||||
.B [\&
|
||||
.I EXPRESSION
|
||||
.B ]\&
|
||||
.br
|
||||
.B "[\& ]\&"
|
||||
.br
|
||||
.B [\&
|
||||
.I OPTION
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# List of files which contain translatable strings.
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
|
||||
# These are nominally temporary...
|
||||
lib/argmatch.c
|
||||
lib/argmatch.h
|
||||
lib/closein.c
|
||||
lib/closeout.c
|
||||
lib/copy-acl.c
|
||||
@@ -33,8 +34,8 @@ lib/xstrtol-error.c
|
||||
|
||||
# Package source files
|
||||
|
||||
src/base64.c
|
||||
src/basename.c
|
||||
src/basenc.c
|
||||
src/cat.c
|
||||
src/chcon.c
|
||||
src/chgrp.c
|
||||
|
||||
1
scripts/build-older-versions/.gitignore
vendored
Normal file
1
scripts/build-older-versions/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
build/
|
||||
174
scripts/build-older-versions/README.older-versions
Normal file
174
scripts/build-older-versions/README.older-versions
Normal file
@@ -0,0 +1,174 @@
|
||||
Building older GNU coreutils versions on newer systems
|
||||
======================================================
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
Some older GNU coreutils fail to build on newer GNU/Linux systems.
|
||||
|
||||
This happens with Coreutils version 8.29 and earlier, on systems
|
||||
using GlibC version 2.28 or newer, Such as Debian 10, CentOS 8, Fedora 29.
|
||||
|
||||
A typical error is:
|
||||
|
||||
$ wget https://ftp.gnu.org/gnu/coreutils/coreutils-7.6.tar.xz
|
||||
$ tar -xf coreutils-7.6.tar.xz
|
||||
$ cd coreutils-7.6
|
||||
$ ./configure
|
||||
$ make
|
||||
[...]
|
||||
freadahead.c: In function 'freadahead':
|
||||
freadahead.c:83:3: error: #error "Please port gnulib freadahead.c to
|
||||
your platform! Look at the definition of fflush,
|
||||
fread, ungetc on your system, then report this
|
||||
to bug-gnulib."
|
||||
[...]
|
||||
make[4]: *** [Makefile:1700: freadahead.o] Error 1
|
||||
|
||||
Other similar errors mention 'freadptr', 'freadseek','fseterr'.
|
||||
Older version (pre 7.2) mention 'tee','eaccess','futimens'.
|
||||
|
||||
|
||||
Details
|
||||
-------
|
||||
|
||||
GLibC version 2.28 removed non-standed headre file (libio.h) and some
|
||||
internal symbols which were used by gnulib (a core component of GNU coreutils).
|
||||
|
||||
These were announced as 'deprecated' in vesion 2.27 [1], and removed in
|
||||
version 2.28. Gnulib code was adjusted shortly after [2],
|
||||
but the code changes obviously can't be retroactively made to
|
||||
previously-released coreutils versions.
|
||||
|
||||
[1] https://sourceware.org/ml/libc-announce/2018/msg00000.html
|
||||
[2] https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
|
||||
|
||||
Older coreutils versions defined functions that were later picked-up
|
||||
by glibc ('tee','eaccess','futimens') resulting in conflicts.
|
||||
|
||||
See the patches for the exact code changes.
|
||||
|
||||
|
||||
Supplied patches
|
||||
----------------
|
||||
|
||||
The patch files in this directory change the source code of older
|
||||
coreutils versions, enabling successful build on newer systems.
|
||||
|
||||
Some versions require different patches.
|
||||
|
||||
Coreutils Versions Patch file
|
||||
5.0 coreutils-5.0-on-glibc-2.28.diff
|
||||
5.97 to 6.9 coreutils-5.97-on-glibc-2.28.diff
|
||||
6.10 coreutils-6.10-on-glibc-2.28.diff
|
||||
6.11 coreutils-6.11-on-glibc-2.28.diff
|
||||
6.12 coreutils-6.12-on-glibc-2.28.diff
|
||||
7.2 to 8.3 coreutils-7.2-on-glibc-2.28.diff
|
||||
8.4 to 8.12 coreutils-8.4-on-glibc-2.28.diff
|
||||
8.13 to 8.16 coreutils-8.13-on-glibc-2.28.diff
|
||||
8.17 coreutils-8.17-on-glibc-2.28.diff
|
||||
8.18 to 8.23 coreutils-8.18-on-glibc-2.28.diff
|
||||
8.24 to 8.29 coreutils-8.24-on-glibc-2.28.diff
|
||||
8.30 and newer [builds without patching]
|
||||
|
||||
|
||||
Manual build
|
||||
------------
|
||||
|
||||
1. Download the desired version from https://ftp.gnu.org/gnu/coreutils .
|
||||
2. Patch using the corresponding patch file (see table above).
|
||||
3. Configure the build, optionally adding the version number
|
||||
to the executables, to ensure they will not conflict with existing
|
||||
(newer) executables
|
||||
4. Build with 'make'
|
||||
5. Optionally install with 'sudo make install'
|
||||
|
||||
Example:
|
||||
|
||||
wget https://ftp.gnu.org/gnu/coreutils/coreutils-5.97.tar.gz
|
||||
tar -xf coreutils-5.97.tar.gz
|
||||
cd coreutils-5.97
|
||||
patch -p1 < ../coreutils-5.97-on-glibc-2.28.diff
|
||||
./configure --program-suffix=-5.97
|
||||
make
|
||||
sudo make install
|
||||
|
||||
This will install the programs (e.g. 'sort', 'head) in
|
||||
/usr/local/bin, with "-5.97" added to each program name (e.g. 'sort-5.97',
|
||||
'head-5.97').
|
||||
|
||||
NOTE:
|
||||
With very old versions (5.X and 6.X), running "./configure" will
|
||||
hang for a long time at the following step:
|
||||
"checking for mktime..."
|
||||
But will eventually continue successfully.
|
||||
|
||||
|
||||
Automated build
|
||||
---------------
|
||||
|
||||
The script 'build-older-versions.sh' automatically performs the manual steps
|
||||
listed above. The script installs each package in a separate directory:
|
||||
Programs in `$HOME/old-coreutils/coreutils-{VERSION}/bin`,
|
||||
manual pages in `$HOME/old-coreutils/coreutils-{VERSION}/share/man`,
|
||||
PDF manual in `$HOME/old-coreutils/coreutils-{VERSION}/share/doc`,
|
||||
INFO pages in `$HOME/old-coreutils/coreutils-{VERSION}/share/info`.
|
||||
It will also create symlinks to all version in a common directory
|
||||
`$HOME/old-coreutils/bin`.
|
||||
|
||||
Example, running the following commands:
|
||||
|
||||
./build-older-versions.sh 5.0
|
||||
./build-older-versions.sh 5.97
|
||||
./build-older-versions.sh 6.12
|
||||
./build-older-versions.sh 7.6
|
||||
|
||||
Will download, patch, build and install the programs for GNU coreutils
|
||||
versions 5.0,5.97,6.12,7.6 in `$HOME/old-coreutils/bin` :
|
||||
|
||||
$ ls $HOME/old-coreutils/bin
|
||||
[-5.97 id-5.0 sha224sum-7.6
|
||||
[-6.12 id-5.97 sha256sum-6.12
|
||||
[-7.6 id-6.12 sha256sum-7.6
|
||||
base64-6.12 id-7.6 sha384sum-6.12
|
||||
base64-7.6 install-5.0 sha384sum-7.6
|
||||
basename-5.0 install-5.97 sha512sum-6.12
|
||||
basename-5.97 install-6.12 sha512sum-7.6
|
||||
basename-6.12 install-7.6 shred-5.0
|
||||
basename-7.6 join-5.0 shred-5.97
|
||||
cat-5.0 join-5.97 shred-6.12
|
||||
cat-5.97 join-6.12 shred-7.6
|
||||
cat-6.12 join-7.6 shuf-6.12
|
||||
cat-7.6 kill-5.0 shuf-7.6
|
||||
chcon-6.12 kill-5.97 sleep-5.0
|
||||
chcon-7.6 kill-6.12 sleep-5.97
|
||||
chgrp-5.0 kill-7.6 sleep-6.12
|
||||
chgrp-5.97 link-5.0 sleep-7.6
|
||||
chgrp-6.12 link-5.97 sort-5.0
|
||||
chgrp-7.6 link-6.12 sort-5.97
|
||||
chmod-5.0 link-7.6 sort-6.12
|
||||
chmod-5.97 ln-5.0 sort-7.6
|
||||
chmod-6.12 ln-5.97 split-5.0
|
||||
chmod-7.6 ln-6.12 split-5.97
|
||||
chown-5.0 ln-7.6 split-6.12
|
||||
[... many more files ...]
|
||||
|
||||
By adding the directory to your $PATH, older versions can be easily used:
|
||||
|
||||
export PATH=$PATH:$HOME/old-coreutils/bin
|
||||
export MANPATH=$MANPATH:$HOME/old-coreutils/man
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 2019-2020 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
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
200
scripts/build-older-versions/build-older-versions.sh
Executable file
200
scripts/build-older-versions/build-older-versions.sh
Executable file
@@ -0,0 +1,200 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# are permitted in any medium without royalty provided the copyright
|
||||
# notice and this notice are preserved. This file is offered as-is,
|
||||
# without any warranty.
|
||||
#
|
||||
# Written by Assaf Gordon and Bernhard Voelker.
|
||||
|
||||
|
||||
# To build all versions since 5.0 (if possible):
|
||||
# git tag \
|
||||
# | grep '^v[5678]' \
|
||||
# | sed 's/^v//' \
|
||||
# | sort -V \
|
||||
# | while read f; do \
|
||||
# ./build-older-versions.sh $f 2>&1 \
|
||||
# | tee build/build.$f.log ; \
|
||||
# done
|
||||
|
||||
PREFIX="${PREFIX:=$HOME/old-coreutils}"
|
||||
|
||||
base=$(basename "$0")
|
||||
|
||||
die()
|
||||
{
|
||||
echo "$base: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
warn()
|
||||
{
|
||||
echo "$base: warning: $*" >&2
|
||||
}
|
||||
|
||||
get_patch_file()
|
||||
{
|
||||
case "$1" in
|
||||
5.0) echo coreutils-5.0-on-glibc-2.28.diff ;;
|
||||
5.97|6.[345679]) echo coreutils-5.97-on-glibc-2.28.diff ;;
|
||||
6.10) echo coreutils-6.10-on-glibc-2.28.diff ;;
|
||||
6.11) echo coreutils-6.11-on-glibc-2.28.diff ;;
|
||||
6.12) echo coreutils-6.12-on-glibc-2.28.diff ;;
|
||||
7.[23456]|8.[123]) echo coreutils-7.2-on-glibc-2.28.diff ;;
|
||||
8.[456789]|8.1[012]) echo coreutils-8.4-on-glibc-2.28.diff ;;
|
||||
8.1[3456]) echo coreutils-8.13-on-glibc-2.28.diff ;;
|
||||
8.17) echo coreutils-8.17-on-glibc-2.28.diff ;;
|
||||
8.1[89]|8.2[0123]) echo coreutils-8.18-on-glibc-2.28.diff ;;
|
||||
8.2[456789]) echo coreutils-8.24-on-glibc-2.28.diff ;;
|
||||
8.[3456789]*) warn "patch not needed for version '$1'" ;;
|
||||
5.[12]*|5.9*) die "version '$1' does not have a patch (yet) " \
|
||||
"use versions 5.0 or 5.97" ;;
|
||||
7.1) die "version '$1' does not have a patch (yet)" \
|
||||
"use versions 6.12 or 7.2" ;;
|
||||
5*|6*|7*|8*) die "non-existing version" ;;
|
||||
*) die "unknown version" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_url()
|
||||
{
|
||||
_base_url="https://ftp.gnu.org/gnu/coreutils/coreutils-$1.tar"
|
||||
case "$1" in
|
||||
5.*|6.*|7.*) echo "$_base_url.gz" ;;
|
||||
8.*) echo "$_base_url.xz" ;;
|
||||
*) die "unknown version" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
##
|
||||
## Setup
|
||||
##
|
||||
test -n "$1" \
|
||||
|| die "missing coreutils version to build (e.g. '6.12')"
|
||||
|
||||
cd $(dirname "$0")
|
||||
|
||||
patch_file=$(get_patch_file "$1") \
|
||||
|| die "cannot build version '$1'"
|
||||
|
||||
# Test for the patch file if the above returned one.
|
||||
if test "$patch_file"; then
|
||||
test -e "$patch_file" \
|
||||
|| die "internal error: patch file '$patch_file' does not exist"
|
||||
fi
|
||||
|
||||
url=$(get_url "$1")
|
||||
tarball=$(basename "$url")
|
||||
|
||||
mkdir -p "build" \
|
||||
&& cd "build" \
|
||||
|| die "creating version build dir 'build' failed"
|
||||
|
||||
##
|
||||
## Download tarball (if needed)
|
||||
##
|
||||
if ! test -e "$tarball" ; then
|
||||
wget -O "$tarball.t" "$url" \
|
||||
&& mv "$tarball.t" "$tarball" \
|
||||
|| die "failed to download '$url'"
|
||||
fi
|
||||
|
||||
##
|
||||
## Extract tarball (if needed)
|
||||
##
|
||||
srcdir=${tarball%.tar.*}
|
||||
if ! test -d "$srcdir" ; then
|
||||
tar -xvf "$tarball" || die "failed to extract '$tarball'"
|
||||
fi
|
||||
|
||||
##
|
||||
## Patch (if needed)
|
||||
##
|
||||
cd "$srcdir" \
|
||||
|| die "changing directory to '$srcdir' failed"
|
||||
|
||||
# Patch will fail if it was already applied (using "--forward" turns
|
||||
# that into a no-op). So don't check for failure.
|
||||
# Is there a way to differentiate between 'already applied' and
|
||||
# 'failed to apply' ?
|
||||
test "$patch_file" \
|
||||
&& patch --ignore-whitespace --batch --forward -p1 < "../../$patch_file"
|
||||
|
||||
##
|
||||
## Configure
|
||||
##
|
||||
version="${srcdir#coreutils}" # note: this keeps the '-' in '$version'
|
||||
vprefix="$PREFIX/coreutils$version"
|
||||
if ! test -e "Makefile" ; then
|
||||
./configure \
|
||||
--program-suffix="$version" \
|
||||
--prefix="$vprefix" \
|
||||
|| die "failed to run configure in 'build/$srcdir/'"
|
||||
fi
|
||||
|
||||
##
|
||||
## Build
|
||||
##
|
||||
make -j4 \
|
||||
|| die "build failed in 'build/$srcdir'"
|
||||
|
||||
##
|
||||
## Install
|
||||
##
|
||||
make install \
|
||||
|| die "make-install failed in 'build/$srcdir' (to '$vprefix')"
|
||||
|
||||
|
||||
# Create convenience links for the executables and manpages in common directory.
|
||||
(
|
||||
mkdir -p "$PREFIX/bin" "$PREFIX/man/man1" \
|
||||
|| die "creating common bin or man directory failed"
|
||||
cd $vprefix/bin \
|
||||
|| die "changing directory to just-installed 'bin' directory failed"
|
||||
for f in *; do
|
||||
ln -snvf "../coreutils$version/bin/$f" "$PREFIX/bin/$f" \
|
||||
|| die "creating symlink of executable '$f' failed"
|
||||
done
|
||||
|
||||
share= # older versions do not have 'share'.
|
||||
cd "$vprefix/share/man/man1" 2>/dev/null \
|
||||
&& share='/share' \
|
||||
|| cd "$vprefix/man/man1" \
|
||||
|| die "changing directory to just-installed 'man/man1' directory failed"
|
||||
for f in *; do
|
||||
ln -snfv "../../coreutils$version$share/man/man1/$f" "$PREFIX/man/man1/$f" \
|
||||
|| die "creating symlink of man page '$f' failed"
|
||||
done
|
||||
) || exit 1
|
||||
|
||||
# Build and install PDF (if possible).
|
||||
if make SUBDIRS=. pdf; then
|
||||
make SUBDIRS=. install-pdf \
|
||||
|| die "make-install-pdf failed in 'build/$srcdir' (to '$vprefix')"
|
||||
else
|
||||
echo "$0: no PDF available"
|
||||
fi
|
||||
|
||||
# Print summary
|
||||
cat<<EOF
|
||||
|
||||
|
||||
=================================================================
|
||||
|
||||
GNU Coreutils$version successfully installed.
|
||||
|
||||
Source code in $PWD/build/$srcdir
|
||||
Installed in $vprefix
|
||||
|
||||
symlinks for all programs (all versions) in $PREFIX/bin
|
||||
manual pages for all programs in $PREFIX/share/man/man1
|
||||
|
||||
Run the following command to add all programs to your \$PATH:
|
||||
|
||||
export PATH=\$PATH:\$HOME/old-coreutils/bin
|
||||
export MANPATH=\$MANPATH:\$HOME/old-coreutils/man
|
||||
|
||||
EOF
|
||||
@@ -0,0 +1,75 @@
|
||||
diff -r -U3 coreutils-5.0/src/Makefile.in coreutils-5.0-patched/src/Makefile.in
|
||||
--- coreutils-5.0/src/Makefile.in 2003-04-02 07:46:19.000000000 -0700
|
||||
+++ coreutils-5.0-patched/src/Makefile.in 2019-08-01 19:38:07.440997426 -0600
|
||||
@@ -209,7 +209,7 @@
|
||||
printf_LDADD = $(LDADD) @POW_LIB@ @LIBICONV@
|
||||
|
||||
# If necessary, add -lm to resolve use of floor, rint, modf.
|
||||
-seq_LDADD = $(LDADD) @SEQ_LIBM@
|
||||
+seq_LDADD = $(LDADD) @SEQ_LIBM@ -lm
|
||||
|
||||
# If necessary, add -lm to resolve the `pow' reference in lib/strtod.c
|
||||
# or for the fesetround reference in programs using nanosec.c.
|
||||
diff -r -U3 coreutils-5.0/src/tee.c coreutils-5.0-patched/src/tee.c
|
||||
--- coreutils-5.0/src/tee.c 2002-12-15 07:21:45.000000000 -0700
|
||||
+++ coreutils-5.0-patched/src/tee.c 2019-08-01 19:34:32.374301325 -0600
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#define AUTHORS N_ ("Mike Parker, Richard M. Stallman, and David MacKenzie")
|
||||
|
||||
-static int tee (int nfiles, const char **files);
|
||||
+static int tee_FOO (int nfiles, const char **files);
|
||||
|
||||
/* If nonzero, append to output files rather than truncating them. */
|
||||
static int append;
|
||||
@@ -146,7 +146,7 @@
|
||||
/* Do *not* warn if tee is given no file arguments.
|
||||
POSIX requires that it work when given no arguments. */
|
||||
|
||||
- errs = tee (argc - optind, (const char **) &argv[optind]);
|
||||
+ errs = tee_FOO (argc - optind, (const char **) &argv[optind]);
|
||||
if (close (STDIN_FILENO) != 0)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
Return 0 if successful, 1 if any errors occur. */
|
||||
|
||||
static int
|
||||
-tee (int nfiles, const char **files)
|
||||
+tee_FOO (int nfiles, const char **files)
|
||||
{
|
||||
FILE **descriptors;
|
||||
char buffer[BUFSIZ];
|
||||
diff -r -U3 coreutils-5.0/src/test.c coreutils-5.0-patched/src/test.c
|
||||
--- coreutils-5.0/src/test.c 2003-02-10 02:19:09.000000000 -0700
|
||||
+++ coreutils-5.0-patched/src/test.c 2019-08-01 19:35:52.871307966 -0600
|
||||
@@ -139,7 +139,7 @@
|
||||
/* Do the same thing access(2) does, but use the effective uid and gid. */
|
||||
|
||||
static int
|
||||
-eaccess (char const *file, int mode)
|
||||
+eaccess_FOO (char const *file, int mode)
|
||||
{
|
||||
static int have_ids;
|
||||
static uid_t uid, euid;
|
||||
@@ -635,17 +635,17 @@
|
||||
|
||||
case 'r': /* file is readable? */
|
||||
unary_advance ();
|
||||
- value = -1 != eaccess (argv[pos - 1], R_OK);
|
||||
+ value = -1 != eaccess_FOO (argv[pos - 1], R_OK);
|
||||
return (TRUE == value);
|
||||
|
||||
case 'w': /* File is writable? */
|
||||
unary_advance ();
|
||||
- value = -1 != eaccess (argv[pos - 1], W_OK);
|
||||
+ value = -1 != eaccess_FOO (argv[pos - 1], W_OK);
|
||||
return (TRUE == value);
|
||||
|
||||
case 'x': /* File is executable? */
|
||||
unary_advance ();
|
||||
- value = -1 != eaccess (argv[pos - 1], X_OK);
|
||||
+ value = -1 != eaccess_FOO (argv[pos - 1], X_OK);
|
||||
return (TRUE == value);
|
||||
|
||||
case 'O': /* File is owned by you? */
|
||||
@@ -0,0 +1,51 @@
|
||||
diff -r -U3 coreutils-6.4/lib/utimens.c coreutils-6.4-patched/lib/utimens.c
|
||||
--- coreutils-6.4/lib/utimens.c 2006-09-14 03:53:59.000000000 -0600
|
||||
+++ coreutils-6.4-patched/lib/utimens.c 2019-08-01 19:09:08.228883163 -0600
|
||||
@@ -73,7 +73,7 @@
|
||||
Return 0 on success, -1 (setting errno) on failure. */
|
||||
|
||||
int
|
||||
-futimens (int fd ATTRIBUTE_UNUSED,
|
||||
+futimens_FOO (int fd ATTRIBUTE_UNUSED,
|
||||
char const *file, struct timespec const timespec[2])
|
||||
{
|
||||
/* There's currently no interface to set file timestamps with
|
||||
@@ -166,5 +166,5 @@
|
||||
int
|
||||
utimens (char const *file, struct timespec const timespec[2])
|
||||
{
|
||||
- return futimens (-1, file, timespec);
|
||||
+ return futimens_FOO (-1, file, timespec);
|
||||
}
|
||||
diff -r -U3 coreutils-6.4/lib/utimens.h coreutils-6.4-patched/lib/utimens.h
|
||||
--- coreutils-6.4/lib/utimens.h 2004-11-23 14:39:48.000000000 -0700
|
||||
+++ coreutils-6.4-patched/lib/utimens.h 2019-08-01 19:08:25.656313704 -0600
|
||||
@@ -1,3 +1,3 @@
|
||||
#include "timespec.h"
|
||||
-int futimens (int, char const *, struct timespec const [2]);
|
||||
+int futimens_FOO (int, char const *, struct timespec const [2]);
|
||||
int utimens (char const *, struct timespec const [2]);
|
||||
diff -r -U3 coreutils-6.4/src/copy.c coreutils-6.4-patched/src/copy.c
|
||||
--- coreutils-6.4/src/copy.c 2006-10-22 10:54:15.000000000 -0600
|
||||
+++ coreutils-6.4-patched/src/copy.c 2019-08-01 19:09:42.421340384 -0600
|
||||
@@ -487,7 +487,7 @@
|
||||
timespec[0] = get_stat_atime (src_sb);
|
||||
timespec[1] = get_stat_mtime (src_sb);
|
||||
|
||||
- if (futimens (dest_desc, dst_name, timespec) != 0)
|
||||
+ if (futimens_FOO (dest_desc, dst_name, timespec) != 0)
|
||||
{
|
||||
error (0, errno, _("preserving times for %s"), quote (dst_name));
|
||||
if (x->require_preserve)
|
||||
diff -r -U3 coreutils-6.4/src/touch.c coreutils-6.4-patched/src/touch.c
|
||||
--- coreutils-6.4/src/touch.c 2006-10-22 10:54:15.000000000 -0600
|
||||
+++ coreutils-6.4-patched/src/touch.c 2019-08-01 19:09:34.685236947 -0600
|
||||
@@ -182,7 +182,7 @@
|
||||
t = timespec;
|
||||
}
|
||||
|
||||
- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
|
||||
+ ok = (futimens_FOO (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
|
||||
|
||||
if (fd == STDIN_FILENO)
|
||||
{
|
||||
@@ -0,0 +1,24 @@
|
||||
diff -r -U3 coreutils-6.10/lib/freadahead.c coreutils-6.10-patched/lib/freadahead.c
|
||||
--- coreutils-6.10/lib/freadahead.c 2007-11-08 00:32:20.000000000 -0700
|
||||
+++ coreutils-6.10-patched/lib/freadahead.c 2019-08-01 20:09:03.731243826 -0600
|
||||
@@ -22,7 +22,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ferror_unlocked /* GNU libc, BeOS */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked /* GNU libc, BeOS */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-6.10/lib/fseterr.c coreutils-6.10-patched/lib/fseterr.c
|
||||
--- coreutils-6.10/lib/fseterr.c 2007-11-08 00:32:20.000000000 -0700
|
||||
+++ coreutils-6.10-patched/lib/fseterr.c 2019-08-01 20:09:16.407416594 -0600
|
||||
@@ -27,7 +27,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ferror_unlocked /* GNU libc, BeOS */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked /* GNU libc, BeOS */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
|
||||
fp->_flags |= __SERR;
|
||||
@@ -0,0 +1,34 @@
|
||||
diff -r -U3 coreutils-6.11/lib/freadahead.c coreutils-6.11-patched/lib/freadahead.c
|
||||
--- coreutils-6.11/lib/freadahead.c 2008-04-17 03:59:17.000000000 -0600
|
||||
+++ coreutils-6.11-patched/lib/freadahead.c 2019-08-01 20:20:12.712193242 -0600
|
||||
@@ -19,10 +19,17 @@
|
||||
/* Specification. */
|
||||
#include "freadahead.h"
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
+
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-6.11/lib/fseterr.c coreutils-6.11-patched/lib/fseterr.c
|
||||
--- coreutils-6.11/lib/fseterr.c 2008-04-17 03:59:17.000000000 -0600
|
||||
+++ coreutils-6.11-patched/lib/fseterr.c 2019-08-01 20:20:37.868480486 -0600
|
||||
@@ -27,7 +27,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
|
||||
fp->_flags |= __SERR;
|
||||
@@ -0,0 +1,63 @@
|
||||
diff -r -U3 coreutils-6.12/lib/freadahead.c coreutils-6.12-patched/lib/freadahead.c
|
||||
--- coreutils-6.12/lib/freadahead.c 2008-05-14 06:53:25.000000000 -0600
|
||||
+++ coreutils-6.12-patched/lib/freadahead.c 2019-08-01 17:50:52.731658318 -0600
|
||||
@@ -24,7 +24,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-6.12/lib/freadptr.c coreutils-6.12-patched/lib/freadptr.c
|
||||
--- coreutils-6.12/lib/freadptr.c 2008-05-14 06:53:25.000000000 -0600
|
||||
+++ coreutils-6.12-patched/lib/freadptr.c 2019-08-01 17:51:06.867856472 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
size_t size;
|
||||
|
||||
/* Keep this code in sync with freadahead! */
|
||||
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return NULL;
|
||||
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-6.12/lib/freadseek.c coreutils-6.12-patched/lib/freadseek.c
|
||||
--- coreutils-6.12/lib/freadseek.c 2008-05-14 06:53:25.000000000 -0600
|
||||
+++ coreutils-6.12-patched/lib/freadseek.c 2019-08-01 17:51:21.264058094 -0600
|
||||
@@ -34,7 +34,7 @@
|
||||
freadptrinc (FILE *fp, size_t increment)
|
||||
{
|
||||
/* Keep this code in sync with freadptr! */
|
||||
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
fp->_IO_read_ptr += increment;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_p += increment;
|
||||
diff -r -U3 coreutils-6.12/lib/fseterr.c coreutils-6.12-patched/lib/fseterr.c
|
||||
--- coreutils-6.12/lib/fseterr.c 2008-05-14 06:53:25.000000000 -0600
|
||||
+++ coreutils-6.12-patched/lib/fseterr.c 2019-08-01 17:51:36.668273645 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_flags |= __SERR;
|
||||
diff -r -U3 coreutils-6.12/lib/stdio-impl.h coreutils-6.12-patched/lib/stdio-impl.h
|
||||
--- coreutils-6.12/lib/stdio-impl.h 2008-05-14 06:53:25.000000000 -0600
|
||||
+++ coreutils-6.12-patched/lib/stdio-impl.h 2019-08-01 17:49:51.518798189 -0600
|
||||
@@ -18,6 +18,12 @@
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
@@ -0,0 +1,75 @@
|
||||
diff -r -U3 coreutils-7.6/lib/freadahead.c coreutils-7.6-patched/lib/freadahead.c
|
||||
--- coreutils-7.6/lib/freadahead.c 2009-05-03 23:46:33.000000000 -0600
|
||||
+++ coreutils-7.6-patched/lib/freadahead.c 2019-08-01 17:30:54.589238442 -0600
|
||||
@@ -25,7 +25,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-7.6/lib/freadptr.c coreutils-7.6-patched/lib/freadptr.c
|
||||
--- coreutils-7.6/lib/freadptr.c 2009-05-03 23:46:33.000000000 -0600
|
||||
+++ coreutils-7.6-patched/lib/freadptr.c 2019-08-01 17:34:10.692659598 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
size_t size;
|
||||
|
||||
/* Keep this code in sync with freadahead! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return NULL;
|
||||
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-7.6/lib/freadseek.c coreutils-7.6-patched/lib/freadseek.c
|
||||
--- coreutils-7.6/lib/freadseek.c 2009-05-03 23:46:33.000000000 -0600
|
||||
+++ coreutils-7.6-patched/lib/freadseek.c 2019-08-01 17:34:41.013164702 -0600
|
||||
@@ -34,7 +34,7 @@
|
||||
freadptrinc (FILE *fp, size_t increment)
|
||||
{
|
||||
/* Keep this code in sync with freadptr! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_IO_read_ptr += increment;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_p += increment;
|
||||
diff -r -U3 coreutils-7.6/lib/fseeko.c coreutils-7.6-patched/lib/fseeko.c
|
||||
--- coreutils-7.6/lib/fseeko.c 2009-08-09 10:16:11.000000000 -0600
|
||||
+++ coreutils-7.6-patched/lib/fseeko.c 2019-08-01 17:36:11.030633785 -0600
|
||||
@@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
/* These tests are based on fpurge.c. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||
&& fp->_IO_save_base == NULL)
|
||||
diff -r -U3 coreutils-7.6/lib/fseterr.c coreutils-7.6-patched/lib/fseterr.c
|
||||
--- coreutils-7.6/lib/fseterr.c 2009-05-03 23:46:33.000000000 -0600
|
||||
+++ coreutils-7.6-patched/lib/fseterr.c 2019-08-01 17:34:57.285433551 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_flags |= __SERR;
|
||||
diff -r -U3 coreutils-7.6/lib/stdio-impl.h coreutils-7.6-patched/lib/stdio-impl.h
|
||||
--- coreutils-7.6/lib/stdio-impl.h 2009-05-03 23:46:34.000000000 -0600
|
||||
+++ coreutils-7.6-patched/lib/stdio-impl.h 2019-08-01 17:32:36.431051254 -0600
|
||||
@@ -18,6 +18,12 @@
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
@@ -0,0 +1,86 @@
|
||||
diff -r -U3 coreutils-8.13/lib/freadahead.c coreutils-8.13-patched/lib/freadahead.c
|
||||
--- coreutils-8.13/lib/freadahead.c 2011-08-19 10:09:37.000000000 -0600
|
||||
+++ coreutils-8.13-patched/lib/freadahead.c 2019-08-01 19:02:30.847557265 -0600
|
||||
@@ -25,7 +25,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-8.13/lib/freadptr.c coreutils-8.13-patched/lib/freadptr.c
|
||||
--- coreutils-8.13/lib/freadptr.c 2011-08-19 10:09:37.000000000 -0600
|
||||
+++ coreutils-8.13-patched/lib/freadptr.c 2019-08-01 19:02:30.851557318 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
size_t size;
|
||||
|
||||
/* Keep this code in sync with freadahead! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return NULL;
|
||||
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-8.13/lib/freadseek.c coreutils-8.13-patched/lib/freadseek.c
|
||||
--- coreutils-8.13/lib/freadseek.c 2011-08-19 10:09:37.000000000 -0600
|
||||
+++ coreutils-8.13-patched/lib/freadseek.c 2019-08-01 19:02:30.851557318 -0600
|
||||
@@ -34,7 +34,7 @@
|
||||
freadptrinc (FILE *fp, size_t increment)
|
||||
{
|
||||
/* Keep this code in sync with freadptr! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_IO_read_ptr += increment;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_p += increment;
|
||||
diff -r -U3 coreutils-8.13/lib/fseeko.c coreutils-8.13-patched/lib/fseeko.c
|
||||
--- coreutils-8.13/lib/fseeko.c 2011-08-12 02:05:46.000000000 -0600
|
||||
+++ coreutils-8.13-patched/lib/fseeko.c 2019-08-01 19:02:30.851557318 -0600
|
||||
@@ -42,7 +42,7 @@
|
||||
#endif
|
||||
|
||||
/* These tests are based on fpurge.c. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||
&& fp->_IO_save_base == NULL)
|
||||
diff -r -U3 coreutils-8.13/lib/fseterr.c coreutils-8.13-patched/lib/fseterr.c
|
||||
--- coreutils-8.13/lib/fseterr.c 2011-08-19 10:09:37.000000000 -0600
|
||||
+++ coreutils-8.13-patched/lib/fseterr.c 2019-08-01 19:02:30.851557318 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_flags |= __SERR;
|
||||
diff -r -U3 coreutils-8.13/lib/stdio-impl.h coreutils-8.13-patched/lib/stdio-impl.h
|
||||
--- coreutils-8.13/lib/stdio-impl.h 2011-04-24 11:21:45.000000000 -0600
|
||||
+++ coreutils-8.13-patched/lib/stdio-impl.h 2019-08-01 19:02:30.851557318 -0600
|
||||
@@ -18,6 +18,12 @@
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
|
||||
diff -r -U3 coreutils-8.13/lib/stdio.in.h coreutils-8.13-patched/lib/stdio.in.h
|
||||
--- coreutils-8.13/lib/stdio.in.h 2011-06-17 02:06:20.000000000 -0600
|
||||
+++ coreutils-8.13-patched/lib/stdio.in.h 2019-08-01 19:03:47.484586570 -0600
|
||||
@@ -697,7 +697,7 @@
|
||||
/* It is very rare that the developer ever has full control of stdin,
|
||||
so any use of gets warrants an unconditional warning. Assume it is
|
||||
always declared, since it is required by C89. */
|
||||
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
|
||||
+/* _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); */
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
diff -r -U3 coreutils-8.17/lib/freadahead.c coreutils-8.17-patched/lib/freadahead.c
|
||||
--- coreutils-8.17/lib/freadahead.c 2012-02-11 02:43:22.000000000 -0700
|
||||
+++ coreutils-8.17-patched/lib/freadahead.c 2019-08-01 19:19:11.975280339 -0600
|
||||
@@ -25,7 +25,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-8.17/lib/freadptr.c coreutils-8.17-patched/lib/freadptr.c
|
||||
--- coreutils-8.17/lib/freadptr.c 2012-02-11 02:43:22.000000000 -0700
|
||||
+++ coreutils-8.17-patched/lib/freadptr.c 2019-08-01 19:19:11.975280339 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
size_t size;
|
||||
|
||||
/* Keep this code in sync with freadahead! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return NULL;
|
||||
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-8.17/lib/freadseek.c coreutils-8.17-patched/lib/freadseek.c
|
||||
--- coreutils-8.17/lib/freadseek.c 2012-02-11 02:43:22.000000000 -0700
|
||||
+++ coreutils-8.17-patched/lib/freadseek.c 2019-08-01 19:19:11.975280339 -0600
|
||||
@@ -34,7 +34,7 @@
|
||||
freadptrinc (FILE *fp, size_t increment)
|
||||
{
|
||||
/* Keep this code in sync with freadptr! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_IO_read_ptr += increment;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_p += increment;
|
||||
diff -r -U3 coreutils-8.17/lib/fseeko.c coreutils-8.17-patched/lib/fseeko.c
|
||||
--- coreutils-8.17/lib/fseeko.c 2012-05-04 03:04:45.000000000 -0600
|
||||
+++ coreutils-8.17-patched/lib/fseeko.c 2019-08-01 19:19:11.975280339 -0600
|
||||
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
/* These tests are based on fpurge.c. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||
&& fp->_IO_save_base == NULL)
|
||||
diff -r -U3 coreutils-8.17/lib/fseterr.c coreutils-8.17-patched/lib/fseterr.c
|
||||
--- coreutils-8.17/lib/fseterr.c 2012-02-11 02:43:22.000000000 -0700
|
||||
+++ coreutils-8.17-patched/lib/fseterr.c 2019-08-01 19:19:11.975280339 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_flags |= __SERR;
|
||||
diff -r -U3 coreutils-8.17/lib/stdio-impl.h coreutils-8.17-patched/lib/stdio-impl.h
|
||||
--- coreutils-8.17/lib/stdio-impl.h 2012-02-11 02:43:22.000000000 -0700
|
||||
+++ coreutils-8.17-patched/lib/stdio-impl.h 2019-08-01 19:19:11.975280339 -0600
|
||||
@@ -18,6 +18,12 @@
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
|
||||
diff -r -U3 coreutils-8.17/lib/stdio.in.h coreutils-8.17-patched/lib/stdio.in.h
|
||||
--- coreutils-8.17/lib/stdio.in.h 2012-05-04 03:04:48.000000000 -0600
|
||||
+++ coreutils-8.17-patched/lib/stdio.in.h 2019-08-01 19:19:37.183560130 -0600
|
||||
@@ -704,7 +704,7 @@
|
||||
removed it. */
|
||||
#undef gets
|
||||
#if HAVE_RAW_DECL_GETS
|
||||
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
|
||||
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
diff -r -U3 coreutils-8.18/lib/freadahead.c coreutils-8.18-patched/lib/freadahead.c
|
||||
--- coreutils-8.18/lib/freadahead.c 2012-07-15 06:26:12.000000000 -0600
|
||||
+++ coreutils-8.18-patched/lib/freadahead.c 2019-08-01 19:22:13.169332844 -0600
|
||||
@@ -25,7 +25,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-8.18/lib/freadptr.c coreutils-8.18-patched/lib/freadptr.c
|
||||
--- coreutils-8.18/lib/freadptr.c 2012-07-15 06:26:12.000000000 -0600
|
||||
+++ coreutils-8.18-patched/lib/freadptr.c 2019-08-01 19:22:13.169332844 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
size_t size;
|
||||
|
||||
/* Keep this code in sync with freadahead! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return NULL;
|
||||
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-8.18/lib/freadseek.c coreutils-8.18-patched/lib/freadseek.c
|
||||
--- coreutils-8.18/lib/freadseek.c 2012-07-15 06:26:12.000000000 -0600
|
||||
+++ coreutils-8.18-patched/lib/freadseek.c 2019-08-01 19:23:20.070111747 -0600
|
||||
@@ -36,7 +36,7 @@
|
||||
/* Keep this code in sync with freadptr! */
|
||||
#if HAVE___FREADPTRINC /* musl libc */
|
||||
__freadptrinc (fp, increment);
|
||||
-#elif defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#elif defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_IO_read_ptr += increment;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
|
||||
fp_->_p += increment;
|
||||
diff -r -U3 coreutils-8.18/lib/fseeko.c coreutils-8.18-patched/lib/fseeko.c
|
||||
--- coreutils-8.18/lib/fseeko.c 2012-07-13 08:18:33.000000000 -0600
|
||||
+++ coreutils-8.18-patched/lib/fseeko.c 2019-08-01 19:22:13.169332844 -0600
|
||||
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
/* These tests are based on fpurge.c. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||
&& fp->_IO_save_base == NULL)
|
||||
diff -r -U3 coreutils-8.18/lib/fseterr.c coreutils-8.18-patched/lib/fseterr.c
|
||||
--- coreutils-8.18/lib/fseterr.c 2012-07-15 06:26:12.000000000 -0600
|
||||
+++ coreutils-8.18-patched/lib/fseterr.c 2019-08-01 19:22:13.169332844 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
|
||||
fp_->_flags |= __SERR;
|
||||
diff -r -U3 coreutils-8.18/lib/stdio-impl.h coreutils-8.18-patched/lib/stdio-impl.h
|
||||
--- coreutils-8.18/lib/stdio-impl.h 2012-07-15 06:26:12.000000000 -0600
|
||||
+++ coreutils-8.18-patched/lib/stdio-impl.h 2019-08-01 19:22:13.169332844 -0600
|
||||
@@ -18,6 +18,12 @@
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
|
||||
diff -r -U3 coreutils-8.18/lib/stdio.in.h coreutils-8.18-patched/lib/stdio.in.h
|
||||
--- coreutils-8.18/lib/stdio.in.h 2012-06-12 14:43:46.000000000 -0600
|
||||
+++ coreutils-8.18-patched/lib/stdio.in.h 2019-08-01 19:22:13.169332844 -0600
|
||||
@@ -704,7 +704,7 @@
|
||||
removed it. */
|
||||
#undef gets
|
||||
#if HAVE_RAW_DECL_GETS
|
||||
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
|
||||
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
diff -r -U3 coreutils-8.24/lib/freadahead.c coreutils-8.24-patched/lib/freadahead.c
|
||||
--- coreutils-8.24/lib/freadahead.c 2015-06-15 23:00:37.000000000 -0600
|
||||
+++ coreutils-8.24-patched/lib/freadahead.c 2019-08-01 19:47:31.412646436 -0600
|
||||
@@ -25,7 +25,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-8.24/lib/freadptr.c coreutils-8.24-patched/lib/freadptr.c
|
||||
--- coreutils-8.24/lib/freadptr.c 2015-06-15 23:00:37.000000000 -0600
|
||||
+++ coreutils-8.24-patched/lib/freadptr.c 2019-08-01 19:47:31.416646500 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
size_t size;
|
||||
|
||||
/* Keep this code in sync with freadahead! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return NULL;
|
||||
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-8.24/lib/freadseek.c coreutils-8.24-patched/lib/freadseek.c
|
||||
--- coreutils-8.24/lib/freadseek.c 2015-06-15 23:00:37.000000000 -0600
|
||||
+++ coreutils-8.24-patched/lib/freadseek.c 2019-08-01 19:47:31.416646500 -0600
|
||||
@@ -36,7 +36,7 @@
|
||||
/* Keep this code in sync with freadptr! */
|
||||
#if HAVE___FREADPTRINC /* musl libc */
|
||||
__freadptrinc (fp, increment);
|
||||
-#elif defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#elif defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_IO_read_ptr += increment;
|
||||
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
|
||||
diff -r -U3 coreutils-8.24/lib/fseeko.c coreutils-8.24-patched/lib/fseeko.c
|
||||
--- coreutils-8.24/lib/fseeko.c 2015-06-15 23:04:31.000000000 -0600
|
||||
+++ coreutils-8.24-patched/lib/fseeko.c 2019-08-01 19:47:31.416646500 -0600
|
||||
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
/* These tests are based on fpurge.c. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||
&& fp->_IO_save_base == NULL)
|
||||
diff -r -U3 coreutils-8.24/lib/fseterr.c coreutils-8.24-patched/lib/fseterr.c
|
||||
--- coreutils-8.24/lib/fseterr.c 2015-06-15 23:00:37.000000000 -0600
|
||||
+++ coreutils-8.24-patched/lib/fseterr.c 2019-08-01 19:47:31.416646500 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
|
||||
diff -r -U3 coreutils-8.24/lib/mountlist.c coreutils-8.24-patched/lib/mountlist.c
|
||||
--- coreutils-8.24/lib/mountlist.c 2015-07-01 09:08:30.000000000 -0600
|
||||
+++ coreutils-8.24-patched/lib/mountlist.c 2019-08-01 19:49:22.354401380 -0600
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
|
||||
#include "xalloc.h"
|
||||
|
||||
diff -r -U3 coreutils-8.24/lib/stdio-impl.h coreutils-8.24-patched/lib/stdio-impl.h
|
||||
--- coreutils-8.24/lib/stdio-impl.h 2015-06-15 23:00:37.000000000 -0600
|
||||
+++ coreutils-8.24-patched/lib/stdio-impl.h 2019-08-01 19:47:31.416646500 -0600
|
||||
@@ -18,6 +18,12 @@
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
@@ -0,0 +1,88 @@
|
||||
diff -r -U3 coreutils-8.5/lib/freadahead.c coreutils-8.5-patched/lib/freadahead.c
|
||||
--- coreutils-8.5/lib/freadahead.c 2010-04-23 07:44:00.000000000 -0600
|
||||
+++ coreutils-8.5-patched/lib/freadahead.c 2019-08-01 18:35:31.580843463 -0600
|
||||
@@ -25,7 +25,7 @@
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return 0;
|
||||
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||
diff -r -U3 coreutils-8.5/lib/freadptr.c coreutils-8.5-patched/lib/freadptr.c
|
||||
--- coreutils-8.5/lib/freadptr.c 2010-04-23 07:44:00.000000000 -0600
|
||||
+++ coreutils-8.5-patched/lib/freadptr.c 2019-08-01 18:35:31.580843463 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
size_t size;
|
||||
|
||||
/* Keep this code in sync with freadahead! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
return NULL;
|
||||
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
diff -r -U3 coreutils-8.5/lib/freadseek.c coreutils-8.5-patched/lib/freadseek.c
|
||||
--- coreutils-8.5/lib/freadseek.c 2010-04-23 07:44:00.000000000 -0600
|
||||
+++ coreutils-8.5-patched/lib/freadseek.c 2019-08-01 18:35:31.580843463 -0600
|
||||
@@ -34,7 +34,7 @@
|
||||
freadptrinc (FILE *fp, size_t increment)
|
||||
{
|
||||
/* Keep this code in sync with freadptr! */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_IO_read_ptr += increment;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_p += increment;
|
||||
diff -r -U3 coreutils-8.5/lib/fseeko.c coreutils-8.5-patched/lib/fseeko.c
|
||||
--- coreutils-8.5/lib/fseeko.c 2010-04-21 12:11:48.000000000 -0600
|
||||
+++ coreutils-8.5-patched/lib/fseeko.c 2019-08-01 18:35:31.580843463 -0600
|
||||
@@ -42,7 +42,7 @@
|
||||
#endif
|
||||
|
||||
/* These tests are based on fpurge.c. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||
&& fp->_IO_save_base == NULL)
|
||||
diff -r -U3 coreutils-8.5/lib/fseterr.c coreutils-8.5-patched/lib/fseterr.c
|
||||
--- coreutils-8.5/lib/fseterr.c 2010-04-23 07:44:00.000000000 -0600
|
||||
+++ coreutils-8.5-patched/lib/fseterr.c 2019-08-01 18:35:31.584843515 -0600
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_flags |= __SERR;
|
||||
diff -r -U3 coreutils-8.5/lib/stdio-impl.h coreutils-8.5-patched/lib/stdio-impl.h
|
||||
--- coreutils-8.5/lib/stdio-impl.h 2010-04-23 07:44:01.000000000 -0600
|
||||
+++ coreutils-8.5-patched/lib/stdio-impl.h 2019-08-01 18:35:31.584843515 -0600
|
||||
@@ -18,6 +18,12 @@
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||
+ * problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||
+ * internals. */
|
||||
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||
+# define _IO_IN_BACKUP 0x100
|
||||
+#endif
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
|
||||
diff -r -U3 coreutils-8.5/lib/stdio.in.h coreutils-8.5-patched/lib/stdio.in.h
|
||||
--- coreutils-8.5/lib/stdio.in.h 2010-04-21 12:11:57.000000000 -0600
|
||||
+++ coreutils-8.5-patched/lib/stdio.in.h 2019-08-01 18:26:34.113941755 -0600
|
||||
@@ -139,7 +139,7 @@
|
||||
so any use of gets warrants an unconditional warning. Assume it is
|
||||
always declared, since it is required by C89. */
|
||||
#undef gets
|
||||
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
|
||||
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/
|
||||
|
||||
#if @GNULIB_FOPEN@
|
||||
# if @REPLACE_FOPEN@
|
||||
@@ -14,10 +14,10 @@ $editor = "vi" if $? != 0 or $editor =~ /^\s*\z/;
|
||||
# Keywords allowed before the colon on the first line of a commit message:
|
||||
# program names and a few general category names.
|
||||
my @valid = qw(
|
||||
arch b2sum base32 base64 basename cat chcon chgrp chmod chown chroot cksum
|
||||
comm cp csplit cut date dd df dir dircolors dirname du echo env expand
|
||||
expr factor false fmt fold groups head hostid hostname id install
|
||||
join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp
|
||||
arch b2sum base32 base64 basenc nbasename cat chcon chgrp chmod chown
|
||||
chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo
|
||||
env expand expr factor false fmt fold groups head hostid hostname id
|
||||
install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp
|
||||
mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf
|
||||
ptx pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum
|
||||
sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty
|
||||
|
||||
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@@ -5,6 +5,7 @@ arch
|
||||
b2sum
|
||||
base32
|
||||
base64
|
||||
basenc
|
||||
basename
|
||||
cat
|
||||
chcon
|
||||
|
||||
350
src/base64.c
350
src/base64.c
@@ -1,350 +0,0 @@
|
||||
/* Base64 encode/decode strings or files.
|
||||
Copyright (C) 2004-2017 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Base64.
|
||||
|
||||
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 Simon Josefsson <simon@josefsson.org>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "error.h"
|
||||
#include "fadvise.h"
|
||||
#include "quote.h"
|
||||
#include "xstrtol.h"
|
||||
#include "xdectoint.h"
|
||||
#include "xbinary-io.h"
|
||||
|
||||
#define AUTHORS proper_name ("Simon Josefsson")
|
||||
|
||||
#if BASE_TYPE == 32
|
||||
# include "base32.h"
|
||||
# define PROGRAM_NAME "base32"
|
||||
#else
|
||||
# include "base64.h"
|
||||
# define PROGRAM_NAME "base64"
|
||||
#endif
|
||||
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"decode", no_argument, 0, 'd'},
|
||||
{"wrap", required_argument, 0, 'w'},
|
||||
{"ignore-garbage", no_argument, 0, 'i'},
|
||||
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
if (status != EXIT_SUCCESS)
|
||||
emit_try_help ();
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]... [FILE]\n\
|
||||
Base%d encode or decode FILE, or standard input, to standard output.\n\
|
||||
"), program_name, BASE_TYPE);
|
||||
|
||||
emit_stdin_note ();
|
||||
emit_mandatory_arg_note ();
|
||||
|
||||
fputs (_("\
|
||||
-d, --decode decode data\n\
|
||||
-i, --ignore-garbage when decoding, ignore non-alphabet characters\n\
|
||||
-w, --wrap=COLS wrap encoded lines after COLS character (default 76).\n\
|
||||
Use 0 to disable line wrapping\n\
|
||||
\n\
|
||||
"), stdout);
|
||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
||||
printf (_("\
|
||||
\n\
|
||||
The data are encoded as described for the %s alphabet in RFC 4648.\n\
|
||||
When decoding, the input may contain newlines in addition to the bytes of\n\
|
||||
the formal %s alphabet. Use --ignore-garbage to attempt to recover\n\
|
||||
from any other non-alphabet bytes in the encoded stream.\n"),
|
||||
PROGRAM_NAME, PROGRAM_NAME);
|
||||
emit_ancillary_info (PROGRAM_NAME);
|
||||
}
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
||||
#define ENC_BLOCKSIZE (1024*3*10)
|
||||
|
||||
#if BASE_TYPE == 32
|
||||
# define BASE_LENGTH BASE32_LENGTH
|
||||
/* Note that increasing this may decrease performance if --ignore-garbage
|
||||
is used, because of the memmove operation below. */
|
||||
# define DEC_BLOCKSIZE (1024*5)
|
||||
|
||||
/* Ensure that BLOCKSIZE is a multiple of 5 and 8. */
|
||||
verify (ENC_BLOCKSIZE % 40 == 0); /* So padding chars only on last block. */
|
||||
verify (DEC_BLOCKSIZE % 40 == 0); /* So complete encoded blocks are used. */
|
||||
|
||||
# define base_encode base32_encode
|
||||
# define base_decode_context base32_decode_context
|
||||
# define base_decode_ctx_init base32_decode_ctx_init
|
||||
# define base_decode_ctx base32_decode_ctx
|
||||
# define isbase isbase32
|
||||
#else
|
||||
# define BASE_LENGTH BASE64_LENGTH
|
||||
/* Note that increasing this may decrease performance if --ignore-garbage
|
||||
is used, because of the memmove operation below. */
|
||||
# define DEC_BLOCKSIZE (1024*3)
|
||||
|
||||
/* Ensure that BLOCKSIZE is a multiple of 3 and 4. */
|
||||
verify (ENC_BLOCKSIZE % 12 == 0); /* So padding chars only on last block. */
|
||||
verify (DEC_BLOCKSIZE % 12 == 0); /* So complete encoded blocks are used. */
|
||||
|
||||
# define base_encode base64_encode
|
||||
# define base_decode_context base64_decode_context
|
||||
# define base_decode_ctx_init base64_decode_ctx_init
|
||||
# define base_decode_ctx base64_decode_ctx
|
||||
# define isbase isbase64
|
||||
#endif
|
||||
|
||||
static void
|
||||
wrap_write (const char *buffer, size_t len,
|
||||
uintmax_t wrap_column, size_t *current_column, FILE *out)
|
||||
{
|
||||
size_t written;
|
||||
|
||||
if (wrap_column == 0)
|
||||
{
|
||||
/* Simple write. */
|
||||
if (fwrite (buffer, 1, len, stdout) < len)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
else
|
||||
for (written = 0; written < len;)
|
||||
{
|
||||
uintmax_t cols_remaining = wrap_column - *current_column;
|
||||
size_t to_write = MIN (cols_remaining, SIZE_MAX);
|
||||
to_write = MIN (to_write, len - written);
|
||||
|
||||
if (to_write == 0)
|
||||
{
|
||||
if (fputc ('\n', out) == EOF)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
*current_column = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fwrite (buffer + written, 1, to_write, stdout) < to_write)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
*current_column += to_write;
|
||||
written += to_write;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_encode (FILE *in, FILE *out, uintmax_t wrap_column)
|
||||
{
|
||||
size_t current_column = 0;
|
||||
char inbuf[ENC_BLOCKSIZE];
|
||||
char outbuf[BASE_LENGTH (ENC_BLOCKSIZE)];
|
||||
size_t sum;
|
||||
|
||||
do
|
||||
{
|
||||
size_t n;
|
||||
|
||||
sum = 0;
|
||||
do
|
||||
{
|
||||
n = fread (inbuf + sum, 1, ENC_BLOCKSIZE - sum, in);
|
||||
sum += n;
|
||||
}
|
||||
while (!feof (in) && !ferror (in) && sum < ENC_BLOCKSIZE);
|
||||
|
||||
if (sum > 0)
|
||||
{
|
||||
/* Process input one block at a time. Note that ENC_BLOCKSIZE
|
||||
is sized so that no pad chars will appear in output. */
|
||||
base_encode (inbuf, sum, outbuf, BASE_LENGTH (sum));
|
||||
|
||||
wrap_write (outbuf, BASE_LENGTH (sum), wrap_column,
|
||||
¤t_column, out);
|
||||
}
|
||||
}
|
||||
while (!feof (in) && !ferror (in) && sum == ENC_BLOCKSIZE);
|
||||
|
||||
/* When wrapping, terminate last line. */
|
||||
if (wrap_column && current_column > 0 && fputc ('\n', out) == EOF)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (ferror (in))
|
||||
die (EXIT_FAILURE, errno, _("read error"));
|
||||
}
|
||||
|
||||
static void
|
||||
do_decode (FILE *in, FILE *out, bool ignore_garbage)
|
||||
{
|
||||
char inbuf[BASE_LENGTH (DEC_BLOCKSIZE)];
|
||||
char outbuf[DEC_BLOCKSIZE];
|
||||
size_t sum;
|
||||
struct base_decode_context ctx;
|
||||
|
||||
base_decode_ctx_init (&ctx);
|
||||
|
||||
do
|
||||
{
|
||||
bool ok;
|
||||
size_t n;
|
||||
unsigned int k;
|
||||
|
||||
sum = 0;
|
||||
do
|
||||
{
|
||||
n = fread (inbuf + sum, 1, BASE_LENGTH (DEC_BLOCKSIZE) - sum, in);
|
||||
|
||||
if (ignore_garbage)
|
||||
{
|
||||
for (size_t i = 0; n > 0 && i < n;)
|
||||
{
|
||||
if (isbase (inbuf[sum + i]) || inbuf[sum + i] == '=')
|
||||
i++;
|
||||
else
|
||||
memmove (inbuf + sum + i, inbuf + sum + i + 1, --n - i);
|
||||
}
|
||||
}
|
||||
|
||||
sum += n;
|
||||
|
||||
if (ferror (in))
|
||||
die (EXIT_FAILURE, errno, _("read error"));
|
||||
}
|
||||
while (sum < BASE_LENGTH (DEC_BLOCKSIZE) && !feof (in));
|
||||
|
||||
/* The following "loop" is usually iterated just once.
|
||||
However, when it processes the final input buffer, we want
|
||||
to iterate it one additional time, but with an indicator
|
||||
telling it to flush what is in CTX. */
|
||||
for (k = 0; k < 1 + !!feof (in); k++)
|
||||
{
|
||||
if (k == 1 && ctx.i == 0)
|
||||
break;
|
||||
n = DEC_BLOCKSIZE;
|
||||
ok = base_decode_ctx (&ctx, inbuf, (k == 0 ? sum : 0), outbuf, &n);
|
||||
|
||||
if (fwrite (outbuf, 1, n, out) < n)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (!ok)
|
||||
die (EXIT_FAILURE, 0, _("invalid input"));
|
||||
}
|
||||
}
|
||||
while (!feof (in));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
FILE *input_fh;
|
||||
const char *infile;
|
||||
|
||||
/* True if --decode has been given and we should decode data. */
|
||||
bool decode = false;
|
||||
/* True if we should ignore non-base-alphabetic characters. */
|
||||
bool ignore_garbage = false;
|
||||
/* Wrap encoded data around the 76:th column, by default. */
|
||||
uintmax_t wrap_column = 76;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "diw:", long_options, NULL)) != -1)
|
||||
switch (opt)
|
||||
{
|
||||
case 'd':
|
||||
decode = true;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
wrap_column = xdectoumax (optarg, 0, UINTMAX_MAX, "",
|
||||
_("invalid wrap size"), 0);
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
ignore_garbage = true;
|
||||
break;
|
||||
|
||||
case_GETOPT_HELP_CHAR;
|
||||
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
|
||||
default:
|
||||
usage (EXIT_FAILURE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (argc - optind > 1)
|
||||
{
|
||||
error (0, 0, _("extra operand %s"), quote (argv[optind]));
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
infile = argv[optind];
|
||||
else
|
||||
infile = "-";
|
||||
|
||||
if (STREQ (infile, "-"))
|
||||
{
|
||||
xset_binary_mode (STDIN_FILENO, O_BINARY);
|
||||
input_fh = stdin;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_fh = fopen (infile, "rb");
|
||||
if (input_fh == NULL)
|
||||
die (EXIT_FAILURE, errno, "%s", quotef (infile));
|
||||
}
|
||||
|
||||
fadvise (input_fh, FADVISE_SEQUENTIAL);
|
||||
|
||||
if (decode)
|
||||
do_decode (input_fh, stdout, ignore_garbage);
|
||||
else
|
||||
do_encode (input_fh, stdout, wrap_column);
|
||||
|
||||
if (fclose (input_fh) == EOF)
|
||||
{
|
||||
if (STREQ (infile, "-"))
|
||||
die (EXIT_FAILURE, errno, _("closing standard input"));
|
||||
else
|
||||
die (EXIT_FAILURE, errno, "%s", quotef (infile));
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user