mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
413 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
447d245551 | ||
|
|
fee722471c | ||
|
|
630f4ba107 | ||
|
|
2fccfaab19 | ||
|
|
2b18a4c138 | ||
|
|
6609ccbf87 | ||
|
|
d863533752 | ||
|
|
bf5af9aef8 | ||
|
|
161e5120d4 | ||
|
|
3b997a9bcb | ||
|
|
00f0cabaec | ||
|
|
5cf6fb3b12 | ||
|
|
9ed5048148 | ||
|
|
c3744b25f2 | ||
|
|
49741b61b7 | ||
|
|
9a91b2a928 | ||
|
|
4c9e7e01fa | ||
|
|
6a31fd8d73 | ||
|
|
719a95aa9d | ||
|
|
1313107c5c | ||
|
|
cf1bc9810d | ||
|
|
622cf39be6 | ||
|
|
3aff3ed137 | ||
|
|
10d97b3191 | ||
|
|
56b85e035b | ||
|
|
c768e2231b | ||
|
|
9a8d8f46a5 | ||
|
|
d9dbbb9a45 | ||
|
|
74cf4cb26d | ||
|
|
41456fac8a | ||
|
|
dde83c27b4 | ||
|
|
20e5a0d562 | ||
|
|
22e4276ed1 | ||
|
|
25d2460ae3 | ||
|
|
31a9937081 | ||
|
|
d431c61873 | ||
|
|
5f29d118df | ||
|
|
0c5ae3a8ac | ||
|
|
e89a5e9b13 | ||
|
|
bcca26e838 | ||
|
|
41b3a8ed8b | ||
|
|
cd65f11c4f | ||
|
|
8ba5d1a70c | ||
|
|
38cb824673 | ||
|
|
d4b96c26ce | ||
|
|
7bf2e3db23 | ||
|
|
87bf834dd3 | ||
|
|
8fe40b84bd | ||
|
|
565e5f6827 | ||
|
|
6eb457eaba | ||
|
|
a276ba2dd4 | ||
|
|
71c2f88155 | ||
|
|
3c88587b2e | ||
|
|
12a0a583f6 | ||
|
|
39da66f979 | ||
|
|
22776f84cb | ||
|
|
17b7d09bf2 | ||
|
|
f2859424cb | ||
|
|
56a66d78ff | ||
|
|
e26cb21e6b | ||
|
|
1c59bb3cef | ||
|
|
536a1fbe5f | ||
|
|
ce22916610 | ||
|
|
da17f99b20 | ||
|
|
c07b181396 | ||
|
|
2904d675a4 | ||
|
|
54491d2751 | ||
|
|
42d12b45d3 | ||
|
|
75efc921b0 | ||
|
|
d6de2f198e | ||
|
|
1a81342089 | ||
|
|
0cc0424119 | ||
|
|
f00bbe33e4 | ||
|
|
0f3f6bf6bf | ||
|
|
243f1b1c71 | ||
|
|
c6900474ef | ||
|
|
dae24f5ffc | ||
|
|
c695781753 | ||
|
|
d9cf7c911f | ||
|
|
50e837b1c4 | ||
|
|
501bf7b589 | ||
|
|
69fbfd400c | ||
|
|
30e4b6e84b | ||
|
|
2122247aca | ||
|
|
bd933c1250 | ||
|
|
1ce9e1e5ca | ||
|
|
b6540b96ba | ||
|
|
97777f559a | ||
|
|
c0dcf3238b | ||
|
|
a08e13a0fb | ||
|
|
5e361387d0 | ||
|
|
cbf36952d8 | ||
|
|
029b6b14c5 | ||
|
|
cd0f3036f6 | ||
|
|
9abbe32c2e | ||
|
|
54645c195c | ||
|
|
710fe413fe | ||
|
|
71adb516de | ||
|
|
6ac6c7e4b7 | ||
|
|
f26508204b | ||
|
|
9e13b6a0b4 | ||
|
|
527fb951de | ||
|
|
f8653f2af3 | ||
|
|
2fa407885c | ||
|
|
b3cfa712ca | ||
|
|
f25273d7f1 | ||
|
|
26e8e602a8 | ||
|
|
7280a913a1 | ||
|
|
7ff00ca82f | ||
|
|
f7b1873805 | ||
|
|
c2bebf63ed | ||
|
|
d74a1b005c | ||
|
|
4f1a3eda10 | ||
|
|
c9e7b8844b | ||
|
|
219f2f0538 | ||
|
|
78c9360178 | ||
|
|
0023f65fd7 | ||
|
|
57d9263ca5 | ||
|
|
e11a0319b3 | ||
|
|
c039c96449 | ||
|
|
aa092ccf6a | ||
|
|
2a876d901d | ||
|
|
a797c4d7d3 | ||
|
|
7a3bc1bf27 | ||
|
|
00674c7475 | ||
|
|
eb5f06f2a6 | ||
|
|
8e32390716 | ||
|
|
b95be30e3f | ||
|
|
d183a15cbb | ||
|
|
96829a9ff0 | ||
|
|
ca1e31f3c5 | ||
|
|
3c40fdfba6 | ||
|
|
3a97d664b9 | ||
|
|
addb62da92 | ||
|
|
569df689e3 | ||
|
|
df0c0381ab | ||
|
|
f8726e05c4 | ||
|
|
95c01c656e | ||
|
|
8a7f66feb4 | ||
|
|
30a227673e | ||
|
|
dd8db19cc7 | ||
|
|
569e387b8a | ||
|
|
9ca7d6b49e | ||
|
|
d4c7114bce | ||
|
|
ce1069c215 | ||
|
|
a033e28737 | ||
|
|
b7aaa0da8b | ||
|
|
36edf7bad2 | ||
|
|
242689c7f9 | ||
|
|
30c65cd49c | ||
|
|
ca9e212cf8 | ||
|
|
efcee783e4 | ||
|
|
fb59d72f0a | ||
|
|
a037e838e1 | ||
|
|
ade8dd2096 | ||
|
|
0cce690850 | ||
|
|
82124c3c06 | ||
|
|
38f1c2006e | ||
|
|
8a1edc971f | ||
|
|
70253e9179 | ||
|
|
b18b6912e8 | ||
|
|
fbfca3c675 | ||
|
|
7a404d10f5 | ||
|
|
8c92bb3441 | ||
|
|
32f987af12 | ||
|
|
fee8694886 | ||
|
|
3a169f4c5d | ||
|
|
29ec834c3b | ||
|
|
9837344837 | ||
|
|
5d4f09d83a | ||
|
|
c48003a53c | ||
|
|
a2883947bc | ||
|
|
99f59aaaf8 | ||
|
|
6504d7e193 | ||
|
|
2bad8c0dea | ||
|
|
fe6f4e305c | ||
|
|
a77fb35364 | ||
|
|
94eca76776 | ||
|
|
20761ce686 | ||
|
|
df84346ebc | ||
|
|
71bac0dac3 | ||
|
|
d41dbb187f | ||
|
|
cca83fafa6 | ||
|
|
eb1299481a | ||
|
|
255a6a201e | ||
|
|
f6f78f093b | ||
|
|
21b617b78b | ||
|
|
ebbf0a1f0f | ||
|
|
398749b0cc | ||
|
|
e5dba03d2f | ||
|
|
c756343503 | ||
|
|
722287e443 | ||
|
|
9966c92dd4 | ||
|
|
4f73ecaf7d | ||
|
|
880a6e7723 | ||
|
|
bd11475627 | ||
|
|
aa2f797c7d | ||
|
|
ebc7aacf7b | ||
|
|
15223b0c3b | ||
|
|
b64d9b6d9e | ||
|
|
0bbb9d7785 | ||
|
|
f1e1e89e81 | ||
|
|
1c0ec3541c | ||
|
|
f0ff8c73fe | ||
|
|
e8591fd39f | ||
|
|
a863644397 | ||
|
|
f6d1f70183 | ||
|
|
af6436559c | ||
|
|
fd9750b0ff | ||
|
|
a8d26b3ce1 | ||
|
|
a4a864da36 | ||
|
|
9547a78bda | ||
|
|
494fed0271 | ||
|
|
61cc6fbc27 | ||
|
|
f68f5f23c6 | ||
|
|
cdfb703c5d | ||
|
|
15f26e296b | ||
|
|
467cc9bb43 | ||
|
|
d54376db68 | ||
|
|
af054f80b2 | ||
|
|
c392c4b8ef | ||
|
|
471f219ac7 | ||
|
|
a5e224d793 | ||
|
|
526a057602 | ||
|
|
70eadcb4e6 | ||
|
|
305bbd99b2 | ||
|
|
c45b4237bc | ||
|
|
c692280926 | ||
|
|
3346c0afbc | ||
|
|
a23afe7b72 | ||
|
|
82f09f4762 | ||
|
|
370fa0fa42 | ||
|
|
e0e8429c24 | ||
|
|
1422cabf93 | ||
|
|
84b5844d21 | ||
|
|
1a94ac4a05 | ||
|
|
1b2d2635ee | ||
|
|
fa3e9cb9af | ||
|
|
228c8e9eec | ||
|
|
1ce27f74ec | ||
|
|
b2c30136dc | ||
|
|
e3b14643f4 | ||
|
|
e579a697b2 | ||
|
|
68c9b31834 | ||
|
|
856ba44297 | ||
|
|
8f7d8e3bc3 | ||
|
|
0b1dcf33f5 | ||
|
|
a977dbbe78 | ||
|
|
a4e123abd3 | ||
|
|
c1e158489d | ||
|
|
12a104b45e | ||
|
|
e3ccc324d3 | ||
|
|
a10ba58f3c | ||
|
|
56300b1dc2 | ||
|
|
0a859a6cb0 | ||
|
|
450df0f26d | ||
|
|
98ec4beba5 | ||
|
|
6c497c6c2d | ||
|
|
9e59f8c47c | ||
|
|
72f98388c3 | ||
|
|
f296cf4052 | ||
|
|
359fa92f2a | ||
|
|
31fa922e57 | ||
|
|
59a6ddfca3 | ||
|
|
de619c8fa5 | ||
|
|
847359b11d | ||
|
|
d6639ee63b | ||
|
|
be8531206b | ||
|
|
899c1d00fa | ||
|
|
e2808a3999 | ||
|
|
ddfcccce51 | ||
|
|
1130e181ee | ||
|
|
5e778f7c8d | ||
|
|
2bc0f3caaa | ||
|
|
831acb987e | ||
|
|
1d651b954f | ||
|
|
99e607b910 | ||
|
|
04a31ad99d | ||
|
|
af1996dde2 | ||
|
|
7f242fadfa | ||
|
|
3db7c2c03c | ||
|
|
a70ac4ef32 | ||
|
|
112bccb26b | ||
|
|
611870a8f3 | ||
|
|
718b2790c0 | ||
|
|
6f6599a006 | ||
|
|
d25101cc30 | ||
|
|
ea57d46482 | ||
|
|
eca6a4a21a | ||
|
|
60d0413fe6 | ||
|
|
dc1618fbd8 | ||
|
|
e4dcb20e83 | ||
|
|
ea5b7124b4 | ||
|
|
f0a1f0df22 | ||
|
|
8574c74325 | ||
|
|
11ccbdab27 | ||
|
|
f43f028652 | ||
|
|
e4caea5775 | ||
|
|
ab274c428d | ||
|
|
e32320de66 | ||
|
|
eb2f9e84b9 | ||
|
|
a1d7469835 | ||
|
|
ff159a605e | ||
|
|
c5c15884df | ||
|
|
5929322ccb | ||
|
|
365fb90eaa | ||
|
|
eae535e1a3 | ||
|
|
1762092901 | ||
|
|
c60f151ebd | ||
|
|
48726556ca | ||
|
|
81ae3611d3 | ||
|
|
c06547cade | ||
|
|
28e3946ef0 | ||
|
|
c9871986eb | ||
|
|
2ac2cace15 | ||
|
|
d3feea0181 | ||
|
|
5ef9069576 | ||
|
|
e40c5f735c | ||
|
|
bc51349ccd | ||
|
|
4533017669 | ||
|
|
095861179c | ||
|
|
1bc5395e92 | ||
|
|
c91c85647c | ||
|
|
9d87a45b2f | ||
|
|
8aeda9b930 | ||
|
|
e81c4d88c2 | ||
|
|
5874a8215d | ||
|
|
493c481684 | ||
|
|
6edc9c972e | ||
|
|
2f4188ebec | ||
|
|
0bf77fc8ec | ||
|
|
394e3ef72a | ||
|
|
9f9e2d81d1 | ||
|
|
571b7e3eee | ||
|
|
954dba24d4 | ||
|
|
4612670f46 | ||
|
|
8f3171bbc4 | ||
|
|
68149832bd | ||
|
|
a9461064b8 | ||
|
|
ad7b37bfd4 | ||
|
|
0d64bc4429 | ||
|
|
0e93175301 | ||
|
|
3639a880aa | ||
|
|
ec34511ccf | ||
|
|
2c20fd053b | ||
|
|
42cd6653b0 | ||
|
|
065ce24361 | ||
|
|
acc01947af | ||
|
|
d9f83f9a60 | ||
|
|
66ac50e723 | ||
|
|
d106277d45 | ||
|
|
962878499c | ||
|
|
3e565eb3a6 | ||
|
|
6d0d1c47b2 | ||
|
|
5718733510 | ||
|
|
f24b825171 | ||
|
|
07c6f21b81 | ||
|
|
b3f293c61b | ||
|
|
e472f8fece | ||
|
|
1c16c9598e | ||
|
|
9c6c621c32 | ||
|
|
2232b4d08f | ||
|
|
ec00727a72 | ||
|
|
f9554bbe25 | ||
|
|
fc66fb4d99 | ||
|
|
0975852c50 | ||
|
|
0c131d4c10 | ||
|
|
25a18dafb8 | ||
|
|
a5a2a406f8 | ||
|
|
ff6fe3d17d | ||
|
|
f51a401bc2 | ||
|
|
c0d8245288 | ||
|
|
ae494d4be8 | ||
|
|
358aca5fb9 | ||
|
|
24c727d3c2 | ||
|
|
ba1c5239bc | ||
|
|
0df338f671 | ||
|
|
502be19e0f | ||
|
|
523c40505c | ||
|
|
f9a950b87f | ||
|
|
5424a74725 | ||
|
|
d8243c25cd | ||
|
|
59400b2884 | ||
|
|
d7397c1e7b | ||
|
|
a65957da77 | ||
|
|
ba6e08c627 | ||
|
|
18db64ba7e | ||
|
|
4dbfbf3fd0 | ||
|
|
0818c52874 | ||
|
|
a5c627f9c6 | ||
|
|
b96cd035ff | ||
|
|
2e62250e98 | ||
|
|
bb7ff3bccd | ||
|
|
df356c22ba | ||
|
|
f9bb168f56 | ||
|
|
c43333419b | ||
|
|
159faba137 | ||
|
|
c45c51fe97 | ||
|
|
39285f6008 | ||
|
|
b7f6e0d516 | ||
|
|
088a7ca9b1 | ||
|
|
564622fbea | ||
|
|
2726826c72 | ||
|
|
9593a3d8e7 | ||
|
|
65ed4ca07b | ||
|
|
9b54961b13 | ||
|
|
50ca12c28d | ||
|
|
242f801adf | ||
|
|
bba5fed6ba | ||
|
|
fc9fdd18b3 | ||
|
|
42e3278f8f | ||
|
|
60e7332dc0 | ||
|
|
034cbb3923 |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -5,3 +5,5 @@
|
||||
# # Derived from the regexp in emacs' lisp/add-log.el.
|
||||
# [diff "texinfo"]
|
||||
# funcname = "^@node[ \t][ \t]*\\([^,][^,]*\\)"
|
||||
|
||||
gl/lib/*.diff -whitespace
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,9 +1,9 @@
|
||||
*.1
|
||||
*.I[12]
|
||||
*.[EIOX]
|
||||
*.o
|
||||
*/.deps
|
||||
*~
|
||||
._bootmp
|
||||
.gdb-history
|
||||
.kludge-stamp
|
||||
.tarball-version
|
||||
@@ -48,15 +48,18 @@ lib/arpa
|
||||
lib/binary-io.h
|
||||
lib/charset.alias
|
||||
lib/configmake.h
|
||||
lib/glthread
|
||||
lib/libcoreutils.a
|
||||
lib/printf.c
|
||||
lib/progname.c
|
||||
lib/progname.h
|
||||
lib/selinux
|
||||
lib/unistr
|
||||
lib/uniwidth
|
||||
m4/.cvsignore
|
||||
m4/.gitignore
|
||||
maint.mk
|
||||
man/*.1
|
||||
po/*.gmo
|
||||
po/*.po
|
||||
po/.gitignore
|
||||
@@ -72,3 +75,5 @@ src/version.c
|
||||
src/version.h
|
||||
stamp-h1
|
||||
tests/*/*.log
|
||||
tests/t?
|
||||
tests/test-suite.log
|
||||
|
||||
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
||||
[submodule "gnulib"]
|
||||
path = gnulib
|
||||
url = git://git.sv.gnu.org/gnulib.git
|
||||
path = gnulib
|
||||
url = git://git.sv.gnu.org/gnulib.git
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.3
|
||||
8.0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Suppress valgrind diagnostics we don't care about.
|
||||
|
||||
# Copyright (C) 2003, 2004, 2006-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003, 2004, 2006-2009 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
.x-sc_prohibit_fail_0
Normal file
3
.x-sc_prohibit_fail_0
Normal file
@@ -0,0 +1,3 @@
|
||||
\.mk$
|
||||
/Makefile\.am$
|
||||
^tests/test-lib\.sh$
|
||||
3
.x-sc_prohibit_magic_number_exit
Normal file
3
.x-sc_prohibit_magic_number_exit
Normal file
@@ -0,0 +1,3 @@
|
||||
configure.ac
|
||||
*.m4
|
||||
ChangeLog*
|
||||
7
.x-sc_prohibit_tab_based_indentation
Normal file
7
.x-sc_prohibit_tab_based_indentation
Normal file
@@ -0,0 +1,7 @@
|
||||
^GNUMakefile$
|
||||
Makefile\.am$
|
||||
\.mk$
|
||||
^tests/pr/
|
||||
ChangeLog.*
|
||||
^man/help2man$
|
||||
^gl/lib/.*\.c\.diff$
|
||||
@@ -9,3 +9,4 @@ m4/lib-prefix.m4
|
||||
m4/po.m4
|
||||
aclocal.m4
|
||||
src/c99-to-c89.diff
|
||||
^gl/lib/.*\.c\.diff$
|
||||
|
||||
3
.x-sc_system_h_headers
Normal file
3
.x-sc_system_h_headers
Normal file
@@ -0,0 +1,3 @@
|
||||
^src/libstdbuf\.c$
|
||||
^src/system\.h$
|
||||
^src/copy\.h$
|
||||
4
AUTHORS
4
AUTHORS
@@ -46,11 +46,12 @@ md5sum: Ulrich Drepper, Scott Miller, David Madore
|
||||
mkdir: David MacKenzie
|
||||
mkfifo: David MacKenzie
|
||||
mknod: David MacKenzie
|
||||
mktemp: Jim Meyering
|
||||
mktemp: Jim Meyering, Eric Blake
|
||||
mv: Mike Parker, David MacKenzie, Jim Meyering
|
||||
nice: David MacKenzie
|
||||
nl: Scott Bartram, David MacKenzie
|
||||
nohup: Jim Meyering
|
||||
nproc: Giuseppe Scrivano
|
||||
od: Jim Meyering
|
||||
paste: David M. Ihnat, David MacKenzie
|
||||
pathchk: Paul Eggert, David MacKenzie, Jim Meyering
|
||||
@@ -76,6 +77,7 @@ sleep: Jim Meyering, Paul Eggert
|
||||
sort: Mike Haertel, Paul Eggert
|
||||
split: Torbjörn Granlund, Richard M. Stallman
|
||||
stat: Michael Meskes
|
||||
stdbuf: Pádraig Brady
|
||||
stty: David MacKenzie
|
||||
su: David MacKenzie
|
||||
sum: Kayvan Aghaiepour, David MacKenzie
|
||||
|
||||
@@ -11609,7 +11609,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -4033,7 +4033,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -4015,7 +4015,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -372,7 +372,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
59
HACKING
59
HACKING
@@ -189,7 +189,7 @@ branch, and then realize that something about it is not right.
|
||||
It's easy to adjust:
|
||||
|
||||
edit your files # this can include running "git add NEW" or "git rm BAD"
|
||||
git commit --amend -e -a
|
||||
git commit --amend -a
|
||||
git format-patch --stdout -1 > your-branch.diff
|
||||
|
||||
That replaces the most recent change-set with the revised one.
|
||||
@@ -213,8 +213,15 @@ Commit log requirements
|
||||
=======================
|
||||
Your commit log should always start with a one-line summary, the second
|
||||
line should be blank, and the remaining lines are usually ChangeLog-style
|
||||
entries for all affected files. Omit the leading TABs that you're used
|
||||
to seeing in a "real" ChangeLog file.
|
||||
entries for all affected files. However, it's fine -- even recommended --
|
||||
to write a few lines of prose describing the change, when the summary
|
||||
and ChangeLog entries don't give enough of the big picture. Omit the
|
||||
leading TABs that you're used to seeing in a "real" ChangeLog file, but
|
||||
keep the maximum line length at 72 or smaller, so that the generated
|
||||
ChangeLog lines, each with its leading TAB, will not exceed 80 columns.
|
||||
As for the ChangeLog-style content, please follow these guidelines:
|
||||
|
||||
http://www.gnu.org/software/guile/changelogs/guile-changelogs_3.html
|
||||
|
||||
Try to make the summary line fit one of the following forms:
|
||||
|
||||
@@ -222,23 +229,30 @@ Try to make the summary line fit one of the following forms:
|
||||
prog1, prog2: change-description
|
||||
doc: change-description
|
||||
tests: change-description
|
||||
build: change-description
|
||||
maint: change-description
|
||||
|
||||
|
||||
Use SPACE-only indentation in new files.
|
||||
========================================
|
||||
In any new file, eliminate all leading TABs (e.g., via running GNU indent
|
||||
with --no-tabs) and put these lines at the end of the file:
|
||||
Use SPACE-only indentation in all[*] files
|
||||
==========================================
|
||||
We use space-only indentation in nearly all files.
|
||||
If you use Emacs and your coreutils working directory name matches,
|
||||
this code enables the right mode:
|
||||
|
||||
;; In coreutils, indent with spaces everywhere (not TABs).
|
||||
;; Exceptions: Makefile and ChangeLog modes.
|
||||
(add-hook 'find-file-hook '(lambda ()
|
||||
(if (and buffer-file-name
|
||||
(string-match "/coreutils\\>" (buffer-file-name))
|
||||
(not (string-equal mode-name "Change Log"))
|
||||
(not (string-equal mode-name "Makefile")))
|
||||
(setq indent-tabs-mode nil))))
|
||||
|
||||
[*] Makefile and ChangeLog files are exempt, of course.
|
||||
|
||||
[FIXME: suggest vim syntax to do same thing, if it can be done safely.
|
||||
Most distros now "set nomodeline" by default for a good reason. ]
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
|
||||
Do not change TABs to spaces or vice versa in any existing file.
|
||||
|
||||
|
||||
Send patches to the address listed in --help output
|
||||
===================================================
|
||||
@@ -261,6 +275,9 @@ When writing prose (documentation, comments, log entries), use an
|
||||
active voice, not a passive one. I.e., say "print the frobnozzle",
|
||||
not "the frobnozzle will be printed".
|
||||
|
||||
Please add comments per the GNU Coding Standard:
|
||||
http://www.gnu.org/prep/standards/html_node/Comments.html
|
||||
|
||||
|
||||
Minor syntactic preferences
|
||||
===========================
|
||||
@@ -404,10 +421,16 @@ See the manpage for git-apply for details.
|
||||
Miscellaneous useful git commands
|
||||
=================================
|
||||
|
||||
* gitk: give a graphical view of the revision graph
|
||||
* gitk: give a graphical view of the revision graph of the current branch
|
||||
* gitk --all: same, but display all branches
|
||||
* git log: to get most of the same info in text form
|
||||
* git log -p: same as above, but with diffs
|
||||
* git log -p SOME_FILE: same as above, but limit to SOME_FILE
|
||||
* git log -p -2 SOME_FILE: same as above, but print only two deltas
|
||||
* git log -p -1: print the most recently committed change set
|
||||
* git format-patch --stdout -1 > FILE: output the most recently committed
|
||||
change set, in a format suitable to be submitted and/or applied via
|
||||
"git am FILE".
|
||||
* git reset --soft HEAD^: Commit the delta required to restore
|
||||
state to the revision just before HEAD (i.e., next-to-last).
|
||||
* git rebase -i master: run this from on a branch, and it gives
|
||||
@@ -419,8 +442,8 @@ Miscellaneous useful git commands
|
||||
its SHA1 and then tag it or cherry-pick it onto an existing branch.
|
||||
For example, run this:
|
||||
git fsck --lost-found HEAD && cd .git/lost-found/commit \
|
||||
&& for i in *; do git show $i|grep SOME_IDENTIFYING_STRING \
|
||||
&& echo $i; done
|
||||
&& for i in *; do git show $i|grep SOME_IDENTIFYING_STRING \
|
||||
&& echo $i; done
|
||||
The "git fsck ..." command creates the .git/lost-found/... hierarchy
|
||||
listing all unreachable objects. Then the for loop
|
||||
print SHA1s for commits that match via log or patch.
|
||||
|
||||
20
Makefile.am
20
Makefile.am
@@ -25,6 +25,7 @@ changelog_etc = \
|
||||
ChangeLog-2007 \
|
||||
ChangeLog-2008 \
|
||||
build-aux/ChangeLog-2007 \
|
||||
build-aux/update-copyright \
|
||||
doc/ChangeLog-2007 \
|
||||
lib/ChangeLog-2007 \
|
||||
m4/ChangeLog-2007 \
|
||||
@@ -40,16 +41,22 @@ changelog_etc = \
|
||||
|
||||
syntax_check_exceptions = \
|
||||
.x-sc_GPL_version \
|
||||
.x-sc_error_message_uppercase \
|
||||
.x-sc_file_system \
|
||||
.x-sc_obsolete_symbols \
|
||||
.x-sc_po_check \
|
||||
.x-sc_program_name \
|
||||
.x-sc_prohibit_atoi_atof \
|
||||
.x-sc_prohibit_fail_0 \
|
||||
.x-sc_prohibit_magic_number_exit \
|
||||
.x-sc_prohibit_stat_st_blocks \
|
||||
.x-sc_prohibit_strcmp \
|
||||
.x-sc_prohibit_tab_based_indentation \
|
||||
.x-sc_require_config_h \
|
||||
.x-sc_require_config_h_first \
|
||||
.x-sc_space_tab \
|
||||
.x-sc_sun_os_names \
|
||||
.x-sc_system_h_headers \
|
||||
.x-sc_trailing_blank \
|
||||
.x-sc_unmarked_diagnostics \
|
||||
.x-sc_useless_cpp_parens
|
||||
@@ -93,20 +100,20 @@ rm_subst = \
|
||||
|
||||
BUILT_SOURCES = .version
|
||||
.version:
|
||||
echo $(VERSION) > $@-t && mv $@-t $@
|
||||
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
|
||||
|
||||
# Arrange so that .tarball-version appears only in the distribution
|
||||
# tarball, and never in a checked-out repository.
|
||||
# The perl substitution is to change some key uses of "rm" to "/bin/rm".
|
||||
# See the rm_subst comment for details.
|
||||
dist-hook: gen-ChangeLog
|
||||
echo $(VERSION) > $(distdir)/.tarball-version
|
||||
perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
|
||||
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
|
||||
$(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
|
||||
|
||||
gen_start_date = 2008-02-08
|
||||
.PHONY: gen-ChangeLog
|
||||
gen-ChangeLog:
|
||||
if test -d .git; then \
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||
--since=$(gen_start_date) > $(distdir)/cl-t; \
|
||||
rm -f $(distdir)/ChangeLog; \
|
||||
@@ -116,11 +123,12 @@ gen-ChangeLog:
|
||||
ALL_RECURSIVE_TARGETS += distcheck-hook
|
||||
distcheck-hook: check-ls-dircolors
|
||||
$(MAKE) my-distcheck
|
||||
$(MAKE) taint-distcheck
|
||||
|
||||
DISTCLEANFILES = VERSION
|
||||
MAINTAINERCLEANFILES = THANKS-to-translators
|
||||
THANKS-to-translators: po/LINGUAS THANKStt.in
|
||||
( \
|
||||
$(AM_V_GEN)( \
|
||||
cat $(srcdir)/THANKStt.in; \
|
||||
for lang in `cat $(srcdir)/po/LINGUAS`; do \
|
||||
echo http://translationproject.org/team/$$lang.html; \
|
||||
@@ -131,7 +139,7 @@ THANKS-to-translators: po/LINGUAS THANKStt.in
|
||||
# remain in sync.
|
||||
.PHONY: check-ls-dircolors
|
||||
check-ls-dircolors:
|
||||
dc=$$(sed -n '/static.*ls_codes\[/,/};'/p \
|
||||
$(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p \
|
||||
$(srcdir)/src/dircolors.c \
|
||||
|sed -n '/^ *"/p'|tr , '\n'|sed 's/^ *//' \
|
||||
|sed -n 's/^"\(..\)"/\1/p'|sort -u); \
|
||||
|
||||
300
NEWS
300
NEWS
@@ -1,5 +1,305 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 8.1 (2009-11-18) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
chcon no longer exits immediately just because SELinux is disabled.
|
||||
Even then, chcon may still be useful.
|
||||
[bug introduced in coreutils-8.0]
|
||||
|
||||
chcon, chgrp, chmod, chown and du now diagnose an ostensible directory cycle
|
||||
and arrange to exit nonzero. Before, they would silently ignore the
|
||||
offending directory and all "contents."
|
||||
|
||||
env -u A=B now fails, rather than silently adding A to the
|
||||
environment. Likewise, printenv A=B silently ignores the invalid
|
||||
name. [the bugs date back to the initial implementation]
|
||||
|
||||
ls --color now handles files with capabilities correctly. Previously
|
||||
files with capabilities were often not colored, and also sometimes, files
|
||||
without capabilites were colored in error. [bug introduced in coreutils-7.0]
|
||||
|
||||
md5sum now prints checksums atomically so that concurrent
|
||||
processes will not intersperse their output.
|
||||
This also affected sum, sha1sum, sha224sum, sha384sum and sha512sum.
|
||||
[the bug dates back to the initial implementation]
|
||||
|
||||
mktemp no longer leaves a temporary file behind if it was unable to
|
||||
output the name of the file to stdout.
|
||||
[the bug dates back to the initial implementation]
|
||||
|
||||
nice -n -1 PROGRAM now runs PROGRAM even when its internal setpriority
|
||||
call fails with errno == EACCES.
|
||||
[the bug dates back to the initial implementation]
|
||||
|
||||
nice, nohup, and su now refuse to execute the subsidiary program if
|
||||
they detect write failure in printing an otherwise non-fatal warning
|
||||
message to stderr.
|
||||
|
||||
stat -f recognizes more file system types: afs, cifs, anon-inode FS,
|
||||
btrfs, cgroupfs, cramfs-wend, debugfs, futexfs, hfs, inotifyfs, minux3,
|
||||
nilfs, securityfs, selinux, xenfs
|
||||
|
||||
tail -f (inotify-enabled) now avoids a race condition.
|
||||
Before, any data appended in the tiny interval between the initial
|
||||
read-to-EOF and the inotify watch initialization would be ignored
|
||||
initially (until more data was appended), or forever, if the file
|
||||
were first renamed or unlinked or never modified.
|
||||
[The race was introduced in coreutils-7.5]
|
||||
|
||||
tail -F (inotify-enabled) now consistently tails a file that has been
|
||||
replaced via renaming. That operation provokes either of two sequences
|
||||
of inotify events. The less common sequence is now handled as well.
|
||||
[The bug came with the implementation change in coreutils-7.5]
|
||||
|
||||
timeout now doesn't exit unless the command it is monitoring does,
|
||||
for any specified signal. [bug introduced in coreutils-7.0].
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
chroot, env, nice, and su fail with status 125, rather than 1, on
|
||||
internal error such as failure to parse command line arguments; this
|
||||
is for consistency with stdbuf and timeout, and avoids ambiguity
|
||||
with the invoked command failing with status 1. Likewise, nohup
|
||||
fails with status 125 instead of 127.
|
||||
|
||||
du (due to a change in gnulib's fts) can now traverse NFSv4 automounted
|
||||
directories in which the stat'd device number of the mount point differs
|
||||
during a traversal. Before, it would fail, because such a mismatch would
|
||||
usually represent a serious error or a subversion attempt.
|
||||
|
||||
echo and printf now interpret \e as the Escape character (0x1B).
|
||||
|
||||
rm -f /read-only-fs/nonexistent now succeeds and prints no diagnostic
|
||||
on systems with an unlinkat syscall that sets errno to EROFS in that case.
|
||||
Before, it would fail with a "Read-only file system" diagnostic.
|
||||
Also, "rm /read-only-fs/nonexistent" now reports "file not found" rather
|
||||
than the less precise "Read-only file system" error.
|
||||
|
||||
** New programs
|
||||
|
||||
nproc: Print the number of processing units available to a process.
|
||||
|
||||
** New features
|
||||
|
||||
env and printenv now accept the option --null (-0), as a means to
|
||||
avoid ambiguity with newlines embedded in the environment.
|
||||
|
||||
md5sum --check now also accepts openssl-style checksums.
|
||||
So do sha1sum, sha224sum, sha384sum and sha512sum.
|
||||
|
||||
mktemp now accepts the option --suffix to provide a known suffix
|
||||
after the substitution in the template. Additionally, uses such as
|
||||
"mktemp fileXXXXXX.txt" are able to infer an appropriate --suffix.
|
||||
|
||||
touch now accepts the option --no-dereference (-h), as a means to
|
||||
change symlink timestamps on platforms with enough support.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.0 (2009-10-06) [beta]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp --preserve=xattr and --archive now preserve extended attributes even
|
||||
when the source file doesn't have write access.
|
||||
[bug introduced in coreutils-7.1]
|
||||
|
||||
touch -t [[CC]YY]MMDDhhmm[.ss] now accepts a timestamp string ending in .60,
|
||||
to accommodate leap seconds.
|
||||
[the bug dates back to the initial implementation]
|
||||
|
||||
ls --color now reverts to the color of a base file type consistently
|
||||
when the color of a more specific type is disabled.
|
||||
[bug introduced in coreutils-5.90]
|
||||
|
||||
ls -LR exits with status 2, not 0, when it encounters a cycle
|
||||
|
||||
ls -is is now consistent with ls -lis in ignoring values returned
|
||||
from a failed stat/lstat. For example ls -Lis now prints "?", not "0",
|
||||
for the inode number and allocated size of a dereferenced dangling symlink.
|
||||
|
||||
tail --follow --pid now avoids a race condition where data written
|
||||
just before the process dies might not have been output by tail.
|
||||
Also, tail no longer delays at all when the specified pid is not live.
|
||||
[The race was introduced in coreutils-7.5,
|
||||
and the unnecessary delay was present since textutils-1.22o]
|
||||
|
||||
** Portability
|
||||
|
||||
On Solaris 9, many commands would mistakenly treat file/ the same as
|
||||
file. Now, even on such a system, path resolution obeys the POSIX
|
||||
rules that a trailing slash ensures that the preceeding name is a
|
||||
directory or a symlink to a directory.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
id no longer prints SELinux " context=..." when the POSIXLY_CORRECT
|
||||
environment variable is set.
|
||||
|
||||
readlink -f now ignores a trailing slash when deciding if the
|
||||
last component (possibly via a dangling symlink) can be created,
|
||||
since mkdir will succeed in that case.
|
||||
|
||||
** New features
|
||||
|
||||
ln now accepts the options --logical (-L) and --physical (-P),
|
||||
added by POSIX 2008. The default behavior is -P on systems like
|
||||
GNU/Linux where link(2) creates hard links to symlinks, and -L on
|
||||
BSD systems where link(2) follows symlinks.
|
||||
|
||||
stat: without -f, a command-line argument of "-" now means standard input.
|
||||
With --file-system (-f), an argument of "-" is now rejected.
|
||||
If you really must operate on a file named "-", specify it as
|
||||
"./-" or use "--" to separate options from arguments.
|
||||
|
||||
** Improvements
|
||||
|
||||
rm: rewrite to use gnulib's fts
|
||||
This makes rm -rf significantly faster (400-500%) in some pathological
|
||||
cases, and slightly slower (20%) in at least one pathological case.
|
||||
|
||||
rm -r deletes deep hierarchies more efficiently. Before, execution time
|
||||
was quadratic in the depth of the hierarchy, now it is merely linear.
|
||||
However, this improvement is not as pronounced as might be expected for
|
||||
very deep trees, because prior to this change, for any relative name
|
||||
length longer than 8KiB, rm -r would sacrifice official conformance to
|
||||
avoid the disproportionate quadratic performance penalty. Leading to
|
||||
another improvement:
|
||||
|
||||
rm -r is now slightly more standards-conformant when operating on
|
||||
write-protected files with relative names longer than 8KiB.
|
||||
|
||||
|
||||
* Noteworthy changes in release 7.6 (2009-09-11) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp, mv now ignore failure to preserve a symlink time stamp, when it is
|
||||
due to their running on a kernel older than what was implied by headers
|
||||
and libraries tested at configure time.
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
cp --reflink --preserve now preserves attributes when cloning a file.
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
cp --preserve=xattr no longer leaks resources on each preservation failure.
|
||||
[bug introduced in coreutils-7.1]
|
||||
|
||||
dd now exits with non-zero status when it encounters a write error while
|
||||
printing a summary to stderr.
|
||||
[bug introduced in coreutils-6.11]
|
||||
|
||||
dd cbs=N conv=unblock would fail to print a final newline when the size
|
||||
of the input was not a multiple of N bytes.
|
||||
[the non-conforming behavior dates back to the initial implementation]
|
||||
|
||||
df no longer requires that each command-line argument be readable
|
||||
[bug introduced in coreutils-7.3]
|
||||
|
||||
ls -i now prints consistent inode numbers also for mount points.
|
||||
This makes ls -i DIR less efficient on systems with dysfunctional readdir,
|
||||
because ls must stat every file in order to obtain a guaranteed-valid
|
||||
inode number. [bug introduced in coreutils-6.0]
|
||||
|
||||
tail -f (inotify-enabled) now flushes any initial output before blocking.
|
||||
Before, this would print nothing and wait: stdbuf -o 4K tail -f /etc/passwd
|
||||
Note that this bug affects tail -f only when its standard output is buffered,
|
||||
which is relatively unusual.
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
tail -f once again works with standard input. inotify-enabled tail -f
|
||||
would fail when operating on a nameless stdin. I.e., tail -f < /etc/passwd
|
||||
would say "tail: cannot watch `-': No such file or directory", yet the
|
||||
relatively baroque tail -f /dev/stdin < /etc/passwd would work. Now, the
|
||||
offending usage causes tail to revert to its conventional sleep-based
|
||||
(i.e., not inotify-based) implementation.
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
** Portability
|
||||
|
||||
ln, link: link f z/ would mistakenly succeed on Solaris 10, given an
|
||||
existing file, f, and nothing named "z". ln -T f z/ has the same problem.
|
||||
Each would mistakenly create "z" as a link to "f". Now, even on such a
|
||||
system, each command reports the error, e.g.,
|
||||
link: cannot create link `z/' to `f': Not a directory
|
||||
|
||||
** New features
|
||||
|
||||
cp --reflink accepts a new "auto" parameter which falls back to
|
||||
a standard copy if creating a copy-on-write clone is not possible.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
tail -f now ignores "-" when stdin is a pipe or FIFO.
|
||||
tail-with-no-args now ignores -f unconditionally when stdin is a pipe or FIFO.
|
||||
Before, it would ignore -f only when no file argument was specified,
|
||||
and then only when POSIXLY_CORRECT was set. Now, :|tail -f - terminates
|
||||
immediately. Before, it would block indefinitely.
|
||||
|
||||
|
||||
* Noteworthy changes in release 7.5 (2009-08-20) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
dd's oflag=direct option now works even when the size of the input
|
||||
is not a multiple of e.g., 512 bytes.
|
||||
|
||||
dd now handles signals consistently even when they're received
|
||||
before data copying has started.
|
||||
|
||||
install runs faster again with SELinux enabled
|
||||
[introduced in coreutils-7.0]
|
||||
|
||||
ls -1U (with two or more arguments, at least one a nonempty directory)
|
||||
would print entry names *before* the name of the containing directory.
|
||||
Also fixed incorrect output of ls -1RU and ls -1sU.
|
||||
[introduced in coreutils-7.0]
|
||||
|
||||
sort now correctly ignores fields whose ending position is specified
|
||||
before the start position. Previously in numeric mode the remaining
|
||||
part of the line after the start position was used as the sort key.
|
||||
[This bug appears to have been present in "the beginning".]
|
||||
|
||||
truncate -s failed to skip all whitespace in the option argument in
|
||||
some locales.
|
||||
|
||||
** New programs
|
||||
|
||||
stdbuf: A new program to run a command with modified stdio buffering
|
||||
for its standard streams.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
ls --color: files with multiple hard links are no longer colored differently
|
||||
by default. That can be enabled by changing the LS_COLORS environment
|
||||
variable. You can control that using the MULTIHARDLINK dircolors input
|
||||
variable which corresponds to the 'mh' LS_COLORS item. Note these variables
|
||||
were renamed from 'HARDLINK' and 'hl' which were available since
|
||||
coreutils-7.1 when this feature was introduced.
|
||||
|
||||
** Deprecated options
|
||||
|
||||
nl --page-increment: deprecated in favor of --line-increment, the new option
|
||||
maintains the previous semantics and the same short option, -i.
|
||||
|
||||
** New features
|
||||
|
||||
chroot now accepts the options --userspec and --groups.
|
||||
|
||||
cp accepts a new option, --reflink: create a lightweight copy
|
||||
using copy-on-write (COW). This is currently only supported within
|
||||
a btrfs file system.
|
||||
|
||||
cp now preserves time stamps on symbolic links, when possible
|
||||
|
||||
sort accepts a new option, --human-numeric-sort (-h): sort numbers
|
||||
while honoring human readable suffixes like KiB and MB etc.
|
||||
|
||||
tail --follow now uses inotify when possible, to be more responsive
|
||||
to file changes and more efficient when monitoring many files.
|
||||
|
||||
|
||||
* Noteworthy changes in release 7.4 (2009-05-07) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
8
README
8
README
@@ -11,11 +11,11 @@ The programs that can be built with this package are:
|
||||
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
|
||||
od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
|
||||
nproc od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
|
||||
runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
|
||||
sleep sort split stat stty su sum sync tac tail tee test timeout touch tr
|
||||
true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who
|
||||
whoami yes
|
||||
sleep sort split stat stdbuf stty su 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.
|
||||
|
||||
|
||||
@@ -2,42 +2,24 @@
|
||||
|
||||
These notes intend to help people working on the checked-out sources.
|
||||
These requirements do not apply when building from a distribution tarball.
|
||||
See also HACKING for more detailed coreutils contribution guidlines.
|
||||
See also HACKING for more detailed coreutils contribution guidelines.
|
||||
|
||||
* Requirements
|
||||
|
||||
We've opted to keep only the highest-level sources in the GIT repository.
|
||||
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||
requirements on anyone wishing to build from the just-checked-out sources.
|
||||
Specific tools and versions will be checked for and listed by the
|
||||
bootstrap script shown below, and will include:
|
||||
|
||||
- Automake <http://www.gnu.org/software/automake/>
|
||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||
- Bison <http://www.gnu.org/software/bison/>
|
||||
- Gettext <http://www.gnu.org/software/gettext/>
|
||||
- Git <http://git.or.cz/>
|
||||
- Gperf <http://www.gnu.org/software/gperf/>
|
||||
- Gzip <http://www.gnu.org/software/gzip/>
|
||||
- Perl <http://www.cpan.org/>
|
||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||
- Tar <http://www.gnu.org/software/tar/>
|
||||
|
||||
Only building the initial full source tree will be a bit painful.
|
||||
Later, a plain `git pull && make' should be sufficient.
|
||||
|
||||
- Valgrind
|
||||
Note the requirements to build the released archive are much less and
|
||||
are just the requirements of the standard ./configure && make procedure.
|
||||
Specific development tools and versions will be checked for and listed by
|
||||
the bootstrap script. See README-prereq for specific notes on obtaining
|
||||
these prerequisite tools.
|
||||
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture. See also README-valgrind.
|
||||
|
||||
- XZ utils (successor to LZMA)
|
||||
|
||||
This package's build procedure uses XZ to create a compressed
|
||||
distribution tarball. Using this feature of Automake requires
|
||||
version 1.10a or newer, as well as the xz program itself.
|
||||
Make sure you have the latest version of the XZ Utils from
|
||||
<http://tukaani.org/lzma/download>.
|
||||
While building from a just-cloned source tree may require installing a
|
||||
few prerequisites, later, a plain `git pull && make' should be sufficient.
|
||||
|
||||
* First GIT checkout
|
||||
|
||||
@@ -53,7 +35,7 @@ which are extracted from other source packages:
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure #[--enable-gcc-warnings]
|
||||
$ ./configure --quiet #[--enable-gcc-warnings] [*]
|
||||
$ make
|
||||
$ make check
|
||||
|
||||
@@ -66,6 +48,12 @@ should output no difference.
|
||||
|
||||
Enjoy!
|
||||
|
||||
[*] The --enable-gcc-warnings option is useful only with glibc
|
||||
and with a very recent version of gcc. You'll probably also have
|
||||
to use recent system headers. If you configure with this option,
|
||||
and spot a problem, please be sure to send the report to the bug
|
||||
reporting address of this package, and not to that of gnulib, even
|
||||
if the problem seems to originate in a gnulib-provided file.
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
@@ -82,7 +70,3 @@ 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/>.
|
||||
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
End:
|
||||
|
||||
@@ -1,35 +1,56 @@
|
||||
Detailed below are concrete examples for
|
||||
getting the prerequisites for particular systems.
|
||||
This gives some notes on obtaining the tools required for development.
|
||||
I.E. the tools checked for by the bootstrap script and include:
|
||||
|
||||
- GNU/Linux - fedora
|
||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||
- Automake <http://www.gnu.org/software/automake/>
|
||||
- Bison <http://www.gnu.org/software/bison/>
|
||||
- Gettext <http://www.gnu.org/software/gettext/>
|
||||
- Git <http://git.or.cz/>
|
||||
- Gperf <http://www.gnu.org/software/gperf/>
|
||||
- Gzip <http://www.gnu.org/software/gzip/>
|
||||
- Perl <http://www.cpan.org/>
|
||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||
- Tar <http://www.gnu.org/software/tar/>
|
||||
- Texinfo <http://www.gnu.org/software/texinfo/>
|
||||
|
||||
This shows the steps for getting the required tools to build coreutils 7.0
|
||||
on a Fedora 8 system. We try to use official packages where possible.
|
||||
The 3 methods described for making these required packages available, should
|
||||
help clarify build requirements on any GNU/Linux system at least.
|
||||
Note please try to install/build official packages for your system.
|
||||
If these are not available then one can make them available only to
|
||||
the coreutils build using the following instructions. Even if the
|
||||
official packages for your system are too old, please install them
|
||||
as they may be required to build the newer versions.
|
||||
|
||||
1. Make sure offical distro git package is installed
|
||||
# yum install git
|
||||
* autoconf *
|
||||
|
||||
2. The distro autoconf is too old, but there is a newer one available
|
||||
so we rebuild that and make it available to the full system:
|
||||
# yum install emacs #autoconf build requires emacs (20MB)
|
||||
# rpmbuild --rebuild http://download.fedora.redhat.com/pub/fedora/linux/development/source/SRPMS/autoconf-2.63-1.fc10.src.rpm
|
||||
# rpm -Uvh /usr/src/redhat/RPMS/noarch/autoconf-2.63-1.fc8.noarch.rpm
|
||||
Note Autoconf 2.61a-341 or newer is needed to build automake-1.10b in step 3.
|
||||
Apply the same method to install the lzma package.
|
||||
[FIXME: mention xz when it's packaged]
|
||||
# Note Autoconf 2.62 or newer is needed to build automake-1.11
|
||||
git clone --depth=1 git://git.sv.gnu.org/autoconf.git
|
||||
git checkout v2.62
|
||||
autoreconf -vi
|
||||
./configure --prefix=$HOME/coreutils/deps
|
||||
make install
|
||||
|
||||
3. The latest stable automake (1.10.1) was not new enough, so we download
|
||||
and build automake-1.10b or newer from its repository and make it available
|
||||
just to coreutils:
|
||||
# yum install help2man #required to build automake fully
|
||||
$ git clone git://git.sv.gnu.org/automake.git
|
||||
$ cd automake
|
||||
$ git checkout -b next --track origin/next
|
||||
$ ./bootstrap
|
||||
$ ./configure --prefix=$HOME/coreutils/deps
|
||||
$ make install
|
||||
* automake *
|
||||
|
||||
Now we can build coreutils as described in README-hacking
|
||||
as long as $PATH starts with $HOME/coreutils/deps
|
||||
# Note help2man is required to build automake fully
|
||||
git clone git://git.sv.gnu.org/automake.git
|
||||
cd automake
|
||||
git checkout -b branch-1.11 --track origin/branch-1.11
|
||||
./bootstrap
|
||||
./configure --prefix=$HOME/coreutils/deps
|
||||
make install
|
||||
|
||||
coreutils uses XZ utils (successor to LZMA) to create
|
||||
a compressed distribution tarball. Using this feature of Automake
|
||||
requires version 1.10a or newer, as well as the xz program itself.
|
||||
|
||||
* xz *
|
||||
|
||||
git clone git://ctrl.tukaani.org/xz.git
|
||||
cd xz
|
||||
./autogen.sh
|
||||
./configure --prefix=$HOME/coreutils/deps
|
||||
make install
|
||||
|
||||
Now we can build coreutils as described in README-hacking
|
||||
as long as $PATH starts with $HOME/coreutils/deps/bin, which
|
||||
one can set for the current shell like:
|
||||
$ export PATH=$HOME/coreutils/deps/bin:$PATH
|
||||
|
||||
@@ -7,19 +7,18 @@ Here are most of the steps we (maintainers) follow when making a release.
|
||||
* Run ./configure && make maintainer-clean
|
||||
|
||||
* Ensure that the desired versions of autoconf, automake, bison, etc.
|
||||
are in your PATH. See HACKING for the complete list.
|
||||
are in your PATH. See the buildreq list in bootstrap.conf for
|
||||
the complete list.
|
||||
|
||||
* Ensure that you're on "master" with no uncommitted diffs.
|
||||
This should produce no output: git checkout master; git diff
|
||||
|
||||
* Make sure your local gnulib directory is up to date.
|
||||
|
||||
* Run bootstrap, (assuming your local copy of gnulib is in /gnulib):
|
||||
./bootstrap --gnulib-srcdir=/gnulib
|
||||
* Run bootstrap: ./bootstrap
|
||||
|
||||
FIXME: enable excluded programs like arch? to get their manual pages?
|
||||
|
||||
* Pre-release testing:
|
||||
Ensure that make check syntax-check succeeds.
|
||||
On at least one SELinux-enabled (enforcing) and one non-SELinux system,
|
||||
run all tests, both root-only and regular.
|
||||
Run *all* non-root tests, including expensive and very expensive ones i.e.,
|
||||
@@ -30,17 +29,17 @@ FIXME: enable excluded programs like arch? to get their manual pages?
|
||||
|
||||
* Run "make distcheck"
|
||||
|
||||
* Manually set the date, version number, and [stable/alpha/beta] on
|
||||
line 3 of NEWS, then do e.g.,:
|
||||
* Set the date, version number, and release type [stable/alpha/beta] on
|
||||
line 3 of NEWS, commit that, and tag the release by running e.g.,
|
||||
|
||||
v=7.3
|
||||
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
|
||||
git tag -s -m "coreutils $v" v$v HEAD
|
||||
build-aux/do-release-commit-and-tag 8.1 beta
|
||||
|
||||
* Run the following to create release tarballs. Your choice selects the
|
||||
corresponding upload-to destination in the emitted gnupload command.
|
||||
The different destinations are specified in cfg.mk. See the definitions
|
||||
of gnu_ftp_host-{alpha,beta,stable}.
|
||||
|
||||
# "TYPE" must be major, beta or alpha
|
||||
# "TYPE" must be stable, beta or alpha
|
||||
make TYPE
|
||||
|
||||
* Test the tarball. copy it to a few odd-ball systems and ensure that
|
||||
@@ -51,19 +50,22 @@ FIXME: enable excluded programs like arch? to get their manual pages?
|
||||
|
||||
Once all the builds and tests have passed,
|
||||
|
||||
* Run the gnupload command suggested by your "XZ_OPT=-9e make major" run above.
|
||||
* Run the gnupload command that was suggested by your "make major" run above.
|
||||
|
||||
* Wait a few minutes (maybe up to 30?) and then use the release URLs to
|
||||
download all tarball/signature pairs and use gpg --verify to ensure
|
||||
that they're all valid.
|
||||
|
||||
* Push the new tag:
|
||||
git push origin tag v<JUST_RELEASED_VERSION_NUMBER>
|
||||
|
||||
v=$(cat .prev-version)
|
||||
git push origin tag v$v
|
||||
|
||||
* Send the gpg-signed announcement mail, e.g.,
|
||||
|
||||
To: info-gnu@gnu.org, coreutils-announce@gnu.org
|
||||
Cc: coordinator@translationproject.org, bug-coreutils@gnu.org
|
||||
Subject: coreutils-7.1 released [stable]
|
||||
Subject: coreutils-8.0 released [beta]
|
||||
|
||||
* Approve the announcement here:
|
||||
http://lists.gnu.org/mailman/admindb/coreutils-announce
|
||||
@@ -72,25 +74,21 @@ Once all the builds and tests have passed,
|
||||
From here:
|
||||
https://savannah.gnu.org/projects/coreutils/
|
||||
click on the "submit news", then write something like the following:
|
||||
(If there is no such button, then enable "News" for the project via
|
||||
the Main -> "Select Features" menu item, or via this link:
|
||||
https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=coreutils)
|
||||
|
||||
Subject: coreutils-7.2 released [stable]
|
||||
Subject: coreutils-0.0 released [beta]
|
||||
The announcement is here:
|
||||
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/49
|
||||
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/54
|
||||
|
||||
Then go here to approve it:
|
||||
https://savannah.gnu.org/news/approve.php?group=coreutils
|
||||
|
||||
* For non-alpha releases, update the on-line manual at
|
||||
* After each non-alpha release, update the on-line manual accessible via
|
||||
|
||||
http://www.gnu.org/software/coreutils/manual/
|
||||
|
||||
Run `make web-manual', then copy the contents of doc/manual
|
||||
into a CVS checkout of the coreutils manual repository.
|
||||
Also edit coreutils.html (FIXME? why?) before doing a CVS commit.
|
||||
by running this:
|
||||
|
||||
CVS_RSH=ssh \
|
||||
cvs -d:ext:$USER@cvs.savannah.gnu.org:/web/coreutils co coreutils
|
||||
|
||||
Be sure to "cvs add -ko" any files that "cvs status" marks with "?".
|
||||
That is necessary whenever a new texinfo node is added. Each becomes
|
||||
a new file in html_node that must then be "cvs add"ed.
|
||||
build-aux/gnu-web-doc-update
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /bin/bash
|
||||
# Convert this package for use with valgrind.
|
||||
|
||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2006, 2009 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
|
||||
|
||||
26
THANKS
26
THANKS
@@ -52,6 +52,7 @@ Andy Longton alongton@metamark.com
|
||||
Anthony Thyssen anthony@griffith.edu.au
|
||||
Antonio Rendas ajrendas@yahoo.com
|
||||
Ariel Faigon ariel@cthulhu.engr.sgi.com
|
||||
Arjan Opmeer arjan.opmeer@gmail.com
|
||||
Arne H. Juul arnej@solan.unit.no
|
||||
Arne Henrik Juul arnej@imf.unit.no
|
||||
Arnold Robbins arnold@skeeve.com
|
||||
@@ -66,8 +67,9 @@ Barry Kelly http://barrkel.blogspot.com/
|
||||
Bauke Jan Douma bjdouma@xs4all.nl
|
||||
Ben Elliston bje@air.net.au
|
||||
Ben Harris bjh21@netbsd.org
|
||||
Benjamin Cutler cutlerbc@simla.colostate.edu
|
||||
Bengt Martensson bengt@mathematik.uni-Bremen.de
|
||||
Benjamin Cutler cutlerbc@simla.colostate.edu
|
||||
Benno Schulenberg bensberg@justemail.net
|
||||
Bernard Giroud bernard.giroud@creditlyonnais.ch
|
||||
Bernd Eckenfels ecki@debian.org
|
||||
Bernd Leibing bernd.leibing@rz.uni-ulm.de
|
||||
@@ -75,8 +77,10 @@ Bernd Melchers melchers@cis.fu-berlin.de
|
||||
Bernhard Baehr bernhard.baehr@gmx.de
|
||||
Bernhard Gabler bernhard@uni-koblenz.de
|
||||
Bernhard Rosenkraenzer bero@redhat.de
|
||||
Bernhard Voelker bernhard.voelker@siemens-enterprise.com
|
||||
Bert Deknuydt Bert.Deknuydt@esat.kuleuven.ac.be
|
||||
Bert Wesarg bert.wesarg@googlemail.com
|
||||
Bill Brelsford wb@k2di.net
|
||||
Bill Peters peters@gaffel.as.arizona.edu
|
||||
Bjorn Helgaas helgaas@rsn.hp.com
|
||||
Bob McCracken kerouac@ravenet.com
|
||||
@@ -112,6 +116,7 @@ Christophe LYON christophe.lyon@st.com
|
||||
Chuck Hedrick hedrick@klinzhai.rutgers.edu
|
||||
Clark Morgan cmorgan@aracnet.com
|
||||
Clement Wang clem.wang@overture.com
|
||||
Cliff Miller cbm@whatexit.org
|
||||
Colin Plumb colin@nyx.net
|
||||
Colin Watson cjw44@riva.ucam.org
|
||||
Collin Rogowski collin@rogowski.de
|
||||
@@ -183,6 +188,7 @@ Felix Rauch Valenti frauch@cse.unsw.edu.au
|
||||
Ferdinand fw@scenic.mine.nu
|
||||
Fletcher Mattox fletcher@cs.utexas.edu
|
||||
Florent Bayle florent@sarcelle.net
|
||||
Florian Schlichting fschlich@cis.fu-berlin.de
|
||||
Florin Iucha fiucha@hsys.mic.ro
|
||||
Francesco Montorsi fr_m@hotmail.com
|
||||
François Pinard pinard@iro.umontreal.ca
|
||||
@@ -205,6 +211,7 @@ Geoff Whale geoffw@cse.unsw.EDU.AU
|
||||
Gerald Pfeifer gerald@pfeifer.com
|
||||
Gerhard Poul gpoul@gnu.org
|
||||
Germano Leichsenring germano@jedi.cs.kobe-u.ac.jp
|
||||
Gilles Espinasse g.esp@free.fr
|
||||
Glen Lenker glen.lenker@gmail.com
|
||||
Göran Uddeborg goeran@uddeborg.se
|
||||
Guochun Shi gshi@ncsa.uiuc.edu
|
||||
@@ -241,12 +248,14 @@ Ian Turner vectro@pipeline.com
|
||||
Iida Yosiaki iida@gnu.org
|
||||
Ilya N. Golubev gin@mo.msk.ru
|
||||
Ingo Saitz ingo@debian.org
|
||||
Ivan Labath labath3@st.fmph.uniba.sk
|
||||
Ivo Timmermans ivo@debian.org
|
||||
James james@albion.glarp.com
|
||||
James Antill jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
James Lemley James.Lemley@acxiom.com
|
||||
James Hunt jamesodhunt@hotmail.com
|
||||
James Ralston ralston@pobox.com
|
||||
James R. Van Zandt jrvz@comcast.net
|
||||
James Sneeringer jvs@ocslink.com
|
||||
James Tanis jtt@soscorp.com
|
||||
James Youngman jay@gnu.org
|
||||
@@ -256,6 +265,7 @@ Jan Engelhardt jengelh@medozas.de
|
||||
Jan Fedak J.Fedak@sh.cvut.cz
|
||||
Jan Moringen jan.moringen@uni-bielefeld.de
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Jan-Pawel Wrozstinski jpwroz@gmail.com
|
||||
Janos Farkas chexum@shadow.banki.hu
|
||||
Jarkko Hietaniemi jhi@epsilon.hut.fi
|
||||
Jarod Wilson jwilson@redhat.com
|
||||
@@ -276,6 +286,7 @@ Jim Dennis jimd@starshine.org
|
||||
Joakim Rosqvist dvljrt@cs.umu.se
|
||||
Jochen Hein jochen@jochen.org
|
||||
Joe Orton joe@manyfish.co.uk
|
||||
Joel E. Denny jdenny@clemson.edu
|
||||
Joerg Sonnenberger joerg@britannica.bec.de
|
||||
Joey Hess joeyh@debian.org
|
||||
Johan Boule bohan@bohan.dyndns.org
|
||||
@@ -299,6 +310,7 @@ Joshua Hudson joshudson@gmail.com
|
||||
Josselin Mouette joss@debian.org
|
||||
Juan F. Codagnone juam@arnet.com.ar
|
||||
Juan M. Guerrero st001906@hrz1.hrz.tu-darmstadt.de
|
||||
Julian Bradfield jcb@inf.ed.ac.uk
|
||||
Jungshik Shin jshin@pantheon.yale.edu
|
||||
Jürgen Fluk louis@dachau.marco.de
|
||||
Jurriaan thunder7@xs4all.nl
|
||||
@@ -328,6 +340,7 @@ Leah Q eequor@earthlink.net
|
||||
Lehti Rami rammer@cs.tut.fi
|
||||
Leonard N. Zubkoff lnz@dandelion.com
|
||||
Leonardo Milano lmilano@udel.edu
|
||||
Lluís Batlle viriketo@gmail.com
|
||||
Lorne Baker lbaker@nitro.avint.net
|
||||
Luke Hassell lukehassell@yahoo.com
|
||||
Luke Kendall lukekendall@optushome.com.au
|
||||
@@ -359,6 +372,7 @@ Martin martin@dresden.nacamar.de
|
||||
Martin Buck martin.buck@ascom.ch
|
||||
Martin Gallant martyg@goodbit.net
|
||||
Martin Hippe martin.hippe@schlund.de
|
||||
Martin Jacobs martin.jacobs@arcor.de
|
||||
Martin Michlmayr tbm@cyrius.com
|
||||
Martin Mitchell martin@debian.org
|
||||
Martin P.J. Zinser zinser@decus.de
|
||||
@@ -366,6 +380,7 @@ Marty Leisner leisner@sdsp.mc.xerox.com
|
||||
Masami Takikawa takikawm@CS.ORST.EDU
|
||||
Mate Wierdl mw@moni.msci.memphis.edu
|
||||
Matej Vela mvela@public.srce.hr
|
||||
Matias A. Fonzo selk@dragora.org
|
||||
Matt Kraai kraai@ftbfs.org
|
||||
Matt Perry matt@primefactor.com
|
||||
Matt Pham mattvpham@gmail.com
|
||||
@@ -381,12 +396,13 @@ Matthew Swift swift@alum.mit.edu
|
||||
Matthew Woehlke mw_triad@users.sourceforge.net
|
||||
Matthias Urlichs smurf@noris.de
|
||||
Matti Aarnio matti.aarnio@zmailer.org
|
||||
Mathias Brodala info@noctus.net
|
||||
Mattias Wadenstein maswan@acc.umu.se
|
||||
Max Chang maxchang@ucla.edu
|
||||
Meelis Roos mroos@tartu.cyber.ee
|
||||
Michael michael@aplatform.com
|
||||
Michael ??? michael@roka.net
|
||||
Michael Bacarella mbac@netgraft.com>
|
||||
Michael Bacarella mbac@netgraft.com
|
||||
Michael Deutschmann michael@talamasca.ocis.net
|
||||
Michael Elizabeth Chastain mec.gnu@mindspring.com
|
||||
Michael Gaughen mgaughen@polyserve.com
|
||||
@@ -396,6 +412,7 @@ Michael J. Croghan mcroghan@usatoday.com
|
||||
Michael McFarland sidlon@yahoo.com
|
||||
Michael McLagan mmclagan@invlogic.com
|
||||
Michael Piefel piefel@informatik.hu-berlin.de
|
||||
Michael Speer knomenet@gmail.com
|
||||
Michael Steffens michael.steffens@s.netic.de
|
||||
Michael Stone mstone@debian.org
|
||||
Michael Stutz stutz@dsl.org
|
||||
@@ -434,6 +451,7 @@ Olatunji Oluwabukunmi Ruwase tjruwase@stanford.edu
|
||||
Olav Morkrid olav@funcom.com
|
||||
Ole Laursen olau@hardworking.dk
|
||||
Oliver Kiddle okiddle@yahoo.co.uk
|
||||
Olivier Fourdan ofourdan@redhat.com
|
||||
Ørn E. Hansen oehansen@daimi.aau.dk
|
||||
Oskar Liljeblad osk@hem.passagen.se
|
||||
Otavio Salvador otavio@ossystems.com.br
|
||||
@@ -481,6 +499,7 @@ Ralph Loader loader@maths.ox.ac.uk
|
||||
Raul Miller moth@magenta.com
|
||||
Raúl Núñez de Arenas Coronado raul@pleyades.net
|
||||
Reuben Thomas rrt@sc3d.org
|
||||
Yang Ren ryang@redhat.com
|
||||
Richard A Downing richard.downing@bcs.org.uk
|
||||
Richard Braakman dark@xs4all.nl
|
||||
Richard Dawe rich@phekda.freeserve.co.uk
|
||||
@@ -525,6 +544,7 @@ Stephen Smoogen smooge@mindspring.com
|
||||
Steve McConnel steve@acadcomp.sil.org
|
||||
Steve McIntyre steve@einval.com
|
||||
Steve Ward planet36@gmail.com
|
||||
Steven Drake sbd@users.sourceforge.net
|
||||
Steven G. Johnson stevenj@alum.mit.edu
|
||||
Steven Mocking ufo@quicknet.nl
|
||||
Steven Parkes smparkes@smparkes.net
|
||||
@@ -555,6 +575,7 @@ Tim Waugh twaugh@redhat
|
||||
Tobias Stoeckmann tobias@bugol.de
|
||||
Toby Peterson toby@opendarwin.org
|
||||
Todd A. Jacobs tjacobs@codegnome.org
|
||||
Tom Fitzhenry tom@tom-fitzhenry.me.uk
|
||||
Tom Haynes thomas@netapp.com
|
||||
Tom Quinn trq@dionysos.thphys.ox.ac.uk
|
||||
Tomas Pospisek tpo@sourcepole.ch
|
||||
@@ -597,6 +618,7 @@ Wis Macomson wis.macomson@intel.com
|
||||
Wojciech Purczynski cliph@isec.pl
|
||||
Wolfram Kleff kleff@cs.uni-bonn.de
|
||||
Won-kyu Park wkpark@chem.skku.ac.kr
|
||||
Yanko Kaneti yaneti@declera.com
|
||||
Yann Dirson dirson@debian.org
|
||||
Zvi Har'El rl@math.technion.ac.il
|
||||
|
||||
|
||||
1
TODO
1
TODO
@@ -12,7 +12,6 @@ Modify chmod so that it does not change an inode's st_ctime
|
||||
Discussed more recently on <http://bugs.debian.org/497514>.
|
||||
|
||||
document the following in coreutils.texi:
|
||||
mktemp
|
||||
[
|
||||
pinky
|
||||
|
||||
|
||||
251
bootstrap
251
bootstrap
@@ -34,7 +34,7 @@ bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
|
||||
bt2=${bt}2
|
||||
|
||||
usage() {
|
||||
echo >&2 "\
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION]...
|
||||
Bootstrap this package from the checked-out sources.
|
||||
|
||||
@@ -56,7 +56,7 @@ For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||
are honored.
|
||||
|
||||
Running without arguments will suffice in most cases.
|
||||
"
|
||||
EOF
|
||||
}
|
||||
|
||||
# Configuration.
|
||||
@@ -70,6 +70,10 @@ gnulib_modules=
|
||||
# Any gnulib files needed that are not in modules.
|
||||
gnulib_files=
|
||||
|
||||
# A function to be called after everything else in this script.
|
||||
# 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
|
||||
@@ -106,14 +110,14 @@ tests_base=tests
|
||||
|
||||
# Extra files from gnulib, which override files from other sources.
|
||||
gnulib_extra_files="
|
||||
$build_aux/install-sh
|
||||
$build_aux/missing
|
||||
$build_aux/mdate-sh
|
||||
$build_aux/texinfo.tex
|
||||
$build_aux/depcomp
|
||||
$build_aux/config.guess
|
||||
$build_aux/config.sub
|
||||
doc/INSTALL
|
||||
$build_aux/install-sh
|
||||
$build_aux/missing
|
||||
$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.
|
||||
@@ -148,6 +152,45 @@ copy=false
|
||||
# on which version control system (if any) is used in the source directory.
|
||||
vc_ignore=auto
|
||||
|
||||
# find_tool ENVVAR NAMES...
|
||||
# -------------------------
|
||||
# Search for a required program. Use the value of ENVVAR, if set,
|
||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||
# supports --version). If found, set ENVVAR to the program name,
|
||||
# die otherwise.
|
||||
find_tool ()
|
||||
{
|
||||
# Find sha1sum, named gsha1sum on MacPorts.
|
||||
find_tool_envvar=$1
|
||||
shift
|
||||
find_tool_names=$@
|
||||
eval "find_tool_res=\$$find_tool_envvar"
|
||||
if test x"$find_tool_res" = x; then
|
||||
for i
|
||||
do
|
||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
fi
|
||||
if test x"$find_tool_res" = x; then
|
||||
echo >&2 "$0: one of these is required: $find_tool_names"
|
||||
exit 1
|
||||
fi
|
||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
|
||||
echo >&2 "$0: ${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||
exit 1
|
||||
}
|
||||
eval "$find_tool_envvar=\$find_tool_res"
|
||||
eval "export $find_tool_envvar"
|
||||
}
|
||||
|
||||
# Find sha1sum, named gsha1sum on MacPorts.
|
||||
find_tool SHA1SUM sha1sum gsha1sum
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
# if we were invoked as "sh bootstrap".
|
||||
@@ -272,10 +315,10 @@ get_version() {
|
||||
|
||||
$app --version 2>&1 |
|
||||
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
|
||||
t done
|
||||
d
|
||||
:done
|
||||
q'
|
||||
t done
|
||||
d
|
||||
:done
|
||||
q'
|
||||
}
|
||||
|
||||
check_versions() {
|
||||
@@ -313,7 +356,7 @@ print_versions() {
|
||||
|
||||
if ! printf "$buildreq" | check_versions; then
|
||||
test -f README-prereq &&
|
||||
echo "Please see README-prereq for notes on obtaining these prerequisite programs:" >&2
|
||||
echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
|
||||
echo
|
||||
print_versions
|
||||
exit 1
|
||||
@@ -342,7 +385,7 @@ cleanup_gnulib() {
|
||||
}
|
||||
|
||||
git_modules_config () {
|
||||
GIT_CONFIG=.gitmodules git config "$@"
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
# Get gnulib files.
|
||||
@@ -371,10 +414,10 @@ case ${GNULIB_SRCDIR--} in
|
||||
# Redirect the gnulib submodule to the directory on the command line
|
||||
# if possible.
|
||||
if test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
git submodule init
|
||||
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
|
||||
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
|
||||
git_modules_config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule update || exit $?
|
||||
GNULIB_SRCDIR=gnulib
|
||||
@@ -419,10 +462,12 @@ update_po_files() {
|
||||
new_po="$ref_po_dir/$po.po"
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
if ! test -f "$cksum_file" ||
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! ${SHA1SUM-sha1sum} -c --status "$cksum_file" < "$new_po" > /dev/null; then
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! $SHA1SUM -c --status "$cksum_file" \
|
||||
< "$new_po" > /dev/null; then
|
||||
echo "updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
|
||||
cp "$new_po" "$po_dir/$po.po" \
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -456,45 +501,45 @@ symlink_to_dir()
|
||||
# FIXME: for now, this does only one level
|
||||
parent=`dirname "$dst_dir"`
|
||||
for dot_ig in x $vc_ignore; do
|
||||
test $dot_ig = x && continue
|
||||
ig=$parent/$dot_ig
|
||||
insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
|
||||
test $dot_ig = x && continue
|
||||
ig=$parent/$dot_ig
|
||||
insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
|
||||
done
|
||||
fi
|
||||
|
||||
if $copy; then
|
||||
{
|
||||
test ! -h "$dst" || {
|
||||
echo "$0: rm -f $dst" &&
|
||||
rm -f "$dst"
|
||||
}
|
||||
test ! -h "$dst" || {
|
||||
echo "$0: rm -f $dst" &&
|
||||
rm -f "$dst"
|
||||
}
|
||||
} &&
|
||||
test -f "$dst" &&
|
||||
cmp -s "$src" "$dst" || {
|
||||
echo "$0: cp -fp $src $dst" &&
|
||||
cp -fp "$src" "$dst"
|
||||
echo "$0: cp -fp $src $dst" &&
|
||||
cp -fp "$src" "$dst"
|
||||
}
|
||||
else
|
||||
test -h "$dst" &&
|
||||
src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
|
||||
dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
|
||||
test "$src_i" = "$dst_i" || {
|
||||
dot_dots=
|
||||
case $src in
|
||||
/*) ;;
|
||||
*)
|
||||
case /$dst/ in
|
||||
*//* | */../* | */./* | /*/*/*/*/*/)
|
||||
echo >&2 "$0: invalid symlink calculation: $src -> $dst"
|
||||
exit 1;;
|
||||
/*/*/*/*/) dot_dots=../../../;;
|
||||
/*/*/*/) dot_dots=../../;;
|
||||
/*/*/) dot_dots=../;;
|
||||
esac;;
|
||||
esac
|
||||
dot_dots=
|
||||
case $src in
|
||||
/*) ;;
|
||||
*)
|
||||
case /$dst/ in
|
||||
*//* | */../* | */./* | /*/*/*/*/*/)
|
||||
echo >&2 "$0: invalid symlink calculation: $src -> $dst"
|
||||
exit 1;;
|
||||
/*/*/*/*/) dot_dots=../../../;;
|
||||
/*/*/*/) dot_dots=../../;;
|
||||
/*/*/) dot_dots=../;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
echo "$0: ln -fs $dot_dots$src $dst" &&
|
||||
ln -fs "$dot_dots$src" "$dst"
|
||||
echo "$0: ln -fs $dot_dots$src $dst" &&
|
||||
ln -fs "$dot_dots$src" "$dst"
|
||||
}
|
||||
fi
|
||||
}
|
||||
@@ -524,29 +569,29 @@ cp_mark_as_generated()
|
||||
|
||||
if test -z "$c1"; then
|
||||
cmp -s "$cp_src" "$cp_dst" || {
|
||||
# Copy the file first to get proper permissions if it
|
||||
# doesn't already exist. Then overwrite the copy.
|
||||
echo "$0: cp -f $cp_src $cp_dst" &&
|
||||
rm -f "$cp_dst" &&
|
||||
cp "$cp_src" "$cp_dst-t" &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
|
||||
mv -f "$cp_dst-t" "$cp_dst"
|
||||
# Copy the file first to get proper permissions if it
|
||||
# doesn't already exist. Then overwrite the copy.
|
||||
echo "$0: cp -f $cp_src $cp_dst" &&
|
||||
rm -f "$cp_dst" &&
|
||||
cp "$cp_src" "$cp_dst-t" &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
|
||||
mv -f "$cp_dst-t" "$cp_dst"
|
||||
}
|
||||
else
|
||||
# Copy the file first to get proper permissions if it
|
||||
# doesn't already exist. Then overwrite the copy.
|
||||
cp "$cp_src" "$cp_dst-t" &&
|
||||
(
|
||||
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
|
||||
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
|
||||
echo '#line 1' &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src"
|
||||
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
|
||||
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
|
||||
echo '#line 1' &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src"
|
||||
) > $cp_dst-t &&
|
||||
if cmp -s "$cp_dst-t" "$cp_dst"; then
|
||||
rm -f "$cp_dst-t"
|
||||
rm -f "$cp_dst-t"
|
||||
else
|
||||
echo "$0: cp $cp_src $cp_dst # with edits" &&
|
||||
mv -f "$cp_dst-t" "$cp_dst"
|
||||
echo "$0: cp $cp_src $cp_dst # with edits" &&
|
||||
mv -f "$cp_dst-t" "$cp_dst"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -558,7 +603,7 @@ version_controlled_file() {
|
||||
found=no
|
||||
if test -d CVS; then
|
||||
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
|
||||
grep '^/[^/]*/[0-9]' > /dev/null && found=yes
|
||||
grep '^/[^/]*/[0-9]' > /dev/null && found=yes
|
||||
elif test -d .git; then
|
||||
git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
|
||||
elif test -d .svn; then
|
||||
@@ -580,35 +625,35 @@ slurp() {
|
||||
esac
|
||||
test -d $1/$dir/$file && continue
|
||||
for excluded_file in $excluded_files; do
|
||||
test "$dir/$file" = "$excluded_file" && continue 2
|
||||
test "$dir/$file" = "$excluded_file" && continue 2
|
||||
done
|
||||
if test $file = Makefile.am; then
|
||||
copied=$copied${sep}$gnulib_mk; sep=$nl
|
||||
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
|
||||
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
|
||||
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
|
||||
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
|
||||
rm -f $dir/$gnulib_mk &&
|
||||
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
|
||||
}
|
||||
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
|
||||
rm -f $dir/$gnulib_mk &&
|
||||
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
|
||||
}
|
||||
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
|
||||
version_controlled_file $dir $file; then
|
||||
echo "$0: $dir/$file overrides $1/$dir/$file"
|
||||
version_controlled_file $dir $file; then
|
||||
echo "$0: $dir/$file overrides $1/$dir/$file"
|
||||
else
|
||||
copied=$copied$sep$file; sep=$nl
|
||||
if test $file = gettext.m4; then
|
||||
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
|
||||
rm -f $dir/$file
|
||||
sed '
|
||||
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
|
||||
AC_DEFUN([AM_INTL_SUBDIR], [
|
||||
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
|
||||
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
|
||||
$a\
|
||||
AC_DEFUN([gl_LOCK_EARLY], [])
|
||||
' $1/$dir/$file >$dir/$file
|
||||
else
|
||||
cp_mark_as_generated $1/$dir/$file $dir/$file
|
||||
fi
|
||||
copied=$copied$sep$file; sep=$nl
|
||||
if test $file = gettext.m4; then
|
||||
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
|
||||
rm -f $dir/$file
|
||||
sed '
|
||||
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
|
||||
AC_DEFUN([AM_INTL_SUBDIR], [
|
||||
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
|
||||
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
|
||||
$a\
|
||||
AC_DEFUN([gl_LOCK_EARLY], [])
|
||||
' $1/$dir/$file >$dir/$file
|
||||
else
|
||||
cp_mark_as_generated $1/$dir/$file $dir/$file
|
||||
fi
|
||||
fi || exit
|
||||
done
|
||||
|
||||
@@ -616,18 +661,18 @@ slurp() {
|
||||
test $dot_ig = x && continue
|
||||
ig=$dir/$dot_ig
|
||||
if test -n "$copied"; then
|
||||
insert_sorted_if_absent $ig "$copied"
|
||||
# If an ignored file name ends with .in.h, then also add
|
||||
# the name with just ".h". Many gnulib headers are generated,
|
||||
# e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
|
||||
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
|
||||
f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
|
||||
insert_sorted_if_absent $ig "$f"
|
||||
insert_sorted_if_absent $ig "$copied"
|
||||
# If an ignored file name ends with .in.h, then also add
|
||||
# the name with just ".h". Many gnulib headers are generated,
|
||||
# e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
|
||||
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
|
||||
f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
|
||||
insert_sorted_if_absent $ig "$f"
|
||||
|
||||
# For files like sys_stat.in.h and sys_time.in.h, record as
|
||||
# ignorable the directory we might eventually create: sys/.
|
||||
f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
|
||||
insert_sorted_if_absent $ig "$f"
|
||||
# For files like sys_stat.in.h and sys_time.in.h, record as
|
||||
# ignorable the directory we might eventually create: sys/.
|
||||
f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
|
||||
insert_sorted_if_absent $ig "$f"
|
||||
fi
|
||||
done
|
||||
done
|
||||
@@ -688,6 +733,10 @@ find "$m4_base" "$source_base" \
|
||||
|
||||
# Reconfigure, getting other files.
|
||||
|
||||
# Skip autoheader if it's not needed.
|
||||
grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
|
||||
AUTOHEADER=true
|
||||
|
||||
for command in \
|
||||
libtool \
|
||||
"${ACLOCAL-aclocal} --force -I m4" \
|
||||
@@ -733,7 +782,7 @@ if test $with_gettext = yes; then
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
||||
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' po/Makevars.template >po/Makevars
|
||||
|
||||
@@ -745,9 +794,9 @@ if test $with_gettext = yes; then
|
||||
/^subdir *=.*/s/=.*/= runtime-po/
|
||||
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
||||
s/$/ \\/
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' <po/Makevars.template >runtime-po/Makevars
|
||||
|
||||
@@ -756,10 +805,6 @@ if test $with_gettext = yes; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Horrible, coreutils-specific kludges.
|
||||
# Change paths in gnulib-tests/gnulib.mk from "../.." to "..".
|
||||
m=gnulib-tests/gnulib.mk
|
||||
sed 's,\.\./\.\.,..,g' $m > $m-t
|
||||
mv -f $m-t $m
|
||||
bootstrap_epilogue
|
||||
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
@@ -20,19 +20,16 @@
|
||||
avoided_gnulib_modules='
|
||||
--avoid=canonicalize-lgpl
|
||||
--avoid=dummy
|
||||
--avoid=lock
|
||||
'
|
||||
|
||||
# These modules are obsolete and can probably be removed soon,
|
||||
# but leave them in for now to minimize changes.
|
||||
obsolete_gnulib_modules='
|
||||
atexit
|
||||
memchr
|
||||
memcmp
|
||||
memcpy
|
||||
memmove
|
||||
memset
|
||||
rename
|
||||
strcspn
|
||||
strtod
|
||||
strtol
|
||||
@@ -74,11 +71,14 @@ gnulib_modules="
|
||||
diacrit
|
||||
dirfd
|
||||
dirname
|
||||
do-release-commit-and-tag
|
||||
dup2
|
||||
environ
|
||||
error
|
||||
euidaccess
|
||||
exclude
|
||||
exitfail
|
||||
faccessat
|
||||
fchdir
|
||||
fcntl
|
||||
fcntl-safer
|
||||
@@ -91,19 +91,21 @@ gnulib_modules="
|
||||
fnmatch-gnu
|
||||
fopen-safer
|
||||
fprintftime
|
||||
freopen
|
||||
freopen-safer
|
||||
fseeko
|
||||
fsusage
|
||||
fsync
|
||||
ftello
|
||||
ftruncate
|
||||
fts
|
||||
gendocs
|
||||
getdate
|
||||
getgroups
|
||||
gethrxtime
|
||||
getline
|
||||
getloadavg
|
||||
getndelim2
|
||||
getopt
|
||||
getopt-gnu
|
||||
getpagesize
|
||||
getpass-gnu
|
||||
gettext
|
||||
@@ -114,6 +116,7 @@ gnulib_modules="
|
||||
git-version-gen
|
||||
gitlog-to-changelog
|
||||
gnu-make
|
||||
gnu-web-doc-update
|
||||
gnumakefile
|
||||
gnupload
|
||||
group-member
|
||||
@@ -127,11 +130,14 @@ gnulib_modules="
|
||||
inttostr
|
||||
inttypes
|
||||
isapipe
|
||||
isblank
|
||||
lchmod
|
||||
lchown
|
||||
lib-ignore
|
||||
linebuffer
|
||||
link
|
||||
link-follow
|
||||
linkat
|
||||
long-options
|
||||
lstat
|
||||
maintainer-makefile
|
||||
@@ -141,6 +147,7 @@ gnulib_modules="
|
||||
mbsalign
|
||||
mbswidth
|
||||
memcasecmp
|
||||
memchr
|
||||
memcmp2
|
||||
mempcpy
|
||||
memrchr
|
||||
@@ -153,6 +160,7 @@ gnulib_modules="
|
||||
modechange
|
||||
mountlist
|
||||
mpsort
|
||||
nproc
|
||||
obstack
|
||||
pathmax
|
||||
perl
|
||||
@@ -175,9 +183,9 @@ gnulib_modules="
|
||||
readutmp
|
||||
realloc
|
||||
regex
|
||||
rename-dest-slash
|
||||
remove
|
||||
rename
|
||||
rmdir
|
||||
rmdir-errno
|
||||
root-dev-ino
|
||||
rpmatch
|
||||
safe-read
|
||||
@@ -196,20 +204,24 @@ gnulib_modules="
|
||||
stdlib-safer
|
||||
stpcpy
|
||||
stpncpy
|
||||
strdup
|
||||
strdup-posix
|
||||
strftime
|
||||
strpbrk
|
||||
strsignal
|
||||
strtoimax
|
||||
strtoumax
|
||||
strverscmp
|
||||
symlink
|
||||
sys_stat
|
||||
timespec
|
||||
tzset
|
||||
uname
|
||||
unicodeio
|
||||
unistd-safer
|
||||
unlink-busy
|
||||
unlinkdir
|
||||
unlocked-io
|
||||
unsetenv
|
||||
update-copyright
|
||||
uptime
|
||||
useless-if-before-free
|
||||
userspec
|
||||
@@ -233,6 +245,7 @@ gnulib_modules="
|
||||
xnanosleep
|
||||
xprintf
|
||||
xprintf-posix
|
||||
xreadlink
|
||||
xstrtod
|
||||
xstrtoimax
|
||||
xstrtol
|
||||
@@ -289,7 +302,6 @@ if test $gettext_external = 1; then
|
||||
m4/glibc2.m4
|
||||
m4/intdiv0.m4
|
||||
m4/lcmessage.m4
|
||||
m4/lock.m4
|
||||
m4/uintmax_t.m4
|
||||
m4/ulonglong.m4
|
||||
m4/visibility.m4
|
||||
@@ -301,7 +313,7 @@ gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
|
||||
# Build prerequisites
|
||||
buildreq="\
|
||||
autoconf 2.61
|
||||
automake 1.10b
|
||||
automake 1.11
|
||||
autopoint -
|
||||
bison -
|
||||
gettext -
|
||||
@@ -315,4 +327,12 @@ tar -
|
||||
"
|
||||
|
||||
# Automake requires that ChangeLog exist.
|
||||
touch ChangeLog
|
||||
touch ChangeLog || exit 1
|
||||
|
||||
bootstrap_epilogue()
|
||||
{
|
||||
# Change paths in gnulib-tests/gnulib.mk from "../.." to "..".
|
||||
m=gnulib-tests/gnulib.mk
|
||||
sed 's,\.\./\.\.,..,g' $m > $m-t
|
||||
mv -f $m-t $m
|
||||
}
|
||||
|
||||
@@ -234,8 +234,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
442
build-aux/cvsu
442
build-aux/cvsu
@@ -27,20 +27,20 @@ use Time::Local;
|
||||
use strict;
|
||||
|
||||
use vars qw($list_types %messages %options @batch_list $batch_cmd
|
||||
$no_recurse $explain_type $find_mode $short_print
|
||||
$no_cvsignore $nolinks $file $single_filename $curr_dir
|
||||
@common_ignores $ignore_rx %entries %subdirs %removed);
|
||||
$no_recurse $explain_type $find_mode $short_print
|
||||
$no_cvsignore $nolinks $file $single_filename $curr_dir
|
||||
@common_ignores $ignore_rx %entries %subdirs %removed);
|
||||
|
||||
use constant SUBDIR_FOUND => 1;
|
||||
use constant SUBDIR_CVS => 2;
|
||||
|
||||
# This list comes from the CVS manual.
|
||||
use constant STANDARD_IGNORES =>
|
||||
('RCS', 'SCCS', 'CVS', 'CVS.adm', 'RCSLOG', 'cvslog.*', 'tags',
|
||||
'TAGS', '.make.state', '.nse_depinfo', '*~', '#*', '.#*', ',*',
|
||||
"_\$*", "*\$", '*.old', '*.bak', '*.BAK', '*.orig', '*.rej',
|
||||
'.del-*', '*.a', '*.olb', '*.o', '*.obj', '*.so', '*.exe',
|
||||
'*.Z', '*.elc', '*.ln', 'core');
|
||||
('RCS', 'SCCS', 'CVS', 'CVS.adm', 'RCSLOG', 'cvslog.*', 'tags',
|
||||
'TAGS', '.make.state', '.nse_depinfo', '*~', '#*', '.#*', ',*',
|
||||
"_\$*", "*\$", '*.old', '*.bak', '*.BAK', '*.orig', '*.rej',
|
||||
'.del-*', '*.a', '*.olb', '*.o', '*.obj', '*.so', '*.exe',
|
||||
'*.Z', '*.elc', '*.ln', 'core');
|
||||
|
||||
# 3-letter month names in POSIX locale, for fast date decoding
|
||||
my %months = (
|
||||
@@ -62,20 +62,20 @@ my %months = (
|
||||
sub usage ()
|
||||
{
|
||||
print "Usage:\n" .
|
||||
" cvsu [OPTIONS] [FILE] ...\n" .
|
||||
"Options:\n" .
|
||||
" --local Disable recursion\n" .
|
||||
" --explain Verbosely print status of files\n" .
|
||||
" --find Emulate find - filenames only\n" .
|
||||
" --short Don't print paths\n" .
|
||||
" --ignore Don't read .cvsignore\n" .
|
||||
" --messages List known file types and long messages\n" .
|
||||
" --nolinks Disable recognizing hard and soft links\n" .
|
||||
" --types=[^]LIST Print only file types [not] from LIST\n" .
|
||||
" --batch=COMMAND Execute this command on files\n" .
|
||||
" --help Print this usage information\n" .
|
||||
" --version Print version number\n" .
|
||||
"Abbreviations and short options are supported\n";
|
||||
" cvsu [OPTIONS] [FILE] ...\n" .
|
||||
"Options:\n" .
|
||||
" --local Disable recursion\n" .
|
||||
" --explain Verbosely print status of files\n" .
|
||||
" --find Emulate find - filenames only\n" .
|
||||
" --short Don't print paths\n" .
|
||||
" --ignore Don't read .cvsignore\n" .
|
||||
" --messages List known file types and long messages\n" .
|
||||
" --nolinks Disable recognizing hard and soft links\n" .
|
||||
" --types=[^]LIST Print only file types [not] from LIST\n" .
|
||||
" --batch=COMMAND Execute this command on files\n" .
|
||||
" --help Print this usage information\n" .
|
||||
" --version Print version number\n" .
|
||||
"Abbreviations and short options are supported\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
@@ -90,11 +90,11 @@ sub version ()
|
||||
sub adjust_types ()
|
||||
{
|
||||
if ($list_types =~ m{^\^(.*)$}) {
|
||||
$list_types = "";
|
||||
foreach (keys %messages) {
|
||||
$list_types .= $_
|
||||
if (index ($1, $_) < 0);
|
||||
}
|
||||
$list_types = "";
|
||||
foreach (keys %messages) {
|
||||
$list_types .= $_
|
||||
if (index ($1, $_) < 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,12 +104,12 @@ sub list_messages ()
|
||||
my $default_mark;
|
||||
print "Recognizable file types are:\n";
|
||||
foreach (sort keys %messages) {
|
||||
if (index($list_types, $_) >= 0) {
|
||||
$default_mark = "*";
|
||||
} else {
|
||||
$default_mark = " ";
|
||||
}
|
||||
print " $default_mark $_ $messages{$_}\n";
|
||||
if (index($list_types, $_) >= 0) {
|
||||
$default_mark = "*";
|
||||
} else {
|
||||
$default_mark = " ";
|
||||
}
|
||||
print " $default_mark $_ $messages{$_}\n";
|
||||
}
|
||||
print "* indicates file types listed by default\n";
|
||||
exit 0;
|
||||
@@ -124,28 +124,28 @@ sub init_ignores ()
|
||||
push @common_ignores, STANDARD_IGNORES;
|
||||
|
||||
unless (defined($HOME)) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
my $home_cvsignore = "${HOME}/.cvsignore";
|
||||
|
||||
if (-f "$home_cvsignore") {
|
||||
|
||||
unless (open (CVSIGNORE, "< $home_cvsignore")) {
|
||||
error ("couldn't open $home_cvsignore: $!");
|
||||
}
|
||||
unless (open (CVSIGNORE, "< $home_cvsignore")) {
|
||||
error ("couldn't open $home_cvsignore: $!");
|
||||
}
|
||||
|
||||
while (<CVSIGNORE>) {
|
||||
push (@common_ignores, split);
|
||||
}
|
||||
while (<CVSIGNORE>) {
|
||||
push (@common_ignores, split);
|
||||
}
|
||||
|
||||
close (CVSIGNORE);
|
||||
close (CVSIGNORE);
|
||||
}
|
||||
|
||||
my $CVSIGNOREENV = $ENV{"CVSIGNORE"};
|
||||
|
||||
unless (defined($CVSIGNOREENV)) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
my @ignores_var = split (/ /, $CVSIGNOREENV);
|
||||
@@ -157,15 +157,15 @@ sub init_ignores ()
|
||||
# Newline is added at the end.
|
||||
sub error ($)
|
||||
{
|
||||
print STDERR "cvsu: ERROR: " . shift(@_) . "\n";
|
||||
exit 1;
|
||||
print STDERR "cvsu: ERROR: " . shift(@_) . "\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# execute commands from @exec_list with $exec_cmd
|
||||
sub do_batch ()
|
||||
{
|
||||
my @cmd_list = split (' ', $batch_cmd);
|
||||
system (@cmd_list, @batch_list);
|
||||
my @cmd_list = split (' ', $batch_cmd);
|
||||
system (@cmd_list, @batch_list);
|
||||
}
|
||||
|
||||
# print files status
|
||||
@@ -177,34 +177,34 @@ sub file_status ($)
|
||||
my $pathfile;
|
||||
|
||||
return
|
||||
if $ignore_rx ne '' && $type =~ /[?SLD]/ && $file =~ /$ignore_rx/;
|
||||
if $ignore_rx ne '' && $type =~ /[?SLD]/ && $file =~ /$ignore_rx/;
|
||||
|
||||
return
|
||||
if (index($list_types, $type) < 0);
|
||||
if (index($list_types, $type) < 0);
|
||||
|
||||
$pathfile = $curr_dir . $file;
|
||||
|
||||
if (defined($batch_cmd)) {
|
||||
push (@batch_list, $pathfile);
|
||||
# 1000 items in the command line might be too much for HP-UX
|
||||
if ($#batch_list > 1000) {
|
||||
do_batch();
|
||||
undef @batch_list;
|
||||
}
|
||||
push (@batch_list, $pathfile);
|
||||
# 1000 items in the command line might be too much for HP-UX
|
||||
if ($#batch_list > 1000) {
|
||||
do_batch();
|
||||
undef @batch_list;
|
||||
}
|
||||
}
|
||||
|
||||
if ($short_print) {
|
||||
$item = $file;
|
||||
$item = $file;
|
||||
} else {
|
||||
$item = $pathfile;
|
||||
$item = $pathfile;
|
||||
}
|
||||
|
||||
if ($find_mode) {
|
||||
print "$item\n";
|
||||
print "$item\n";
|
||||
} else {
|
||||
$type = $messages{$type}
|
||||
if ($explain_type);
|
||||
print "$type $item\n";
|
||||
$type = $messages{$type}
|
||||
if ($explain_type);
|
||||
print "$type $item\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,28 +219,28 @@ sub load_entries ($)
|
||||
my %ent = ();
|
||||
|
||||
unless (open (ENTRIES, "< $entries_file")) {
|
||||
error ("couldn't open $entries_file: $!");
|
||||
error ("couldn't open $entries_file: $!");
|
||||
}
|
||||
while (<ENTRIES>) {
|
||||
chomp;
|
||||
$ent{$_} = 1;
|
||||
chomp;
|
||||
$ent{$_} = 1;
|
||||
}
|
||||
close (ENTRIES);
|
||||
|
||||
if (open (ENTRIES, "< $entries_log_file")) {
|
||||
while (<ENTRIES>) {
|
||||
chomp;
|
||||
if ( m{^A (.+)} ) {
|
||||
$ent{$1} = 1;
|
||||
} elsif ( m{^R (.+)} ) {
|
||||
delete $ent{$1};
|
||||
} else {
|
||||
# Note: "cvs commit" helps even when you are offline
|
||||
error ("$entries_log_file:$.: unrecognizable line, " .
|
||||
"try \"cvs commit\"");
|
||||
}
|
||||
}
|
||||
close (ENTRIES);
|
||||
while (<ENTRIES>) {
|
||||
chomp;
|
||||
if ( m{^A (.+)} ) {
|
||||
$ent{$1} = 1;
|
||||
} elsif ( m{^R (.+)} ) {
|
||||
delete $ent{$1};
|
||||
} else {
|
||||
# Note: "cvs commit" helps even when you are offline
|
||||
error ("$entries_log_file:$.: unrecognizable line, " .
|
||||
"try \"cvs commit\"");
|
||||
}
|
||||
}
|
||||
close (ENTRIES);
|
||||
}
|
||||
|
||||
return keys %ent;
|
||||
@@ -260,28 +260,28 @@ sub process_arg ($)
|
||||
local $single_filename = 0;
|
||||
|
||||
if ( $arg eq "" or -d $arg ) {
|
||||
$curr_dir = $arg;
|
||||
my $real_curr_dir = $curr_dir eq "" ? "." : $curr_dir;
|
||||
$curr_dir = $arg;
|
||||
my $real_curr_dir = $curr_dir eq "" ? "." : $curr_dir;
|
||||
|
||||
error ("$real_curr_dir is not a directory")
|
||||
unless ( -d $real_curr_dir );
|
||||
error ("$real_curr_dir is not a directory")
|
||||
unless ( -d $real_curr_dir );
|
||||
|
||||
# Scan present files.
|
||||
file_status (".");
|
||||
opendir (DIR, $real_curr_dir) ||
|
||||
error ("couldn't open directory $real_curr_dir: $!");
|
||||
foreach (readdir (DIR)) {
|
||||
$found_files {$_} = 1;
|
||||
}
|
||||
closedir (DIR);
|
||||
# Scan present files.
|
||||
file_status (".");
|
||||
opendir (DIR, $real_curr_dir) ||
|
||||
error ("couldn't open directory $real_curr_dir: $!");
|
||||
foreach (readdir (DIR)) {
|
||||
$found_files {$_} = 1;
|
||||
}
|
||||
closedir (DIR);
|
||||
} else {
|
||||
$single_filename = basename $arg;
|
||||
$curr_dir = dirname $arg;
|
||||
$found_files{$single_filename} = 1 if lstat $arg;
|
||||
$single_filename = basename $arg;
|
||||
$curr_dir = dirname $arg;
|
||||
$found_files{$single_filename} = 1 if lstat $arg;
|
||||
}
|
||||
|
||||
$curr_dir .= "/"
|
||||
unless ( $curr_dir eq "" || $curr_dir =~ m{/$} );
|
||||
unless ( $curr_dir eq "" || $curr_dir =~ m{/$} );
|
||||
|
||||
# Scan CVS/Entries.
|
||||
my %entries = ();
|
||||
@@ -289,118 +289,118 @@ sub process_arg ($)
|
||||
my %removed = ();
|
||||
|
||||
foreach ( load_entries ("${curr_dir}CVS/Entries") ) {
|
||||
if ( m{^D/([^/]+)/} ) {
|
||||
$subdirs{$1} = SUBDIR_FOUND if !$single_filename;
|
||||
} elsif ( m{^/([^/]+)/([^/])[^/]*/([^/]*)/} ) {
|
||||
if ( !$single_filename or $single_filename eq $1 ) {
|
||||
$entries{$1} = $3;
|
||||
$removed{$1} = 1
|
||||
if $2 eq '-';
|
||||
}
|
||||
} elsif ( m{^D$} ) {
|
||||
next;
|
||||
} else {
|
||||
error ("${curr_dir}CVS/Entries: unrecognizable line");
|
||||
}
|
||||
if ( m{^D/([^/]+)/} ) {
|
||||
$subdirs{$1} = SUBDIR_FOUND if !$single_filename;
|
||||
} elsif ( m{^/([^/]+)/([^/])[^/]*/([^/]*)/} ) {
|
||||
if ( !$single_filename or $single_filename eq $1 ) {
|
||||
$entries{$1} = $3;
|
||||
$removed{$1} = 1
|
||||
if $2 eq '-';
|
||||
}
|
||||
} elsif ( m{^D$} ) {
|
||||
next;
|
||||
} else {
|
||||
error ("${curr_dir}CVS/Entries: unrecognizable line");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $single_filename && !$entries{$single_filename} &&
|
||||
!$found_files{$single_filename} ) {
|
||||
error ("nothing known about $arg");
|
||||
!$found_files{$single_filename} ) {
|
||||
error ("nothing known about $arg");
|
||||
}
|
||||
|
||||
# Scan .cvsignore if any
|
||||
unless ($no_cvsignore) {
|
||||
my (@ignore_list) = ();
|
||||
my (@ignore_list) = ();
|
||||
|
||||
if (-f "${curr_dir}.cvsignore") {
|
||||
open (CVSIGNORE, "< ${curr_dir}.cvsignore")
|
||||
|| error ("couldn't open ${curr_dir}.cvsignore: $!");
|
||||
while (<CVSIGNORE>) {
|
||||
push (@ignore_list, split);
|
||||
}
|
||||
close (CVSIGNORE);
|
||||
}
|
||||
if (-f "${curr_dir}.cvsignore") {
|
||||
open (CVSIGNORE, "< ${curr_dir}.cvsignore")
|
||||
|| error ("couldn't open ${curr_dir}.cvsignore: $!");
|
||||
while (<CVSIGNORE>) {
|
||||
push (@ignore_list, split);
|
||||
}
|
||||
close (CVSIGNORE);
|
||||
}
|
||||
|
||||
my ($iter);
|
||||
foreach $iter (@ignore_list, @common_ignores) {
|
||||
if ($iter eq '!') {
|
||||
$ignore_rx = ''
|
||||
} else {
|
||||
if ($ignore_rx eq '') {
|
||||
$ignore_rx = '^(';
|
||||
} else {
|
||||
$ignore_rx .= '|';
|
||||
}
|
||||
$ignore_rx .= glob_to_rx ($iter);
|
||||
}
|
||||
}
|
||||
$ignore_rx .= ')$'
|
||||
if $ignore_rx ne '';
|
||||
my ($iter);
|
||||
foreach $iter (@ignore_list, @common_ignores) {
|
||||
if ($iter eq '!') {
|
||||
$ignore_rx = ''
|
||||
} else {
|
||||
if ($ignore_rx eq '') {
|
||||
$ignore_rx = '^(';
|
||||
} else {
|
||||
$ignore_rx .= '|';
|
||||
}
|
||||
$ignore_rx .= glob_to_rx ($iter);
|
||||
}
|
||||
}
|
||||
$ignore_rx .= ')$'
|
||||
if $ignore_rx ne '';
|
||||
}
|
||||
|
||||
# File is missing
|
||||
foreach $file (sort keys %entries) {
|
||||
unless ($found_files{$file}) {
|
||||
if ($removed{$file}) {
|
||||
file_status("R");
|
||||
} else {
|
||||
file_status("U");
|
||||
}
|
||||
}
|
||||
unless ($found_files{$file}) {
|
||||
if ($removed{$file}) {
|
||||
file_status("R");
|
||||
} else {
|
||||
file_status("U");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach $file (sort keys %found_files) {
|
||||
next if ($file eq '.' || $file eq '..');
|
||||
lstat ($curr_dir . $file) ||
|
||||
error ("lstat() failed on $curr_dir . $file");
|
||||
if (! $nolinks && -l _) {
|
||||
file_status ("L");
|
||||
} elsif (-d _) {
|
||||
if ($file eq 'CVS') {
|
||||
file_status ("C");
|
||||
} elsif ($subdirs{$file}) {
|
||||
$subdirs{$file} = SUBDIR_CVS;
|
||||
} else {
|
||||
file_status ("D"); # Unknown directory
|
||||
}
|
||||
} elsif (! (-f _) && ! (-l _)) {
|
||||
file_status ("S"); # This must be something very special
|
||||
} elsif (! $nolinks && (stat _) [3] > 1 ) {
|
||||
file_status ("H"); # Hard link
|
||||
} elsif (! $entries{$file}) {
|
||||
file_status ("?");
|
||||
} elsif ($entries{$file} =~ /^Initial |^dummy /) {
|
||||
file_status ("A");
|
||||
} elsif ($entries{$file} =~ /^Result of merge/) {
|
||||
file_status ("G");
|
||||
} elsif ($entries{$file} !~
|
||||
/^(...) (...) (..) (..):(..):(..) (....)$/) {
|
||||
error ("Invalid timestamp for $curr_dir$file: $entries{$file}");
|
||||
} else {
|
||||
my $cvtime = timegm($6, $5, $4, $3, $months{$2}, $7 - 1900);
|
||||
my $mtime = (stat _) [9];
|
||||
if ($cvtime == $mtime) {
|
||||
file_status ("F");
|
||||
} elsif ($cvtime < $mtime) {
|
||||
file_status ("M");
|
||||
} else {
|
||||
file_status ("O");
|
||||
}
|
||||
}
|
||||
next if ($file eq '.' || $file eq '..');
|
||||
lstat ($curr_dir . $file) ||
|
||||
error ("lstat() failed on $curr_dir . $file");
|
||||
if (! $nolinks && -l _) {
|
||||
file_status ("L");
|
||||
} elsif (-d _) {
|
||||
if ($file eq 'CVS') {
|
||||
file_status ("C");
|
||||
} elsif ($subdirs{$file}) {
|
||||
$subdirs{$file} = SUBDIR_CVS;
|
||||
} else {
|
||||
file_status ("D"); # Unknown directory
|
||||
}
|
||||
} elsif (! (-f _) && ! (-l _)) {
|
||||
file_status ("S"); # This must be something very special
|
||||
} elsif (! $nolinks && (stat _) [3] > 1 ) {
|
||||
file_status ("H"); # Hard link
|
||||
} elsif (! $entries{$file}) {
|
||||
file_status ("?");
|
||||
} elsif ($entries{$file} =~ /^Initial |^dummy /) {
|
||||
file_status ("A");
|
||||
} elsif ($entries{$file} =~ /^Result of merge/) {
|
||||
file_status ("G");
|
||||
} elsif ($entries{$file} !~
|
||||
/^(...) (...) (..) (..):(..):(..) (....)$/) {
|
||||
error ("Invalid timestamp for $curr_dir$file: $entries{$file}");
|
||||
} else {
|
||||
my $cvtime = timegm($6, $5, $4, $3, $months{$2}, $7 - 1900);
|
||||
my $mtime = (stat _) [9];
|
||||
if ($cvtime == $mtime) {
|
||||
file_status ("F");
|
||||
} elsif ($cvtime < $mtime) {
|
||||
file_status ("M");
|
||||
} else {
|
||||
file_status ("O");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Now do directories.
|
||||
unless ($no_recurse) {
|
||||
my $save_curr_dir = $curr_dir;
|
||||
foreach $file (sort keys %subdirs) {
|
||||
if ($subdirs{$file} == SUBDIR_FOUND) {
|
||||
$curr_dir = $save_curr_dir;
|
||||
file_status ("X");
|
||||
} elsif ($subdirs{$file} == SUBDIR_CVS) {
|
||||
process_arg ($save_curr_dir . $file)
|
||||
}
|
||||
}
|
||||
my $save_curr_dir = $curr_dir;
|
||||
foreach $file (sort keys %subdirs) {
|
||||
if ($subdirs{$file} == SUBDIR_FOUND) {
|
||||
$curr_dir = $save_curr_dir;
|
||||
file_status ("X");
|
||||
} elsif ($subdirs{$file} == SUBDIR_CVS) {
|
||||
process_arg ($save_curr_dir . $file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,13 +423,13 @@ sub glob_to_rx ($)
|
||||
# Find parts in square brackets and copy them literally
|
||||
# Text outside brackets is processed by glob_to_rx_simple()
|
||||
while ($expr ne '') {
|
||||
if ($expr =~ /^(.*?)(\[.*?\])(.*)/) {
|
||||
$expr = $3;
|
||||
$result .= glob_to_rx_simple ($1) . $2;
|
||||
} else {
|
||||
$result .= glob_to_rx_simple ($expr);
|
||||
last;
|
||||
}
|
||||
if ($expr =~ /^(.*?)(\[.*?\])(.*)/) {
|
||||
$expr = $3;
|
||||
$result .= glob_to_rx_simple ($1) . $2;
|
||||
} else {
|
||||
$result .= glob_to_rx_simple ($expr);
|
||||
last;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -441,21 +441,21 @@ sub Main ()
|
||||
|
||||
# long status messages
|
||||
%messages = (
|
||||
"?" => "Unlisted file",
|
||||
"." => "Known directory",
|
||||
"F" => "Up-to-date file",
|
||||
"C" => "CVS admin directory",
|
||||
"M" => "Modified file",
|
||||
"S" => "Special file",
|
||||
"D" => "Unlisted directory",
|
||||
"L" => "Symbolic link",
|
||||
"H" => "Hard link",
|
||||
"U" => "Lost file",
|
||||
"X" => "Lost directory",
|
||||
"A" => "Newly added",
|
||||
"O" => "Older copy",
|
||||
"G" => "Result of merge",
|
||||
"R" => "Removed file"
|
||||
"?" => "Unlisted file",
|
||||
"." => "Known directory",
|
||||
"F" => "Up-to-date file",
|
||||
"C" => "CVS admin directory",
|
||||
"M" => "Modified file",
|
||||
"S" => "Special file",
|
||||
"D" => "Unlisted directory",
|
||||
"L" => "Symbolic link",
|
||||
"H" => "Hard link",
|
||||
"U" => "Lost file",
|
||||
"X" => "Lost directory",
|
||||
"A" => "Newly added",
|
||||
"O" => "Older copy",
|
||||
"G" => "Result of merge",
|
||||
"R" => "Removed file"
|
||||
);
|
||||
|
||||
undef @batch_list; # List of files for batch processing
|
||||
@@ -471,17 +471,17 @@ sub Main ()
|
||||
my $want_ver = 0; # Print version and exit
|
||||
|
||||
my %options = (
|
||||
"types=s" => \$list_types,
|
||||
"batch=s" => \$batch_cmd,
|
||||
"local" => \$no_recurse,
|
||||
"explain" => \$explain_type,
|
||||
"find" => \$find_mode,
|
||||
"short" => \$short_print,
|
||||
"ignore" => \$no_cvsignore,
|
||||
"messages" => \$want_msg,
|
||||
"nolinks" => \$nolinks,
|
||||
"help" => \$want_help,
|
||||
"version" => \$want_ver
|
||||
"types=s" => \$list_types,
|
||||
"batch=s" => \$batch_cmd,
|
||||
"local" => \$no_recurse,
|
||||
"explain" => \$explain_type,
|
||||
"find" => \$find_mode,
|
||||
"short" => \$short_print,
|
||||
"ignore" => \$no_cvsignore,
|
||||
"messages" => \$want_msg,
|
||||
"nolinks" => \$nolinks,
|
||||
"help" => \$want_help,
|
||||
"version" => \$want_ver
|
||||
);
|
||||
|
||||
GetOptions(%options);
|
||||
@@ -493,19 +493,19 @@ sub Main ()
|
||||
version() if $want_ver;
|
||||
|
||||
unless ($no_cvsignore) {
|
||||
init_ignores();
|
||||
init_ignores();
|
||||
}
|
||||
|
||||
if ($#ARGV < 0) {
|
||||
@ARGV = ("");
|
||||
@ARGV = ("");
|
||||
}
|
||||
|
||||
foreach (@ARGV) {
|
||||
process_arg ($_);
|
||||
process_arg ($_);
|
||||
}
|
||||
|
||||
if ($#batch_list >= 0) {
|
||||
do_batch();
|
||||
do_batch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
73
cfg.mk
73
cfg.mk
@@ -25,18 +25,13 @@ gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
|
||||
manual_title = Core GNU utilities
|
||||
|
||||
url_dir_list = \
|
||||
ftp://$(gnu_rel_host)/gnu/coreutils
|
||||
ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
|
||||
|
||||
# The GnuPG ID of the key used to sign the tarballs.
|
||||
gpg_key_ID = B9AB9A16
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
local-checks-to-skip = strftime-check
|
||||
|
||||
# The local directory containing the checked-out copy of gnulib used in this
|
||||
# release. Used to get gnulib's SHA1 for the "announcement" target and
|
||||
# for signing release tags.
|
||||
gnulib_dir = gnulib
|
||||
local-checks-to-skip =
|
||||
|
||||
# Tools used to bootstrap this package, used for "announcement".
|
||||
bootstrap-tools = autoconf,automake,gnulib,bison
|
||||
@@ -44,7 +39,7 @@ bootstrap-tools = autoconf,automake,gnulib,bison
|
||||
# Now that we have better tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
old_NEWS_hash = 2f661e60191e2c52ba73c22e5ac42b79
|
||||
old_NEWS_hash = 785e51bc9af87e7eb004f9ba24a0ca27
|
||||
|
||||
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
|
||||
dd = $(srcdir)/src/dd.c
|
||||
@@ -104,6 +99,18 @@ sc_root_tests:
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Ensure that the syntax_check_exceptions file list in Makefile.am
|
||||
# stays in sync with corresponding files in the repository.
|
||||
sce = syntax_check_exceptions
|
||||
sc_x_sc_dist_check:
|
||||
@test "$$( ($(VC_LIST) | sed -n '/^.x-sc_/p'; \
|
||||
sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
|
||||
$(srcdir)/Makefile.am \
|
||||
| sed 's/^ *//;/^$(sce) =/d' \
|
||||
| tr -s '\012\\' ' ' | fmt -1 \
|
||||
) | sort | uniq -u)" \
|
||||
&& { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
|
||||
|
||||
headers_with_interesting_macro_defs = \
|
||||
exit.h \
|
||||
fcntl_.h \
|
||||
@@ -153,8 +160,7 @@ sc_system_h_headers: .re-list
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||
grep -nE -f .re-list \
|
||||
$$($(VC_LIST) src | \
|
||||
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
|
||||
$$($(VC_LIST_EXCEPT) | grep '^src/') \
|
||||
&& { echo '$(ME): the above are already included via system.h'\
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
@@ -170,6 +176,10 @@ ALL_RECURSIVE_TARGETS += sc_tight_scope
|
||||
sc_tight_scope:
|
||||
@$(MAKE) -C src $@
|
||||
|
||||
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
|
||||
sc_check-AUTHORS:
|
||||
@$(MAKE) -C src $@
|
||||
|
||||
# Perl-based tests used to exec perl from a #!/bin/sh script.
|
||||
# Now they all start with #!/usr/bin/perl and the portability
|
||||
# infrastructure is in tests/Makefile.am. Make sure no old-style
|
||||
@@ -181,6 +191,18 @@ sc_no_exec_perl_coreutils:
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Don't use "readlink" or "readlinkat" directly
|
||||
sc_prohibit_readlink:
|
||||
@re='\<readlink(at)? \(' \
|
||||
msg='do not use readlink(at); use via xreadlink or areadlink*' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Don't use address of "stat" or "lstat" functions
|
||||
sc_prohibit_stat_macro_address:
|
||||
@re='\<l?stat '':|&l?stat\>' \
|
||||
msg='stat() and lstat() may be function-like macros' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Ensure that date's --help output stays in sync with the info
|
||||
# documentation for GNU strftime. The only exception is %N,
|
||||
# which date accepts but GNU strftime does not.
|
||||
@@ -196,4 +218,35 @@ sc_strftime_check:
|
||||
rm -f $@-src $@-info; \
|
||||
fi
|
||||
|
||||
# Indent only with spaces.
|
||||
sc_prohibit_tab_based_indentation:
|
||||
@re='^ * ' \
|
||||
msg='TAB in indentation; use only spaces' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
|
||||
sc_prohibit_emacs__indent_tabs_mode__setting:
|
||||
@re='^( *[*#] *)?indent-tabs-mode:' \
|
||||
msg='use of emacs indent-tabs-mode: setting' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Ensure that each file that contains fail=1 also contains fail=0.
|
||||
# Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
|
||||
sc_prohibit_fail_0:
|
||||
@re='\<fail=0\>' \
|
||||
msg='fail=0 initialization' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Ensure that "stdio--.h" is used where appropriate.
|
||||
sc_require_stdio_safer:
|
||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||
files=$$(grep -l '\bfreopen \?(' $$($(VC_LIST_EXCEPT) \
|
||||
| grep '\.[ch]$$')); \
|
||||
test -n "$$files" && grep -LE 'include "stdio--.h"' $$files \
|
||||
| grep . && \
|
||||
{ echo '$(ME): the above files should use "stdio--.h"' \
|
||||
1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
include $(srcdir)/dist-check.mk
|
||||
|
||||
66
configure.ac
66
configure.ac
@@ -24,15 +24,15 @@ AC_PREREQ([2.61])
|
||||
# indicates that it is built from the 219th delta (in _some_ repository)
|
||||
# following the v6.9 tag, and that 58ddd is a prefix of the commit SHA1.
|
||||
AC_INIT([GNU coreutils],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[bug-coreutils@gnu.org])
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[bug-coreutils@gnu.org])
|
||||
|
||||
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.10b dist-xz color-tests parallel-tests])
|
||||
AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
|
||||
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
|
||||
|
||||
AC_PROG_CC_STDC
|
||||
@@ -47,7 +47,7 @@ coreutils_MACROS
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[AS_HELP_STRING([--enable-gcc-warnings],
|
||||
[turn on lots of GCC warnings (for developers)])],
|
||||
[turn on lots of GCC warnings (for developers)])],
|
||||
[case $enableval in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
|
||||
@@ -60,9 +60,11 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||
AC_SUBST([WERROR_CFLAGS])
|
||||
|
||||
# Add many warnings, except some...
|
||||
nw=
|
||||
# This, $nw, is the list of warnings we disable.
|
||||
nw="$nw -Wdeclaration-after-statement" # too useful to forbid
|
||||
nw="$nw -Waggregate-return" # anachronistic
|
||||
nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h)
|
||||
nw="$nw -Wc++-compat" # We don't care about C++ compilers
|
||||
nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
|
||||
nw="$nw -Wtraditional" # Warns on #elif which we use often
|
||||
@@ -80,6 +82,7 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
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
|
||||
# things I might fix soon:
|
||||
nw="$nw -Wfloat-equal" # sort.c, seq.c
|
||||
nw="$nw -Wmissing-format-attribute" # copy.c
|
||||
@@ -97,7 +100,13 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
|
||||
|
||||
# In spite of excluding -Wlogical-op above, it is enabled, as of
|
||||
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
|
||||
gl_WARN_ADD([-Wno-logical-op])
|
||||
|
||||
gl_WARN_ADD([-fdiagnostics-show-option])
|
||||
gl_WARN_ADD([-funit-at-a-time])
|
||||
|
||||
AC_SUBST([WARN_CFLAGS])
|
||||
|
||||
@@ -105,17 +114,25 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
AC_DEFINE([_FORTIFY_SOURCE], [2],
|
||||
[enable compile-time and run-time bounds-checking, and some warnings])
|
||||
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
|
||||
|
||||
# We use a slightly smaller set of warning options for lib/.
|
||||
# Remove the following and save the result in GNULIB_WARN_CFLAGS.
|
||||
nw=
|
||||
nw="$nw -Wuninitialized"
|
||||
nw="$nw -Wunused-macros"
|
||||
nw="$nw -Wmissing-prototypes"
|
||||
nw="$nw -Wold-style-definition"
|
||||
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
|
||||
AC_SUBST([GNULIB_WARN_CFLAGS])
|
||||
fi
|
||||
|
||||
AC_FUNC_FORK
|
||||
|
||||
optional_bin_progs=
|
||||
AC_CHECK_FUNCS([uname],
|
||||
gl_ADD_PROG([optional_bin_progs], [uname]))
|
||||
AC_CHECK_FUNCS([chroot],
|
||||
gl_ADD_PROG([optional_bin_progs], [chroot]))
|
||||
gl_ADD_PROG([optional_bin_progs], [chroot]))
|
||||
AC_CHECK_FUNCS([gethostid],
|
||||
gl_ADD_PROG([optional_bin_progs], [hostid]))
|
||||
gl_ADD_PROG([optional_bin_progs], [hostid]))
|
||||
|
||||
gl_WINSIZE_IN_PTEM
|
||||
|
||||
@@ -157,9 +174,9 @@ int main()
|
||||
[# If we have tzset, assume the worst when cross-compiling.
|
||||
utils_cv_localtime_cache=yes])
|
||||
else
|
||||
# If we lack tzset, report that localtime does not cache TZ,
|
||||
# since we can't invalidate the cache if we don't have tzset.
|
||||
utils_cv_localtime_cache=no
|
||||
# If we lack tzset, report that localtime does not cache TZ,
|
||||
# since we can't invalidate the cache if we don't have tzset.
|
||||
utils_cv_localtime_cache=no
|
||||
fi])dnl
|
||||
AC_MSG_RESULT([$utils_cv_localtime_cache])
|
||||
if test $utils_cv_localtime_cache = yes; then
|
||||
@@ -186,7 +203,7 @@ AC_CACHE_CHECK([for 3-argument setpriority function],
|
||||
[AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/resource.h>
|
||||
]],
|
||||
[[setpriority (0, 0, 0);]])],
|
||||
[utils_cv_func_setpriority=yes],
|
||||
@@ -314,6 +331,19 @@ if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
|
||||
gl_ADD_PROG([optional_bin_progs], [df])
|
||||
fi
|
||||
|
||||
# Limit stdbuf to ELF systems with GCC
|
||||
optional_pkglib_progs=
|
||||
AC_MSG_CHECKING([whether this is an ELF system])
|
||||
AC_EGREP_CPP([yes], [#if __ELF__
|
||||
yes
|
||||
#endif], [elf_sys=yes], [elf_sys=no])
|
||||
AC_MSG_RESULT([$elf_sys])
|
||||
if test "$elf_sys" = "yes" && \
|
||||
test "$GCC" = "yes"; then
|
||||
gl_ADD_PROG([optional_bin_progs], [stdbuf])
|
||||
gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so])
|
||||
fi
|
||||
|
||||
############################################################################
|
||||
mk="$srcdir/src/Makefile.am"
|
||||
# Extract all literal names from the definition of $(EXTRA_PROGRAMS)
|
||||
@@ -350,8 +380,8 @@ case $t in
|
||||
$no_install_progs_default) ;;
|
||||
*) AC_MSG_ERROR([[internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, $t,
|
||||
does not match the list of default-not-installed programs
|
||||
($no_install_progs_default) also recorded in $mk]],
|
||||
1) ;;
|
||||
($no_install_progs_default) also recorded in $mk]],
|
||||
1) ;;
|
||||
esac
|
||||
|
||||
# Given the name of a variable containing a space-separated list of
|
||||
@@ -386,6 +416,8 @@ MAN=`echo "$MAN"|sed 's/\@<:@\.1//'`
|
||||
|
||||
OPTIONAL_BIN_PROGS=`echo "$optional_bin_progs "|sed 's/ /\$(EXEEXT) /g;s/ $//'`
|
||||
AC_SUBST([OPTIONAL_BIN_PROGS])
|
||||
OPTIONAL_PKGLIB_PROGS=`echo "$optional_pkglib_progs " | sed 's/ $//'`
|
||||
AC_SUBST([OPTIONAL_PKGLIB_PROGS])
|
||||
NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
|
||||
AC_SUBST([NO_INSTALL_PROGS_DEFAULT])
|
||||
|
||||
@@ -397,8 +429,10 @@ CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am'
|
||||
AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
|
||||
############################################################################
|
||||
|
||||
# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
|
||||
# translatable strings, we must use need-formatstring-macros here.
|
||||
AM_GNU_GETTEXT([external], [need-formatstring-macros])
|
||||
AM_GNU_GETTEXT_VERSION([0.15])
|
||||
AM_GNU_GETTEXT_VERSION([0.17])
|
||||
|
||||
# For a test of uniq: it uses the $LOCALE_FR envvar.
|
||||
gt_LOCALE_FR
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# Most of this is probably too coreutils-centric to be useful to other packages.
|
||||
|
||||
warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
|
||||
bin=bin-$$$$
|
||||
|
||||
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
|
||||
@@ -118,9 +117,8 @@ my-distcheck: $(DIST_ARCHIVES) $(local-check)
|
||||
mkdir -p $(t)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --disable-nls \
|
||||
&& $(MAKE) CFLAGS='$(warn_cflags)' \
|
||||
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||
&& ./configure --enable-gcc-warnings --disable-nls \
|
||||
&& $(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(install-transform-check) \
|
||||
&& $(my-instcheck) \
|
||||
|
||||
@@ -2002,8 +2002,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -48,8 +48,10 @@ _W = (^|[^A-Za-z0-9_])
|
||||
W_ = ([^A-Za-z0-9_]|$$)
|
||||
|
||||
syntax_checks = \
|
||||
sc-avoid-builtin \
|
||||
sc-avoid-io \
|
||||
sc-avoid-non-zero \
|
||||
sc-avoid-path \
|
||||
sc-avoid-timezone \
|
||||
sc-avoid-zeroes \
|
||||
sc-exponent-grouping \
|
||||
@@ -70,9 +72,18 @@ check-texinfo: $(syntax_checks)
|
||||
$(PERL) -e 1 2> /dev/null && { $(PERL) -ne \
|
||||
'/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \
|
||||
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
|
||||
$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \
|
||||
exit $$fail
|
||||
|
||||
sc-avoid-builtin:
|
||||
$(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi \
|
||||
&& exit 1 || :
|
||||
|
||||
sc-avoid-path:
|
||||
$(AM_V_GEN)fail=0; \
|
||||
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
|
||||
| $(EGREP) -v 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
|
||||
| $(EGREP) -v \
|
||||
'PATH=|path search|search path|@vindex PATH$$|@env[{]PATH[}]' \
|
||||
&& fail=1; \
|
||||
exit $$fail
|
||||
|
||||
# Use `time zone', not `timezone'.
|
||||
|
||||
1425
doc/coreutils.texi
1425
doc/coreutils.texi
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
@c File mode bits
|
||||
|
||||
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008
|
||||
@c Free Software Foundation, Inc.
|
||||
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006,
|
||||
@c 2008-2009 Free Software Foundation, Inc.
|
||||
|
||||
@c Permission is granted to copy, distribute and/or modify this document
|
||||
@c under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
/* Iterate over arguments from argv or --files0-from=FILE
|
||||
Copyright (C) 2008 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
#include "argv-iter.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct argv_iterator
|
||||
{
|
||||
/* Test FP to determine whether in read-mode or argv-mode. */
|
||||
/* file-mode: fp records position */
|
||||
FILE *fp;
|
||||
size_t item_idx;
|
||||
char *tok;
|
||||
size_t buf_len;
|
||||
|
||||
/* argv-mode: record just argv and current pointer */
|
||||
char **arg_list;
|
||||
char **p;
|
||||
};
|
||||
|
||||
struct argv_iterator *
|
||||
argv_iter_init_argv (char **argv)
|
||||
{
|
||||
struct argv_iterator *ai = malloc (sizeof *ai);
|
||||
if (!ai)
|
||||
return NULL;
|
||||
ai->fp = NULL;
|
||||
ai->arg_list = argv;
|
||||
ai->p = argv;
|
||||
return ai;
|
||||
}
|
||||
|
||||
/* Initialize to read from the stream, FP.
|
||||
The input is expected to contain a list of NUL-delimited tokens. */
|
||||
struct argv_iterator *
|
||||
argv_iter_init_stream (FILE *fp)
|
||||
{
|
||||
struct argv_iterator *ai = malloc (sizeof *ai);
|
||||
if (!ai)
|
||||
return NULL;
|
||||
ai->fp = fp;
|
||||
ai->tok = NULL;
|
||||
ai->buf_len = 0;
|
||||
|
||||
ai->item_idx = 0;
|
||||
ai->arg_list = NULL;
|
||||
return ai;
|
||||
}
|
||||
|
||||
char *
|
||||
argv_iter (struct argv_iterator *ai, enum argv_iter_err *err)
|
||||
{
|
||||
if (ai->fp)
|
||||
{
|
||||
ssize_t len = getdelim (&ai->tok, &ai->buf_len, '\0', ai->fp);
|
||||
if (len < 0)
|
||||
{
|
||||
*err = feof (ai->fp) ? AI_ERR_EOF : AI_ERR_READ;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*err = AI_ERR_OK;
|
||||
ai->item_idx++;
|
||||
return ai->tok;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*(ai->p) == NULL)
|
||||
{
|
||||
*err = AI_ERR_EOF;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*err = AI_ERR_OK;
|
||||
return *(ai->p++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
argv_iter_n_args (struct argv_iterator const *ai)
|
||||
{
|
||||
return ai->fp ? ai->item_idx : ai->p - ai->arg_list;
|
||||
}
|
||||
|
||||
void
|
||||
argv_iter_free (struct argv_iterator *ai)
|
||||
{
|
||||
if (ai->fp)
|
||||
free (ai->tok);
|
||||
free (ai);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
@@ -1,47 +0,0 @@
|
||||
/* Iterate over arguments from argv or --files0-from=FILE
|
||||
Copyright (C) 2008-2009 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct argv_iterator;
|
||||
enum argv_iter_err;
|
||||
|
||||
#undef _ATTRIBUTE_NONNULL_
|
||||
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
|
||||
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
|
||||
#else
|
||||
# define _ATTRIBUTE_NONNULL_(m)
|
||||
#endif
|
||||
|
||||
enum argv_iter_err
|
||||
{
|
||||
AI_ERR_OK = 1,
|
||||
AI_ERR_EOF,
|
||||
AI_ERR_MEM,
|
||||
AI_ERR_READ
|
||||
};
|
||||
|
||||
struct argv_iterator *argv_iter_init_argv (char **argv)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
struct argv_iterator *argv_iter_init_stream (FILE *fp)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
char *argv_iter (struct argv_iterator *, enum argv_iter_err *)
|
||||
_ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);
|
||||
size_t argv_iter_n_args (struct argv_iterator const *)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
void argv_iter_free (struct argv_iterator *)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
@@ -129,7 +129,7 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
|
||||
|
||||
size_t
|
||||
mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
size_t *width, mbs_align_t align, int flags)
|
||||
size_t *width, mbs_align_t align, int flags _UNUSED_PARAMETER_)
|
||||
{
|
||||
size_t ret = -1;
|
||||
size_t src_size = strlen (src) + 1;
|
||||
@@ -219,7 +219,7 @@ mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
|
||||
dest = mbs_align_pad (dest, dest_end, start_spaces);
|
||||
dest = mempcpy(dest, str_to_print, MIN (n_used_bytes, dest_end - dest));
|
||||
dest = mbs_align_pad (dest, dest_end, end_spaces);
|
||||
mbs_align_pad (dest, dest_end, end_spaces);
|
||||
}
|
||||
|
||||
mbsalign_cleanup:
|
||||
@@ -229,8 +229,3 @@ mbsalign_cleanup:
|
||||
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
/* mgetgroups.c -- return a list of the groups a user is in
|
||||
|
||||
Copyright (C) 2007-2009 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Extracted from coreutils' src/id.c. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "mgetgroups.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#if HAVE_GETGROUPLIST
|
||||
# include <grp.h>
|
||||
#endif
|
||||
#include "getugroups.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
|
||||
static GETGROUPS_T *
|
||||
realloc_groupbuf (GETGROUPS_T *g, size_t num)
|
||||
{
|
||||
if (xalloc_oversized (num, sizeof (*g)))
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return realloc (g, num * sizeof (*g));
|
||||
}
|
||||
|
||||
/* Like getugroups, but store the result in malloc'd storage.
|
||||
Set *GROUPS to the malloc'd list of all group IDs of which USERNAME
|
||||
is a member. If GID is not -1, store it first. GID should be the
|
||||
group ID (pw_gid) obtained from getpwuid, in case USERNAME is not
|
||||
listed in the groups database (e.g., /etc/groups). Upon failure,
|
||||
don't modify *GROUPS, set errno, and return -1. Otherwise, return
|
||||
the number of groups. */
|
||||
|
||||
int
|
||||
mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
{
|
||||
int max_n_groups;
|
||||
int ng;
|
||||
GETGROUPS_T *g;
|
||||
|
||||
#if HAVE_GETGROUPLIST
|
||||
/* We prefer to use getgrouplist if available, because it has better
|
||||
performance characteristics.
|
||||
|
||||
In glibc 2.3.2, getgrouplist is buggy. If you pass a zero as the
|
||||
length of the output buffer, getgrouplist will still write to the
|
||||
buffer. Contrary to what some versions of the getgrouplist
|
||||
manpage say, this doesn't happen with nonzero buffer sizes.
|
||||
Therefore our usage here just avoids a zero sized buffer. */
|
||||
if (username)
|
||||
{
|
||||
enum { N_GROUPS_INIT = 10 };
|
||||
max_n_groups = N_GROUPS_INIT;
|
||||
|
||||
g = realloc_groupbuf (NULL, max_n_groups);
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
GETGROUPS_T *h;
|
||||
int last_n_groups = max_n_groups;
|
||||
|
||||
/* getgrouplist updates max_n_groups to num required. */
|
||||
ng = getgrouplist (username, gid, g, &max_n_groups);
|
||||
|
||||
/* Some systems (like Darwin) have a bug where they
|
||||
never increase max_n_groups. */
|
||||
if (ng < 0 && last_n_groups == max_n_groups)
|
||||
max_n_groups *= 2;
|
||||
|
||||
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
free (g);
|
||||
errno = saved_errno;
|
||||
return -1;
|
||||
}
|
||||
g = h;
|
||||
|
||||
if (0 <= ng)
|
||||
{
|
||||
*groups = g;
|
||||
/* On success some systems just return 0 from getgrouplist,
|
||||
so return max_n_groups rather than ng. */
|
||||
return max_n_groups;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* else no username, so fall through and use getgroups. */
|
||||
#endif
|
||||
|
||||
max_n_groups = (username
|
||||
? getugroups (0, NULL, username, gid)
|
||||
: getgroups (0, NULL));
|
||||
|
||||
/* If we failed to count groups with NULL for a buffer,
|
||||
try again with a non-NULL one, just in case. */
|
||||
if (max_n_groups < 0)
|
||||
max_n_groups = 5;
|
||||
|
||||
g = realloc_groupbuf (NULL, max_n_groups);
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
ng = (username
|
||||
? getugroups (max_n_groups, g, username, gid)
|
||||
: getgroups (max_n_groups, g));
|
||||
|
||||
if (ng < 0)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
free (g);
|
||||
errno = saved_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*groups = g;
|
||||
return ng;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/* Get a list of all group IDs associated with a specified user ID.
|
||||
Copyright (C) 2007 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int mgetgroups (const char *username, gid_t gid, GETGROUPS_T **groups);
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Bob Jenkins's cryptographic random number generator, ISAAC.
|
||||
|
||||
Copyright (C) 1999-2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Colin Plumb.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -43,7 +43,7 @@
|
||||
/* This index operation is more efficient on many processors */
|
||||
#define ind(mm, x) \
|
||||
(* (uint32_t *) ((char *) (mm) \
|
||||
+ ((x) & (ISAAC_WORDS - 1) * sizeof (uint32_t))))
|
||||
+ ((x) & (ISAAC_WORDS - 1) * sizeof (uint32_t))))
|
||||
|
||||
/*
|
||||
* The central step. This uses two temporaries, x and y. mm is the
|
||||
@@ -191,18 +191,18 @@ isaac_init (struct isaac_state *s, uint32_t const *seed, size_t seedsize)
|
||||
isaac_mix (s, seed);
|
||||
/* Second and subsequent passes (extension to ISAAC) */
|
||||
while (seedsize -= ISAAC_BYTES)
|
||||
{
|
||||
seed += ISAAC_WORDS;
|
||||
for (i = 0; i < ISAAC_WORDS; i++)
|
||||
s->mm[i] += seed[i];
|
||||
isaac_mix (s, s->mm);
|
||||
}
|
||||
{
|
||||
seed += ISAAC_WORDS;
|
||||
for (i = 0; i < ISAAC_WORDS; i++)
|
||||
s->mm[i] += seed[i];
|
||||
isaac_mix (s, s->mm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The no seed case (as in reference ISAAC code) */
|
||||
for (i = 0; i < ISAAC_WORDS; i++)
|
||||
s->mm[i] = 0;
|
||||
s->mm[i] = 0;
|
||||
}
|
||||
|
||||
/* Final pass */
|
||||
@@ -252,7 +252,7 @@ isaac_seed_data (struct isaac_state *s, void const *buffer, size_t size)
|
||||
{
|
||||
p = (unsigned char *) s->mm + s->c;
|
||||
for (i = 0; i < avail; i++)
|
||||
p[i] ^= buf[i];
|
||||
p[i] ^= buf[i];
|
||||
buf += avail;
|
||||
size -= avail;
|
||||
isaac_mix (s, s->mm);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Bob Jenkins's cryptographic random number generator, ISAAC.
|
||||
|
||||
Copyright (C) 1999-2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2005, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Colin Plumb.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
114
gl/lib/randint.c
114
gl/lib/randint.c
@@ -1,6 +1,6 @@
|
||||
/* Generate random integers.
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009 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
|
||||
@@ -128,75 +128,75 @@ randint_genmax (struct randint_source *s, randint genmax)
|
||||
for (;;)
|
||||
{
|
||||
if (randmax < genmax)
|
||||
{
|
||||
/* Calculate how many input bytes will be needed, and read
|
||||
the bytes. */
|
||||
{
|
||||
/* Calculate how many input bytes will be needed, and read
|
||||
the bytes. */
|
||||
|
||||
size_t i = 0;
|
||||
randint rmax = randmax;
|
||||
unsigned char buf[sizeof randnum];
|
||||
size_t i = 0;
|
||||
randint rmax = randmax;
|
||||
unsigned char buf[sizeof randnum];
|
||||
|
||||
do
|
||||
{
|
||||
rmax = shift_left (rmax) + UCHAR_MAX;
|
||||
i++;
|
||||
}
|
||||
while (rmax < genmax);
|
||||
do
|
||||
{
|
||||
rmax = shift_left (rmax) + UCHAR_MAX;
|
||||
i++;
|
||||
}
|
||||
while (rmax < genmax);
|
||||
|
||||
randread (source, buf, i);
|
||||
randread (source, buf, i);
|
||||
|
||||
/* Increase RANDMAX by appending random bytes to RANDNUM and
|
||||
UCHAR_MAX to RANDMAX until RANDMAX is no less than
|
||||
GENMAX. This may lose up to CHAR_BIT bits of information
|
||||
if shift_right (RANDINT_MAX) < GENMAX, but it is not
|
||||
worth the programming hassle of saving these bits since
|
||||
GENMAX is rarely that large in practice. */
|
||||
/* Increase RANDMAX by appending random bytes to RANDNUM and
|
||||
UCHAR_MAX to RANDMAX until RANDMAX is no less than
|
||||
GENMAX. This may lose up to CHAR_BIT bits of information
|
||||
if shift_right (RANDINT_MAX) < GENMAX, but it is not
|
||||
worth the programming hassle of saving these bits since
|
||||
GENMAX is rarely that large in practice. */
|
||||
|
||||
i = 0;
|
||||
i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
randnum = shift_left (randnum) + buf[i];
|
||||
randmax = shift_left (randmax) + UCHAR_MAX;
|
||||
i++;
|
||||
}
|
||||
while (randmax < genmax);
|
||||
}
|
||||
do
|
||||
{
|
||||
randnum = shift_left (randnum) + buf[i];
|
||||
randmax = shift_left (randmax) + UCHAR_MAX;
|
||||
i++;
|
||||
}
|
||||
while (randmax < genmax);
|
||||
}
|
||||
|
||||
if (randmax == genmax)
|
||||
{
|
||||
s->randnum = s->randmax = 0;
|
||||
return randnum;
|
||||
}
|
||||
{
|
||||
s->randnum = s->randmax = 0;
|
||||
return randnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* GENMAX < RANDMAX, so attempt to generate a random number
|
||||
by taking RANDNUM modulo GENMAX+1. This will choose
|
||||
fairly so long as RANDNUM falls within an integral
|
||||
multiple of GENMAX+1; otherwise, LAST_USABLE_CHOICE < RANDNUM,
|
||||
so discard this attempt and try again.
|
||||
{
|
||||
/* GENMAX < RANDMAX, so attempt to generate a random number
|
||||
by taking RANDNUM modulo GENMAX+1. This will choose
|
||||
fairly so long as RANDNUM falls within an integral
|
||||
multiple of GENMAX+1; otherwise, LAST_USABLE_CHOICE < RANDNUM,
|
||||
so discard this attempt and try again.
|
||||
|
||||
Since GENMAX cannot be RANDINT_MAX, CHOICES cannot be
|
||||
zero and there is no need to worry about dividing by
|
||||
zero. */
|
||||
Since GENMAX cannot be RANDINT_MAX, CHOICES cannot be
|
||||
zero and there is no need to worry about dividing by
|
||||
zero. */
|
||||
|
||||
randint excess_choices = randmax - genmax;
|
||||
randint unusable_choices = excess_choices % choices;
|
||||
randint last_usable_choice = randmax - unusable_choices;
|
||||
randint reduced_randnum = randnum % choices;
|
||||
randint excess_choices = randmax - genmax;
|
||||
randint unusable_choices = excess_choices % choices;
|
||||
randint last_usable_choice = randmax - unusable_choices;
|
||||
randint reduced_randnum = randnum % choices;
|
||||
|
||||
if (randnum <= last_usable_choice)
|
||||
{
|
||||
s->randnum = randnum / choices;
|
||||
s->randmax = excess_choices / choices;
|
||||
return reduced_randnum;
|
||||
}
|
||||
if (randnum <= last_usable_choice)
|
||||
{
|
||||
s->randnum = randnum / choices;
|
||||
s->randmax = excess_choices / choices;
|
||||
return reduced_randnum;
|
||||
}
|
||||
|
||||
/* Retry, but retain the randomness from the fact that RANDNUM fell
|
||||
into the range LAST_USABLE_CHOICE+1 .. RANDMAX. */
|
||||
randnum = reduced_randnum;
|
||||
randmax = unusable_choices - 1;
|
||||
}
|
||||
/* Retry, but retain the randomness from the fact that RANDNUM fell
|
||||
into the range LAST_USABLE_CHOICE+1 .. RANDMAX. */
|
||||
randnum = reduced_randnum;
|
||||
randmax = unusable_choices - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate random integers.
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009 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, 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2007, 2009 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
|
||||
@@ -79,21 +79,21 @@ randperm_new (struct randint_source *r, size_t h, size_t n)
|
||||
|
||||
default:
|
||||
{
|
||||
size_t i;
|
||||
size_t i;
|
||||
|
||||
v = xnmalloc (n, sizeof *v);
|
||||
for (i = 0; i < n; i++)
|
||||
v[i] = i;
|
||||
v = xnmalloc (n, sizeof *v);
|
||||
for (i = 0; i < n; i++)
|
||||
v[i] = i;
|
||||
|
||||
for (i = 0; i < h; i++)
|
||||
{
|
||||
size_t j = i + randint_choose (r, n - i);
|
||||
size_t t = v[i];
|
||||
v[i] = v[j];
|
||||
v[j] = t;
|
||||
}
|
||||
for (i = 0; i < h; i++)
|
||||
{
|
||||
size_t j = i + randint_choose (r, n - i);
|
||||
size_t t = v[i];
|
||||
v[i] = v[j];
|
||||
v[j] = t;
|
||||
}
|
||||
|
||||
v = xnrealloc (v, h, sizeof *v);
|
||||
v = xnrealloc (v, h, sizeof *v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ struct randread_source
|
||||
/* Up to a buffer's worth of pseudorandom data. */
|
||||
union
|
||||
{
|
||||
uint32_t w[ISAAC_WORDS];
|
||||
unsigned char b[ISAAC_BYTES];
|
||||
uint32_t w[ISAAC_WORDS];
|
||||
unsigned char b[ISAAC_BYTES];
|
||||
} data;
|
||||
} isaac;
|
||||
} buf;
|
||||
@@ -115,8 +115,8 @@ randread_error (void const *file_name)
|
||||
{
|
||||
if (file_name)
|
||||
error (exit_failure, errno,
|
||||
_(errno == 0 ? "%s: end of file" : "%s: read error"),
|
||||
quotearg_colon (file_name));
|
||||
_(errno == 0 ? "%s: end of file" : "%s: read error"),
|
||||
quotearg_colon (file_name));
|
||||
abort ();
|
||||
}
|
||||
|
||||
@@ -155,18 +155,18 @@ randread_new (char const *name, size_t bytes_bound)
|
||||
struct randread_source *s;
|
||||
|
||||
if (name)
|
||||
if (! (source = fopen_safer (name, "rb")))
|
||||
return NULL;
|
||||
if (! (source = fopen_safer (name, "rb")))
|
||||
return NULL;
|
||||
|
||||
s = simple_new (source, name);
|
||||
|
||||
if (source)
|
||||
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
|
||||
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
|
||||
else
|
||||
{
|
||||
s->buf.isaac.buffered = 0;
|
||||
isaac_seed (&s->buf.isaac.state);
|
||||
}
|
||||
{
|
||||
s->buf.isaac.buffered = 0;
|
||||
isaac_seed (&s->buf.isaac.state);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ readsource (struct randread_source *s, unsigned char *p, size_t size)
|
||||
p += inbytes;
|
||||
size -= inbytes;
|
||||
if (size == 0)
|
||||
break;
|
||||
break;
|
||||
errno = (ferror (s->source) ? fread_errno : 0);
|
||||
s->handler (s->handler_arg);
|
||||
}
|
||||
@@ -224,34 +224,34 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
|
||||
for (;;)
|
||||
{
|
||||
if (size <= inbytes)
|
||||
{
|
||||
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, size);
|
||||
isaac->buffered = inbytes - size;
|
||||
return;
|
||||
}
|
||||
{
|
||||
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, size);
|
||||
isaac->buffered = inbytes - size;
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, inbytes);
|
||||
p += inbytes;
|
||||
size -= inbytes;
|
||||
|
||||
/* If P is aligned, write to *P directly to avoid the overhead
|
||||
of copying from the buffer. */
|
||||
of copying from the buffer. */
|
||||
if (ALIGNED_POINTER (p, uint32_t))
|
||||
{
|
||||
uint32_t *wp = (uint32_t *) p;
|
||||
while (ISAAC_BYTES <= size)
|
||||
{
|
||||
isaac_refill (&isaac->state, wp);
|
||||
wp += ISAAC_WORDS;
|
||||
size -= ISAAC_BYTES;
|
||||
if (size == 0)
|
||||
{
|
||||
isaac->buffered = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
p = (unsigned char *) wp;
|
||||
}
|
||||
{
|
||||
uint32_t *wp = (uint32_t *) p;
|
||||
while (ISAAC_BYTES <= size)
|
||||
{
|
||||
isaac_refill (&isaac->state, wp);
|
||||
wp += ISAAC_WORDS;
|
||||
size -= ISAAC_BYTES;
|
||||
if (size == 0)
|
||||
{
|
||||
isaac->buffered = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
p = (unsigned char *) wp;
|
||||
}
|
||||
|
||||
isaac_refill (&isaac->state, isaac->data.w);
|
||||
inbytes = ISAAC_BYTES;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
82
gl/lib/regcomp.c.diff
Normal file
82
gl/lib/regcomp.c.diff
Normal file
@@ -0,0 +1,82 @@
|
||||
diff --git c/lib/regcomp.c i/lib/regcomp.c
|
||||
index 6472ff6..665b2ab 100644
|
||||
--- c/lib/regcomp.c
|
||||
+++ i/lib/regcomp.c
|
||||
@@ -18,6 +18,8 @@
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
+#include "intprops.h"
|
||||
+#include "verify.h"
|
||||
static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
|
||||
size_t length, reg_syntax_t syntax);
|
||||
static void re_compile_fastmap_iter (regex_t *bufp,
|
||||
@@ -541,7 +543,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
|
||||
size_t errbuf_size;
|
||||
#else /* size_t might promote */
|
||||
size_t
|
||||
-regerror (int errcode, const regex_t *_Restrict_ preg,
|
||||
+regerror (int errcode, const regex_t *_Restrict_ preg _UNUSED_PARAMETER_,
|
||||
char *_Restrict_ errbuf, size_t errbuf_size)
|
||||
#endif
|
||||
{
|
||||
@@ -1375,7 +1377,7 @@ calc_first (void *extra, bin_tree_t *node)
|
||||
|
||||
/* Pass 2: compute NEXT on the tree. Preorder visit. */
|
||||
static reg_errcode_t
|
||||
-calc_next (void *extra, bin_tree_t *node)
|
||||
+calc_next (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
|
||||
{
|
||||
switch (node->token.type)
|
||||
{
|
||||
@@ -2571,7 +2573,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
|
||||
/* This loop is actually executed only when end != REG_MISSING,
|
||||
to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?... We have
|
||||
already created the start+1-th copy. */
|
||||
- if ((Idx) -1 < 0 || end != REG_MISSING)
|
||||
+ verify (! TYPE_SIGNED (Idx));
|
||||
+ if (end != REG_MISSING)
|
||||
for (i = start + 2; i <= end; ++i)
|
||||
{
|
||||
elem = duplicate_tree (elem, dfa);
|
||||
@@ -2731,7 +2734,8 @@ static reg_errcode_t
|
||||
internal_function
|
||||
build_collating_symbol (bitset_t sbcset,
|
||||
# ifdef RE_ENABLE_I18N
|
||||
- re_charset_t *mbcset, Idx *coll_sym_alloc,
|
||||
+ re_charset_t *mbcset _UNUSED_PARAMETER_,
|
||||
+ Idx *coll_sym_alloc _UNUSED_PARAMETER_,
|
||||
# endif
|
||||
const unsigned char *name)
|
||||
{
|
||||
@@ -3309,7 +3313,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
|
||||
|
||||
static reg_errcode_t
|
||||
parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
|
||||
- re_token_t *token, int token_len, re_dfa_t *dfa,
|
||||
+ re_token_t *token, int token_len,
|
||||
+ re_dfa_t *dfa _UNUSED_PARAMETER_,
|
||||
reg_syntax_t syntax, bool accept_hyphen)
|
||||
{
|
||||
#ifdef RE_ENABLE_I18N
|
||||
@@ -3396,8 +3401,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
|
||||
|
||||
static reg_errcode_t
|
||||
#ifdef RE_ENABLE_I18N
|
||||
-build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
|
||||
- Idx *equiv_class_alloc, const unsigned char *name)
|
||||
+build_equiv_class (bitset_t sbcset, re_charset_t *mbcset _UNUSED_PARAMETER_,
|
||||
+ Idx *equiv_class_alloc _UNUSED_PARAMETER_,
|
||||
+ const unsigned char *name)
|
||||
#else /* not RE_ENABLE_I18N */
|
||||
build_equiv_class (bitset_t sbcset, const unsigned char *name)
|
||||
#endif /* not RE_ENABLE_I18N */
|
||||
@@ -3798,7 +3804,7 @@ free_token (re_token_t *node)
|
||||
and its children. */
|
||||
|
||||
static reg_errcode_t
|
||||
-free_tree (void *extra, bin_tree_t *node)
|
||||
+free_tree (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
|
||||
{
|
||||
free_token (&node->token);
|
||||
return REG_NOERROR;
|
||||
25
gl/lib/regex_internal.c.diff
Normal file
25
gl/lib/regex_internal.c.diff
Normal file
@@ -0,0 +1,25 @@
|
||||
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
|
||||
index 904b88e..61c8d9d 100644
|
||||
--- a/lib/regex_internal.c
|
||||
+++ b/lib/regex_internal.c
|
||||
@@ -18,6 +18,8 @@
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
+#include "verify.h"
|
||||
+#include "intprops.h"
|
||||
static void re_string_construct_common (const char *str, Idx len,
|
||||
re_string_t *pstr,
|
||||
RE_TRANSLATE_TYPE trans, bool icase,
|
||||
@@ -1390,7 +1392,10 @@ static void
|
||||
internal_function
|
||||
re_node_set_remove_at (re_node_set *set, Idx idx)
|
||||
{
|
||||
- if (idx < 0 || idx >= set->nelem)
|
||||
+ verify (! TYPE_SIGNED (Idx));
|
||||
+ /* if (idx < 0)
|
||||
+ return; */
|
||||
+ if (idx >= set->nelem)
|
||||
return;
|
||||
--set->nelem;
|
||||
for (; idx < set->nelem; idx++)
|
||||
14
gl/lib/regex_internal.h.diff
Normal file
14
gl/lib/regex_internal.h.diff
Normal file
@@ -0,0 +1,14 @@
|
||||
diff --git i/lib/regex_internal.h w/lib/regex_internal.h
|
||||
index 859832f..3c7fe06 100644
|
||||
--- i/lib/regex_internal.h
|
||||
+++ w/lib/regex_internal.h
|
||||
@@ -826,7 +826,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
|
||||
|
||||
static int
|
||||
internal_function __attribute ((pure))
|
||||
-re_string_elem_size_at (const re_string_t *pstr, Idx idx)
|
||||
+re_string_elem_size_at (const re_string_t *pstr _UNUSED_PARAMETER_,
|
||||
+ Idx idx _UNUSED_PARAMETER_)
|
||||
{
|
||||
# ifdef _LIBC
|
||||
const unsigned char *p, *extra;
|
||||
45
gl/lib/regexec.c.diff
Normal file
45
gl/lib/regexec.c.diff
Normal file
@@ -0,0 +1,45 @@
|
||||
diff --git a/lib/regexec.c b/lib/regexec.c
|
||||
index 21a8166..7762437 100644
|
||||
--- a/lib/regexec.c
|
||||
+++ b/lib/regexec.c
|
||||
@@ -18,6 +18,8 @@
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
+#include "verify.h"
|
||||
+#include "intprops.h"
|
||||
static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
|
||||
Idx n) internal_function;
|
||||
static void match_ctx_clean (re_match_context_t *mctx) internal_function;
|
||||
@@ -378,8 +380,11 @@ re_search_2_stub (struct re_pattern_buffer *bufp,
|
||||
Idx len = length1 + length2;
|
||||
char *s = NULL;
|
||||
|
||||
- if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0))
|
||||
- return -2;
|
||||
+ verify (! TYPE_SIGNED (Idx));
|
||||
+ if (BE (len < length1, 0))
|
||||
+ return -2;
|
||||
+ /* if (BE (length1 < 0 || length2 < 0 || stop < 0, 0))
|
||||
+ return -2; */
|
||||
|
||||
/* Concatenate the strings. */
|
||||
if (length2 > 0)
|
||||
@@ -431,11 +436,14 @@ re_search_stub (struct re_pattern_buffer *bufp,
|
||||
Idx last_start = start + range;
|
||||
|
||||
/* Check for out-of-range. */
|
||||
- if (BE (start < 0 || start > length, 0))
|
||||
- return -1;
|
||||
+ verify (! TYPE_SIGNED (Idx));
|
||||
+ /* if (BE (start < 0, 0))
|
||||
+ return -1; */
|
||||
+ if (BE (start > length, 0))
|
||||
+ return -1;
|
||||
if (BE (length < last_start || (0 <= range && last_start < start), 0))
|
||||
last_start = length;
|
||||
- else if (BE (last_start < 0 || (range < 0 && start <= last_start), 0))
|
||||
+ else if (BE (/* last_start < 0 || */ (range < 0 && start <= last_start), 0))
|
||||
last_start = 0;
|
||||
|
||||
__libc_lock_lock (dfa->lock);
|
||||
@@ -1,5 +1,5 @@
|
||||
/* root-dev-ino.c -- get the device and inode numbers for `/'.
|
||||
Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2005, 2006, 2009 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, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2006, 2009 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
|
||||
@@ -34,12 +34,12 @@ get_root_dev_ino (struct dev_ino *root_d_i);
|
||||
do \
|
||||
{ \
|
||||
if (STREQ (Dirname, "/")) \
|
||||
error (0, 0, _("it is dangerous to operate recursively on %s"), \
|
||||
quote (Dirname)); \
|
||||
error (0, 0, _("it is dangerous to operate recursively on %s"), \
|
||||
quote (Dirname)); \
|
||||
else \
|
||||
error (0, 0, \
|
||||
_("it is dangerous to operate recursively on %s (same as %s)"), \
|
||||
quote_n (0, Dirname), quote_n (1, "/")); \
|
||||
error (0, 0, \
|
||||
_("it is dangerous to operate recursively on %s (same as %s)"), \
|
||||
quote_n (0, Dirname), quote_n (1, "/")); \
|
||||
error (0, 0, _("use --no-preserve-root to override this failsafe")); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/* openat-style fd-relative functions for SE Linux
|
||||
Copyright (C) 2007, 2009 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "selinux-at.h"
|
||||
#include "openat.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
|
||||
#include "save-cwd.h"
|
||||
|
||||
#include "openat-priv.h"
|
||||
|
||||
#define AT_FUNC_NAME getfileconat
|
||||
#define AT_FUNC_F1 getfilecon
|
||||
#define AT_FUNC_F2 getfilecon
|
||||
#define AT_FUNC_USE_F1_COND 1
|
||||
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t *con
|
||||
#define AT_FUNC_POST_FILE_ARGS , con
|
||||
#include "at-func.c"
|
||||
#undef AT_FUNC_NAME
|
||||
#undef AT_FUNC_F1
|
||||
#undef AT_FUNC_F2
|
||||
#undef AT_FUNC_USE_F1_COND
|
||||
#undef AT_FUNC_POST_FILE_PARAM_DECLS
|
||||
#undef AT_FUNC_POST_FILE_ARGS
|
||||
|
||||
#define AT_FUNC_NAME lgetfileconat
|
||||
#define AT_FUNC_F1 lgetfilecon
|
||||
#define AT_FUNC_F2 lgetfilecon
|
||||
#define AT_FUNC_USE_F1_COND 1
|
||||
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t *con
|
||||
#define AT_FUNC_POST_FILE_ARGS , con
|
||||
#include "at-func.c"
|
||||
#undef AT_FUNC_NAME
|
||||
#undef AT_FUNC_F1
|
||||
#undef AT_FUNC_F2
|
||||
#undef AT_FUNC_USE_F1_COND
|
||||
#undef AT_FUNC_POST_FILE_PARAM_DECLS
|
||||
#undef AT_FUNC_POST_FILE_ARGS
|
||||
|
||||
#define AT_FUNC_NAME setfileconat
|
||||
#define AT_FUNC_F1 setfilecon
|
||||
#define AT_FUNC_F2 setfilecon
|
||||
#define AT_FUNC_USE_F1_COND 1
|
||||
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t con
|
||||
#define AT_FUNC_POST_FILE_ARGS , con
|
||||
#include "at-func.c"
|
||||
#undef AT_FUNC_NAME
|
||||
#undef AT_FUNC_F1
|
||||
#undef AT_FUNC_F2
|
||||
#undef AT_FUNC_USE_F1_COND
|
||||
#undef AT_FUNC_POST_FILE_PARAM_DECLS
|
||||
#undef AT_FUNC_POST_FILE_ARGS
|
||||
|
||||
#define AT_FUNC_NAME lsetfileconat
|
||||
#define AT_FUNC_F1 lsetfilecon
|
||||
#define AT_FUNC_F2 lsetfilecon
|
||||
#define AT_FUNC_USE_F1_COND 1
|
||||
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t con
|
||||
#define AT_FUNC_POST_FILE_ARGS , con
|
||||
#include "at-func.c"
|
||||
#undef AT_FUNC_NAME
|
||||
#undef AT_FUNC_F1
|
||||
#undef AT_FUNC_F2
|
||||
#undef AT_FUNC_USE_F1_COND
|
||||
#undef AT_FUNC_POST_FILE_PARAM_DECLS
|
||||
#undef AT_FUNC_POST_FILE_ARGS
|
||||
@@ -1,23 +0,0 @@
|
||||
/* Prototypes for openat-style fd-relative SELinux functions
|
||||
Copyright (C) 2007 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <selinux/selinux.h>
|
||||
#include <selinux/context.h>
|
||||
|
||||
int getfileconat (int fd, char const *file, security_context_t *con);
|
||||
int lgetfileconat (int fd, char const *file, security_context_t *con);
|
||||
int setfileconat (int fd, char const *file, security_context_t con);
|
||||
int lsetfileconat (int fd, char const *file, security_context_t con);
|
||||
@@ -1,301 +0,0 @@
|
||||
/* tempname.c - generate the name of a temporary file.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
2000, 2001, 2002, 2003, 2005, 2006, 2007 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */
|
||||
|
||||
#if !_LIBC
|
||||
# include <config.h>
|
||||
# include "tempname.h"
|
||||
# include "randint.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef __set_errno
|
||||
# define __set_errno(Val) errno = (Val)
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef P_tmpdir
|
||||
# define P_tmpdir "/tmp"
|
||||
#endif
|
||||
#ifndef TMP_MAX
|
||||
# define TMP_MAX 238328
|
||||
#endif
|
||||
#ifndef __GT_FILE
|
||||
# define __GT_FILE 0
|
||||
# define __GT_BIGFILE 1
|
||||
# define __GT_DIR 2
|
||||
# define __GT_NOCREATE 3
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if _LIBC
|
||||
# define struct_stat64 struct stat64
|
||||
# define small_open __open
|
||||
# define large_open __open64
|
||||
#else
|
||||
# define struct_stat64 struct stat
|
||||
# define small_open open
|
||||
# define large_open open
|
||||
# define __gen_tempname gen_tempname
|
||||
# define __getpid getpid
|
||||
# define __gettimeofday gettimeofday
|
||||
# define __mkdir mkdir
|
||||
# define __lxstat64(version, file, buf) lstat (file, buf)
|
||||
# define __xstat64(version, file, buf) stat (file, buf)
|
||||
#endif
|
||||
|
||||
#if ! (HAVE___SECURE_GETENV || _LIBC)
|
||||
# define __secure_getenv getenv
|
||||
#endif
|
||||
|
||||
#if _LIBC
|
||||
/* Return nonzero if DIR is an existent directory. */
|
||||
static int
|
||||
direxists (const char *dir)
|
||||
{
|
||||
struct_stat64 buf;
|
||||
return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
|
||||
}
|
||||
|
||||
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
|
||||
non-null and exists, uses it; otherwise uses the first of $TMPDIR,
|
||||
P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
|
||||
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
|
||||
doesn't exist, none of the searched dirs exists, or there's not
|
||||
enough space in TMPL. */
|
||||
int
|
||||
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
|
||||
int try_tmpdir)
|
||||
{
|
||||
const char *d;
|
||||
size_t dlen, plen;
|
||||
|
||||
if (!pfx || !pfx[0])
|
||||
{
|
||||
pfx = "file";
|
||||
plen = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
plen = strlen (pfx);
|
||||
if (plen > 5)
|
||||
plen = 5;
|
||||
}
|
||||
|
||||
if (try_tmpdir)
|
||||
{
|
||||
d = __secure_getenv ("TMPDIR");
|
||||
if (d != NULL && direxists (d))
|
||||
dir = d;
|
||||
else if (dir != NULL && direxists (dir))
|
||||
/* nothing */ ;
|
||||
else
|
||||
dir = NULL;
|
||||
}
|
||||
if (dir == NULL)
|
||||
{
|
||||
if (direxists (P_tmpdir))
|
||||
dir = P_tmpdir;
|
||||
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
|
||||
dir = "/tmp";
|
||||
else
|
||||
{
|
||||
__set_errno (ENOENT);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dlen = strlen (dir);
|
||||
while (dlen > 1 && dir[dlen - 1] == '/')
|
||||
dlen--; /* remove trailing slashes */
|
||||
|
||||
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
|
||||
if (tmpl_len < dlen + 1 + plen + 6 + 1)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
|
||||
return 0;
|
||||
}
|
||||
#endif /* _LIBC */
|
||||
|
||||
static inline bool
|
||||
check_x_suffix (char const *s, size_t len)
|
||||
{
|
||||
return strspn (s, "X") == len;
|
||||
}
|
||||
|
||||
/* These are the characters used in temporary file names. */
|
||||
static const char letters[] =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
/* Generate a temporary file name based on TMPL. TMPL must end in a
|
||||
a sequence of at least X_SUFFIX_LEN "X"s. The name constructed
|
||||
does not exist at the time of the call to __gen_tempname. TMPL is
|
||||
overwritten with the result.
|
||||
|
||||
KIND may be one of:
|
||||
__GT_NOCREATE: simply verify that the name does not exist
|
||||
at the time of the call.
|
||||
__GT_FILE: create the file using open(O_CREAT|O_EXCL)
|
||||
and return a read-write fd. The file is mode 0600.
|
||||
__GT_BIGFILE: same as __GT_FILE but use open64().
|
||||
__GT_DIR: create a directory, which will be mode 0700.
|
||||
|
||||
We use a clever algorithm to get hard-to-predict names. */
|
||||
int
|
||||
gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len)
|
||||
{
|
||||
size_t len;
|
||||
char *XXXXXX;
|
||||
unsigned int count;
|
||||
int fd = -1;
|
||||
int save_errno = errno;
|
||||
struct_stat64 st;
|
||||
struct randint_source *rand_src;
|
||||
|
||||
/* A lower bound on the number of temporary files to attempt to
|
||||
generate. The maximum total number of temporary file names that
|
||||
can exist for a given template is 62**6. It should never be
|
||||
necessary to try all these combinations. Instead if a reasonable
|
||||
number of names is tried (we define reasonable as 62**3) fail to
|
||||
give the system administrator the chance to remove the problems. */
|
||||
#define ATTEMPTS_MIN (62 * 62 * 62)
|
||||
|
||||
/* The number of times to attempt to generate a temporary file. To
|
||||
conform to POSIX, this must be no smaller than TMP_MAX. */
|
||||
#if ATTEMPTS_MIN < TMP_MAX
|
||||
unsigned int attempts = TMP_MAX;
|
||||
#else
|
||||
unsigned int attempts = ATTEMPTS_MIN;
|
||||
#endif
|
||||
|
||||
len = strlen (tmpl);
|
||||
if (len < x_suffix_len || ! check_x_suffix (&tmpl[len - x_suffix_len],
|
||||
x_suffix_len))
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rand_src = randint_all_new (NULL, 8);
|
||||
if (! rand_src)
|
||||
return -1;
|
||||
|
||||
/* This is where the Xs start. */
|
||||
XXXXXX = &tmpl[len - x_suffix_len];
|
||||
|
||||
for (count = 0; count < attempts; ++count)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < x_suffix_len; i++)
|
||||
{
|
||||
XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
|
||||
}
|
||||
|
||||
switch (kind)
|
||||
{
|
||||
case __GT_FILE:
|
||||
fd = small_open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
break;
|
||||
|
||||
case __GT_BIGFILE:
|
||||
fd = large_open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
break;
|
||||
|
||||
case __GT_DIR:
|
||||
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||
break;
|
||||
|
||||
case __GT_NOCREATE:
|
||||
/* This case is backward from the other three. This function
|
||||
succeeds if __xstat fails because the name does not exist.
|
||||
Note the continue to bypass the common logic at the bottom
|
||||
of the loop. */
|
||||
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
fd = 0;
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Give up now. */
|
||||
fd = -1;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
default:
|
||||
assert (! "invalid KIND in __gen_tempname");
|
||||
}
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
goto done;
|
||||
}
|
||||
else if (errno != EEXIST)
|
||||
{
|
||||
fd = -1;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
randint_all_free (rand_src);
|
||||
|
||||
/* We got out of the loop because we ran out of combinations to try. */
|
||||
__set_errno (EEXIST);
|
||||
return -1;
|
||||
|
||||
done:
|
||||
{
|
||||
int saved_errno = errno;
|
||||
randint_all_free (rand_src);
|
||||
__set_errno (saved_errno);
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
int
|
||||
__gen_tempname (char *tmpl, int kind)
|
||||
{
|
||||
return gen_tempname_len (tmpl, kind, 6);
|
||||
}
|
||||
193
gl/lib/tempname.c.diff
Normal file
193
gl/lib/tempname.c.diff
Normal file
@@ -0,0 +1,193 @@
|
||||
diff --git c/lib/tempname.c i/lib/tempname.c
|
||||
index 2da5afe..562955a 100644
|
||||
--- c/lib/tempname.c
|
||||
+++ i/lib/tempname.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#if !_LIBC
|
||||
# include <config.h>
|
||||
# include "tempname.h"
|
||||
+# include "randint.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -49,6 +50,7 @@
|
||||
# error report this to bug-gnulib@gnu.org
|
||||
#endif
|
||||
|
||||
+#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -179,14 +181,21 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
|
||||
}
|
||||
#endif /* _LIBC */
|
||||
|
||||
+static inline bool
|
||||
+check_x_suffix (char const *s, size_t len)
|
||||
+{
|
||||
+ return len <= strspn (s, "X");
|
||||
+}
|
||||
+
|
||||
/* These are the characters used in temporary file names. */
|
||||
static const char letters[] =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
/* Generate a temporary file name based on TMPL. TMPL must match the
|
||||
- rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
|
||||
+ rules for mk[s]temp (i.e. end in at least X_SUFFIX_LEN "X"s,
|
||||
+ possibly with a suffix).
|
||||
The name constructed does not exist at the time of the call to
|
||||
- __gen_tempname. TMPL is overwritten with the result.
|
||||
+ this function. TMPL is overwritten with the result.
|
||||
|
||||
KIND may be one of:
|
||||
__GT_NOCREATE: simply verify that the name does not exist
|
||||
@@ -197,23 +206,24 @@ static const char letters[] =
|
||||
|
||||
We use a clever algorithm to get hard-to-predict names. */
|
||||
int
|
||||
-__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
+gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
|
||||
+ size_t x_suffix_len)
|
||||
{
|
||||
- int len;
|
||||
+ size_t len;
|
||||
char *XXXXXX;
|
||||
- static uint64_t value;
|
||||
- uint64_t random_time_bits;
|
||||
unsigned int count;
|
||||
int fd = -1;
|
||||
int save_errno = errno;
|
||||
struct_stat64 st;
|
||||
+ struct randint_source *rand_src;
|
||||
|
||||
/* A lower bound on the number of temporary files to attempt to
|
||||
generate. The maximum total number of temporary file names that
|
||||
can exist for a given template is 62**6. It should never be
|
||||
necessary to try all these combinations. Instead if a reasonable
|
||||
number of names is tried (we define reasonable as 62**3) fail to
|
||||
- give the system administrator the chance to remove the problems. */
|
||||
+ give the system administrator the chance to remove the problems.
|
||||
+ This value requires that X_SUFFIX_LEN be at least 3. */
|
||||
#define ATTEMPTS_MIN (62 * 62 * 62)
|
||||
|
||||
/* The number of times to attempt to generate a temporary file. To
|
||||
@@ -225,43 +235,28 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
#endif
|
||||
|
||||
len = strlen (tmpl);
|
||||
- if (len < 6 + suffixlen || memcmp (&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
|
||||
+ if (len < x_suffix_len + suffixlen
|
||||
+ || ! check_x_suffix (&tmpl[len - x_suffix_len - suffixlen],
|
||||
+ x_suffix_len))
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This is where the Xs start. */
|
||||
- XXXXXX = &tmpl[len - 6 - suffixlen];
|
||||
+ XXXXXX = &tmpl[len - x_suffix_len - suffixlen];
|
||||
|
||||
/* Get some more or less random data. */
|
||||
-#ifdef RANDOM_BITS
|
||||
- RANDOM_BITS (random_time_bits);
|
||||
-#else
|
||||
- {
|
||||
- struct timeval tv;
|
||||
- __gettimeofday (&tv, NULL);
|
||||
- random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
|
||||
- }
|
||||
-#endif
|
||||
- value += random_time_bits ^ __getpid ();
|
||||
+ rand_src = randint_all_new (NULL, 8);
|
||||
+ if (! rand_src)
|
||||
+ return -1;
|
||||
|
||||
- for (count = 0; count < attempts; value += 7777, ++count)
|
||||
+ for (count = 0; count < attempts; ++count)
|
||||
{
|
||||
- uint64_t v = value;
|
||||
-
|
||||
- /* Fill in the random bits. */
|
||||
- XXXXXX[0] = letters[v % 62];
|
||||
- v /= 62;
|
||||
- XXXXXX[1] = letters[v % 62];
|
||||
- v /= 62;
|
||||
- XXXXXX[2] = letters[v % 62];
|
||||
- v /= 62;
|
||||
- XXXXXX[3] = letters[v % 62];
|
||||
- v /= 62;
|
||||
- XXXXXX[4] = letters[v % 62];
|
||||
- v /= 62;
|
||||
- XXXXXX[5] = letters[v % 62];
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < x_suffix_len; i++)
|
||||
+ XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
|
||||
|
||||
switch (kind)
|
||||
{
|
||||
@@ -276,7 +271,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
break;
|
||||
|
||||
case __GT_NOCREATE:
|
||||
- /* This case is backward from the other three. __gen_tempname
|
||||
+ /* This case is backward from the other three. This function
|
||||
succeeds if __xstat fails because the name does not exist.
|
||||
Note the continue to bypass the common logic at the bottom
|
||||
of the loop. */
|
||||
@@ -285,11 +280,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
- return 0;
|
||||
+ fd = 0;
|
||||
+ goto done;
|
||||
}
|
||||
else
|
||||
- /* Give up now. */
|
||||
- return -1;
|
||||
+ {
|
||||
+ /* Give up now. */
|
||||
+ fd = -1;
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -301,13 +300,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
if (fd >= 0)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
- return fd;
|
||||
+ goto done;
|
||||
}
|
||||
else if (errno != EEXIST)
|
||||
- return -1;
|
||||
+ {
|
||||
+ fd = -1;
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
|
||||
+ randint_all_free (rand_src);
|
||||
+
|
||||
/* We got out of the loop because we ran out of combinations to try. */
|
||||
__set_errno (EEXIST);
|
||||
return -1;
|
||||
+
|
||||
+ done:
|
||||
+ {
|
||||
+ int saved_errno = errno;
|
||||
+ randint_all_free (rand_src);
|
||||
+ __set_errno (saved_errno);
|
||||
+ }
|
||||
+ return fd;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
+{
|
||||
+ return gen_tempname_len (tmpl, suffixlen, flags, kind, 6);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/* Create a temporary file or directory.
|
||||
|
||||
Copyright (C) 2006, 2007 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* header written by Eric Blake */
|
||||
|
||||
/* In gnulib, always prefer large files. GT_FILE maps to
|
||||
__GT_BIGFILE, not __GT_FILE, for a reason. */
|
||||
#define GT_FILE 1
|
||||
#define GT_DIR 2
|
||||
#define GT_NOCREATE 3
|
||||
|
||||
/* Generate a temporary file name based on TMPL. TMPL must match the
|
||||
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
|
||||
does not exist at the time of the call to gen_tempname. TMPL is
|
||||
overwritten with the result.
|
||||
|
||||
KIND may be one of:
|
||||
GT_NOCREATE: simply verify that the name does not exist
|
||||
at the time of the call.
|
||||
GT_FILE: create a large file using open(O_CREAT|O_EXCL)
|
||||
and return a read-write fd. The file is mode 0600.
|
||||
GT_DIR: create a directory, which will be mode 0700.
|
||||
|
||||
We use a clever algorithm to get hard-to-predict names. */
|
||||
#include <stddef.h>
|
||||
extern int gen_tempname (char *tmpl, int kind);
|
||||
extern int gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len);
|
||||
12
gl/lib/tempname.h.diff
Normal file
12
gl/lib/tempname.h.diff
Normal file
@@ -0,0 +1,12 @@
|
||||
diff --git c/lib/tempname.h i/lib/tempname.h
|
||||
index cd69e7d..9757db2 100644
|
||||
--- c/lib/tempname.h
|
||||
+++ i/lib/tempname.h
|
||||
@@ -46,5 +46,7 @@
|
||||
|
||||
We use a clever algorithm to get hard-to-predict names. */
|
||||
extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
|
||||
+extern int gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
|
||||
+ size_t x_suffix_len);
|
||||
|
||||
#endif /* GL_TEMPNAME_H */
|
||||
@@ -1,5 +1,5 @@
|
||||
/* a wrapper for frepoen
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
#include "quote.h"
|
||||
#include "stdio--.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
@@ -31,11 +32,11 @@ xfreopen (char const *filename, char const *mode, FILE *fp)
|
||||
if (!freopen (filename, mode, fp))
|
||||
{
|
||||
char const *f = (filename ? filename
|
||||
: (fp == stdin ? _("stdin")
|
||||
: (fp == stdout ? _("stdout")
|
||||
: (fp == stderr ? _("stderr")
|
||||
: _("unknown stream")))));
|
||||
: (fp == stdin ? _("stdin")
|
||||
: (fp == stdout ? _("stdout")
|
||||
: (fp == stderr ? _("stderr")
|
||||
: _("unknown stream")))));
|
||||
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
|
||||
quote_n (0, f), quote_n (1, mode));
|
||||
quote_n (0, f), quote_n (1, mode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#serial 3
|
||||
dnl Copyright (C) 2007-2008 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.
|
||||
|
||||
AC_DEFUN([gl_MGETGROUPS],
|
||||
[
|
||||
AC_CHECK_FUNCS([getgrouplist])
|
||||
AC_LIBOBJ([mgetgroups])
|
||||
])
|
||||
@@ -1,5 +1,5 @@
|
||||
#serial 3
|
||||
dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
Description:
|
||||
iterate through argv or a --files0-from=-specified file
|
||||
|
||||
Files:
|
||||
lib/argv-iter.c
|
||||
lib/argv-iter.h
|
||||
|
||||
Depends-on:
|
||||
getdelim
|
||||
stdbool
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += argv-iter.c argv-iter.h
|
||||
|
||||
Include:
|
||||
"argv-iter.h"
|
||||
|
||||
License
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
@@ -1,10 +0,0 @@
|
||||
Files:
|
||||
tests/test-argv-iter.c
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-argv-iter
|
||||
check_PROGRAMS += test-argv-iter
|
||||
@@ -1,24 +0,0 @@
|
||||
Description:
|
||||
Return the group IDs of a user in malloc'd storage.
|
||||
|
||||
Files:
|
||||
lib/mgetgroups.c
|
||||
lib/mgetgroups.h
|
||||
m4/mgetgroups.m4
|
||||
|
||||
Depends-on:
|
||||
getugroups
|
||||
xalloc
|
||||
|
||||
configure.ac:
|
||||
gl_MGETGROUPS
|
||||
|
||||
Makefile.am:
|
||||
|
||||
Include:
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
9
gl/modules/rename-tests.diff
Normal file
9
gl/modules/rename-tests.diff
Normal file
@@ -0,0 +1,9 @@
|
||||
diff --git a/modules/rename-tests b/modules/rename-tests
|
||||
index be1b423..fea330a 100644
|
||||
--- a/modules/rename-tests
|
||||
+++ b/modules/rename-tests
|
||||
@@ -14,3 +14,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-rename
|
||||
check_PROGRAMS += test-rename
|
||||
+test_rename_LDADD = $(LDADD) @LIBINTL@
|
||||
@@ -1,33 +0,0 @@
|
||||
Description:
|
||||
openat-style fd-relative functions for SE Linux
|
||||
|
||||
Files:
|
||||
lib/selinux-at.c
|
||||
lib/selinux-at.h
|
||||
|
||||
Depends-on:
|
||||
selinux-h
|
||||
|
||||
configure.ac:
|
||||
# FIXME: put this in an .m4 file?
|
||||
# For runcon.
|
||||
AC_CHECK_HEADERS([selinux/flask.h])
|
||||
AC_LIBOBJ([selinux-at])
|
||||
gl_save_LIBS=$LIBS
|
||||
LIB_SELINUX=
|
||||
AC_SEARCH_LIBS([setfilecon], [selinux],
|
||||
[test "$ac_cv_search_setfilecon" = "none required" ||
|
||||
LIB_SELINUX=$ac_cv_search_setfilecon])
|
||||
AC_SUBST(LIB_SELINUX)
|
||||
LIBS=$gl_save_LIBS
|
||||
|
||||
Makefile.am:
|
||||
|
||||
Include:
|
||||
selinux-at.h
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
@@ -8,6 +8,7 @@ lib/xfreopen.h
|
||||
Depends-on:
|
||||
error
|
||||
exitfail
|
||||
freopen-safer
|
||||
quote
|
||||
|
||||
configure.ac:
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/* Test argv iterator
|
||||
Copyright (C) 2008 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
|
||||
#define ASSERT(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
|
||||
fflush (stderr); \
|
||||
abort (); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#include "argv-iter.h"
|
||||
|
||||
static FILE *
|
||||
write_nul_delimited_argv (char **argv)
|
||||
{
|
||||
FILE *fp = tmpfile ();
|
||||
ASSERT (fp);
|
||||
while (*argv)
|
||||
{
|
||||
size_t len = strlen (*argv) + 1;
|
||||
ASSERT (fwrite (*argv, len, 1, fp) == 1);
|
||||
argv++;
|
||||
}
|
||||
ASSERT (fflush (fp) == 0);
|
||||
rewind (fp);
|
||||
return fp;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
/* set_program_name (argv[0]); placate overzealous "syntax-check" test. */
|
||||
static char *av[][4] = {
|
||||
{NULL},
|
||||
{"1", NULL},
|
||||
{"1", "2", NULL},
|
||||
{"1", "2", "3", NULL}
|
||||
};
|
||||
|
||||
int use_stream;
|
||||
for (use_stream = 0; use_stream < 2; use_stream++)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < ARRAY_CARDINALITY (av); i++)
|
||||
{
|
||||
FILE *fp;
|
||||
struct argv_iterator *ai;
|
||||
size_t n_found = 0;
|
||||
if (use_stream)
|
||||
{
|
||||
/* Generate an identical list to be read via FP. */
|
||||
ASSERT ((fp = write_nul_delimited_argv (av[i])) != NULL);
|
||||
ai = argv_iter_init_stream (fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = NULL;
|
||||
ai = argv_iter_init_argv (av[i]);
|
||||
}
|
||||
ASSERT (ai);
|
||||
|
||||
while (1)
|
||||
{
|
||||
enum argv_iter_err ai_err;
|
||||
char *s = argv_iter (ai, &ai_err);
|
||||
ASSERT ((i == n_found) == (ai_err == AI_ERR_EOF));
|
||||
ASSERT ((s == NULL) ^ (ai_err == AI_ERR_OK));
|
||||
ASSERT (ai_err == AI_ERR_OK || ai_err == AI_ERR_EOF);
|
||||
if (ai_err == AI_ERR_OK)
|
||||
++n_found;
|
||||
if (ai_err == AI_ERR_EOF)
|
||||
break;
|
||||
/* In stream mode, the strings are equal, but
|
||||
in argv mode the actual pointers are equal. */
|
||||
ASSERT (use_stream
|
||||
? STREQ (s, av[i][n_found - 1])
|
||||
: s == av[i][n_found - 1]);
|
||||
}
|
||||
ASSERT (argv_iter_n_args (ai) == i);
|
||||
argv_iter_free (ai);
|
||||
if (fp)
|
||||
ASSERT (fclose (fp) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
2
gnulib
2
gnulib
Submodule gnulib updated: c90c5cc82c...0883405cc7
@@ -1 +1,3 @@
|
||||
include gnulib.mk
|
||||
|
||||
AM_CFLAGS = $(GNULIB_WARN_CFLAGS) # $(WERROR_CFLAGS)
|
||||
|
||||
@@ -8746,8 +8746,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
|
||||
Software Foundation, Inc.
|
||||
Copyright (C) 2000-2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
include gnulib.mk
|
||||
|
||||
AM_CFLAGS += $(WARN_CFLAGS) # $(WERROR_CFLAGS)
|
||||
AM_CFLAGS += $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
libcoreutils_a_SOURCES += \
|
||||
buffer-lcm.c buffer-lcm.h \
|
||||
|
||||
40
lib/TODO
40
lib/TODO
@@ -1,40 +0,0 @@
|
||||
Things to do to hash.c:
|
||||
|
||||
Always use curly braces around statements in if/else/while/do/etc.
|
||||
that span more than a line -- even around multiline simple statements
|
||||
or single-line simple statements preceded by a comment line.
|
||||
|
||||
Never have lines longer than 80 chars.
|
||||
|
||||
Remove ^L characters. We don't want/need such crutches.
|
||||
Get a good (smart) pagination filter. I have one (a perl script)
|
||||
that usually does a decent job for me -- I called it something
|
||||
like stdc-print and think I sent you an early verison.
|
||||
|
||||
I don't like the name `cursor'. I much prefer short names
|
||||
like `p' for index variables. I doubt I'll change all of them,
|
||||
but thought you should know why some will probably end up changing.
|
||||
|
||||
#define USE_OBSTACK somewhere
|
||||
|
||||
Fix this comment. Depending on system and application...
|
||||
Mention fragmentation.
|
||||
+#if USE_OBSTACK
|
||||
+ /* Whenever obstacks are used, it is possible to allocate all overflowed
|
||||
+ entries into a single stack, so they all can be freed in a single
|
||||
+ operation. It is not clear if the speedup is worth the trouble. */
|
||||
+ struct obstack entry_stack;
|
||||
+#endif
|
||||
|
||||
|
||||
assert (bucket_limit - bucket == n_buckets) ?
|
||||
|
||||
remove.c: s/done/successful or ok
|
||||
|
||||
|
||||
-----
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
and this notice are preserved.
|
||||
@@ -1,6 +1,6 @@
|
||||
/* buffer-lcm.c - compute a good buffer size for dealing with two files
|
||||
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2005, 2009 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
|
||||
@@ -34,22 +34,22 @@ buffer_lcm (size_t a, size_t b, size_t lcm_max)
|
||||
else
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
/* Return lcm (A, B) if it is in range; otherwise, fall back
|
||||
on A. */
|
||||
{
|
||||
/* Return lcm (A, B) if it is in range; otherwise, fall back
|
||||
on A. */
|
||||
|
||||
size_t lcm, m, n, q, r;
|
||||
size_t lcm, m, n, q, r;
|
||||
|
||||
/* N = gcd (A, B). */
|
||||
for (m = a, n = b; (r = m % n) != 0; m = n, n = r)
|
||||
continue;
|
||||
/* N = gcd (A, B). */
|
||||
for (m = a, n = b; (r = m % n) != 0; m = n, n = r)
|
||||
continue;
|
||||
|
||||
/* LCM = lcm (A, B), if in range. */
|
||||
q = a / n;
|
||||
lcm = q * b;
|
||||
if (lcm <= lcm_max && lcm / b == q)
|
||||
return lcm;
|
||||
}
|
||||
/* LCM = lcm (A, B), if in range. */
|
||||
q = a / n;
|
||||
lcm = q * b;
|
||||
if (lcm <= lcm_max && lcm / b == q)
|
||||
return lcm;
|
||||
}
|
||||
|
||||
size = a;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
This function is probably useful only for choosing whether to issue
|
||||
a prompt in an implementation of POSIX-specified rm.
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2006, 2009 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,13 +25,6 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef F_OK
|
||||
# define F_OK 0
|
||||
# define X_OK 1
|
||||
# define W_OK 2
|
||||
# define R_OK 4
|
||||
#endif
|
||||
|
||||
#include "group-member.h"
|
||||
#include "stat-macros.h"
|
||||
|
||||
@@ -57,8 +50,8 @@ euidaccess_stat (struct stat const *st, int mode)
|
||||
mode &= 7;
|
||||
else
|
||||
mode = ((mode & R_OK ? 4 : 0)
|
||||
+ (mode & W_OK ? 2 : 0)
|
||||
+ (mode & X_OK ? 1 : 0));
|
||||
+ (mode & W_OK ? 2 : 0)
|
||||
+ (mode & X_OK ? 1 : 0));
|
||||
|
||||
if (mode == 0)
|
||||
return true; /* The file exists. */
|
||||
@@ -68,7 +61,7 @@ euidaccess_stat (struct stat const *st, int mode)
|
||||
/* The super-user can read and write any file, and execute any file
|
||||
that anyone can execute. */
|
||||
if (euid == 0 && ((mode & X_OK) == 0
|
||||
|| (st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
|
||||
|| (st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
|
||||
return true;
|
||||
|
||||
/* Convert the file's permission bits to traditional form. */
|
||||
@@ -84,14 +77,14 @@ euidaccess_stat (struct stat const *st, int mode)
|
||||
granted = st->st_mode;
|
||||
else
|
||||
granted = ( (st->st_mode & S_IRUSR ? 4 << 6 : 0)
|
||||
+ (st->st_mode & S_IWUSR ? 2 << 6 : 0)
|
||||
+ (st->st_mode & S_IXUSR ? 1 << 6 : 0)
|
||||
+ (st->st_mode & S_IRGRP ? 4 << 3 : 0)
|
||||
+ (st->st_mode & S_IWGRP ? 2 << 3 : 0)
|
||||
+ (st->st_mode & S_IXGRP ? 1 << 3 : 0)
|
||||
+ (st->st_mode & S_IROTH ? 4 << 0 : 0)
|
||||
+ (st->st_mode & S_IWOTH ? 2 << 0 : 0)
|
||||
+ (st->st_mode & S_IXOTH ? 1 << 0 : 0));
|
||||
+ (st->st_mode & S_IWUSR ? 2 << 6 : 0)
|
||||
+ (st->st_mode & S_IXUSR ? 1 << 6 : 0)
|
||||
+ (st->st_mode & S_IRGRP ? 4 << 3 : 0)
|
||||
+ (st->st_mode & S_IWGRP ? 2 << 3 : 0)
|
||||
+ (st->st_mode & S_IXGRP ? 1 << 3 : 0)
|
||||
+ (st->st_mode & S_IROTH ? 4 << 0 : 0)
|
||||
+ (st->st_mode & S_IWOTH ? 2 << 0 : 0)
|
||||
+ (st->st_mode & S_IXOTH ? 1 << 0 : 0));
|
||||
|
||||
if (euid == st->st_uid)
|
||||
granted >>= 6;
|
||||
@@ -99,7 +92,7 @@ euidaccess_stat (struct stat const *st, int mode)
|
||||
{
|
||||
gid_t egid = getegid ();
|
||||
if (egid == st->st_gid || group_member (st->st_gid))
|
||||
granted >>= 3;
|
||||
granted >>= 3;
|
||||
}
|
||||
|
||||
if ((mode & ~granted) == 0)
|
||||
@@ -137,6 +130,6 @@ main (int argc, char **argv)
|
||||
|
||||
ok = euidaccess_stat (&st, mode);
|
||||
printf ("%s: %s\n", file, ok ? "y" : "n");
|
||||
exit (0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Invoke open, but return either a desired file descriptor or -1.
|
||||
|
||||
Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2006, 2008-2009 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 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2009 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,136 +0,0 @@
|
||||
/* fdopendir implementation derived from glibc.
|
||||
|
||||
Copyright (C) 2006 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if _LIBC
|
||||
# include <dirstream.h>
|
||||
# include <not-cancel.h>
|
||||
|
||||
#else
|
||||
|
||||
# if __GNUC__ < 3
|
||||
# define __builtin_expect(expr, expected_val) expr
|
||||
# endif
|
||||
|
||||
# include "openat.h"
|
||||
# define stat64 stat
|
||||
# define dirent64 dirent
|
||||
# define __fxstat64(V, fd, sb) fstat(fd, sb)
|
||||
# define __fcntl fcntl
|
||||
# define __set_errno(Val) do { errno = (Val); } while (0)
|
||||
# define __libc_lock_init(NAME) ((NAME) = 0, 0)
|
||||
# define close_not_cancel_no_status(fd) close (fd)
|
||||
# ifdef __i386__
|
||||
# define internal_function __attribute ((regparm (3), stdcall))
|
||||
# else
|
||||
# define internal_function
|
||||
# endif
|
||||
|
||||
struct __dirstream
|
||||
{
|
||||
int fd; /* File descriptor. */
|
||||
|
||||
char *data; /* Directory block. */
|
||||
size_t allocation; /* Space allocated for the block. */
|
||||
size_t size; /* Total valid data in the block. */
|
||||
size_t offset; /* Current offset into the block. */
|
||||
|
||||
off_t filepos; /* Position of next entry to read. */
|
||||
int lock;
|
||||
};
|
||||
#endif
|
||||
|
||||
#undef _STATBUF_ST_BLKSIZE
|
||||
|
||||
static DIR *
|
||||
internal_function
|
||||
__alloc_dir (int fd, bool close_fd)
|
||||
{
|
||||
if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
|
||||
goto lose;
|
||||
|
||||
size_t allocation;
|
||||
#ifdef _STATBUF_ST_BLKSIZE
|
||||
if (__builtin_expect ((size_t) statp->st_blksize >= sizeof (struct dirent64),
|
||||
1))
|
||||
allocation = statp->st_blksize;
|
||||
else
|
||||
#endif
|
||||
allocation = (BUFSIZ < sizeof (struct dirent64)
|
||||
? sizeof (struct dirent64) : BUFSIZ);
|
||||
|
||||
const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
|
||||
|
||||
DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
|
||||
if (dirp == NULL)
|
||||
lose:
|
||||
{
|
||||
if (close_fd)
|
||||
{
|
||||
int save_errno = errno;
|
||||
close_not_cancel_no_status (fd);
|
||||
__set_errno (save_errno);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
memset (dirp, '\0', sizeof (DIR));
|
||||
dirp->data = (char *) (dirp + 1) + pad;
|
||||
dirp->allocation = allocation;
|
||||
dirp->fd = fd;
|
||||
|
||||
__libc_lock_init (dirp->lock);
|
||||
|
||||
return dirp;
|
||||
}
|
||||
|
||||
DIR *
|
||||
fdopendir (int fd)
|
||||
{
|
||||
#if 0
|
||||
struct stat64 statbuf;
|
||||
|
||||
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
|
||||
return NULL;
|
||||
if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
|
||||
{
|
||||
__set_errno (ENOTDIR);
|
||||
return NULL;
|
||||
}
|
||||
/* Make sure the descriptor allows for reading. */
|
||||
int flags = __fcntl (fd, F_GETFL);
|
||||
if (__builtin_expect (flags == -1, 0))
|
||||
return NULL;
|
||||
if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0))
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return __alloc_dir (fd, false);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Locale-specific memory transformation
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009 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
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
size_t
|
||||
memxfrm (char *restrict dest, size_t destsize,
|
||||
char *restrict src, size_t srcsize)
|
||||
char *restrict src, size_t srcsize)
|
||||
{
|
||||
#if HAVE_STRXFRM
|
||||
|
||||
@@ -59,33 +59,33 @@ memxfrm (char *restrict dest, size_t destsize,
|
||||
errno = 0;
|
||||
result += strxfrm (dest + di, src + si, destsize - di) + 1;
|
||||
if (errno != 0)
|
||||
break;
|
||||
break;
|
||||
if (result <= result0)
|
||||
{
|
||||
errno = ERANGE;
|
||||
break;
|
||||
}
|
||||
{
|
||||
errno = ERANGE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == destsize + 1 && si + slen == srcsize)
|
||||
{
|
||||
/* The destination is exactly the right size, but strxfrm wants
|
||||
room for a trailing null. Work around the problem with a
|
||||
temporary buffer. */
|
||||
size_t bufsize = destsize - di + 1;
|
||||
char stackbuf[4000];
|
||||
char *buf = stackbuf;
|
||||
if (sizeof stackbuf < bufsize)
|
||||
{
|
||||
buf = malloc (bufsize);
|
||||
if (! buf)
|
||||
break;
|
||||
}
|
||||
strxfrm (buf, src + si, bufsize);
|
||||
memcpy (dest + di, buf, destsize - di);
|
||||
if (sizeof stackbuf < bufsize)
|
||||
free (buf);
|
||||
errno = 0;
|
||||
}
|
||||
{
|
||||
/* The destination is exactly the right size, but strxfrm wants
|
||||
room for a trailing null. Work around the problem with a
|
||||
temporary buffer. */
|
||||
size_t bufsize = destsize - di + 1;
|
||||
char stackbuf[4000];
|
||||
char *buf = stackbuf;
|
||||
if (sizeof stackbuf < bufsize)
|
||||
{
|
||||
buf = malloc (bufsize);
|
||||
if (! buf)
|
||||
break;
|
||||
}
|
||||
strxfrm (buf, src + si, bufsize);
|
||||
memcpy (dest + di, buf, destsize - di);
|
||||
if (sizeof stackbuf < bufsize)
|
||||
free (buf);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
di = (result < destsize ? result : destsize);
|
||||
si += slen + 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compare integer strings.
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2006, 2009 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 @@
|
||||
/* Compare numeric strings. This is an internal include file.
|
||||
|
||||
Copyright (C) 1988, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
|
||||
2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2006, 2009 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
|
||||
@@ -77,28 +77,28 @@ fraccompare (char const *a, char const *b, char decimal_point)
|
||||
if (*a == decimal_point && *b == decimal_point)
|
||||
{
|
||||
while (*++a == *++b)
|
||||
if (! ISDIGIT (*a))
|
||||
return 0;
|
||||
if (! ISDIGIT (*a))
|
||||
return 0;
|
||||
if (ISDIGIT (*a) && ISDIGIT (*b))
|
||||
return *a - *b;
|
||||
return *a - *b;
|
||||
if (ISDIGIT (*a))
|
||||
goto a_trailing_nonzero;
|
||||
goto a_trailing_nonzero;
|
||||
if (ISDIGIT (*b))
|
||||
goto b_trailing_nonzero;
|
||||
goto b_trailing_nonzero;
|
||||
return 0;
|
||||
}
|
||||
else if (*a++ == decimal_point)
|
||||
{
|
||||
a_trailing_nonzero:
|
||||
while (*a == NUMERIC_ZERO)
|
||||
a++;
|
||||
a++;
|
||||
return ISDIGIT (*a);
|
||||
}
|
||||
else if (*b++ == decimal_point)
|
||||
{
|
||||
b_trailing_nonzero:
|
||||
while (*b == NUMERIC_ZERO)
|
||||
b++;
|
||||
b++;
|
||||
return - ISDIGIT (*b);
|
||||
}
|
||||
return 0;
|
||||
@@ -113,7 +113,7 @@ fraccompare (char const *a, char const *b, char decimal_point)
|
||||
|
||||
static inline int
|
||||
numcompare (char const *a, char const *b,
|
||||
int decimal_point, int thousands_sep)
|
||||
int decimal_point, int thousands_sep)
|
||||
{
|
||||
unsigned char tmpa = *a;
|
||||
unsigned char tmpb = *b;
|
||||
@@ -124,119 +124,119 @@ numcompare (char const *a, char const *b,
|
||||
if (tmpa == NEGATION_SIGN)
|
||||
{
|
||||
do
|
||||
tmpa = *++a;
|
||||
tmpa = *++a;
|
||||
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep);
|
||||
if (tmpb != NEGATION_SIGN)
|
||||
{
|
||||
if (tmpa == decimal_point)
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == NUMERIC_ZERO);
|
||||
if (ISDIGIT (tmpa))
|
||||
return -1;
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
|
||||
tmpb = *++b;
|
||||
if (tmpb == decimal_point)
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO);
|
||||
return - ISDIGIT (tmpb);
|
||||
}
|
||||
{
|
||||
if (tmpa == decimal_point)
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == NUMERIC_ZERO);
|
||||
if (ISDIGIT (tmpa))
|
||||
return -1;
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
|
||||
tmpb = *++b;
|
||||
if (tmpb == decimal_point)
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO);
|
||||
return - ISDIGIT (tmpb);
|
||||
}
|
||||
do
|
||||
tmpb = *++b;
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep);
|
||||
|
||||
while (tmpa == tmpb && ISDIGIT (tmpa))
|
||||
{
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
}
|
||||
{
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
}
|
||||
|
||||
if ((tmpa == decimal_point && !ISDIGIT (tmpb))
|
||||
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
|
||||
return fraccompare (b, a, decimal_point);
|
||||
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
|
||||
return fraccompare (b, a, decimal_point);
|
||||
|
||||
tmp = tmpb - tmpa;
|
||||
|
||||
for (log_a = 0; ISDIGIT (tmpa); ++log_a)
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
|
||||
for (log_b = 0; ISDIGIT (tmpb); ++log_b)
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
|
||||
if (log_a != log_b)
|
||||
return log_a < log_b ? 1 : -1;
|
||||
return log_a < log_b ? 1 : -1;
|
||||
|
||||
if (!log_a)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
else if (tmpb == NEGATION_SIGN)
|
||||
{
|
||||
do
|
||||
tmpb = *++b;
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep);
|
||||
if (tmpb == decimal_point)
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO);
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == NUMERIC_ZERO);
|
||||
if (ISDIGIT (tmpb))
|
||||
return 1;
|
||||
return 1;
|
||||
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep)
|
||||
tmpa = *++a;
|
||||
tmpa = *++a;
|
||||
if (tmpa == decimal_point)
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == NUMERIC_ZERO);
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == NUMERIC_ZERO);
|
||||
return ISDIGIT (tmpa);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep)
|
||||
tmpa = *++a;
|
||||
tmpa = *++a;
|
||||
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
|
||||
tmpb = *++b;
|
||||
tmpb = *++b;
|
||||
|
||||
while (tmpa == tmpb && ISDIGIT (tmpa))
|
||||
{
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
}
|
||||
{
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
}
|
||||
|
||||
if ((tmpa == decimal_point && !ISDIGIT (tmpb))
|
||||
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
|
||||
return fraccompare (a, b, decimal_point);
|
||||
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
|
||||
return fraccompare (a, b, decimal_point);
|
||||
|
||||
tmp = tmpa - tmpb;
|
||||
|
||||
for (log_a = 0; ISDIGIT (tmpa); ++log_a)
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
do
|
||||
tmpa = *++a;
|
||||
while (tmpa == thousands_sep);
|
||||
|
||||
for (log_b = 0; ISDIGIT (tmpb); ++log_b)
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == thousands_sep);
|
||||
|
||||
if (log_a != log_b)
|
||||
return log_a < log_b ? -1 : 1;
|
||||
return log_a < log_b ? -1 : 1;
|
||||
|
||||
if (!log_a)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compare numeric strings.
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
int
|
||||
strnumcmp (char const *a, char const *b,
|
||||
int decimal_point, int thousands_sep)
|
||||
int decimal_point, int thousands_sep)
|
||||
{
|
||||
return numcompare (a, b, decimal_point, thousands_sep);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Exercise chdir-long's sample main program.
|
||||
|
||||
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005, 2006, 2009 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,10 +38,10 @@ function mkdir_len
|
||||
( cd $root &&
|
||||
perl -e 'my $len='$n'-length "'$root'";$i=100;$d="z"x$i;
|
||||
while ($i+2 < $len) {
|
||||
$len -= $i + 1;
|
||||
mkdir $d,0700 or die "$!\n";
|
||||
chdir $d} $d="z"x($len-1);
|
||||
mkdir $d or die "mkdir_len: $d: $!\n"' )
|
||||
$len -= $i + 1;
|
||||
mkdir $d,0700 or die "$!\n";
|
||||
chdir $d} $d="z"x($len-1);
|
||||
mkdir $d or die "mkdir_len: $d: $!\n"' )
|
||||
}
|
||||
|
||||
size_list=
|
||||
|
||||
47
lib/xfts.c
47
lib/xfts.c
@@ -1,6 +1,6 @@
|
||||
/* xfts.c -- a wrapper for fts_open
|
||||
|
||||
Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2005-2007, 2009 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,29 +35,48 @@
|
||||
|
||||
FTS *
|
||||
xfts_open (char * const *argv, int options,
|
||||
int (*compar) (const FTSENT **, const FTSENT **))
|
||||
int (*compar) (const FTSENT **, const FTSENT **))
|
||||
{
|
||||
FTS *fts = fts_open (argv, options | FTS_CWDFD, compar);
|
||||
if (fts == NULL)
|
||||
{
|
||||
/* This can fail in three ways: out of memory, invalid bit_flags,
|
||||
and one or more of the FILES is an empty string. We could try
|
||||
to decipher that errno==EINVAL means invalid bit_flags and
|
||||
errno==ENOENT means there's an empty string, but that seems wrong.
|
||||
Ideally, fts_open would return a proper error indicator. For now,
|
||||
we'll presume that the bit_flags are valid and just check for
|
||||
empty strings. */
|
||||
and one or more of the FILES is an empty string. We could try
|
||||
to decipher that errno==EINVAL means invalid bit_flags and
|
||||
errno==ENOENT means there's an empty string, but that seems wrong.
|
||||
Ideally, fts_open would return a proper error indicator. For now,
|
||||
we'll presume that the bit_flags are valid and just check for
|
||||
empty strings. */
|
||||
bool invalid_arg = false;
|
||||
for (; *argv; ++argv)
|
||||
{
|
||||
if (**argv == '\0')
|
||||
invalid_arg = true;
|
||||
}
|
||||
{
|
||||
if (**argv == '\0')
|
||||
invalid_arg = true;
|
||||
}
|
||||
if (invalid_arg)
|
||||
error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote (""));
|
||||
error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote (""));
|
||||
else
|
||||
xalloc_die ();
|
||||
xalloc_die ();
|
||||
}
|
||||
|
||||
return fts;
|
||||
}
|
||||
|
||||
/* When fts_read returns FTS_DC to indicate a directory cycle,
|
||||
it may or may not indicate a real problem. When a program like
|
||||
chgrp performs a recursive traversal that requires traversing
|
||||
symbolic links, it is *not* a problem. However, when invoked
|
||||
with "-P -R", it deserves a warning. The fts_options member
|
||||
records the options that control this aspect of fts's behavior,
|
||||
so test that. */
|
||||
bool
|
||||
cycle_warning_required (FTS const *fts, FTSENT const *ent)
|
||||
{
|
||||
#define ISSET(Fts,Opt) ((Fts)->fts_options & (Opt))
|
||||
/* When dereferencing no symlinks, or when dereferencing only
|
||||
those listed on the command line and we're not processing
|
||||
a command-line argument, then a cycle is a serious problem. */
|
||||
return ((ISSET (fts, FTS_PHYSICAL) && !ISSET (fts, FTS_COMFOLLOW))
|
||||
|| (ISSET (fts, FTS_PHYSICAL) && ISSET (fts, FTS_COMFOLLOW)
|
||||
&& ent->fts_level != FTS_ROOTLEVEL));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#include <stdbool.h>
|
||||
#include "fts_.h"
|
||||
|
||||
FTS *
|
||||
xfts_open (char * const *, int options,
|
||||
int (*) (const FTSENT **, const FTSENT **));
|
||||
int (*) (const FTSENT **, const FTSENT **));
|
||||
|
||||
bool
|
||||
cycle_warning_required (FTS const *fts, FTSENT const *ent);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Locale-specific memory transformation
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009 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
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
size_t
|
||||
xmemxfrm (char *restrict dest, size_t destsize,
|
||||
char *restrict src, size_t srcsize)
|
||||
char *restrict src, size_t srcsize)
|
||||
{
|
||||
size_t translated_size = memxfrm (dest, destsize, src, srcsize);
|
||||
|
||||
@@ -54,8 +54,8 @@ xmemxfrm (char *restrict dest, size_t destsize,
|
||||
error (0, errno, _("string transformation failed"));
|
||||
error (0, 0, _("set LC_ALL='C' to work around the problem"));
|
||||
error (exit_failure, 0,
|
||||
_("the untransformed string was %s"),
|
||||
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
|
||||
_("the untransformed string was %s"),
|
||||
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
|
||||
}
|
||||
|
||||
return translated_size;
|
||||
|
||||
@@ -5005,7 +5005,7 @@
|
||||
-----
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006 Free Software Foundation, Inc.
|
||||
2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# boottime.m4 serial 4
|
||||
# Determine whether this system has infrastructure for obtaining the boot time.
|
||||
|
||||
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008-2009 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,8 +1,8 @@
|
||||
#serial 24
|
||||
#serial 26
|
||||
# Check declarations for this package.
|
||||
|
||||
dnl Copyright (C) 1997-2001, 2003-2006, 2008
|
||||
dnl Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 1997-2001, 2003-2006, 2008-2009 Free Software
|
||||
dnl Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
@@ -35,15 +35,7 @@ AC_DEFUN([gl_CHECK_DECLS],
|
||||
getpwuid,
|
||||
ttyname], , , $headers)
|
||||
|
||||
AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
|
||||
|
||||
AC_CHECK_DECLS_ONCE([free])
|
||||
AC_CHECK_DECLS_ONCE([getenv])
|
||||
AC_CHECK_DECLS_ONCE([geteuid])
|
||||
AC_CHECK_DECLS_ONCE([getlogin])
|
||||
AC_CHECK_DECLS_ONCE([getuid])
|
||||
AC_CHECK_DECLS_ONCE([lseek])
|
||||
AC_CHECK_DECLS_ONCE([malloc])
|
||||
AC_CHECK_DECLS_ONCE([memchr])
|
||||
AC_CHECK_DECLS_ONCE([realloc])
|
||||
])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# serial 1
|
||||
dnl Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Invoke open, but return either a desired file descriptor or -1.
|
||||
|
||||
dnl Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005, 2009 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 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
@@ -30,7 +30,9 @@ AC_DEFUN([cu_GMP],
|
||||
LIB_GMP=$ac_cv_search___gmpz_init
|
||||
AC_DEFINE([HAVE_GMP], [1],
|
||||
[Define if you have GNU libgmp (or replacement)])
|
||||
}])
|
||||
}],
|
||||
[AC_MSG_WARN([libgmp development library was not found or not usable.])
|
||||
AC_MSG_WARN([AC_PACKAGE_NAME will be built without GMP support.])])
|
||||
LIBS=$cu_saved_libs
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#serial 2
|
||||
dnl Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2007, 2009 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.
|
||||
@@ -36,8 +36,8 @@ AC_DEFUN([gl_INCLUDE_EXCLUDE_PROG],
|
||||
gl_no_install_progs_default=`echo '$2'|sed 's/,/ /g'`
|
||||
AC_ARG_ENABLE([install-program],
|
||||
[AS_HELP_STRING([--enable-install-program=PROG_LIST],
|
||||
[install the programs in PROG_LIST (comma-separated,
|
||||
default: none)])],
|
||||
[install the programs in PROG_LIST (comma-separated,
|
||||
default: none)])],
|
||||
[gl_do_install_prog=$enableval],
|
||||
[gl_do_install_prog=]
|
||||
)
|
||||
@@ -46,8 +46,8 @@ AC_DEFUN([gl_INCLUDE_EXCLUDE_PROG],
|
||||
# use --enable-no-install-program=A,B
|
||||
AC_ARG_ENABLE([no-install-program],
|
||||
[AS_HELP_STRING([--enable-no-install-program=PROG_LIST],
|
||||
[do NOT install the programs in PROG_LIST
|
||||
(comma-separated, default: $2)])],
|
||||
[do NOT install the programs in PROG_LIST
|
||||
(comma-separated, default: $2)])],
|
||||
[gl_no_install_prog=$enableval],
|
||||
[gl_no_install_prog=]
|
||||
)
|
||||
@@ -78,7 +78,7 @@ AC_DEFUN([gl_INCLUDE_EXCLUDE_PROG],
|
||||
# Warn about a request not to install a program that is
|
||||
# already on the default-no-install list.
|
||||
case " $gl_no_install_progs_default " in
|
||||
*" $gl_i "*) gl_msg="by default, '$gl_i' is not installed" ;;
|
||||
*" $gl_i "*) gl_msg="by default, '$gl_i' is not installed" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ AC_DEFUN([coreutils_MACROS],
|
||||
|
||||
# By default, argmatch should fail calling usage (1).
|
||||
AC_DEFINE([ARGMATCH_DIE], [usage (1)],
|
||||
[Define to the function xargmatch calls on failures.])
|
||||
[Define to the function xargmatch calls on failures.])
|
||||
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
|
||||
[Define to the declaration of the xargmatch failure function.])
|
||||
[Define to the declaration of the xargmatch failure function.])
|
||||
|
||||
# used by ls
|
||||
AC_REQUIRE([gl_CLOCK_TIME])
|
||||
@@ -47,11 +47,30 @@ AC_DEFUN([coreutils_MACROS],
|
||||
AC_CHECK_FUNCS_ONCE([directio])
|
||||
|
||||
# Used by install.c.
|
||||
AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
|
||||
coreutils_saved_libs=$LIBS
|
||||
LIBS="$LIBS $LIB_SELINUX"
|
||||
AC_CHECK_FUNCS([matchpathcon_init_prefix], [],
|
||||
[
|
||||
case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
|
||||
no:*) # SELinux disabled
|
||||
;;
|
||||
*:no) # SELinux disabled
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([SELinux enabled, but matchpathcon_init_prefix not found])
|
||||
AC_MSG_WARN([The install utility may run slowly])
|
||||
esac
|
||||
])
|
||||
LIBS=$coreutils_saved_libs
|
||||
|
||||
# Used by sort.c.
|
||||
AC_CHECK_FUNCS_ONCE([nl_langinfo])
|
||||
|
||||
# Used by tail.c.
|
||||
AC_CHECK_FUNCS([inotify_init],
|
||||
[AC_DEFINE([HAVE_INOTIFY], [1],
|
||||
[Define to 1 if you have usable inotify support.])])
|
||||
|
||||
AC_CHECK_FUNCS_ONCE( \
|
||||
endgrent \
|
||||
endpwent \
|
||||
@@ -75,25 +94,35 @@ AC_DEFUN([coreutils_MACROS],
|
||||
|
||||
# for dd.c and shred.c
|
||||
coreutils_saved_libs=$LIBS
|
||||
LIB_FDATASYNC=
|
||||
AC_SEARCH_LIBS([fdatasync], [rt posix4],
|
||||
[test "$ac_cv_search_fdatasync" = "none required" ||
|
||||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
|
||||
[test "$ac_cv_search_fdatasync" = "none required" ||
|
||||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
|
||||
AC_SUBST([LIB_FDATASYNC])
|
||||
AC_CHECK_FUNCS([fdatasync])
|
||||
LIBS=$coreutils_saved_libs
|
||||
|
||||
# Check whether libcap is usable -- for ls --color support
|
||||
LIB_CAP=
|
||||
AC_ARG_ENABLE([libcap],
|
||||
AC_HELP_STRING([--disable-libcap], [disable libcap support]),
|
||||
AC_MSG_WARN([libcap support disabled by user]),
|
||||
[AC_CHECK_LIB([cap], [cap_get_file],
|
||||
AC_HELP_STRING([--disable-libcap], [disable libcap support]))
|
||||
if test "X$enable_libcap" != "Xno"; then
|
||||
AC_CHECK_LIB([cap], [cap_get_file],
|
||||
[AC_CHECK_HEADER([sys/capability.h],
|
||||
[LIB_CAP=-lcap
|
||||
AC_DEFINE([HAVE_CAP], [1], [libcap usability])],
|
||||
[AC_MSG_WARN([header sys/capability.h was not found, support for libcap will not be built])]
|
||||
)],
|
||||
[AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])])
|
||||
])
|
||||
[LIB_CAP=-lcap
|
||||
AC_DEFINE([HAVE_CAP], [1], [libcap usability])]
|
||||
)])
|
||||
if test "X$LIB_CAP" = "X"; then
|
||||
if test "X$enable_libcap" = "Xyes"; then
|
||||
AC_MSG_ERROR([libcap library was not found or not usable])
|
||||
else
|
||||
AC_MSG_WARN([libcap library was not found or not usable.])
|
||||
AC_MSG_WARN([AC_PACKAGE_NAME will be built without capability support.])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([libcap support disabled by user])
|
||||
fi
|
||||
AC_SUBST([LIB_CAP])
|
||||
|
||||
# See if linking `seq' requires -lm.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
dnl Misc lib-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008
|
||||
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008-2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -51,10 +51,11 @@ $ac_includes_default
|
||||
|
||||
# SCO-ODT-3.0 is reported to need -lufc for crypt.
|
||||
# NetBSD needs -lcrypt for crypt.
|
||||
LIB_CRYPT=
|
||||
cu_saved_libs="$LIBS"
|
||||
AC_SEARCH_LIBS([crypt], [ufc crypt],
|
||||
[test "$ac_cv_search_crypt" = "none required" ||
|
||||
LIB_CRYPT="$ac_cv_search_crypt"])
|
||||
[test "$ac_cv_search_crypt" = "none required" ||
|
||||
LIB_CRYPT="$ac_cv_search_crypt"])
|
||||
LIBS="$cu_saved_libs"
|
||||
AC_SUBST([LIB_CRYPT])
|
||||
])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
dnl Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# stat-prog.m4 serial 6
|
||||
# Record the prerequisites of src/stat.c from the coreutils package.
|
||||
|
||||
# Copyright (C) 2002-2004, 2006, 2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2004, 2006, 2008-2009 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
|
||||
@@ -57,30 +57,30 @@ AC_INCLUDES_DEFAULT
|
||||
{ AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [$statvfs_includes])
|
||||
test $ac_cv_member_struct_statvfs_f_basetype = yes ||
|
||||
{ AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [$statvfs_includes])
|
||||
test $ac_cv_member_struct_statvfs_f_fstypename = yes ||
|
||||
{ test $ac_cv_member_struct_statfs_f_fstypename != yes &&
|
||||
{ AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
|
||||
test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
|
||||
test $ac_cv_member_struct_statvfs_f_fstypename = yes ||
|
||||
{ test $ac_cv_member_struct_statfs_f_fstypename != yes &&
|
||||
{ AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
|
||||
test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
|
||||
then
|
||||
AC_CHECK_MEMBERS([struct statvfs.f_namemax],,, [$statvfs_includes])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[$statvfs_includes],
|
||||
[static statvfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[$statvfs_includes],
|
||||
[static statvfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
|
||||
[Define to 1 if the f_fsid member of struct statvfs is an integer.])])
|
||||
[Define to 1 if the f_fsid member of struct statvfs is an integer.])])
|
||||
else
|
||||
AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type],,,
|
||||
[$statfs_includes])
|
||||
if test $ac_cv_header_OS_h != yes; then
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[$statfs_includes],
|
||||
[static statfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
|
||||
[Define to 1 if the f_fsid member of struct statfs is an integer.])])
|
||||
[AC_LANG_PROGRAM(
|
||||
[$statfs_includes],
|
||||
[static statfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
|
||||
[Define to 1 if the f_fsid member of struct statfs is an integer.])])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Compare numeric strings.
|
||||
|
||||
dnl Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user