mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
511 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dcf7a4d23 | ||
|
|
eeeccb3d0f | ||
|
|
6fa5f12107 | ||
|
|
d99c479311 | ||
|
|
9f39fa8559 | ||
|
|
00f84872e4 | ||
|
|
a8fde98844 | ||
|
|
e412e5cb49 | ||
|
|
e65d0d0525 | ||
|
|
9b6538aa8d | ||
|
|
843a0f1a23 | ||
|
|
22fa69e27d | ||
|
|
c04cb1274c | ||
|
|
b102ed9ba6 | ||
|
|
9b4aa5e268 | ||
|
|
53191d01e2 | ||
|
|
26559b513d | ||
|
|
b498eb071d | ||
|
|
991a1d6de9 | ||
|
|
2827bb5704 | ||
|
|
d1df6ef183 | ||
|
|
e45c9a02a4 | ||
|
|
1f95a45099 | ||
|
|
143bfd67c9 | ||
|
|
0b47305caa | ||
|
|
25bbb44dbb | ||
|
|
25507a54f7 | ||
|
|
8e6a68e2fd | ||
|
|
5b86dc69d7 | ||
|
|
f31ea18146 | ||
|
|
8f7fae5972 | ||
|
|
e6d2d94794 | ||
|
|
fd53921a68 | ||
|
|
20d523bfa2 | ||
|
|
bd23509bef | ||
|
|
a4780e67f4 | ||
|
|
b581752137 | ||
|
|
558525592b | ||
|
|
ba5a1036f1 | ||
|
|
d16b4760d7 | ||
|
|
98aec338ef | ||
|
|
ebb9617fde | ||
|
|
c160afe902 | ||
|
|
cf0bb5e05d | ||
|
|
20dc2a6a61 | ||
|
|
1644e58905 | ||
|
|
55efc5f3ee | ||
|
|
93f6771e82 | ||
|
|
83244ba312 | ||
|
|
df2e983677 | ||
|
|
97d21865fb | ||
|
|
a4053c5291 | ||
|
|
85507b24f9 | ||
|
|
19a0b6be60 | ||
|
|
51b88670cb | ||
|
|
4f526d2d64 | ||
|
|
02c3dc9de8 | ||
|
|
8b638f994a | ||
|
|
5d71171e01 | ||
|
|
c763b485f5 | ||
|
|
0d61f144a3 | ||
|
|
826095ffad | ||
|
|
cb0d71399c | ||
|
|
59cec5af12 | ||
|
|
ce9c2c64de | ||
|
|
2b1e6636be | ||
|
|
8c4f28b124 | ||
|
|
0433f90e3d | ||
|
|
1c7d5b5847 | ||
|
|
6449370e9e | ||
|
|
ebfbdf9f0e | ||
|
|
2d10b7617b | ||
|
|
14cdeddbf3 | ||
|
|
2209d10f4c | ||
|
|
18332a65af | ||
|
|
17b18bfa6c | ||
|
|
eb1e30c213 | ||
|
|
d88c9f95e3 | ||
|
|
b50a4ae557 | ||
|
|
3a914fa76d | ||
|
|
224a69b56b | ||
|
|
9a2a8f0b3e | ||
|
|
3f1579c470 | ||
|
|
bba5a47651 | ||
|
|
ca4e48f822 | ||
|
|
3a8d16800c | ||
|
|
de13679b32 | ||
|
|
f7da3f1c10 | ||
|
|
9bde4fd426 | ||
|
|
359c48d5c6 | ||
|
|
74ba433a14 | ||
|
|
c980b0566a | ||
|
|
31896c21c6 | ||
|
|
773a88d33f | ||
|
|
cd78f85b0b | ||
|
|
2061cd8aa6 | ||
|
|
0c91ae335d | ||
|
|
0e40e9de57 | ||
|
|
0a3f944791 | ||
|
|
fa391362e1 | ||
|
|
8c243ff965 | ||
|
|
86cef85b36 | ||
|
|
65ba955988 | ||
|
|
dac5f12c6e | ||
|
|
26d3d090bd | ||
|
|
1eaacac312 | ||
|
|
5d0b158f4c | ||
|
|
982504452d | ||
|
|
48cae1e864 | ||
|
|
022889a457 | ||
|
|
adc62b5d9f | ||
|
|
1f4fcd083d | ||
|
|
9c8e4f6918 | ||
|
|
ed85df444a | ||
|
|
0dc4478f13 | ||
|
|
8ed84c3438 | ||
|
|
c55c0e7369 | ||
|
|
e3e9713fad | ||
|
|
6b8578af5e | ||
|
|
04d49874a2 | ||
|
|
18810ae65f | ||
|
|
d3dcb10f90 | ||
|
|
52b4d2a51a | ||
|
|
2b32399fdc | ||
|
|
44421c22a3 | ||
|
|
61a42e3743 | ||
|
|
60ca9e1599 | ||
|
|
0889381cbf | ||
|
|
1bdf77ad52 | ||
|
|
05a50b7848 | ||
|
|
2f61473e85 | ||
|
|
460ebb078e | ||
|
|
0d5508de13 | ||
|
|
ddf56e0440 | ||
|
|
2fbee63cc9 | ||
|
|
b27275c668 | ||
|
|
016f8c9998 | ||
|
|
10f3e12a0d | ||
|
|
83ae1bdd44 | ||
|
|
2a8f5104cd | ||
|
|
065f14f471 | ||
|
|
9a45c19667 | ||
|
|
f6240c49df | ||
|
|
b52a88607f | ||
|
|
f15842de47 | ||
|
|
c926d002b5 | ||
|
|
31b6c0489a | ||
|
|
a488f288a2 | ||
|
|
a7592cfcb2 | ||
|
|
3288ebb0d7 | ||
|
|
9934f50282 | ||
|
|
46d6df933e | ||
|
|
7b1967351c | ||
|
|
d01338eb3d | ||
|
|
a99c35b04d | ||
|
|
5e3a5ae519 | ||
|
|
1fd718e93c | ||
|
|
972967903d | ||
|
|
e0035fa4eb | ||
|
|
99be907838 | ||
|
|
1ead085826 | ||
|
|
695682d514 | ||
|
|
442d63051c | ||
|
|
7fc5292a29 | ||
|
|
cf5616a0aa | ||
|
|
13601dd3cf | ||
|
|
1ee192a9ff | ||
|
|
cbecb8cab8 | ||
|
|
fb992bae4c | ||
|
|
ac9e4915ad | ||
|
|
92465d59c6 | ||
|
|
921feefb12 | ||
|
|
0c65638b0f | ||
|
|
5c065bb0cb | ||
|
|
680afe6751 | ||
|
|
0fcf730104 | ||
|
|
f144582e17 | ||
|
|
9a913a2461 | ||
|
|
317d2c6384 | ||
|
|
292d68565a | ||
|
|
c352bb469d | ||
|
|
22a2a43021 | ||
|
|
4000c35ae3 | ||
|
|
99eccc3359 | ||
|
|
9965d234e5 | ||
|
|
a011b01af1 | ||
|
|
28fbe5a487 | ||
|
|
9b8023e69c | ||
|
|
b8497a3a7a | ||
|
|
c2e56e0de7 | ||
|
|
031e2fb5e9 | ||
|
|
e181802521 | ||
|
|
c58b5daa33 | ||
|
|
80325aca2d | ||
|
|
d3b5555f10 | ||
|
|
ca738e4414 | ||
|
|
21eb87e6ea | ||
|
|
7ef56a26fd | ||
|
|
aa2617b908 | ||
|
|
016958f2f0 | ||
|
|
1ce9d86c30 | ||
|
|
00b5a2db33 | ||
|
|
e34894bf3f | ||
|
|
b14e5c40b9 | ||
|
|
90f74735aa | ||
|
|
d6a62182f0 | ||
|
|
847ab6a518 | ||
|
|
b5b3690d06 | ||
|
|
57e2022b8d | ||
|
|
be6b4218e4 | ||
|
|
48a05a9ce9 | ||
|
|
fc3b301d4f | ||
|
|
c7e971bee0 | ||
|
|
b0312caf6f | ||
|
|
1c318d52de | ||
|
|
186b655094 | ||
|
|
8333cc3c0f | ||
|
|
c27c4a0957 | ||
|
|
a5e53ecc2c | ||
|
|
d5ab05998c | ||
|
|
a2be861b04 | ||
|
|
fbd87029cf | ||
|
|
3ece0355d5 | ||
|
|
1760ade090 | ||
|
|
ed017d44b2 | ||
|
|
8b09875b59 | ||
|
|
4e38e6a19c | ||
|
|
b3e779c090 | ||
|
|
17409787bb | ||
|
|
ac819e1044 | ||
|
|
36eb45201f | ||
|
|
b43255473f | ||
|
|
90a83264b9 | ||
|
|
43448b0493 | ||
|
|
854284f788 | ||
|
|
0e2ac2de24 | ||
|
|
03911ef780 | ||
|
|
32d4d0dd5e | ||
|
|
cfa2120e83 | ||
|
|
1c5e5d6277 | ||
|
|
41ec3548b0 | ||
|
|
5b27ec57b0 | ||
|
|
1e48b1fee5 | ||
|
|
5dc070cc86 | ||
|
|
b4ec994b26 | ||
|
|
2bf151cd93 | ||
|
|
153477479a | ||
|
|
fec0e89c20 | ||
|
|
407e8f0fdd | ||
|
|
461231f022 | ||
|
|
b705e9a9e7 | ||
|
|
b3677e5e38 | ||
|
|
cc0f637b6d | ||
|
|
7920f2c14a | ||
|
|
99f4994982 | ||
|
|
5afac2aee1 | ||
|
|
aa67daf63b | ||
|
|
f7a009c17c | ||
|
|
028e12ce3b | ||
|
|
f3f1ccfd87 | ||
|
|
08c38ab7cb | ||
|
|
d60e33e241 | ||
|
|
31a884dab7 | ||
|
|
74443830ea | ||
|
|
2ae61facc7 | ||
|
|
bb7fa1e932 | ||
|
|
16c8062085 | ||
|
|
17278118ee | ||
|
|
7f6fb43e7d | ||
|
|
ddc409b59e | ||
|
|
7eb3aab88b | ||
|
|
4fb3704c25 | ||
|
|
514b7fbc00 | ||
|
|
555c219d9e | ||
|
|
59964c164b | ||
|
|
7377f49ea8 | ||
|
|
969841cb77 | ||
|
|
c3e1fe230b | ||
|
|
1833a876ae | ||
|
|
0f5695bd59 | ||
|
|
42df6d7de2 | ||
|
|
9c0c57a1b4 | ||
|
|
a36f4cb451 | ||
|
|
ed0a1c9f94 | ||
|
|
f9da2d0e87 | ||
|
|
42285406aa | ||
|
|
5149348906 | ||
|
|
fbc5aa7c47 | ||
|
|
15f4d612df | ||
|
|
e505736f82 | ||
|
|
7eb15e1020 | ||
|
|
ef13885b37 | ||
|
|
0628b73f35 | ||
|
|
dafbd407bc | ||
|
|
94c59c97f9 | ||
|
|
ab02e256e9 | ||
|
|
0eff09dfcf | ||
|
|
0482f193b5 | ||
|
|
cfe3602ad6 | ||
|
|
cee53c1430 | ||
|
|
0643c51cab | ||
|
|
b616886492 | ||
|
|
58aaf71f07 | ||
|
|
24412edeaf | ||
|
|
a5111af33e | ||
|
|
1e3ebd660a | ||
|
|
2f706199d0 | ||
|
|
e13188e7ef | ||
|
|
2a4dcb627e | ||
|
|
13a2025998 | ||
|
|
9a33347007 | ||
|
|
e916c8ff05 | ||
|
|
beaee48f26 | ||
|
|
2643b4b77d | ||
|
|
8c4a656fad | ||
|
|
fec05eb377 | ||
|
|
6d5bf36d5c | ||
|
|
be11df4916 | ||
|
|
2f776f3096 | ||
|
|
13edec7c62 | ||
|
|
57622cac71 | ||
|
|
3b39aa796f | ||
|
|
a7ea04404c | ||
|
|
e34eb51728 | ||
|
|
771484f47a | ||
|
|
c7c961a3e5 | ||
|
|
4718a2fdf4 | ||
|
|
2298544c64 | ||
|
|
18efee4e2a | ||
|
|
f923ceceba | ||
|
|
e10e4b6697 | ||
|
|
cddcb5d468 | ||
|
|
3e8f9c8d35 | ||
|
|
ae1c205fc4 | ||
|
|
2221ea2c3a | ||
|
|
a06afbeec5 | ||
|
|
d9903062cf | ||
|
|
9dcebc51be | ||
|
|
1084bf78ea | ||
|
|
68561594ca | ||
|
|
22e5102f19 | ||
|
|
e4fa3e7808 | ||
|
|
737461d23f | ||
|
|
6b22726dd4 | ||
|
|
54281e9c60 | ||
|
|
ea2887bbe4 | ||
|
|
ef6a361a07 | ||
|
|
63a7120c28 | ||
|
|
5bf3e7ee96 | ||
|
|
0c1fc1c715 | ||
|
|
f03a67735a | ||
|
|
f325d180cf | ||
|
|
bfe4a55520 | ||
|
|
8ea96a5c90 | ||
|
|
f3574102d3 | ||
|
|
edd292f8d4 | ||
|
|
929479026b | ||
|
|
4c9fae4e97 | ||
|
|
a01c4720d6 | ||
|
|
081ebb2822 | ||
|
|
22999697b8 | ||
|
|
7e0019b168 | ||
|
|
64c25ed741 | ||
|
|
d9c0881137 | ||
|
|
4290abda87 | ||
|
|
5a74a2d566 | ||
|
|
7ee3d2430a | ||
|
|
f0f6e14610 | ||
|
|
e4fd2bf4e6 | ||
|
|
18e2a330b9 | ||
|
|
4ebf956b4e | ||
|
|
0392142b87 | ||
|
|
127c689f64 | ||
|
|
baad54258d | ||
|
|
d3ad58376d | ||
|
|
a1cb30c1fb | ||
|
|
d7e2f425e7 | ||
|
|
4b5e044be3 | ||
|
|
43f66923cc | ||
|
|
cd1f4bc1ec | ||
|
|
b673a5b8ac | ||
|
|
2a2d3f237b | ||
|
|
0d279d2378 | ||
|
|
c339cff4a6 | ||
|
|
ae5ae5e117 | ||
|
|
f65cafd67b | ||
|
|
d9207b48a3 | ||
|
|
d7f79cf6cb | ||
|
|
8c3835bf93 | ||
|
|
273c10fc2c | ||
|
|
f4bffea5e9 | ||
|
|
6b9f1bdd66 | ||
|
|
ffc630e598 | ||
|
|
c4c3dbc024 | ||
|
|
110df929fc | ||
|
|
e3b5543ea8 | ||
|
|
84f6abfe00 | ||
|
|
00c6aacf31 | ||
|
|
8d974b00fb | ||
|
|
b44f5f74aa | ||
|
|
662ce25d83 | ||
|
|
0d75784da0 | ||
|
|
cbdcc9fb4e | ||
|
|
bee58d8a04 | ||
|
|
e535754fdb | ||
|
|
f674a10f7e | ||
|
|
4fff95cfe1 | ||
|
|
77d97a1be4 | ||
|
|
f82c5ba71e | ||
|
|
9bb0d5766e | ||
|
|
1ee81530c0 | ||
|
|
ecb0ea20ca | ||
|
|
9a221e27f5 | ||
|
|
4e6af68846 | ||
|
|
186b45aaed | ||
|
|
773be9eca8 | ||
|
|
8461d49df0 | ||
|
|
b1a1fcbf57 | ||
|
|
0fb0a03c5c | ||
|
|
63467fa187 | ||
|
|
5483165b12 | ||
|
|
9a4e22d036 | ||
|
|
bba4d3e054 | ||
|
|
760bc6f7e7 | ||
|
|
9396eb9037 | ||
|
|
8da8dfc470 | ||
|
|
1d9b3de948 | ||
|
|
f38003890b | ||
|
|
5b610a06b2 | ||
|
|
5cc42f7de6 | ||
|
|
0a98d79bd2 | ||
|
|
a676856285 | ||
|
|
e2dbcee444 | ||
|
|
8ce745dc61 | ||
|
|
1fcd8cf8b4 | ||
|
|
595fc63c42 | ||
|
|
58b2e1204a | ||
|
|
27311c9e85 | ||
|
|
556fbb5721 | ||
|
|
b1a1c9ee06 | ||
|
|
3d309aa725 | ||
|
|
4f4700cca8 | ||
|
|
2e6fa14d16 | ||
|
|
3ea1fe588e | ||
|
|
574f761403 | ||
|
|
c1aabf84e6 | ||
|
|
02bfd65480 | ||
|
|
2c88abe2a2 | ||
|
|
7d10e30088 | ||
|
|
61f94d4dbc | ||
|
|
a087f17a44 | ||
|
|
20905b0cdc | ||
|
|
322c6f2e5c | ||
|
|
3435bb7f40 | ||
|
|
96ae7199c4 | ||
|
|
a7a328af0f | ||
|
|
94cecb5cf6 | ||
|
|
58db1bb942 | ||
|
|
45e67188d6 | ||
|
|
3de1559830 | ||
|
|
956abf969c | ||
|
|
b1db942595 | ||
|
|
2cbbbf6319 | ||
|
|
837bb31803 | ||
|
|
44530f2ddd | ||
|
|
9823682c2f | ||
|
|
1463824d8e | ||
|
|
d42994df5d | ||
|
|
d7d80c5b7b | ||
|
|
20c0b8701f | ||
|
|
46a811b9e7 | ||
|
|
bbbc35c9ed | ||
|
|
c49b2e32bb | ||
|
|
b83c498809 | ||
|
|
6c79825ce9 | ||
|
|
3808eccbbf | ||
|
|
81d0c8f367 | ||
|
|
98a96822d9 | ||
|
|
5f47278372 | ||
|
|
47ed009e57 | ||
|
|
394f88c4aa | ||
|
|
8253a9aeb4 | ||
|
|
a16bee4f07 | ||
|
|
e63c9825da | ||
|
|
263bb1be67 | ||
|
|
23c2a0cbac | ||
|
|
252d6d01c9 | ||
|
|
6eec737ade | ||
|
|
68158e6b10 | ||
|
|
75e0047c4b | ||
|
|
74c0bfbc4c | ||
|
|
80213bc66d | ||
|
|
4b92612944 | ||
|
|
896b672499 | ||
|
|
1b0b6c8d08 | ||
|
|
cc4bdb92f9 | ||
|
|
0647f3eb5a | ||
|
|
77b1bfc85c | ||
|
|
434258ca73 | ||
|
|
eebe731014 | ||
|
|
91c1384602 | ||
|
|
265c4b83a8 | ||
|
|
4a510cd399 | ||
|
|
ecb67c8389 | ||
|
|
86535835fe | ||
|
|
01e6181965 | ||
|
|
8a4192d3c0 | ||
|
|
423f28be77 | ||
|
|
dd3612a12b | ||
|
|
3cafcf8584 | ||
|
|
4db4c2aa6d |
7
.gitattributes
vendored
Normal file
7
.gitattributes
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
*.texi* diff=texinfo
|
||||
|
||||
# Put something like the following e.g., in your ~/.gitconfig file
|
||||
# # Include proper "function name" string in diffs of texinfo.
|
||||
# # Derived from the regexp in emacs' lisp/add-log.el.
|
||||
# [diff "texinfo"]
|
||||
# funcname = "^@node[ \t][ \t]*\\([^,][^,]*\\)"
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -44,6 +44,7 @@ coreutils-*.tar.lzma.sig
|
||||
gnulib-tests
|
||||
lib/.cvsignore
|
||||
lib/.gitignore
|
||||
lib/arpa
|
||||
lib/binary-io.h
|
||||
lib/charset.alias
|
||||
lib/configmake.h
|
||||
@@ -52,6 +53,7 @@ lib/printf.c
|
||||
lib/progname.c
|
||||
lib/progname.h
|
||||
lib/selinux
|
||||
lib/uniwidth
|
||||
m4/.cvsignore
|
||||
m4/.gitignore
|
||||
po/*.gmo
|
||||
@@ -65,5 +67,7 @@ po/POTFILES
|
||||
po/checksums
|
||||
po/coreutils.pot
|
||||
po/stamp-po
|
||||
src/version.c
|
||||
src/version.h
|
||||
stamp-h1
|
||||
tests/*/*.log
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "gnulib"]
|
||||
path = gnulib
|
||||
url = git://git.sv.gnu.org/gnulib.git
|
||||
@@ -1 +1 @@
|
||||
6.11
|
||||
7.1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Suppress valgrind diagnostics we don't care about.
|
||||
|
||||
# Copyright (C) 2003, 2004, 2006-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003, 2004, 2006-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
|
||||
@@ -90,3 +90,11 @@
|
||||
fun:gobble_file
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
utimensat-NULL
|
||||
Memcheck:Param
|
||||
utimensat(filename)
|
||||
fun:futimens
|
||||
fun:gl_futimens
|
||||
fun:main
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
ChangeLog(-[0-9]+)?$
|
||||
^old/
|
||||
^src/c99-to-c98\.diff$
|
||||
^gl/.*
|
||||
1
.x-sc_error_message_uppercase
Normal file
1
.x-sc_error_message_uppercase
Normal file
@@ -0,0 +1 @@
|
||||
build-aux/cvsu
|
||||
1
.x-sc_po_check
Normal file
1
.x-sc_po_check
Normal file
@@ -0,0 +1 @@
|
||||
^gl/
|
||||
2
.x-sc_program_name
Normal file
2
.x-sc_program_name
Normal file
@@ -0,0 +1,2 @@
|
||||
gl/lib/randint.c
|
||||
lib/euidaccess-stat.c
|
||||
@@ -1,6 +1 @@
|
||||
ChangeLog
|
||||
^TODO$
|
||||
^lib/euidaccess-stat\.c$
|
||||
^maint\.mk$
|
||||
^doc/coreutils.texi$
|
||||
^tests/misc/stty-invalid$
|
||||
|
||||
4
.x-sc_prohibit_stat_st_blocks
Normal file
4
.x-sc_prohibit_stat_st_blocks
Normal file
@@ -0,0 +1,4 @@
|
||||
src/system.h
|
||||
tests/du/2g
|
||||
old/fileutils/ChangeLog-1997
|
||||
ChangeLog-2005
|
||||
@@ -1,2 +1 @@
|
||||
^src/system\.h
|
||||
ChangeLog
|
||||
|
||||
@@ -1,30 +1,9 @@
|
||||
^lib/at-func\.c$
|
||||
^lib/bcopy\.c$
|
||||
^lib/buffer-lcm\.c$
|
||||
^lib/c-strtold\.c$
|
||||
^lib/fnmatch_loop\.c$
|
||||
^lib/full-read\.c$
|
||||
^lib/imaxtostr\.c$
|
||||
^lib/mempcpy\.c$
|
||||
^lib/memset\.c$
|
||||
^lib/offtostr\.c$
|
||||
^lib/regcomp\.c$
|
||||
^lib/regex_internal\.c$
|
||||
^lib/regexec\.c$
|
||||
^lib/safe-write\.c$
|
||||
^lib/strtoll\.c$
|
||||
^lib/strtoul\.c$
|
||||
^lib/strtoull\.c$
|
||||
^lib/strtoumax\.c$
|
||||
^lib/umaxtostr\.c$
|
||||
^lib/xstrtold\.c$
|
||||
^lib/xstrtoul\.c$
|
||||
^src/false\.c$
|
||||
^src/lbracket\.c$
|
||||
^src/ls-dir\.c$
|
||||
^src/ls-ls\.c$
|
||||
^src/ls-vdir\.c$
|
||||
^src/rand-isaac\.c$
|
||||
^src/tac-pipe\.c$
|
||||
^src/uname-arch\.c$
|
||||
^src/uname-uname\.c$
|
||||
|
||||
9
.x-sc_require_config_h_first
Normal file
9
.x-sc_require_config_h_first
Normal file
@@ -0,0 +1,9 @@
|
||||
^lib/buffer-lcm\.c$
|
||||
^src/false\.c$
|
||||
^src/lbracket\.c$
|
||||
^src/ls-dir\.c$
|
||||
^src/ls-ls\.c$
|
||||
^src/ls-vdir\.c$
|
||||
^src/tac-pipe\.c$
|
||||
^src/uname-arch\.c$
|
||||
^src/uname-uname\.c$
|
||||
22
AUTHORS
22
AUTHORS
@@ -3,7 +3,7 @@ each followed by the name(s) of its author(s).
|
||||
|
||||
arch: David MacKenzie, Karel Zak
|
||||
base64: Simon Josefsson
|
||||
basename: FIXME unknown
|
||||
basename: David MacKenzie
|
||||
cat: Torbjörn Granlund, Richard M. Stallman
|
||||
chcon: Russell Coker, Jim Meyering
|
||||
chgrp: David MacKenzie, Jim Meyering
|
||||
@@ -11,21 +11,21 @@ chmod: David MacKenzie, Jim Meyering
|
||||
chown: David MacKenzie, Jim Meyering
|
||||
chroot: Roland McGrath
|
||||
cksum: Q. Frank Xia
|
||||
comm: Richard Stallman, David MacKenzie
|
||||
comm: Richard M. Stallman, David MacKenzie
|
||||
cp: Torbjörn Granlund, David MacKenzie, Jim Meyering
|
||||
csplit: Stuart Kemp, David MacKenzie
|
||||
cut: David Ihnat, David MacKenzie, Jim Meyering
|
||||
cut: David M. Ihnat, David MacKenzie, Jim Meyering
|
||||
date: David MacKenzie
|
||||
dd: Paul Rubin, David MacKenzie, Stuart Kemp
|
||||
df: Torbjörn Granlund, David MacKenzie, Paul Eggert
|
||||
dir: Richard Stallman, David MacKenzie
|
||||
dir: Richard M. Stallman, David MacKenzie
|
||||
dircolors: H. Peter Anvin
|
||||
dirname: David MacKenzie, Jim Meyering
|
||||
du: Torbjörn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
|
||||
echo: FIXME unknown
|
||||
echo: Brian Fox, Chet Ramey
|
||||
env: Richard Mlynarik, David MacKenzie
|
||||
expand: David MacKenzie
|
||||
expr: Mike Parker
|
||||
expr: Mike Parker, James Youngman, Paul Eggert
|
||||
factor: Paul Rubin
|
||||
false: Jim Meyering
|
||||
fmt: Ross Paterson
|
||||
@@ -41,7 +41,7 @@ kill: Paul Eggert
|
||||
link: Michael Stone
|
||||
ln: Mike Parker, David MacKenzie
|
||||
logname: FIXME: unknown
|
||||
ls: Richard Stallman, David MacKenzie
|
||||
ls: Richard M. Stallman, David MacKenzie
|
||||
md5sum: Ulrich Drepper, Scott Miller, David Madore
|
||||
mkdir: David MacKenzie
|
||||
mkfifo: David MacKenzie
|
||||
@@ -61,7 +61,7 @@ printf: David MacKenzie
|
||||
ptx: François Pinard
|
||||
pwd: Jim Meyering
|
||||
readlink: Dmitry V. Levin
|
||||
rm: Paul Rubin, David MacKenzie, Richard Stallman, Jim Meyering
|
||||
rm: Paul Rubin, David MacKenzie, Richard M. Stallman, Jim Meyering
|
||||
rmdir: David MacKenzie
|
||||
runcon: Russell Coker
|
||||
seq: Ulrich Drepper
|
||||
@@ -84,18 +84,20 @@ tac: Jay Lepreau, David MacKenzie
|
||||
tail: Paul Rubin, David MacKenzie, Ian Lance Taylor, Jim Meyering
|
||||
tee: Mike Parker, Richard M. Stallman, David MacKenzie
|
||||
test: Kevin Braunsdorf, Matthew Bradburn
|
||||
timeout: Pádraig Brady
|
||||
touch: Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, Randy Smith
|
||||
tr: Jim Meyering
|
||||
true: Jim Meyering
|
||||
truncate: Pádraig Brady
|
||||
tsort: Mark Kettenis
|
||||
tty: David MacKenzie
|
||||
uname: David MacKenzie
|
||||
unexpand: David MacKenzie
|
||||
uniq: Richard Stallman, David MacKenzie
|
||||
uniq: Richard M. Stallman, David MacKenzie
|
||||
unlink: Michael Stone
|
||||
uptime: Joseph Arceneaux, David MacKenzie, Kaveh Ghazi
|
||||
users: Joseph Arceneaux, David MacKenzie
|
||||
vdir: Richard Stallman, David MacKenzie
|
||||
vdir: Richard M. Stallman, David MacKenzie
|
||||
wc: Paul Rubin, David MacKenzie
|
||||
who: Joseph Arceneaux, David MacKenzie, Michael Stone
|
||||
whoami: Richard Mlynarik
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2008-12-16 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
NB: ChangeLog files are no longer manually maintained.
|
||||
See HACKING for details.
|
||||
|
||||
2008-02-07 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
We *do* need two different version files.
|
||||
|
||||
128
HACKING
128
HACKING
@@ -32,9 +32,14 @@ inside your new coreutils/ directory:
|
||||
If you have made *no* changes:
|
||||
git pull
|
||||
|
||||
If you *have* made changes and committed them to "master", do this:
|
||||
git fetch
|
||||
git rebase origin
|
||||
If you *have* made changes and mistakenly committed them to "master",
|
||||
do the following to put your changes on a private branch, "br", and
|
||||
to restore master to its unmodified (relative-to-upstream) state:
|
||||
git checkout -b br
|
||||
git checkout master
|
||||
git reset --hard origin
|
||||
|
||||
Then "git pull" should work.
|
||||
|
||||
|
||||
*Before* you commit changes
|
||||
@@ -69,7 +74,7 @@ Once your change is committed, you can create a proper patch that includes
|
||||
a log message and authorship information as well as any permissions
|
||||
changes. Use this command to save that single, most-recent change set:
|
||||
|
||||
git format-patch --stdout --signoff HEAD~1 > DIFF
|
||||
git format-patch --stdout -1 > DIFF
|
||||
|
||||
The trouble with this approach is that you've just checked in a change
|
||||
(remember, it's only local) on the "master" branch, and that's where new
|
||||
@@ -185,7 +190,7 @@ 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 format-patch --stdout --signoff HEAD~1 > your-branch.diff
|
||||
git format-patch --stdout -1 > your-branch.diff
|
||||
|
||||
That replaces the most recent change-set with the revised one.
|
||||
|
||||
@@ -211,6 +216,13 @@ 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.
|
||||
|
||||
Try to make the summary line fit one of the following forms:
|
||||
|
||||
program_name: change-description
|
||||
prog1, prog2: change-description
|
||||
doc: change-description
|
||||
tests: change-description
|
||||
|
||||
|
||||
Use SPACE-only indentation in new files.
|
||||
========================================
|
||||
@@ -245,6 +257,35 @@ doc/*.texi. The man pages are generated from --help output, so
|
||||
you shouldn't need to change anything under man/. User-visible changes
|
||||
are usually documented in NEWS, too.
|
||||
|
||||
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".
|
||||
|
||||
|
||||
Minor syntactic preferences
|
||||
===========================
|
||||
[I hesitate to write this one down, because it appears to be an
|
||||
acquired taste, at least for native-English speakers. It seems odd
|
||||
(if not truly backwards) to nearly anyone who doesn't have a strong
|
||||
mathematics background and perhaps a streak of something odd in their
|
||||
character ;-) ]
|
||||
In writing arithmetic comparisons, use "<" and "<=" rather than
|
||||
">" and ">=". For some justification, read this:
|
||||
http://thread.gmane.org/gmane.comp.version-control.git/3903/focus=4126
|
||||
|
||||
const placement:
|
||||
Write "Type const *var", not "const Type *var".
|
||||
FIXME: dig up justification
|
||||
|
||||
|
||||
Be nice to translators
|
||||
======================
|
||||
Don't change translatable strings if you can avoid it.
|
||||
If you must rearrange individual lines (e.g., in multi-line --help
|
||||
strings), extract and create new strings, rather than extracting
|
||||
and moving into existing blocks. This avoids making unnecessary
|
||||
work for translators.
|
||||
|
||||
|
||||
Add tests
|
||||
==========
|
||||
@@ -252,7 +293,9 @@ Nearly every significant change must be accompanied by a test suite
|
||||
addition that exercises it. If you fix a bug, add at least one test that
|
||||
fails without the patch, but that succeeds once your patch is applied.
|
||||
If you add a feature, add tests to exercise as much of the new code
|
||||
as possible.
|
||||
as possible. Note to run tests/misc/newtest in isolation you can do:
|
||||
|
||||
(cd tests && make check TESTS=misc/newtest VERBOSE=yes)
|
||||
|
||||
There are hundreds of tests in the tests/ directories. You can use
|
||||
tests/sample-test as a template, or one of the various Perl-based ones
|
||||
@@ -287,6 +330,10 @@ you'd use doc/Copyright/request-assign.future:
|
||||
|
||||
You may make assignments for up to four projects at a time.
|
||||
|
||||
In case you're wondering why we bother with all of this, read this:
|
||||
|
||||
http://www.gnu.org/licenses/why-assign.html
|
||||
|
||||
|
||||
Run "make syntax-check", or even "make distcheck"
|
||||
================================================
|
||||
@@ -309,6 +356,49 @@ With other files, there will be some existing differences.
|
||||
Try not to add any more.
|
||||
|
||||
|
||||
Avoid trailing white space
|
||||
==========================
|
||||
You may notice that the only trailing blanks in coreutils'
|
||||
version-controlled files are in a single directory: tests/pr,
|
||||
which contains expected output from various invocations of pr.
|
||||
|
||||
Do not add any more trailing blanks anywhere. While "make syntax-check"
|
||||
will alert you if you slip up, it's better to nip any problem in the
|
||||
bud, as you're typing. A good way to help you adapt to this rule is
|
||||
to configure your editor to highlight any offending characters in the
|
||||
files you edit. If you use Emacs, customize its font-lock mode (FIXME:
|
||||
provide more detail) or try one of its whitespace packages. This appears
|
||||
to be the one that will end up in emacs 23:
|
||||
|
||||
http://www.emacswiki.org/emacs/WhiteSpace
|
||||
|
||||
[that page says its version also works with emacs 21 and 22]
|
||||
If you use vim, add this to ~/.vimrc:
|
||||
|
||||
let c_space_errors=1
|
||||
highlight RedundantSpaces ctermbg=red guibg=red
|
||||
match RedundantSpaces /\s\+$\| \+\ze\t/
|
||||
|
||||
|
||||
Git can help too, by stopping you from committing any change that would
|
||||
add trailing blanks. The example pre-commit hook contains code to check
|
||||
for trailing whitespace and spaces before tabs; enable it by moving it
|
||||
to the right place and making sure it is executable:
|
||||
|
||||
mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
|
||||
|
||||
With a repository created by git-1.5.6 or older, use this command:
|
||||
|
||||
chmod +x .git/hooks/pre-commit
|
||||
|
||||
To manually check for whitespace errors before committing, you can use
|
||||
|
||||
git diff --check
|
||||
|
||||
Git also has some settings to enable suitable internal whitespace checks.
|
||||
See the manpage for git-apply for details.
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
Miscellaneous useful git commands
|
||||
@@ -324,6 +414,22 @@ Miscellaneous useful git commands
|
||||
you an interface with which you can reorder and modify arbitrary
|
||||
change sets on that branch.
|
||||
|
||||
* if you "misplace" a change set, i.e., via git reset --hard ..., so that
|
||||
it's no longer reachable by any branch, you can use "git fsck" to find
|
||||
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
|
||||
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.
|
||||
For example, say that found 556fbb57216b119155cdda824c98dc579b8121c8,
|
||||
you could run "git show 556fbb57216b119" to examine the change set,
|
||||
or "git checkout -b found 556fbb5721" to give it a branch name.
|
||||
Finally, you might run "git checkout master && git cherry-pick 556fbb5721"
|
||||
to put that change on the tip of "master".
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
Finding things to do
|
||||
@@ -350,3 +456,13 @@ to generate HTML coverage reports. Follow these steps:
|
||||
|
||||
Then just open the index.html file (in the generated lcov-html directory)
|
||||
in your favorite web browser.
|
||||
|
||||
========================================================================
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
Documentation License'' file as part of this distribution.
|
||||
|
||||
11
Makefile.am
11
Makefile.am
@@ -20,10 +20,13 @@ EXTRA_DIST = cfg.mk maint.mk \
|
||||
.prev-version THANKS-to-translators THANKStt.in \
|
||||
.version \
|
||||
.vg-suppressions \
|
||||
.x-po-check \
|
||||
.x-sc_GPL_version \
|
||||
.x-sc_file_system .x-sc_obsolete_symbols \
|
||||
.x-sc_file_system \
|
||||
.x-sc_obsolete_symbols \
|
||||
.x-sc_po_check \
|
||||
.x-sc_program_name \
|
||||
.x-sc_prohibit_atoi_atof \
|
||||
.x-sc_prohibit_stat_st_blocks \
|
||||
.x-sc_prohibit_strcmp \
|
||||
.x-sc_require_config_h \
|
||||
.x-sc_space_tab .x-sc_sun_os_names \
|
||||
@@ -99,8 +102,8 @@ MAINTAINERCLEANFILES = THANKS-to-translators
|
||||
THANKS-to-translators: po/LINGUAS THANKStt.in
|
||||
( \
|
||||
cat $(srcdir)/THANKStt.in; \
|
||||
for lang in `cat $(srcdir)/po/LINGUAS`; do \
|
||||
echo http://www.iro.umontreal.ca/contrib/po/HTML/team-$$lang.html; \
|
||||
for lang in `cat $(srcdir)/po/LINGUAS`; do \
|
||||
echo http://translationproject.org/team/$$lang.html; \
|
||||
done; \
|
||||
) > $@-tmp && mv $@-tmp $@
|
||||
|
||||
|
||||
214
NEWS
214
NEWS
@@ -1,5 +1,216 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 7.2 (2009-03-31) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
pwd now accepts the options --logical (-L) and --physical (-P). For
|
||||
compatibility with existing scripts, -P is the default behavior
|
||||
unless POSIXLY_CORRECT is requested.
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cat once again immediately outputs data it has processed.
|
||||
Previously it would have been buffered and only output if enough
|
||||
data was read, or on process exit.
|
||||
[bug introduced in coreutils-6.0]
|
||||
|
||||
comm's new --check-order option would fail to detect disorder on any pair
|
||||
of lines where one was a prefix of the other. For example, this would
|
||||
fail to report the disorder: printf 'Xb\nX\n'>k; comm --check-order k k
|
||||
[bug introduced in coreutils-7.0]
|
||||
|
||||
cp once again diagnoses the invalid "cp -rl dir dir" right away,
|
||||
rather than after creating a very deep dir/dir/dir/... hierarchy.
|
||||
The bug strikes only with both --recursive (-r, -R) and --link (-l).
|
||||
[bug introduced in coreutils-7.1]
|
||||
|
||||
ls --sort=version (-v) sorted names beginning with "." inconsistently.
|
||||
Now, names that start with "." are always listed before those that don't.
|
||||
|
||||
pr: fix the bug whereby --indent=N (-o) did not indent header lines
|
||||
[bug introduced in coreutils-6.9.90]
|
||||
|
||||
sort now handles specified key ends correctly.
|
||||
Previously -k1,1b would have caused leading space from field 2 to be
|
||||
included in the sort while -k2,3.0 would have not included field 3.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
cp,mv,install,cat,split: now read and write a minimum of 32KiB
|
||||
at a time. This was seen to increase throughput. Up to 2 times
|
||||
when reading cached files on linux for example.
|
||||
|
||||
cp -a now tries to preserve extended attributes (xattr), but does not
|
||||
diagnose xattr-preservation failure. However, cp --preserve=all still does.
|
||||
|
||||
ls --color: hard link highlighting can be now disabled by changing the
|
||||
LS_COLORS environment variable. To disable it you can add something like
|
||||
this to your profile: eval `dircolors | sed s/hl=[^:]*:/hl=:/`
|
||||
|
||||
|
||||
* Noteworthy changes in release 7.1 (2009-02-21) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
Add extended attribute support available on certain filesystems like ext2
|
||||
and XFS.
|
||||
cp: Tries to copy xattrs when --preserve=xattr or --preserve=all specified
|
||||
mv: Always tries to copy xattrs
|
||||
install: Never copies xattrs
|
||||
|
||||
cp and mv accept a new option, --no-clobber (-n): silently refrain
|
||||
from overwriting any existing destination file
|
||||
|
||||
dd accepts iflag=cio and oflag=cio to open the file in CIO (concurrent I/O)
|
||||
mode where this feature is available.
|
||||
|
||||
install accepts a new option, --compare (-C): compare each pair of source
|
||||
and destination files, and if the destination has identical content and
|
||||
any specified owner, group, permissions, and possibly SELinux context, then
|
||||
do not modify the destination at all.
|
||||
|
||||
ls --color now highlights hard linked files, too
|
||||
|
||||
stat -f recognizes the Lustre file system type
|
||||
|
||||
** Bug fixes
|
||||
|
||||
chgrp, chmod, chown --silent (--quiet, -f) no longer print some diagnostics
|
||||
[bug introduced in coreutils-5.1]
|
||||
|
||||
cp uses much less memory in some situations
|
||||
|
||||
cp -a now correctly tries to preserve SELinux context (announced in 6.9.90),
|
||||
doesn't inform about failure, unlike with --preserve=all
|
||||
|
||||
du --files0-from=FILE no longer reads all of FILE into RAM before
|
||||
processing the first file name
|
||||
|
||||
seq 9223372036854775807 9223372036854775808 now prints only two numbers
|
||||
on systems with extended long double support and good library support.
|
||||
Even with this patch, on some systems, it still produces invalid output,
|
||||
from 3 to at least 1026 lines long. [bug introduced in coreutils-6.11]
|
||||
|
||||
seq -w now accounts for a decimal point added to the last number
|
||||
to correctly print all numbers to the same width.
|
||||
|
||||
wc --files0-from=FILE no longer reads all of FILE into RAM, before
|
||||
processing the first file name, unless the list of names is known
|
||||
to be small enough.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
cp and mv: the --reply={yes,no,query} option has been removed.
|
||||
Using it has elicited a warning for the last three years.
|
||||
|
||||
dd: user specified offsets that are too big are handled better.
|
||||
Previously, erroneous parameters to skip and seek could result
|
||||
in redundant reading of the file with no warnings or errors.
|
||||
|
||||
du: -H (initially equivalent to --si) is now equivalent to
|
||||
--dereference-args, and thus works as POSIX requires
|
||||
|
||||
shred: now does 3 overwrite passes by default rather than 25.
|
||||
|
||||
ls -l now marks SELinux-only files with the less obtrusive '.',
|
||||
rather than '+'. A file with any other combination of MAC and ACL
|
||||
is still marked with a '+'.
|
||||
|
||||
|
||||
* Noteworthy changes in release 7.0 (2008-10-05) [beta]
|
||||
|
||||
** New programs
|
||||
|
||||
timeout: Run a command with bounded time.
|
||||
truncate: Set the size of a file to a specified size.
|
||||
|
||||
** New features
|
||||
|
||||
chgrp, chmod, chown, chcon, du, rm: now all display linear performance,
|
||||
even when operating on million-entry directories on ext3 and ext4 file
|
||||
systems. Before, they would exhibit O(N^2) performance, due to linear
|
||||
per-entry seek time cost when operating on entries in readdir order.
|
||||
Rm was improved directly, while the others inherit the improvement
|
||||
from the newer version of fts in gnulib.
|
||||
|
||||
comm now verifies that the inputs are in sorted order. This check can
|
||||
be turned off with the --nocheck-order option.
|
||||
|
||||
comm accepts new option, --output-delimiter=STR, that allows specification
|
||||
of an output delimiter other than the default single TAB.
|
||||
|
||||
cp and mv: the deprecated --reply=X option is now also undocumented.
|
||||
|
||||
dd accepts iflag=fullblock to make it accumulate full input blocks.
|
||||
With this new option, after a short read, dd repeatedly calls read,
|
||||
until it fills the incomplete block, reaches EOF, or encounters an error.
|
||||
|
||||
df accepts a new option --total, which produces a grand total of all
|
||||
arguments after all arguments have been processed.
|
||||
|
||||
If the GNU MP library is available at configure time, factor and
|
||||
expr support arbitrarily large numbers. Pollard's rho algorithm is
|
||||
used to factor large numbers.
|
||||
|
||||
install accepts a new option --strip-program to specify the program used to
|
||||
strip binaries.
|
||||
|
||||
ls now colorizes files with capabilities if libcap is available
|
||||
|
||||
ls -v now uses filevercmp function as sort predicate (instead of strverscmp)
|
||||
|
||||
md5sum now accepts the new option, --quiet, to suppress the printing of
|
||||
'OK' messages. sha1sum, sha224sum, sha384sum, and sha512sum accept it, too.
|
||||
|
||||
sort accepts a new option, --files0-from=F, that specifies a file
|
||||
containing a null-separated list of files to sort. This list is used
|
||||
instead of filenames passed on the command-line to avoid problems with
|
||||
maximum command-line (argv) length.
|
||||
|
||||
sort accepts a new option --batch-size=NMERGE, where NMERGE
|
||||
represents the maximum number of inputs that will be merged at once.
|
||||
When processing more than NMERGE inputs, sort uses temporary files.
|
||||
|
||||
sort accepts a new option --version-sort (-V, --sort=version),
|
||||
specifying that ordering is to be based on filevercmp.
|
||||
|
||||
** Bug fixes
|
||||
|
||||
chcon --verbose now prints a newline after each message
|
||||
|
||||
od no longer suffers from platform bugs in printf(3). This is
|
||||
probably most noticeable when using 'od -tfL' to print long doubles.
|
||||
|
||||
seq -0.1 0.1 2 now prints 2,0 when locale's decimal point is ",".
|
||||
Before, it would mistakenly omit the final number in that example.
|
||||
|
||||
shuf honors the --zero-terminated (-z) option, even with --input-range=LO-HI
|
||||
|
||||
shuf --head-count is now correctly documented. The documentation
|
||||
previously claimed it was called --head-lines.
|
||||
|
||||
** Improvements
|
||||
|
||||
Improved support for access control lists (ACLs): On MacOS X, Solaris 7..10,
|
||||
HP-UX 11, Tru64, AIX, IRIX 6.5, and Cygwin, "ls -l" now displays the presence
|
||||
of an ACL on a file via a '+' sign after the mode, and "cp -p" copies ACLs.
|
||||
|
||||
join has significantly better performance due to better memory management
|
||||
|
||||
ls now uses constant memory when not sorting and using one_per_line format,
|
||||
no matter how many files are in a given directory
|
||||
|
||||
od now aligns fields across lines when printing multiple -t
|
||||
specifiers, and no longer prints fields that resulted entirely from
|
||||
padding the input out to the least common multiple width.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
stat's --context (-Z) option has always been a no-op.
|
||||
Now it evokes a warning that it is obsolete and will be removed.
|
||||
|
||||
|
||||
* Noteworthy changes in release 6.12 (2008-05-31) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -2211,8 +2422,7 @@ packages, see ./old/*/NEWS.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
|
||||
28
README
28
README
@@ -13,8 +13,9 @@ The programs that can be built with this package are:
|
||||
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
|
||||
runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
|
||||
sleep sort split stat stty su sum sync tac tail tee test touch tr true
|
||||
tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
|
||||
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
|
||||
|
||||
See the file NEWS for a list of major changes in the current release.
|
||||
|
||||
@@ -91,11 +92,15 @@ compiler, due to the use of declarations after non-declaration statements
|
||||
in several files in src/. There is code in configure to find and, if
|
||||
possible, enable an appropriate compiler. However, if configure doesn't
|
||||
find a C99 compiler, it continues nonetheless, and your build will fail.
|
||||
If that happens, simply apply the included patch using the following
|
||||
If that happens, simply[*] apply the included patch using the following
|
||||
command, and then run make again:
|
||||
|
||||
cd src && patch < c99-to-c89.diff
|
||||
|
||||
[*] however, as of coreutils-7.1, the "c99-to-c89.diff" file is no longer
|
||||
maintained, so even if the patches still apply, the result will be an
|
||||
incomplete conversion. It's been 10 years. Get a decent compiler! ;-)
|
||||
|
||||
|
||||
***********************
|
||||
HPUX 11.x build failure
|
||||
@@ -160,17 +165,13 @@ Reporting bugs:
|
||||
IMPORTANT: if you take the time to report a test failure,
|
||||
please be sure to include the output of running `make check'
|
||||
in verbose mode for each failing test. For example,
|
||||
if the test that fails is tests/mv/hard-link-1, then you
|
||||
would run this command:
|
||||
if the test that fails is tests/misc/df, then you would
|
||||
run this command:
|
||||
|
||||
env VERBOSE=yes make check -C tests/mv TESTS=hard-link-1 >> log 2>&1
|
||||
(cd tests && make check TESTS=misc/df VERBOSE=yes) >> log 2>&1
|
||||
|
||||
For some tests, you can get even more detail by including
|
||||
DEBUG=yes in the environment:
|
||||
|
||||
env DEBUG=yes VERBOSE=yes make check -C tests/mv TESTS=hard-link-1 >> log 2>&1
|
||||
|
||||
and then include the contents of the file `log' in your bug report.
|
||||
For some tests, you can get even more detail by adding DEBUG=yes.
|
||||
Then include the contents of the file `log' in your bug report.
|
||||
|
||||
***************************************
|
||||
|
||||
@@ -230,8 +231,7 @@ the address on the last line of --help output.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 1998, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 1998, 2002-2009 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
|
||||
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.
|
||||
|
||||
* 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.
|
||||
For example, you have to use the latest stable versions of the maintainer
|
||||
tools we depend upon, including:
|
||||
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/>
|
||||
@@ -22,46 +23,44 @@ tools we depend upon, including:
|
||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||
- Tar <http://www.gnu.org/software/tar/>
|
||||
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture.
|
||||
|
||||
Only building the initial full source tree will be a bit painful.
|
||||
Later, a plain `git pull && make' should be sufficient.
|
||||
|
||||
* LZMA
|
||||
- Valgrind
|
||||
|
||||
The coreutils build procedure can build distribution tarballs with the
|
||||
LZMA compression scheme. This feature is so new that it is not
|
||||
supported by the latest version of Automake. If you don't care about
|
||||
building LZMA tarballs, you can manually remove the string "dist-lzma"
|
||||
from configure.ac before bootstrapping.
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture. See also README-valgrind.
|
||||
|
||||
If you do want to build LZMA tarballs, you'll need to make sure you
|
||||
have the latest stable version of the LZMA Utils
|
||||
<http://tukaani.org/lzma/>. Also, you'll need a version of
|
||||
Automake that supports the dist-lzma feature, like automake-1.10.1.
|
||||
- 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>.
|
||||
|
||||
* First GIT checkout
|
||||
|
||||
You can get a copy of the source repository like this:
|
||||
|
||||
$ git clone git://git.sv.gnu.org/coreutils
|
||||
$ git clone git://git.sv.gnu.org/coreutils
|
||||
$ cd coreutils
|
||||
|
||||
The next step is to get other files needed to build, which are
|
||||
extracted from other source packages:
|
||||
The next step is to get and check other files needed to build,
|
||||
which are extracted from other source packages:
|
||||
|
||||
$ ./bootstrap
|
||||
$ ./bootstrap
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make check
|
||||
$ ./configure #[--enable-gcc-warnings]
|
||||
$ make
|
||||
$ make check
|
||||
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the GIT master copy:
|
||||
|
||||
$ git diff
|
||||
$ git diff
|
||||
|
||||
should output no difference.
|
||||
|
||||
@@ -69,7 +68,7 @@ Enjoy!
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-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
|
||||
@@ -83,3 +82,7 @@ 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:
|
||||
|
||||
32
README-prereq
Normal file
32
README-prereq
Normal file
@@ -0,0 +1,32 @@
|
||||
Detailed below are concrete examples for
|
||||
getting the prerequisites for particular systems.
|
||||
|
||||
- linux - fedora
|
||||
|
||||
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 linux system at least.
|
||||
|
||||
1. Make sure offical distro git package is installed
|
||||
# yum install git
|
||||
|
||||
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.10a in step 3.
|
||||
Apply the same method to install the lzma package.
|
||||
[FIXME: mention xz when it's packaged]
|
||||
|
||||
3. The latest released automake (1.10.1) was not new enough, so we download
|
||||
and build automake-1.10a 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 && ./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
|
||||
95
README-release
Normal file
95
README-release
Normal file
@@ -0,0 +1,95 @@
|
||||
Here are most of the steps we (maintainers) follow when making a release.
|
||||
|
||||
* start from a clean, up-to-date git directory.
|
||||
|
||||
git checkout master; git pull
|
||||
|
||||
* 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.
|
||||
|
||||
* 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
|
||||
|
||||
FIXME: enable excluded programs like arch? to get their manual pages?
|
||||
|
||||
* Pre-release testing:
|
||||
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.,
|
||||
run this: make check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
|
||||
|
||||
Run the root-only tests:
|
||||
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
|
||||
|
||||
* Run "make distcheck"
|
||||
|
||||
* Manually set the date, version number, and [stable/alpha/beta] on
|
||||
line 3 of NEWS, then do this:
|
||||
|
||||
v=7.1
|
||||
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
|
||||
git tag -s -m "coreutils $v" v$v HEAD
|
||||
|
||||
* Run the following to create release tarballs. Your choice selects the
|
||||
corresponding upload-to destination in the emitted gnupload command.
|
||||
|
||||
# "TYPE" must be major, beta or alpha
|
||||
make TYPE
|
||||
|
||||
* Test the tarball. copy it to a few odd-ball systems and ensure that
|
||||
it builds and passes all tests.
|
||||
|
||||
* While that's happening, write the release announcement that you will
|
||||
soon post.
|
||||
|
||||
Once all the builds and tests have passed,
|
||||
|
||||
* Run the gnupload command suggested by your "XZ_OPT=-9e 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>
|
||||
|
||||
* 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]
|
||||
|
||||
* Approve the announcement here:
|
||||
http://lists.gnu.org/mailman/admindb/coreutils-announce
|
||||
|
||||
* Announce it on Savannah, too:
|
||||
From here:
|
||||
https://savannah.gnu.org/projects/coreutils/
|
||||
click on the "submit news", then write something like the following:
|
||||
|
||||
The announcement is here:
|
||||
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/48
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
47
THANKS
47
THANKS
@@ -10,6 +10,7 @@ the bug-report mailing list (as seen on last line of e.g., cp --help).
|
||||
A Costa agcosta@gis.net
|
||||
Aaron Hawley ashawley@uvm.edu
|
||||
Achim Blumensath blume@corona.oche.de
|
||||
Adam Jimerson vendion@charter.net
|
||||
Adam Klein aklein@debian.org
|
||||
Adrian Bunk bunk@stusta.de
|
||||
AIDA Shinra shinra@j10n.org
|
||||
@@ -21,6 +22,8 @@ Albert Hopkins ahopkins@dynacare.com
|
||||
Alberto Accomazzi alberto@cfa0.harvard.edu
|
||||
aldomel aldomel@ix.netcom.com
|
||||
Alen Muzinic zveki@fly.cc.fer.hr
|
||||
Alexander Nguyen vinh@seas.ucla.edu
|
||||
Alexander V. Lukyanov lav@netis.ru
|
||||
Allen Hewes allen@decisiv.net
|
||||
Axel Dörfler axeld@pinc-software.de
|
||||
Alexandre Duret-Lutz duret_g@epita.fr
|
||||
@@ -33,11 +36,12 @@ Andreas Frische andreasfrische@gmail.com
|
||||
Andreas Gruenbacher ag@bestbits.at
|
||||
Andreas Jaeger jaeger@gnu.org
|
||||
Andreas Luik luik@isa.de
|
||||
Andreas Schwab schwab@suse.de
|
||||
Andreas Schwab schwab@linux-m68k.org
|
||||
Andreas Stolcke stolcke@ICSI.Berkeley.EDU
|
||||
Andrei Gaponenko andr@triumf.ca
|
||||
Andres Soolo andres@soolo.matti.ee
|
||||
Andrew Burgess aab@cichlid.com
|
||||
Andrew Church achurch@achurch.org
|
||||
Andrew Dalke dalke@bioreason.com
|
||||
Andrew Fabbro andrew@fabbro.org
|
||||
Andrew Pham andpha@us.ibm.com
|
||||
@@ -58,6 +62,7 @@ Augey Mikus mikus@dqc.org
|
||||
Aurelien Jarno aurel32@debian.org
|
||||
Austin Donnelly Austin.Donnelly@cl.cam.ac.uk
|
||||
Axel Kittenberger Anshil@gmx.net
|
||||
Barry Kelly http://barrkel.blogspot.com/
|
||||
Bauke Jan Douma bjdouma@xs4all.nl
|
||||
Ben Elliston bje@air.net.au
|
||||
Ben Harris bjh21@netbsd.org
|
||||
@@ -79,12 +84,16 @@ Bob Proulx rwp@fc.hp.com
|
||||
Branden Robinson branden@necrotic.deadbeast.net
|
||||
Brendan O'Dea bod@compusol.com.au
|
||||
Brian Kimball bfk@footbag.org
|
||||
Brian M. Carlson sandals@crustytoothpaste.ath.cx
|
||||
Brian Silverman bsilverman@conceptxdesign.com
|
||||
Brian Youmans 3diff@gnu.org
|
||||
Bruce Korb bkorb@veritas.com
|
||||
Bruce Robertson brucer@theodolite.dyndns.org
|
||||
Bruno Haible haible@clisp.cons.org
|
||||
C de-Avillez hggdh2@gmail.com
|
||||
Carl Johnson carlj@cjlinux.home.org
|
||||
Carl Lowenstein cdl@mpl.UCSD.EDU
|
||||
Carl Roth roth@urs.us
|
||||
Carlos Canau Carlos.Canau@relay.puug.pt
|
||||
Charles Karney karney@pppl.gov
|
||||
Charles Randall crandall@matchlogic.com
|
||||
@@ -110,8 +119,9 @@ Cray-Cyber Project http://www.cray-cyber.org
|
||||
Cristian Cadar cristic@stanford.edu
|
||||
Cyril Bouthors cyril@bouthors.org
|
||||
Dale Scheetz dwarf@polaris.net
|
||||
Dameon G. Rogers dgr03@uark.edu
|
||||
Dan Hagerty hag@gnu.ai.it.edu
|
||||
Dan Jacobson http://www.geocities.com/jidani
|
||||
Dan Jacobson jidanni@jidanni.org
|
||||
Dan Pascu dan@services.iiruc.ro
|
||||
Daniel Bergstrom noa@melody.se
|
||||
Daniel Dunbar ddunbar@stanford.edu
|
||||
@@ -122,6 +132,7 @@ Darrel Francis d.francis@cheerful.com
|
||||
Darren Salt ds@youmustbejoking.demon.co.uk
|
||||
Dave Beckett dajobe@dajobe.org
|
||||
David Alan Gilbert gilbertd@treblig.org
|
||||
David Bartley dtbartle@csclub.uwaterloo.ca
|
||||
David Dyck dcd@tc.fluke.COM
|
||||
David Eisner cradle@umd.edu
|
||||
David Flynn dav@chess.plus.com
|
||||
@@ -129,9 +140,11 @@ David Godfrey dave@delta.demon.co.uk
|
||||
David Luyer david_luyer@pacific.net.au
|
||||
David Madore david.madore@ens.fr
|
||||
David Malone dwmalone@cnri.dit.ie
|
||||
Davide Canova kc.canova@gmail.com
|
||||
Dawson Engler engler@stanford.edu
|
||||
Dean Gaudet dean-savannah@arctic.org
|
||||
Deepak Goel deego@gnufans.org
|
||||
Denis Excoffier denis.excoffier@airbus.com
|
||||
Dennis Henriksen opus@flamingo.osrl.dk
|
||||
Dennis Smit ds@nerds-incorporated.org
|
||||
Derek Clegg dclegg@next.com
|
||||
@@ -156,6 +169,7 @@ Elbert Pol elbert.pol@gmail.com
|
||||
Eli Zaretskii eliz@is.elta.co.il
|
||||
Elias Pipping pipping@gentoo.org
|
||||
Emile LeBlanc leblanc@math.toronto.edu
|
||||
Erik Auerswald auerswal@unix-ag.uni-kl.de
|
||||
Eric Backus ericb@lsid.hp.com
|
||||
Eric Blake ebb9@byu.net
|
||||
Eric G. Miller egm2@jps.net
|
||||
@@ -181,6 +195,7 @@ Gabor Z. Papp gzp@gzp.org.hu
|
||||
Gaël Quéri gqueri@mail.dotcom.fr
|
||||
Galen Hazelwood galenh@micron.net
|
||||
Gary Anderson ganderson@clark.net
|
||||
Gary Johnson garyjohn@spk.agilent.com
|
||||
Gary V. Vaughan gary@gnu.org
|
||||
Gaute Hvoslef Kvalnes gaute@verdsveven.com
|
||||
Geoff Collyer geoff at collyer.net
|
||||
@@ -190,11 +205,13 @@ 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
|
||||
Göran Uddeborg goeran@uddeborg.pp.se
|
||||
Glen Lenker glen.lenker@gmail.com
|
||||
Göran Uddeborg goeran@uddeborg.se
|
||||
Guochun Shi gshi@ncsa.uiuc.edu
|
||||
GOTO Masanori gotom@debian.or.jp
|
||||
Greg Louis glouis@dynamicro.on.ca
|
||||
Greg McGary gkm@gnu.org
|
||||
Greg Metcalfe metcalfegreg@qwest.net
|
||||
Greg Schafer gschafer@zip.com.au
|
||||
Greg Troxel gdt@bbn.com
|
||||
Greg Wooledge gawooledge@sherwin.com
|
||||
@@ -209,6 +226,7 @@ Harald Dunkel harald.dunkel@t-online.de
|
||||
Harry Liu rliu@lek.ugcs.caltech.edu
|
||||
Harti Brandt brandt@fokus.fraunhofer.de
|
||||
Harvey Eneman Harvey.Eneman@oracle.com
|
||||
Heiko Marr h.marr@webmasters.de
|
||||
Helen Faulkner helen_ml_faulkner@yahoo.co.uk
|
||||
Herbert Xu herbert@gondor.apana.org.au
|
||||
Holger Berger hberger@ess.nec.de
|
||||
@@ -220,6 +238,7 @@ Ian Jackson ijackson@chiark.greenend.org.uk
|
||||
Ian Lance Taylor ian@cygnus.com
|
||||
Ian Turner vectro@pipeline.com
|
||||
Iida Yosiaki iida@gnu.org
|
||||
Ilya N. Golubev gin@mo.msk.ru
|
||||
Ingo Saitz ingo@debian.org
|
||||
Ivo Timmermans ivo@debian.org
|
||||
James james@albion.glarp.com
|
||||
@@ -229,19 +248,22 @@ James Hunt jamesodhunt@hotmail.com
|
||||
James Ralston ralston@pobox.com
|
||||
James Sneeringer jvs@ocslink.com
|
||||
James Tanis jtt@soscorp.com
|
||||
James Youngman james+usenet@free-lunch.demon.co.uk
|
||||
James Youngman jay@gnu.org
|
||||
Jamie Lokier jamie@imbolc.ucc.ie
|
||||
Jamie McClelland jm@mayfirst.org
|
||||
Jan Engelhardt jengelh@medozas.de
|
||||
Jan Fedak J.Fedak@sh.cvut.cz
|
||||
Jan Moringen jan.moringen@uni-bielefeld.de
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Janos Farkas chexum@shadow.banki.hu
|
||||
Jarkko Hietaniemi jhi@epsilon.hut.fi
|
||||
Jarod Wilson jwilson@redhat.com
|
||||
Jean Charles Delepine delepine@u-picardie.fr
|
||||
Jeff Moore jbm@mordor.com
|
||||
Jeff Sheinberg jeff@bsrd.net
|
||||
Jens Elkner elkner@imsgroup.de
|
||||
Jens Schmidt jms@jsds.hamburg.com
|
||||
Jeph Cowan jeph@ucar.edu
|
||||
Jeremy Maitin-Shepard jbms@cmu.edu
|
||||
Jerome Abela abela@hsc.fr
|
||||
Jérôme Zago bug-coreutils-ml@agt-the-walker.net
|
||||
@@ -271,6 +293,7 @@ Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
|
||||
Joost van Baal joostvb@xs4all.nl
|
||||
Jorge Stolfi stolfi@ic.unicamp.br
|
||||
Joseph S. Myers jsm28@cam.ac.uk
|
||||
Josh Triplett josh@freedesktop.org
|
||||
Joshua Hudson joshudson@gmail.com
|
||||
Josselin Mouette joss@debian.org
|
||||
Juan F. Codagnone juam@arnet.com.ar
|
||||
@@ -344,6 +367,7 @@ Mate Wierdl mw@moni.msci.memphis.edu
|
||||
Matej Vela mvela@public.srce.hr
|
||||
Matt Kraai kraai@ftbfs.org
|
||||
Matt Perry matt@primefactor.com
|
||||
Matt Pham mattvpham@gmail.com
|
||||
Matt Schalit mschalit@pacbell.net
|
||||
Matt Swift swift@alum.mit.edu
|
||||
Matthew Arnison maffew@cat.org.au
|
||||
@@ -357,6 +381,7 @@ Matthew Woehlke mw_triad@users.sourceforge.net
|
||||
Matthias Urlichs smurf@noris.de
|
||||
Matti Aarnio matti.aarnio@zmailer.org
|
||||
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
|
||||
@@ -380,6 +405,7 @@ Michal Politowski mpol@charybda.icm.edu.pl
|
||||
Michal Svec msvec@suse.cz
|
||||
Michel Robitaille robitail@IRO.UMontreal.CA
|
||||
Michiel Bacchiani bacchian@raven.bu.edu
|
||||
Mikael Magnusson mikachu@gmail.com
|
||||
Mike Castle dalgoda@ix.netcom.com
|
||||
Mike Coleman mkc@mathdogs.com
|
||||
Mike Jetzer mjetzer@mke.catalystwms.com
|
||||
@@ -393,11 +419,13 @@ Neal H Walfield neal@cs.uml.edu
|
||||
Neil Brown neilb@cse.unsw.edu.au
|
||||
Nelson H. F. Beebe beebe@math.utah.edu
|
||||
Nick Estes debian@nickstoys.com
|
||||
Nick Graham nick.d.graham@gmail.com
|
||||
Nick Lawes nlawes@silverplatter.com
|
||||
Nickolai Zeldovich nickolai@cs.stanford.edu
|
||||
Nicolas François nicolas.francois@centraliens.net
|
||||
Niklas Edmundsson nikke@acc.umu.se
|
||||
Nikola Milutinovic Nikola.Milutinovic@ev.co.yu
|
||||
Nima Nikzad nnikzad@ucla.edu
|
||||
Noah Friedman friedman@splode.com
|
||||
Noel Cragg noel@red-bean.com
|
||||
Norbert Kiesel nkiesel@tbdnetworks.com
|
||||
@@ -409,6 +437,7 @@ Oliver Kiddle okiddle@yahoo.co.uk
|
||||
Oskar Liljeblad osk@hem.passagen.se
|
||||
Pádraig Brady P@draigBrady.com
|
||||
Patrick Mauritz oxygene@studentenbude.ath.cx
|
||||
Paul D. Smith psmith@gnu.org
|
||||
Paul Eggert eggert@twinsun.com
|
||||
Paul Ghaleb paul.ghaleb@st.com
|
||||
Paul Jarc prj@po.cwru.edu
|
||||
@@ -430,9 +459,11 @@ Peter Moulder reiter@netspace.net.au
|
||||
Peter O'Gorman bug-coreutils@mlists.thewrittenword.com
|
||||
Peter Samuelson psamuels@sampo.creighton.edu
|
||||
Peter Seebach seebs@taniemarie.solon.com
|
||||
Petr Uzel petr.uzel@suse.cz
|
||||
Petter Reinholdtsen pere@hungry.com
|
||||
Phelippe Neveu pneveu@pcigeomatics.com
|
||||
Phil Richards phil.richards@vf.vodafone.co.uk
|
||||
Philip Rowlands phr@doc.ic.ac.uk
|
||||
Philippe De Muyter phdm@macqel.be
|
||||
Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
|
||||
Phillip Jones mouse@datastacks.com
|
||||
@@ -440,6 +471,7 @@ Piergiorgio Sartor sartor@sony.de
|
||||
Pieter Bowman bowman@math.utah.edu
|
||||
Piotr Kwapulinski kwap@univ.gda.pl
|
||||
Prashant TR tr@eth.net
|
||||
Priit Jõerüüt jemm4jemm@yahoo.com
|
||||
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
|
||||
Ralf W. Stephan stephan@tmt.de
|
||||
Ralf Wildenhues Ralf.Wildenhues@gmx.de
|
||||
@@ -467,6 +499,7 @@ Ross Alexander r.alexander@auckland.ac.nz
|
||||
Ross Paterson rap@doc.ic.ac.uk
|
||||
Ross Ridge rridge@calum.csclub.uwaterloo.ca
|
||||
Rudolf Kastl rkastl@redhat.com
|
||||
Sahil Amoli sahilamoli@gmail.com
|
||||
Sami Farin sfarin@ratol.fi
|
||||
Samuel Tardieu sam@rfc1149.net
|
||||
Samuel Thibault samuel.thibault@ens-lyon.org
|
||||
@@ -493,6 +526,7 @@ Steven G. Johnson stevenj@alum.mit.edu
|
||||
Steven Mocking ufo@quicknet.nl
|
||||
Steven P Watson steven@magelico.net
|
||||
Stuart Kemp skemp@peter.bmc.com
|
||||
Stuart Shelton stuart@shelton.me
|
||||
Sven Joachim svenjoac@gmx.de
|
||||
Szakacsits Szabolcs szaka@sienet.hu
|
||||
Tadayoshi Funaba tadf@kt.rim.or.jp
|
||||
@@ -510,8 +544,10 @@ Thomas Schwinge tschwinge@gnu.org
|
||||
Thomas Wolff mined@towo.net
|
||||
Tim J. Robbins tjr@FreeBSD.org
|
||||
Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
|
||||
Tim Ryan Tim_Ryan@bnz.co.nz
|
||||
Tim Smithers mouse@dmouse.com.au
|
||||
Tim Waugh twaugh@redhat
|
||||
Tobias Stoeckmann tobias@bugol.de
|
||||
Toby Peterson toby@opendarwin.org
|
||||
Todd A. Jacobs tjacobs@codegnome.org
|
||||
Tom Haynes thomas@netapp.com
|
||||
@@ -528,6 +564,7 @@ Torbjorn Granlund tege@nada.kth.se
|
||||
Torbjorn Lindgren tl@funcom.no
|
||||
Torsten Landschoff torsten@pclab.ifg.uni-kiel.de
|
||||
Tristan Miller psychonaut@nothingisreal.com
|
||||
Tzvi Rotshtein tzvi.ro@gmail.com
|
||||
Ulrich Drepper drepper@gnu.org
|
||||
Ulrich Hermisson ulrich_hermisson@hotmail.com
|
||||
Urs Thuermann urs@isnogud.escape.de
|
||||
@@ -535,7 +572,9 @@ Uwe H. Steinfeld usteinfeld@gmx.net
|
||||
Vesselin Atanasov vesselin@bgnet.bg
|
||||
Vin Shelton acs@alumni.princeton.edu
|
||||
Vineet Chadha chadha@acis.ufl.edu
|
||||
Vitali Lovich vlovich@gmail.com
|
||||
Vitaly A. Ostanin vyt@altlinux.org
|
||||
Vito Caputo vcaputo@pengaru.com
|
||||
Vlada Macek tuttle@bbs.fsik.cvut.cz
|
||||
Volker Borchert bt@teknon.de
|
||||
Volker Paul vpaul@dohle.com
|
||||
|
||||
39
TODO
39
TODO
@@ -5,26 +5,31 @@ longer pertinent, please search the mailing list and post your intent
|
||||
before embarking on a big project.
|
||||
|
||||
==================================================
|
||||
Modify chmod so that it does not change an inode's st_ctime
|
||||
when the selected operation would have no other effect.
|
||||
First suggested by Hans Ecke <http://hans.ecke.ws> in
|
||||
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/2920
|
||||
Discussed more recently on <http://bugs.debian.org/497514>.
|
||||
|
||||
document the following in coreutils.texi:
|
||||
runcon
|
||||
chcon
|
||||
mktemp
|
||||
[
|
||||
pinky
|
||||
uptime
|
||||
Also document the SELinux changes.
|
||||
|
||||
Suggestion from Paul Eggert:
|
||||
More generally, there's not that much use for imaxtostr nowadays,
|
||||
since the inttypes module and newer versions of gettext allow things
|
||||
like _("truncating %s at %" PRIdMAX " bytes") to work portably.
|
||||
I suspect that (if someone cares to take the time) we can remove
|
||||
all instances of imaxtostr and umaxtostr in coreutils and gnulib.
|
||||
|
||||
cp --recursive: use fts and *at functions to perform directory traversals
|
||||
in source and destination hierarchy rather than forming full file names.
|
||||
The latter (current) approach fails unnecessarily when the names
|
||||
become very long, and requires space and time that is quadratic in the
|
||||
depth of the hierarchy. [Bo Borgerson is working on this]
|
||||
|
||||
comm: add an option, --output-delimiter=STR
|
||||
Files to change: src/comm.c, ChangeLog, NEWS, doc/coreutils.texi,
|
||||
Add a new file, tests/misc/comm (use another file in that directory as
|
||||
a template), to exercise the new option. Suggestion from Dan Jacobson.
|
||||
|
||||
printf:
|
||||
Now that gnulib supports *printf("%a"), import one of the
|
||||
*printf-posix modules so that printf(1) will support %a even on
|
||||
@@ -35,9 +40,6 @@ renice: POSIX utility, needs implementing.
|
||||
suggestion from Karl Berry (among others).
|
||||
Bob Proulx is working on this.
|
||||
|
||||
install: add an option to specify the program used to strip binaries.
|
||||
suggestion from Karl Berry
|
||||
|
||||
doc/coreutils.texi:
|
||||
Address this comment: FIXME: mv's behavior in this case is system-dependent
|
||||
Better still: fix the code so it's *not* system-dependent.
|
||||
@@ -65,8 +67,6 @@ Should printf '\0123' print "\n3"?
|
||||
|
||||
printf: consider adapting builtins/printf.def from bash
|
||||
|
||||
df: add `--total' option, suggested here http://bugs.debian.org/186007
|
||||
|
||||
tail: don't use xlseek; it *exits*.
|
||||
Instead, maybe use a macro and return nonzero.
|
||||
|
||||
@@ -102,6 +102,9 @@ sort: Investigate better sorting algorithms; see Knuth vol. 3.
|
||||
5.3.1, who credits Lester Ford, Jr. and Selmer Johnson, American
|
||||
Mathematical Monthly 66 (1959), 387-389.
|
||||
|
||||
shred: Update shred as described here to conform to DoD 5220 rules:
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2007-05/msg00075.html
|
||||
|
||||
Remove suspicious uses of alloca (ones that may allocate more than
|
||||
about 4k)
|
||||
|
||||
@@ -125,9 +128,6 @@ Changes expected to go in, someday.
|
||||
an implicit --NO-dereference-command-line-symlink-to-dir meaning.
|
||||
Pointed out by Karl Berry.
|
||||
|
||||
A more efficient version of factor, and possibly one that
|
||||
accepts inputs of size 2^64 and larger.
|
||||
|
||||
dd: consider adding an option to suppress `bytes/block read/written'
|
||||
output to stderr. Suggested here:
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=165045
|
||||
@@ -157,6 +157,11 @@ remove all uses of the `register' keyword: Done. add a maint.mk rule
|
||||
remove or adjust chown's --changes option, since it
|
||||
can't always do what it currently says it does.
|
||||
|
||||
Support arbitrary-precision arithmetic in those tools for which it
|
||||
makes sense. Factor and expr already support this via libgmp.
|
||||
The "test" program is covered via its string-based comparison of
|
||||
integers. To be converted: seq.
|
||||
|
||||
Adapt tools like wc, tr, fmt, etc. (most of the textutils) to be
|
||||
multibyte aware. The problem is that I want to avoid duplicating
|
||||
significant blocks of logic, yet I also want to incur only minimal
|
||||
@@ -166,7 +171,7 @@ pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-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
|
||||
|
||||
206
bootstrap
206
bootstrap
@@ -2,7 +2,7 @@
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-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
|
||||
@@ -49,9 +49,12 @@ Options:
|
||||
not to have been checked out.
|
||||
--skip-po Do not download po files.
|
||||
|
||||
If the file bootstrap.conf exists in the current working directory, its
|
||||
If the file $0.conf exists in the same directory as this script, its
|
||||
contents are read as shell variables to configure the bootstrap.
|
||||
|
||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||
are honored.
|
||||
|
||||
Running without arguments will suffice in most cases.
|
||||
"
|
||||
}
|
||||
@@ -146,7 +149,13 @@ copy=false
|
||||
vc_ignore=auto
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
test -r bootstrap.conf && . ./bootstrap.conf
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
# if we were invoked as "sh bootstrap".
|
||||
case "$0" in
|
||||
*/*) test -r "$0.conf" && . "$0.conf" ;;
|
||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||
esac
|
||||
|
||||
|
||||
if test "$vc_ignore" = auto; then
|
||||
vc_ignore=
|
||||
@@ -165,7 +174,7 @@ do
|
||||
usage
|
||||
exit;;
|
||||
--gnulib-srcdir=*)
|
||||
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
|
||||
GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
|
||||
--skip-po)
|
||||
SKIP_PO=t;;
|
||||
--force)
|
||||
@@ -189,7 +198,7 @@ insert_sorted_if_absent() {
|
||||
file=$1
|
||||
str=$2
|
||||
test -f $file || touch $file
|
||||
echo "$str" | sort -u - $file | cmp -s - $file \
|
||||
echo "$str" | sort -u - $file | cmp - $file > /dev/null \
|
||||
|| echo "$str" | sort -u - $file -o $file \
|
||||
|| exit 1
|
||||
}
|
||||
@@ -216,29 +225,161 @@ if test ! -d $build_aux; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Note this deviates from the version comparison in automake
|
||||
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
|
||||
# but this should suffice as we won't be specifying old
|
||||
# version formats or redundant trailing .0 in bootstrap.conf.
|
||||
# If we did want full compatibility then we should probably
|
||||
# use m4_version_compare from autoconf.
|
||||
sort_ver() { #sort -V is not generally available
|
||||
ver1="$1"
|
||||
ver2="$2"
|
||||
|
||||
#split on '.' and compare each component
|
||||
i=1
|
||||
while : ; do
|
||||
p1=$(echo "$ver1" | cut -d. -f$i)
|
||||
p2=$(echo "$ver2" | cut -d. -f$i)
|
||||
if [ ! "$p1" ]; then
|
||||
echo "$1 $2"
|
||||
break
|
||||
elif [ ! "$p2" ]; then
|
||||
echo "$2 $1"
|
||||
break
|
||||
elif [ ! "$p1" = "$p2" ]; then
|
||||
if [ "$p1" -gt "$p2" ] 2>/dev/null; then #numeric comparision
|
||||
echo "$2 $1"
|
||||
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then #numeric comparision
|
||||
echo "$1 $2"
|
||||
else #numeric, then lexographic comparison
|
||||
lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
|
||||
if [ "$lp" = "$p2" ]; then
|
||||
echo "$1 $2"
|
||||
else
|
||||
echo "$2 $1"
|
||||
fi
|
||||
fi
|
||||
break
|
||||
fi
|
||||
i=$(($i+1))
|
||||
done
|
||||
}
|
||||
|
||||
get_version() {
|
||||
app=$1
|
||||
|
||||
$app --version >/dev/null 2>&1 || return 1
|
||||
|
||||
$app --version 2>&1 |
|
||||
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
|
||||
t done
|
||||
d
|
||||
:done
|
||||
q'
|
||||
}
|
||||
|
||||
check_versions() {
|
||||
ret=0
|
||||
|
||||
while read app req_ver; do
|
||||
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
|
||||
appvar=`echo $app | tr '[a-z]' '[A-Z]'`
|
||||
test "$appvar" = TAR && appvar=AMTAR
|
||||
eval "app=\${$appvar-$app}"
|
||||
inst_ver=$(get_version $app)
|
||||
if [ ! "$inst_ver" ]; then
|
||||
echo "Error: '$app' not found" >&2
|
||||
ret=1
|
||||
elif [ ! "$req_ver" = "-" ]; then
|
||||
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
|
||||
if [ ! "$latest_ver" = "$inst_ver" ]; then
|
||||
echo "Error: '$app' version == $inst_ver is too old" >&2
|
||||
echo " '$app' version >= $req_ver is required" >&2
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
print_versions() {
|
||||
echo "Program Min_version"
|
||||
echo "----------------------"
|
||||
printf "$buildreq"
|
||||
echo "----------------------"
|
||||
#can't depend on column -t
|
||||
}
|
||||
|
||||
if ! printf "$buildreq" | check_versions; then
|
||||
test -f README-prereq &&
|
||||
echo "Please see README-prereq for notes on obtaining these prerequisite programs:" >&2
|
||||
echo
|
||||
print_versions
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||
|
||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||
:
|
||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
||||
echo "initializing git-merge-changelog driver"
|
||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||
else
|
||||
echo "consider installing git-merge-changelog from gnulib"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
cleanup_gnulib() {
|
||||
status=$?
|
||||
rm -fr gnulib
|
||||
exit $status
|
||||
}
|
||||
|
||||
git_modules_config () {
|
||||
GIT_CONFIG=.gitmodules git config "$@"
|
||||
}
|
||||
|
||||
# Get gnulib files.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
if [ ! -d gnulib ]; then
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init || exit $?
|
||||
git submodule update || exit $?
|
||||
|
||||
elif [ ! -d gnulib ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
git clone --depth 2 git://git.sv.gnu.org/gnulib ||
|
||||
git clone --help|grep depth > /dev/null && depth='--depth 2' || depth=
|
||||
git clone $depth git://git.sv.gnu.org/gnulib ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=gnulib
|
||||
;;
|
||||
*)
|
||||
# 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 submodule init
|
||||
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
|
||||
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule update || exit $?
|
||||
GNULIB_SRCDIR=gnulib
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
@@ -273,15 +414,15 @@ update_po_files() {
|
||||
|
||||
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
|
||||
test "$langs" = '*' && langs=x
|
||||
for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
|
||||
for po in $langs; do
|
||||
case $po in x) continue;; esac
|
||||
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 -c --status "$cksum_file" < "$new_po" > /dev/null; then
|
||||
! ${SHA1SUM-sha1sum} -c --status "$cksum_file" < "$new_po" > /dev/null; then
|
||||
echo "updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
|
||||
cp "$new_po" "$po_dir/$po.po" && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -383,9 +524,13 @@ 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" &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src" > "$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
|
||||
@@ -440,7 +585,7 @@ slurp() {
|
||||
if test $file = Makefile.am; then
|
||||
copied=$copied${sep}$gnulib_mk; sep=$nl
|
||||
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
|
||||
sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/$gnulib_mk || {
|
||||
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
|
||||
@@ -522,13 +667,12 @@ grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
|
||||
with_gettext=no
|
||||
|
||||
if test $with_gettext = yes; then
|
||||
echo "$0: (cd $bt2; autopoint) ..."
|
||||
echo "$0: (cd $bt2; ${AUTOPOINT-autopoint}) ..."
|
||||
cp configure.ac $bt2 &&
|
||||
(cd $bt2 && autopoint && rm configure.ac) &&
|
||||
(cd $bt2 && ${AUTOPOINT-autopoint} && rm configure.ac) &&
|
||||
slurp $bt2 $bt || exit
|
||||
|
||||
rm -fr $bt $bt2 || exit
|
||||
fi
|
||||
rm -fr $bt $bt2 || exit
|
||||
|
||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||
@@ -542,20 +686,33 @@ find "$m4_base" "$source_base" \
|
||||
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
||||
-type l -xtype l -delete > /dev/null 2>&1
|
||||
|
||||
# Use automake's --silent-rules option, if possible.
|
||||
automake="${AUTOMAKE-automake} --add-missing --copy --force-missing"
|
||||
(${AUTOMAKE-automake} --help) 2>&1 \
|
||||
| grep -e '^ *--silent-rules' > /dev/null \
|
||||
&& automake="$automake --silent-rules"
|
||||
|
||||
# Reconfigure, getting other files.
|
||||
|
||||
for command in \
|
||||
libtool \
|
||||
'aclocal --force -I m4' \
|
||||
'autoconf --force' \
|
||||
'autoheader --force' \
|
||||
'automake --add-missing --copy --force-missing';
|
||||
"${ACLOCAL-aclocal} --force -I m4" \
|
||||
"${AUTOCONF-autoconf} --force" \
|
||||
"${AUTOHEADER-autoheader} --force" \
|
||||
"$automake"
|
||||
do
|
||||
if test "$command" = libtool; then
|
||||
grep '^[ ]*AM_PROG_LIBTOOL\>' configure.ac >/dev/null ||
|
||||
continue
|
||||
command='libtoolize -c -f'
|
||||
use_libtool=0
|
||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||
# but that's not portable enough (e.g., for Solaris).
|
||||
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
test $use_libtool = 0 \
|
||||
&& continue
|
||||
command="${LIBTOOLIZE-libtoolize} -c -f"
|
||||
fi
|
||||
echo "$0: $command ..."
|
||||
$command || exit
|
||||
@@ -611,7 +768,4 @@ m=gnulib-tests/gnulib.mk
|
||||
sed 's,\.\./\.\.,..,g' $m > $m-t
|
||||
mv -f $m-t $m
|
||||
|
||||
# Make tests executable.
|
||||
chmod a+x gnulib-tests/test-*.sh
|
||||
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006-2008 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
|
||||
@@ -16,11 +16,11 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# We don't need these modules, even though gnulib-tool mistakenly
|
||||
# includes them because of gettext and fchdir dependencies.
|
||||
# We don't need these modules.
|
||||
avoided_gnulib_modules='
|
||||
--avoid=lock
|
||||
--avoid=canonicalize-lgpl
|
||||
--avoid=dummy
|
||||
--avoid=lock
|
||||
'
|
||||
|
||||
# These modules are obsolete and can probably be removed soon,
|
||||
@@ -34,7 +34,9 @@ obsolete_gnulib_modules='
|
||||
gnulib_modules="
|
||||
$avoided_gnulib_modules
|
||||
$obsolete_gnulib_modules
|
||||
acl alloca announce-gen argmatch assert
|
||||
acl alloca announce-gen argmatch
|
||||
argv-iter
|
||||
assert
|
||||
autobuild
|
||||
backupfile base64
|
||||
c-strcase c-strtod
|
||||
@@ -48,28 +50,35 @@ gnulib_modules="
|
||||
cycle-check
|
||||
d-ino d-type diacrit dirfd dirname dup2
|
||||
error euidaccess exclude exitfail fchdir fcntl fcntl-safer fdl
|
||||
file-type fileblocks filemode filenamecat fnmatch-gnu
|
||||
file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu
|
||||
fopen-safer
|
||||
fprintftime
|
||||
fseeko
|
||||
fsusage ftruncate
|
||||
ftello
|
||||
fts getdate getgroups gethrxtime
|
||||
gendocs
|
||||
getline getloadavg getndelim2 getopt getpagesize getpass-gnu
|
||||
gettext gettime gettimeofday getugroups getusershell
|
||||
git-version-gen
|
||||
gitlog-to-changelog
|
||||
gnu-make gnumakefile gnupload
|
||||
group-member hard-locale hash hash-pjw host-os human idcache
|
||||
ignore-value
|
||||
inttostr inttypes isapipe
|
||||
lchmod lchown lib-ignore linebuffer link-follow
|
||||
long-options lstat malloc mbswidth memcasecmp mempcpy
|
||||
long-options lstat malloc
|
||||
manywarnings
|
||||
mbrtowc
|
||||
mbswidth
|
||||
memcasecmp memcmp2 mempcpy
|
||||
memrchr mgetgroups
|
||||
mkancesdirs mkdir mkdir-p mkstemp mktime modechange
|
||||
mountlist mpsort obstack pathmax perl physmem
|
||||
posix-shell
|
||||
posixtm
|
||||
posixver
|
||||
progname
|
||||
propername
|
||||
putenv
|
||||
quote quotearg raise readlink areadlink-with-size
|
||||
@@ -83,9 +92,10 @@ gnulib_modules="
|
||||
safe-read same
|
||||
save-cwd savedir savewd
|
||||
selinux-at
|
||||
settime sig2str ssize_t stat-macros
|
||||
settime sig2str sigaction ssize_t stat-macros
|
||||
stat-time stdbool stdlib-safer stpcpy
|
||||
stpncpy
|
||||
strdup
|
||||
strftime
|
||||
strpbrk strtoimax strtoumax strverscmp sys_stat timespec tzset
|
||||
unicodeio unistd-safer unlink-busy unlinkdir unlocked-io
|
||||
@@ -94,9 +104,12 @@ gnulib_modules="
|
||||
userspec utimecmp utimens
|
||||
vasprintf-posix
|
||||
vc-list-files
|
||||
verify version-etc-fsf
|
||||
verify version-etc-fsf verror
|
||||
warnings
|
||||
wcwidth winsz-ioctl winsz-termios write-any-file
|
||||
xalloc xgetcwd xgethostname
|
||||
xalloc
|
||||
xfreopen
|
||||
xgetcwd xgethostname
|
||||
xmemcoll xnanosleep
|
||||
xprintf
|
||||
xprintf-posix
|
||||
@@ -109,17 +122,19 @@ EXTRA_LOCALE_CATEGORIES=LC_TIME
|
||||
|
||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||
--from-code=UTF-8\\\
|
||||
--flag=asprintf:2:c-format\\\
|
||||
--flag=asnprintf:3:c-format\\\
|
||||
--flag=asprintf:2:c-format\\\
|
||||
--flag=error:3:c-format\\\
|
||||
--flag=error_at_line:5:c-format\\\
|
||||
--flag=vasprintf:2:c-format\\\
|
||||
--flag=vasnprintf:3:c-format\\\
|
||||
--flag=vasprintf:2:c-format\\\
|
||||
--flag=verror:3:c-format\\\
|
||||
--flag=verror_at_line:5:c-format\\\
|
||||
--flag=wrapf:1:c-format\\\
|
||||
--flag=xasprintf:1:c-format\\\
|
||||
--flag=xfprintf:2:c-format\\\
|
||||
--flag=xprintf:1:c-format\\\
|
||||
--from-code=UTF-8\\\
|
||||
'
|
||||
|
||||
# Append these, since we use the propername module.
|
||||
@@ -159,5 +174,21 @@ fi
|
||||
|
||||
gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
|
||||
|
||||
# Build prerequisites
|
||||
buildreq="\
|
||||
autoconf 2.61
|
||||
automake 1.10a
|
||||
autopoint -
|
||||
bison -
|
||||
gettext -
|
||||
git 1.4.4
|
||||
gperf -
|
||||
gzip -
|
||||
makeinfo -
|
||||
perl 5.5
|
||||
rsync -
|
||||
tar -
|
||||
"
|
||||
|
||||
# Automake requires that ChangeLog exist.
|
||||
touch ChangeLog
|
||||
|
||||
@@ -41,7 +41,7 @@ ENABLE_HARD_ERRORS = :
|
||||
|
||||
## We use GNU Make extensions (%-rules) inside GNU_MAKE checks,
|
||||
## and we override check-TESTS.
|
||||
AUTOMAKE_OPTIONS = -Wno-portability -Wno-override
|
||||
AUTOMAKE_OPTIONS += -Wno-portability -Wno-override
|
||||
|
||||
# Restructured Text title and section.
|
||||
am__rst_title = sed 's/.*/ & /;h;s/./=/g;p;x;p;g;p;s/.*//'
|
||||
@@ -145,7 +145,7 @@ echo "$$res: $@ (exit: $$estatus)" | \
|
||||
cat $@-t >>$@; \
|
||||
rm $@-t
|
||||
|
||||
SUFFIXES = .html .log
|
||||
SUFFIXES += .html .log
|
||||
|
||||
# From a test (with no extension) to a log file.
|
||||
if GNU_MAKE
|
||||
@@ -159,8 +159,9 @@ CHECK-FORCE:
|
||||
DEPENDENCY = CHECK-FORCE
|
||||
$(TEST_LOGS): $(DEPENDENCY)
|
||||
@if test '$(DEPENDENCY)' = CHECK-FORCE; then \
|
||||
dst=$@; \
|
||||
exec $(MAKE) $(AM_MAKEFLAGS) DEPENDENCY='$(srcdir)'/$${dst%.log} $@;\
|
||||
dst=$@; src=$${dst%.log}; \
|
||||
test -x "$$src" || src='$(srcdir)'/$$src; \
|
||||
exec $(MAKE) $(AM_MAKEFLAGS) DEPENDENCY="$$src" $@; \
|
||||
else \
|
||||
src='$(DEPENDENCY)'; \
|
||||
$(am__check_pre) "$$dir$$src" $(am__check_post); \
|
||||
@@ -212,8 +213,8 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
|
||||
for f in $(TEST_LOGS); \
|
||||
do \
|
||||
case $$(sed 1q $$f) in \
|
||||
SKIP:*|PASS:*|XFAIL:*);; \
|
||||
*) echo; cat $$f;; \
|
||||
SKIP:*|PASS:*|XFAIL:*);; \
|
||||
*) echo; cat $$f;; \
|
||||
esac; \
|
||||
done; \
|
||||
} >$(TEST_SUITE_LOG).tmp; \
|
||||
|
||||
158
cfg.mk
158
cfg.mk
@@ -1,5 +1,5 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-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,9 @@ gnu_ftp_host-beta = alpha.gnu.org
|
||||
gnu_ftp_host-major = ftp.gnu.org
|
||||
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
|
||||
|
||||
# Used in maint.mk's web-manual rule
|
||||
manual_title = Core GNU utilities
|
||||
|
||||
url_dir_list = \
|
||||
ftp://$(gnu_rel_host)/gnu/coreutils
|
||||
|
||||
@@ -33,6 +36,8 @@ gpg_key_ID = B9AB9A16
|
||||
# at the top of the file for each `make distcheck' run.
|
||||
local-checks-to-skip = changelog-check strftime-check
|
||||
|
||||
local-checks-to-skip += patch-check
|
||||
|
||||
# The local directory containing the checked-out copy of gnulib used in this
|
||||
# release. Used solely to get gnulib's SHA1 for the "announcement" target.
|
||||
gnulib_dir = /gnulib
|
||||
@@ -40,4 +45,153 @@ gnulib_dir = /gnulib
|
||||
# Now that we have better (check.mk) tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
old_NEWS_hash = c58d611d93d218181ed77f81ff2395ff -
|
||||
old_NEWS_hash = fa6cba1740b3f385520c1b54d90859ca
|
||||
|
||||
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
|
||||
dd = $(srcdir)/src/dd.c
|
||||
sc_dd_O_FLAGS:
|
||||
@rm -f $@.1 $@.2
|
||||
@{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
|
||||
$(dd); } | sort > $@.1
|
||||
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
|
||||
$(dd); } | sort > $@.2
|
||||
@diff -u $@.1 $@.2 || diff=1 || diff=; \
|
||||
rm -f $@.1 $@.2; \
|
||||
test "$$diff" \
|
||||
&& { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
||||
# with the strings from the two affected variables.
|
||||
dd_c = $(srcdir)/src/dd.c
|
||||
sc_dd_max_sym_length:
|
||||
ifneq ($(wildcard $(dd_c)),)
|
||||
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||
| wc --max-line-length); \
|
||||
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||
|tr -d '"' | wc --max-line-length); \
|
||||
if test "$$len" = "$$max"; then :; else \
|
||||
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Many m4 macros names once began with `jm_'.
|
||||
# On 2004-04-13, they were all changed to start with gl_ instead.
|
||||
# Make sure that none are inadvertently reintroduced.
|
||||
sc_prohibit_jm_in_m4:
|
||||
@grep -nE 'jm_[A-Z]' \
|
||||
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
|
||||
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Ensure that each root-requiring test is run via the "check-root" rule.
|
||||
sc_root_tests:
|
||||
@if test -d tests \
|
||||
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
|
||||
t1=sc-root.expected; t2=sc-root.actual; \
|
||||
grep -nl '^require_root_$$' \
|
||||
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
|
||||
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
|
||||
$(srcdir)/tests/Makefile.am \
|
||||
| sed 's/^ *//;/^root_tests =/d' \
|
||||
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
|
||||
diff -u $$t1 $$t2 || diff=1 || diff=; \
|
||||
rm -f $$t1 $$t2; \
|
||||
test "$$diff" \
|
||||
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
headers_with_interesting_macro_defs = \
|
||||
exit.h \
|
||||
fcntl_.h \
|
||||
fnmatch_.h \
|
||||
intprops.h \
|
||||
inttypes_.h \
|
||||
lchown.h \
|
||||
openat.h \
|
||||
stat-macros.h \
|
||||
stdint_.h
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of macros that are guaranteed by parts of gnulib to be defined.
|
||||
.re-defmac:
|
||||
@(cd $(srcdir)/lib; \
|
||||
for f in $(headers_with_interesting_macro_defs); do \
|
||||
test -f $$f && \
|
||||
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
|
||||
done; \
|
||||
) | sort -u \
|
||||
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
|
||||
| sed 's/^/^# *define /' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Don't define macros that we already get from gnulib header files.
|
||||
sc_always_defined_macros: .re-defmac
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
|
||||
grep -f .re-defmac $$($(VC_LIST)) \
|
||||
&& { echo '$(ME): define the above via some gnulib .h file' \
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of files included from system.h. Exclude a couple.
|
||||
.re-list:
|
||||
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
||||
| grep -Ev 'sys/(param|file)\.h' \
|
||||
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Files in src/ should not include directly any of
|
||||
# the headers already included via system.h.
|
||||
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)$$') \
|
||||
&& { echo '$(ME): the above are already included via system.h'\
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
sc_sun_os_names:
|
||||
@grep -nEi \
|
||||
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_tight_scope:
|
||||
@$(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
|
||||
# script sneaks back in.
|
||||
sc_no_exec_perl_coreutils:
|
||||
@if test -f $(srcdir)/tests/Coreutils.pm; then \
|
||||
grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
|
||||
{ echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# 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.
|
||||
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||
sc_strftime_check:
|
||||
@if test -f $(srcdir)/src/date.c; then \
|
||||
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||
| $(extract_char) > $@-src; \
|
||||
{ echo N; \
|
||||
info libc date calendar format | grep '^ `%.'\' \
|
||||
| $(extract_char); } | sort > $@-info; \
|
||||
diff -u $@-src $@-info || exit 1; \
|
||||
rm -f $@-src $@-info; \
|
||||
fi
|
||||
|
||||
147
configure.ac
147
configure.ac
@@ -1,7 +1,7 @@
|
||||
# -*- autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 1991, 1993-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 1993-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
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
dnl Written by Jim Meyering.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_PREREQ([2.61])
|
||||
|
||||
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
|
||||
# indicates that it is built from the 219th delta (in _some_ repository)
|
||||
@@ -27,12 +27,12 @@ AC_INIT([GNU coreutils],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[bug-coreutils@gnu.org])
|
||||
|
||||
AC_CONFIG_SRCDIR(src/ls.c)
|
||||
AC_CONFIG_SRCDIR([src/ls.c])
|
||||
|
||||
AC_CONFIG_AUX_DIR(build-aux)
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.10.1 dist-lzma])
|
||||
AM_INIT_AUTOMAKE([1.10a dist-xz])
|
||||
|
||||
AC_PROG_CC_STDC
|
||||
AM_PROG_CC_C_O
|
||||
@@ -44,20 +44,82 @@ gl_EARLY
|
||||
gl_INIT
|
||||
coreutils_MACROS
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[AS_HELP_STRING([--enable-gcc-warnings],
|
||||
[turn on lots of GCC warnings (for developers)])],
|
||||
[case $enableval in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
|
||||
esac
|
||||
gl_gcc_warnings=$enableval],
|
||||
[gl_gcc_warnings=no]
|
||||
)
|
||||
|
||||
if test "$gl_gcc_warnings" = yes; then
|
||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||
AC_SUBST([WERROR_CFLAGS])
|
||||
|
||||
# Add many warnings, except some...
|
||||
nw="$nw -Wdeclaration-after-statement" # too useful to forbid
|
||||
nw="$nw -Waggregate-return" # anachronistic
|
||||
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
|
||||
nw="$nw -Wcast-qual" # Too many warnings for now
|
||||
nw="$nw -Wconversion" # Too many warnings for now
|
||||
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
|
||||
nw="$nw -Wsign-conversion" # Too many warnings for now
|
||||
nw="$nw -Wtraditional-conversion" # Too many warnings for now
|
||||
nw="$nw -Wunreachable-code" # Too many warnings for now
|
||||
nw="$nw -Wpadded" # Our structs are not padded
|
||||
nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
|
||||
nw="$nw -Wlogical-op" # any use of fwrite provokes this
|
||||
nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
|
||||
nw="$nw -Wvla" # warnings in gettext.h
|
||||
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
|
||||
nw="$nw -Wswitch-enum" # Too many warnings for now
|
||||
nw="$nw -Wswitch-default" # Too many warnings for now
|
||||
# things I might fix soon:
|
||||
nw="$nw -Wfloat-equal" # sort.c, seq.c
|
||||
nw="$nw -Wmissing-format-attribute" # copy.c
|
||||
nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
|
||||
nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
|
||||
nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
|
||||
# ?? -Wstrict-overflow
|
||||
|
||||
gl_MANYWARN_ALL_GCC([ws])
|
||||
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
|
||||
for w in $ws; do
|
||||
gl_WARN_ADD([$w])
|
||||
done
|
||||
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
|
||||
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
|
||||
gl_WARN_ADD([-fdiagnostics-show-option])
|
||||
|
||||
AC_SUBST([WARN_CFLAGS])
|
||||
|
||||
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
|
||||
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])
|
||||
fi
|
||||
|
||||
AC_FUNC_FORK
|
||||
|
||||
optional_bin_progs=
|
||||
AC_CHECK_FUNCS(uname,
|
||||
AC_CHECK_FUNCS([uname],
|
||||
gl_ADD_PROG([optional_bin_progs], [uname]))
|
||||
AC_CHECK_FUNCS(chroot,
|
||||
AC_CHECK_FUNCS([chroot],
|
||||
gl_ADD_PROG([optional_bin_progs], [chroot]))
|
||||
AC_CHECK_FUNCS(gethostid,
|
||||
AC_CHECK_FUNCS([gethostid],
|
||||
gl_ADD_PROG([optional_bin_progs], [hostid]))
|
||||
|
||||
gl_WINSIZE_IN_PTEM
|
||||
|
||||
AC_MSG_CHECKING(whether localtime caches TZ)
|
||||
AC_CACHE_VAL(utils_cv_localtime_cache,
|
||||
AC_MSG_CHECKING([whether localtime caches TZ])
|
||||
AC_CACHE_VAL([utils_cv_localtime_cache],
|
||||
[if test x$ac_cv_func_tzset = xyes; then
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
|
||||
#if STDC_HEADERS
|
||||
@@ -98,22 +160,22 @@ else
|
||||
# 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)
|
||||
AC_MSG_RESULT([$utils_cv_localtime_cache])
|
||||
if test $utils_cv_localtime_cache = yes; then
|
||||
AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
|
||||
AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
|
||||
fi
|
||||
|
||||
# SCO-ODT-3.0 is reported to need -los to link programs using initgroups
|
||||
AC_CHECK_FUNCS(initgroups)
|
||||
AC_CHECK_FUNCS([initgroups])
|
||||
if test $ac_cv_func_initgroups = no; then
|
||||
AC_CHECK_LIB(os, initgroups)
|
||||
AC_CHECK_LIB([os], [initgroups])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(syslog)
|
||||
AC_CHECK_FUNCS([syslog])
|
||||
if test $ac_cv_func_syslog = no; then
|
||||
# syslog is not in the default libraries. See if it's in some other.
|
||||
for lib in bsd socket inet; do
|
||||
AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
|
||||
AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
|
||||
LIBS="$LIBS -l$lib"; break])
|
||||
done
|
||||
fi
|
||||
@@ -147,29 +209,29 @@ AC_DEFUN([coreutils_DUMMY_1],
|
||||
])
|
||||
coreutils_DUMMY_1
|
||||
|
||||
AC_MSG_CHECKING(ut_host in struct utmp)
|
||||
AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
|
||||
AC_MSG_CHECKING([ut_host in struct utmp])
|
||||
AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <utmp.h>]], [[struct utmp ut; return !sizeof ut.ut_host;]])],
|
||||
[su_cv_func_ut_host_in_utmp=yes],
|
||||
[su_cv_func_ut_host_in_utmp=no])])
|
||||
AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
|
||||
AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
|
||||
if test $su_cv_func_ut_host_in_utmp = yes; then
|
||||
have_ut_host=1
|
||||
AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
|
||||
AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
|
||||
fi
|
||||
|
||||
if test -z "$have_ut_host"; then
|
||||
AC_MSG_CHECKING(ut_host in struct utmpx)
|
||||
AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
|
||||
AC_MSG_CHECKING([ut_host in struct utmpx])
|
||||
AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <utmpx.h>]], [[struct utmpx ut; return !sizeof ut.ut_host;]])],
|
||||
[su_cv_func_ut_host_in_utmpx=yes],
|
||||
[su_cv_func_ut_host_in_utmpx=no])])
|
||||
AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
|
||||
AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
|
||||
if test $su_cv_func_ut_host_in_utmpx = yes; then
|
||||
AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
|
||||
AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
|
||||
AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
|
||||
AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -181,24 +243,24 @@ gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
|
||||
if test $ac_cv_sys_posix_termios = yes; then
|
||||
gl_ADD_PROG([optional_bin_progs], [stty])
|
||||
|
||||
AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
|
||||
AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
|
||||
[AC_EGREP_CPP(yes, [#include <termios.h>
|
||||
AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
|
||||
AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
|
||||
[AC_EGREP_CPP([yes], [#include <termios.h>
|
||||
#ifdef IUCLC
|
||||
yes
|
||||
#endif], su_cv_sys_termios_needs_xopen_source=no,
|
||||
AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
|
||||
AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
|
||||
#include <termios.h>
|
||||
#ifdef IUCLC
|
||||
yes
|
||||
#endif], su_cv_sys_termios_needs_xopen_source=yes,
|
||||
su_cv_sys_termios_needs_xopen_source=no))])
|
||||
AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
|
||||
AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
|
||||
test $su_cv_sys_termios_needs_xopen_source = yes &&
|
||||
AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
|
||||
AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
|
||||
|
||||
AC_MSG_CHECKING(c_line in struct termios)
|
||||
AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
|
||||
AC_MSG_CHECKING([c_line in struct termios])
|
||||
AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE
|
||||
#endif
|
||||
@@ -206,9 +268,9 @@ yes
|
||||
#include <termios.h>]], [[struct termios t; return !sizeof t.c_line;]])],
|
||||
[su_cv_sys_c_line_in_termios=yes],
|
||||
[su_cv_sys_c_line_in_termios=no])])
|
||||
AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
|
||||
AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
|
||||
test $su_cv_sys_c_line_in_termios = yes \
|
||||
&& AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
|
||||
&& AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
|
||||
fi
|
||||
|
||||
# FIXME: note that this macro appears above, too.
|
||||
@@ -219,8 +281,8 @@ gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
|
||||
|
||||
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
|
||||
test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
|
||||
AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
|
||||
AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
|
||||
AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
|
||||
AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#ifdef WINSIZE_IN_PTEM
|
||||
# include <sys/stream.h>
|
||||
@@ -231,10 +293,10 @@ if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
|
||||
#include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
|
||||
[su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
|
||||
[su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
|
||||
AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
|
||||
AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
|
||||
|
||||
test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
|
||||
&& AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
|
||||
&& AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
|
||||
[Define if your system defines TIOCGWINSZ in sys/pty.h.])
|
||||
fi
|
||||
|
||||
@@ -244,6 +306,7 @@ AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
|
||||
#include <signal.h>])
|
||||
|
||||
cu_LIB_CHECK
|
||||
cu_GMP
|
||||
|
||||
# Build df only if there's a point to it.
|
||||
if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
|
||||
@@ -258,7 +321,7 @@ mk="$srcdir/src/Makefile.am"
|
||||
v=EXTRA_PROGRAMS
|
||||
for gl_i in `sed -n '/^'$v' =/,/[[^\]]$/p' $mk \
|
||||
| sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \
|
||||
| tr -s '\\015\\012\\\\' ' '`; do
|
||||
| tr -s '\\015\\012\\\\' ' '`; do
|
||||
gl_ADD_PROG([optional_bin_progs], $gl_i)
|
||||
done
|
||||
|
||||
@@ -313,7 +376,7 @@ MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'|tr -d '\\015\\012'`
|
||||
|
||||
# Change ginstall.1 to "install.h" in $MAN.
|
||||
MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done \
|
||||
| tr '\015\012' ' '; echo`
|
||||
| tr '\015\012' ' '; echo`
|
||||
|
||||
# Remove [.1, since writing a portable rule for it in man/Makefile.am
|
||||
# is not practical. The sed LHS below uses the autoconf quadrigraph
|
||||
@@ -325,6 +388,8 @@ AC_SUBST([OPTIONAL_BIN_PROGS])
|
||||
NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
|
||||
AC_SUBST([NO_INSTALL_PROGS_DEFAULT])
|
||||
|
||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||
|
||||
# Arrange to rerun configure whenever the file, src/Makefile.am,
|
||||
# containing the list of program names changes.
|
||||
CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am'
|
||||
|
||||
1
doc/.gitignore
vendored
1
doc/.gitignore
vendored
@@ -16,6 +16,7 @@ coreutils.toc
|
||||
coreutils.tp
|
||||
coreutils.vr
|
||||
fdl.texi
|
||||
gendocs_template
|
||||
getdate.texi
|
||||
stamp-vti
|
||||
version.texi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make coreutils documentation. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1995-1998, 2001-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-1998, 2001-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
|
||||
@@ -29,10 +29,13 @@ EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
|
||||
# old systems.
|
||||
AM_MAKEINFOFLAGS = --no-split
|
||||
|
||||
constants.texi: $(top_srcdir)/src/tail.c
|
||||
constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
|
||||
LC_ALL=C \
|
||||
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
|
||||
$(top_srcdir)/src/tail.c > t-$@
|
||||
LC_ALL=C \
|
||||
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
|
||||
$(top_srcdir)/src/shred.c >> t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
MAINTAINERCLEANFILES = constants.texi
|
||||
@@ -50,13 +53,14 @@ syntax_checks = \
|
||||
sc-avoid-timezone \
|
||||
sc-avoid-zeroes \
|
||||
sc-exponent-grouping \
|
||||
sc-lower-case-var \
|
||||
sc-use-small-caps-NUL
|
||||
|
||||
.PHONY: $(syntax_checks) check-texinfo
|
||||
|
||||
# List words/regexps here that should not appear in the texinfo documentation.
|
||||
check-texinfo: $(syntax_checks)
|
||||
fail=0; \
|
||||
@fail=0; \
|
||||
grep '@url{' $(srcdir)/*.texi && fail=1; \
|
||||
grep '\$$@"' $(srcdir)/*.texi && fail=1; \
|
||||
grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \
|
||||
@@ -68,32 +72,50 @@ check-texinfo: $(syntax_checks)
|
||||
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
|
||||
$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \
|
||||
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
|
||||
| $(EGREP) -v '@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
|
||||
| $(EGREP) -v 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
|
||||
exit $$fail
|
||||
|
||||
# Use `time zone', not `timezone'.
|
||||
sc-avoid-timezone:
|
||||
$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# Check for insufficient exponent grouping, e.g.,
|
||||
# @math{2^64} should be @math{2^{64}}.
|
||||
sc-exponent-grouping:
|
||||
$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# E.g., use @sc{nul}, not NUL.
|
||||
sc-use-small-caps-NUL:
|
||||
$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# Say I/O, not IO.
|
||||
sc-avoid-io:
|
||||
$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# I prefer nonzero over non-zero.
|
||||
sc-avoid-non-zero:
|
||||
$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent).
|
||||
sc-avoid-zeroes:
|
||||
$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# ME = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
ME = doc/Makefile
|
||||
|
||||
# The quantity inside @var{...} should not contain upper case letters.
|
||||
# The leading backslash exemption is to permit in-macro uses like
|
||||
# @var{\varName\} where the upper case letter is part of a parameter name.
|
||||
find_upper_case_var = \
|
||||
'/\@var{/ or next; \
|
||||
while (/\@var{(.+?)}/g) \
|
||||
{ \
|
||||
$$v = $$1; \
|
||||
$$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print "$$ARGV:$$.:$$_"), $$m = 1 \
|
||||
} \
|
||||
END {$$m and (warn "$(ME): do not use upper case in \@var{...}\n"), exit 1}'
|
||||
sc-lower-case-var:
|
||||
@$(PERL) -e 1 2> /dev/null && \
|
||||
$(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
|
||||
|
||||
check: check-texinfo
|
||||
|
||||
1780
doc/coreutils.texi
1780
doc/coreutils.texi
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
||||
@c File mode bits
|
||||
|
||||
@c Copyright (C) 1994, 1996, 1999, 2000, 2001, 2003, 2004, 2005, 2006
|
||||
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008
|
||||
@c 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.2 or
|
||||
@c under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
@c any later version published by the Free Software Foundation; with no
|
||||
@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
@c Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
117
gl/lib/argv-iter.c
Normal file
117
gl/lib/argv-iter.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/* 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:
|
||||
*/
|
||||
47
gl/lib/argv-iter.h
Normal file
47
gl/lib/argv-iter.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* 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);
|
||||
@@ -1,6 +1,6 @@
|
||||
/* mgetgroups.c -- return a list of the groups a user is in
|
||||
|
||||
Copyright (C) 2007-2008 Free Software Foundation, Inc.
|
||||
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
|
||||
@@ -33,16 +33,16 @@
|
||||
#include "xalloc.h"
|
||||
|
||||
|
||||
static void *
|
||||
allocate_groupbuf (int size)
|
||||
static GETGROUPS_T *
|
||||
realloc_groupbuf (GETGROUPS_T *g, size_t num)
|
||||
{
|
||||
if (xalloc_oversized (size, sizeof (GETGROUPS_T)))
|
||||
if (xalloc_oversized (num, sizeof (*g)))
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return malloc (size * sizeof (GETGROUPS_T));
|
||||
return realloc (g, num * sizeof (*g));
|
||||
}
|
||||
|
||||
/* Like getugroups, but store the result in malloc'd storage.
|
||||
@@ -65,45 +65,27 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
performance characteristics.
|
||||
|
||||
In glibc 2.3.2, getgrouplist is buggy. If you pass a zero as the
|
||||
size of the output buffer, getgrouplist will still write to 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 };
|
||||
GETGROUPS_T smallbuf[N_GROUPS_INIT];
|
||||
|
||||
max_n_groups = N_GROUPS_INIT;
|
||||
ng = getgrouplist (username, gid, smallbuf, &max_n_groups);
|
||||
|
||||
g = allocate_groupbuf (max_n_groups);
|
||||
g = realloc_groupbuf (NULL, max_n_groups);
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
if (max_n_groups <= N_GROUPS_INIT)
|
||||
{
|
||||
/* smallbuf was big enough, so we already have our data */
|
||||
memcpy (g, smallbuf, max_n_groups * sizeof *g);
|
||||
*groups = g;
|
||||
return max_n_groups;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
GETGROUPS_T *h;
|
||||
|
||||
/* getgrouplist updates max_n_groups to num required. */
|
||||
ng = getgrouplist (username, gid, g, &max_n_groups);
|
||||
if (0 <= ng)
|
||||
{
|
||||
*groups = g;
|
||||
return ng;
|
||||
}
|
||||
|
||||
/* When getgrouplist fails, it guarantees that
|
||||
max_n_groups reflects the new number of groups. */
|
||||
|
||||
if (xalloc_oversized (max_n_groups, sizeof *h)
|
||||
|| (h = realloc (g, max_n_groups * sizeof *h)) == NULL)
|
||||
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
free (g);
|
||||
@@ -111,6 +93,12 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
return -1;
|
||||
}
|
||||
g = h;
|
||||
|
||||
if (0 <= ng)
|
||||
{
|
||||
*groups = g;
|
||||
return ng;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* else no username, so fall through and use getgroups. */
|
||||
@@ -125,7 +113,7 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
if (max_n_groups < 0)
|
||||
max_n_groups = 5;
|
||||
|
||||
g = allocate_groupbuf (max_n_groups);
|
||||
g = realloc_groupbuf (NULL, max_n_groups);
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 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
|
||||
@@ -43,16 +43,6 @@
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
# define __attribute__(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif
|
||||
|
||||
#if _STRING_ARCH_unaligned
|
||||
# define ALIGNED_POINTER(ptr, type) true
|
||||
#else
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef SELINUX_CONTEXT_H
|
||||
# define SELINUX_CONTEXT_H
|
||||
|
||||
# include <errno.h>
|
||||
/* Some systems don't have ENOTSUP. */
|
||||
# ifndef ENOTSUP
|
||||
# ifdef ENOSYS
|
||||
# define ENOTSUP ENOSYS
|
||||
# else
|
||||
/* Some systems don't have ENOSYS either. */
|
||||
# define ENOTSUP EINVAL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
typedef int context_t;
|
||||
static inline context_t context_new (char const *s)
|
||||
{ errno = ENOTSUP; return 0; }
|
||||
static inline char *context_str (context_t con)
|
||||
{ errno = ENOTSUP; return (void *) 0; }
|
||||
static inline void context_free (context_t c) {}
|
||||
|
||||
static inline int context_user_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int context_role_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int context_range_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int context_type_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
|
||||
#endif
|
||||
@@ -1,57 +0,0 @@
|
||||
#ifndef SELINUX_SELINUX_H
|
||||
# define SELINUX_SELINUX_H
|
||||
|
||||
# include <sys/types.h>
|
||||
# include <errno.h>
|
||||
/* Some systems don't have ENOTSUP. */
|
||||
# ifndef ENOTSUP
|
||||
# ifdef ENOSYS
|
||||
# define ENOTSUP ENOSYS
|
||||
# else
|
||||
/* Some systems don't have ENOSYS either. */
|
||||
# define ENOTSUP EINVAL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
typedef unsigned short security_class_t;
|
||||
# define security_context_t char*
|
||||
# define is_selinux_enabled() 0
|
||||
|
||||
static inline int getcon (security_context_t *con) { errno = ENOTSUP; return -1; }
|
||||
static inline void freecon (security_context_t con) {}
|
||||
|
||||
|
||||
static inline int getfscreatecon (security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int setfscreatecon (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int matchpathcon (char const *s, mode_t m,
|
||||
security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
|
||||
static inline int getfilecon (char const *s, security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int lgetfilecon (char const *s, security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int setfilecon (char const *s, security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int lsetfilecon (char const *s, security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int fsetfilecon (int fd, security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
|
||||
static inline int security_check_context (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int security_check_context_raw (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int setexeccon (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int security_compute_create (security_context_t scon,
|
||||
security_context_t tcon,
|
||||
security_class_t tclass,
|
||||
security_context_t *newcon)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int matchpathcon_init_prefix (char const *path,
|
||||
char const *prefix)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* openat-style fd-relative functions for SE Linux
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
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
|
||||
@@ -29,9 +29,6 @@
|
||||
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
|
||||
#include "save-cwd.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include "openat-priv.h"
|
||||
|
||||
#define AT_FUNC_NAME getfileconat
|
||||
|
||||
41
gl/lib/xfreopen.c
Normal file
41
gl/lib/xfreopen.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* a wrapper for frepoen
|
||||
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/>. */
|
||||
|
||||
#include <config.h>
|
||||
#include "xfreopen.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
#include "quote.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
void
|
||||
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")))));
|
||||
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
|
||||
quote_n (0, f), quote_n (1, mode));
|
||||
}
|
||||
}
|
||||
2
gl/lib/xfreopen.h
Normal file
2
gl/lib/xfreopen.h
Normal file
@@ -0,0 +1,2 @@
|
||||
#include <stdio.h>
|
||||
void xfreopen (char const *filename, char const *mode, FILE *fp);
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 2
|
||||
#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,
|
||||
@@ -6,6 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_MGETGROUPS],
|
||||
[
|
||||
AC_CHECK_FUNCS(getgrouplist)
|
||||
AC_CHECK_FUNCS([getgrouplist])
|
||||
AC_LIBOBJ([mgetgroups])
|
||||
])
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# serial 1 -*- Autoconf -*-
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# From Jim Meyering
|
||||
# Provide <selinux/context.h>, if necessary.
|
||||
|
||||
AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H],
|
||||
[
|
||||
# Check for <selinux/context.h>,
|
||||
AC_CHECK_HEADERS([selinux/context.h],
|
||||
[SELINUX_CONTEXT_H=],
|
||||
[SELINUX_CONTEXT_H=selinux/context.h])
|
||||
AC_SUBST([SELINUX_CONTEXT_H])
|
||||
])
|
||||
@@ -1,17 +0,0 @@
|
||||
# serial 1 -*- Autoconf -*-
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# From Jim Meyering
|
||||
# Provide <selinux/selinux.h>, if necessary.
|
||||
|
||||
AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H],
|
||||
[
|
||||
# Check for <selinux/selinux.h>,
|
||||
AC_CHECK_HEADERS([selinux/selinux.h],
|
||||
[SELINUX_SELINUX_H=],
|
||||
[SELINUX_SELINUX_H=selinux/selinux.h])
|
||||
AC_SUBST([SELINUX_SELINUX_H])
|
||||
])
|
||||
24
gl/modules/argv-iter
Normal file
24
gl/modules/argv-iter
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
10
gl/modules/argv-iter-tests
Normal file
10
gl/modules/argv-iter-tests
Normal file
@@ -0,0 +1,10 @@
|
||||
Files:
|
||||
tests/test-argv-iter.c
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-argv-iter
|
||||
check_PROGRAMS += test-argv-iter
|
||||
@@ -1,16 +1,13 @@
|
||||
Index: modules/getloadavg
|
||||
===================================================================
|
||||
RCS file: /sources/gnulib/gnulib/modules/getloadavg,v
|
||||
retrieving revision 1.13
|
||||
diff -u -p -r1.13 getloadavg
|
||||
--- modules/getloadavg 22 Sep 2006 12:47:55 -0000 1.13
|
||||
+++ modules/getloadavg 23 Sep 2006 16:41:36 -0000
|
||||
@@ -14,7 +14,7 @@ stdbool
|
||||
diff --git a/modules/getloadavg b/modules/getloadavg
|
||||
index 2fbeb40..b79aaca 100644
|
||||
--- a/modules/getloadavg
|
||||
+++ b/modules/getloadavg
|
||||
@@ -16,7 +16,7 @@ stdbool
|
||||
fcntl-safer
|
||||
|
||||
configure.ac:
|
||||
-gl_GETLOADAVG([$gl_source_base])
|
||||
+gl_GETLOADAVG([lib])
|
||||
gl_STDLIB_MODULE_INDICATOR([getloadavg])
|
||||
|
||||
Makefile.am:
|
||||
|
||||
|
||||
@@ -13,12 +13,13 @@ configure.ac:
|
||||
# For runcon.
|
||||
AC_CHECK_HEADERS([selinux/flask.h])
|
||||
AC_LIBOBJ([selinux-at])
|
||||
ac_save_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS(setfilecon, selinux,
|
||||
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="$ac_save_LIBS"
|
||||
LIBS=$gl_save_LIBS
|
||||
|
||||
Makefile.am:
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
Description:
|
||||
SELinux-related headers for systems that lack them.
|
||||
|
||||
Files:
|
||||
lib/se-context.in.h
|
||||
lib/se-selinux.in.h
|
||||
m4/selinux-context-h.m4
|
||||
m4/selinux-selinux-h.m4
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
gl_HEADERS_SELINUX_SELINUX_H
|
||||
gl_HEADERS_SELINUX_CONTEXT_H
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += se-context.in.h se-selinux.in.h
|
||||
|
||||
BUILT_SOURCES += $(SELINUX_SELINUX_H)
|
||||
selinux/selinux.h: se-selinux.in.h
|
||||
mkdir -p selinux
|
||||
cp $(srcdir)/se-selinux.in.h $@-t
|
||||
chmod a-x $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += selinux/selinux.h selinux/selinux.h-t
|
||||
|
||||
BUILT_SOURCES += $(SELINUX_CONTEXT_H)
|
||||
selinux/context.h: se-context.in.h
|
||||
mkdir -p selinux
|
||||
cp $(srcdir)/se-context.in.h $@-t
|
||||
chmod a-x $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t
|
||||
MOSTLYCLEANDIRS += selinux
|
||||
|
||||
Include:
|
||||
#include <selinux/selinux.h>
|
||||
#include <selinux/context.h>
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
|
||||
# lib/selinux-at.c
|
||||
#
|
||||
# # For runcon.
|
||||
# AC_CHECK_HEADERS([selinux/flask.h])
|
||||
#
|
||||
# ac_save_LIBS="$LIBS"
|
||||
# AC_SEARCH_LIBS(setfilecon, selinux,
|
||||
# [test "$ac_cv_search_setfilecon" = "none required" ||
|
||||
# LIB_SELINUX=$ac_cv_search_setfilecon])
|
||||
# AC_SUBST(LIB_SELINUX)
|
||||
# LIBS="$ac_save_LIBS"
|
||||
25
gl/modules/xfreopen
Normal file
25
gl/modules/xfreopen
Normal file
@@ -0,0 +1,25 @@
|
||||
Description:
|
||||
a wrapper for frepoen
|
||||
|
||||
Files:
|
||||
lib/xfreopen.c
|
||||
lib/xfreopen.h
|
||||
|
||||
Depends-on:
|
||||
error
|
||||
exitfail
|
||||
quote
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += xfreopen.c xfreopen.h
|
||||
|
||||
Include:
|
||||
"xfreopen.h"
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
120
gl/tests/test-argv-iter.c
Normal file
120
gl/tests/test-argv-iter.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* 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:
|
||||
*/
|
||||
1
gnulib
Submodule
1
gnulib
Submodule
Submodule gnulib added at 5a1286a9f8
@@ -1 +1,6 @@
|
||||
include gnulib.mk
|
||||
|
||||
TEST_LOGS = $(TESTS:=.log)
|
||||
|
||||
# Parallel replacement of Automake's check-TESTS target.
|
||||
include $(top_srcdir)/build-aux/check.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Makefile for gnulib/lib -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1995-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-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
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
include gnulib.mk
|
||||
|
||||
AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
|
||||
AM_CFLAGS += $(WARN_CFLAGS) # $(WERROR_CFLAGS)
|
||||
|
||||
libcoreutils_a_SOURCES += \
|
||||
buffer-lcm.c buffer-lcm.h \
|
||||
|
||||
@@ -52,9 +52,9 @@ xmemxfrm (char *restrict dest, size_t destsize,
|
||||
if (errno)
|
||||
{
|
||||
error (0, errno, _("string transformation failed"));
|
||||
error (0, 0, _("Set LC_ALL='C' to work around the problem."));
|
||||
error (0, 0, _("set LC_ALL='C' to work around the problem"));
|
||||
error (exit_failure, 0,
|
||||
_("The untransformed string was %s."),
|
||||
_("the untransformed string was %s"),
|
||||
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# boottime.m4 serial 3
|
||||
# boottime.m4 serial 4
|
||||
# Determine whether this system has infrastructure for obtaining the boot time.
|
||||
|
||||
# Copyright (C) 1996, 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 2000, 2002-2004, 2006, 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
|
||||
@@ -20,14 +20,14 @@
|
||||
* ----------------------------------------------------------
|
||||
AC_DEFUN([GNULIB_BOOT_TIME],
|
||||
[
|
||||
AC_CHECK_FUNCS(sysctl)
|
||||
AC_CHECK_HEADERS_ONCE(sys/param.h)
|
||||
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
|
||||
AC_CHECK_FUNCS([sysctl])
|
||||
AC_CHECK_HEADERS_ONCE([sys/param.h])
|
||||
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif]])
|
||||
AC_CHECK_HEADERS_ONCE(utmp.h utmpx.h OS.h)
|
||||
AC_CHECK_HEADERS_ONCE([utmp.h utmpx.h OS.h])
|
||||
AC_CACHE_CHECK(
|
||||
[whether we can get the system boot time],
|
||||
[gnulib_cv_have_boot_time],
|
||||
@@ -57,8 +57,8 @@ AC_DEFUN([GNULIB_BOOT_TIME],
|
||||
please_tell_us_how_to_determine_boot_time_on_your_system
|
||||
#endif
|
||||
]])],
|
||||
gnulib_cv_have_boot_time=yes,
|
||||
gnulib_cv_have_boot_time=no)
|
||||
[gnulib_cv_have_boot_time=yes],
|
||||
[gnulib_cv_have_boot_time=no])
|
||||
])
|
||||
AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])
|
||||
])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#serial 23
|
||||
#serial 24
|
||||
# Check declarations for this package.
|
||||
|
||||
dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
|
||||
dnl Copyright (C) 1997-2001, 2003-2006, 2008
|
||||
dnl Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
@@ -16,7 +16,7 @@ AC_DEFUN([gl_CHECK_DECLS],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_TIME])
|
||||
|
||||
AC_CHECK_HEADERS_ONCE(grp.h pwd.h)
|
||||
AC_CHECK_HEADERS_ONCE([grp.h pwd.h])
|
||||
headers='
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
36
m4/gmp.m4
Normal file
36
m4/gmp.m4
Normal file
@@ -0,0 +1,36 @@
|
||||
# Tests for GNU GMP (or any compatible replacement).
|
||||
|
||||
dnl Copyright (C) 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.
|
||||
|
||||
dnl Written by James Youngman.
|
||||
|
||||
dnl Check for libgmp. We avoid use of AC_CHECK_LIBS because we don't want to
|
||||
dnl add this to $LIBS for all targets.
|
||||
AC_DEFUN([cu_GMP],
|
||||
[
|
||||
LIB_GMP=
|
||||
AC_SUBST([LIB_GMP])
|
||||
|
||||
AC_ARG_WITH([gmp],
|
||||
AS_HELP_STRING([--without-gmp],
|
||||
[do not use the GNU MP library for arbitrary precision
|
||||
calculation (default: use it if available)]),
|
||||
[cu_use_gmp=$withval],
|
||||
[cu_use_gmp=auto])
|
||||
|
||||
if test $cu_use_gmp != no; then
|
||||
cu_saved_libs=$LIBS
|
||||
AC_SEARCH_LIBS([__gmpz_init], [gmp],
|
||||
[test "$ac_cv_search___gmpz_init" = "none required" ||
|
||||
{
|
||||
LIB_GMP=$ac_cv_search___gmpz_init
|
||||
AC_DEFINE([HAVE_GMP], [1],
|
||||
[Define if you have GNU libgmp (or replacement)])
|
||||
}])
|
||||
LIBS=$cu_saved_libs
|
||||
fi
|
||||
])
|
||||
@@ -1,8 +1,8 @@
|
||||
#serial 106 -*- autoconf -*-
|
||||
#serial 109 -*- autoconf -*-
|
||||
|
||||
dnl Misc type-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1998, 2000-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998, 2000-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
|
||||
@@ -22,7 +22,7 @@ dnl Misc type-related macros for coreutils.
|
||||
AC_DEFUN([coreutils_MACROS],
|
||||
[
|
||||
AM_MISSING_PROG(HELP2MAN, help2man)
|
||||
AC_SUBST(MAN)
|
||||
AC_SUBST([MAN])
|
||||
|
||||
dnl This macro actually runs replacement code. See isc-posix.m4.
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
@@ -36,15 +36,21 @@ AC_DEFUN([coreutils_MACROS],
|
||||
AC_REQUIRE([AC_FUNC_FSEEKO])
|
||||
|
||||
# By default, argmatch should fail calling usage (1).
|
||||
AC_DEFINE(ARGMATCH_DIE, [usage (1)],
|
||||
AC_DEFINE([ARGMATCH_DIE], [usage (1)],
|
||||
[Define to the function xargmatch calls on failures.])
|
||||
AC_DEFINE(ARGMATCH_DIE_DECL, [void usage ()],
|
||||
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
|
||||
[Define to the declaration of the xargmatch failure function.])
|
||||
|
||||
# used by ls
|
||||
AC_REQUIRE([gl_CLOCK_TIME])
|
||||
# used by shred
|
||||
AC_CHECK_FUNCS_ONCE(directio)
|
||||
AC_CHECK_FUNCS_ONCE([directio])
|
||||
|
||||
# Used by install.c.
|
||||
AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
|
||||
|
||||
# Used by sort.c.
|
||||
AC_CHECK_FUNCS_ONCE([nl_langinfo])
|
||||
|
||||
AC_CHECK_FUNCS_ONCE( \
|
||||
endgrent \
|
||||
@@ -73,24 +79,38 @@ AC_DEFUN([coreutils_MACROS],
|
||||
[test "$ac_cv_search_fdatasync" = "none required" ||
|
||||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
|
||||
AC_SUBST([LIB_FDATASYNC])
|
||||
AC_CHECK_FUNCS(fdatasync)
|
||||
AC_CHECK_FUNCS([fdatasync])
|
||||
LIBS=$coreutils_saved_libs
|
||||
|
||||
# Check whether libcap is usable -- for ls --color support
|
||||
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_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])])
|
||||
])
|
||||
AC_SUBST([LIB_CAP])
|
||||
|
||||
# See if linking `seq' requires -lm.
|
||||
# It does on nearly every system. The single exception (so far) is
|
||||
# BeOS which has all the math functions in the normal runtime library
|
||||
# and doesn't have a separate math library.
|
||||
|
||||
AC_SUBST(SEQ_LIBM)
|
||||
AC_SUBST([SEQ_LIBM])
|
||||
ac_seq_body='
|
||||
static double x, y;
|
||||
x = floor (x);
|
||||
x = rint (x);
|
||||
x = modf (x, &y);'
|
||||
AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
|
||||
AC_TRY_LINK([#include <math.h>], [$ac_seq_body], ,
|
||||
[ac_seq_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
|
||||
AC_TRY_LINK([#include <math.h>], [$ac_seq_body], [SEQ_LIBM=-lm])
|
||||
LIBS="$ac_seq_save_LIBS"
|
||||
])
|
||||
|
||||
@@ -113,7 +133,7 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS],
|
||||
syslog.h \
|
||||
termios.h \
|
||||
)
|
||||
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
|
||||
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
@@ -134,10 +154,9 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
|
||||
AC_REQUIRE([AM_C_PROTOTYPES])
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_REQUIRE([AC_C_BIGENDIAN])
|
||||
AC_REQUIRE([gl_BIGENDIAN])
|
||||
AC_REQUIRE([AC_C_VOLATILE])
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
AC_REQUIRE([AC_C_LONG_DOUBLE])
|
||||
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
|
||||
|
||||
AC_REQUIRE([gl_CHECK_ALL_HEADERS])
|
||||
@@ -155,12 +174,12 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
|
||||
AC_REQUIRE([AC_TYPE_PID_T])
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])
|
||||
AC_REQUIRE([AC_TYPE_UID_T])
|
||||
AC_CHECK_TYPE(ino_t, unsigned long int)
|
||||
AC_CHECK_TYPE([ino_t], [unsigned long int])
|
||||
|
||||
dnl This relies on the fact that Autoconf's implementation of
|
||||
dnl AC_CHECK_TYPE checks includes unistd.h.
|
||||
AC_CHECK_TYPE(major_t, unsigned int)
|
||||
AC_CHECK_TYPE(minor_t, unsigned int)
|
||||
AC_CHECK_TYPE([major_t], [unsigned int])
|
||||
AC_CHECK_TYPE([minor_t], [unsigned int])
|
||||
|
||||
AC_REQUIRE([AC_HEADER_MAJOR])
|
||||
])
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#serial 10
|
||||
#serial 11
|
||||
|
||||
dnl Misc lib-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004,
|
||||
# 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 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
|
||||
@@ -24,20 +24,20 @@ AC_DEFUN([cu_LIB_CHECK],
|
||||
[
|
||||
|
||||
# Check for libypsec.a on Dolphin M88K machines.
|
||||
AC_CHECK_LIB(ypsec, main)
|
||||
AC_CHECK_LIB([ypsec], [main])
|
||||
|
||||
# m88k running dgux 5.4 needs this
|
||||
AC_CHECK_LIB(ldgc, main)
|
||||
AC_CHECK_LIB([ldgc], [main])
|
||||
|
||||
# The -lsun library is required for YP support on Irix-4.0.5 systems.
|
||||
# m88k/svr3 DolphinOS systems using YP need -lypsec for id.
|
||||
AC_SEARCH_LIBS(yp_match, [sun ypsec])
|
||||
AC_SEARCH_LIBS([yp_match], [sun ypsec])
|
||||
|
||||
# SysV needs -lsec, older versions of Linux need -lshadow for
|
||||
# shadow passwords. UnixWare 7 needs -lgen.
|
||||
AC_SEARCH_LIBS(getspnam, [shadow sec gen])
|
||||
AC_SEARCH_LIBS([getspnam], [shadow sec gen])
|
||||
|
||||
AC_CHECK_HEADERS(shadow.h)
|
||||
AC_CHECK_HEADERS([shadow.h])
|
||||
|
||||
# Requirements for su.c.
|
||||
shadow_includes="\
|
||||
@@ -47,14 +47,14 @@ $ac_includes_default
|
||||
#endif
|
||||
"
|
||||
AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
|
||||
AC_CHECK_FUNCS(getspnam)
|
||||
AC_CHECK_FUNCS([getspnam])
|
||||
|
||||
# SCO-ODT-3.0 is reported to need -lufc for crypt.
|
||||
# NetBSD needs -lcrypt for crypt.
|
||||
cu_saved_libs="$LIBS"
|
||||
AC_SEARCH_LIBS(crypt, [ufc crypt],
|
||||
AC_SEARCH_LIBS([crypt], [ufc crypt],
|
||||
[test "$ac_cv_search_crypt" = "none required" ||
|
||||
LIB_CRYPT="$ac_cv_search_crypt"])
|
||||
LIBS="$cu_saved_libs"
|
||||
AC_SUBST(LIB_CRYPT)
|
||||
AC_SUBST([LIB_CRYPT])
|
||||
])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 75
|
||||
#serial 76
|
||||
|
||||
dnl We use gl_ for non Autoconf macros.
|
||||
m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
|
||||
@@ -7,7 +7,7 @@ m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
|
||||
# directory of the coreutils package.
|
||||
|
||||
|
||||
# Copyright (C) 1998, 2000, 2001, 2003-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998, 2000, 2001, 2003-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,6 +38,7 @@ AC_DEFUN([gl_PREREQ],
|
||||
# handles that; see ../bootstrap.conf.
|
||||
AC_REQUIRE([gl_EUIDACCESS_STAT])
|
||||
AC_REQUIRE([gl_FD_REOPEN])
|
||||
AC_REQUIRE([gl_FUNC_XATTR])
|
||||
AC_REQUIRE([gl_FUNC_XFTS])
|
||||
AC_REQUIRE([gl_MEMXFRM])
|
||||
AC_REQUIRE([gl_STRINTCMP])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# stat-prog.m4 serial 5
|
||||
# stat-prog.m4 serial 6
|
||||
# Record the prerequisites of src/stat.c from the coreutils package.
|
||||
|
||||
# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2004, 2006, 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
|
||||
@@ -68,7 +68,7 @@ AC_INCLUDES_DEFAULT
|
||||
[$statvfs_includes],
|
||||
[static statvfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], 1,
|
||||
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
|
||||
[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],,,
|
||||
@@ -79,7 +79,7 @@ AC_INCLUDES_DEFAULT
|
||||
[$statfs_includes],
|
||||
[static statfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], 1,
|
||||
[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
|
||||
|
||||
36
m4/xattr.m4
Normal file
36
m4/xattr.m4
Normal file
@@ -0,0 +1,36 @@
|
||||
# xattr.m4 - check for Extended Attributes (Linux)
|
||||
|
||||
# Copyright (C) 2003, 2008-2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Originally written by Andreas Gruenbacher.
|
||||
# http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff
|
||||
|
||||
AC_DEFUN([gl_FUNC_XATTR],
|
||||
[
|
||||
AC_ARG_ENABLE([xattr],
|
||||
AC_HELP_STRING([--disable-xattr],
|
||||
[do not support extended attributes]),
|
||||
[use_xattr=$enableval], [use_xattr=yes])
|
||||
|
||||
if test "$use_xattr" = "yes"; then
|
||||
AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
|
||||
if test $ac_cv_header_attr_libattr_h = yes \
|
||||
&& test $ac_cv_header_attr_error_context_h = yes; then
|
||||
use_xattr=1
|
||||
else
|
||||
use_xattr=0
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
|
||||
[Define if you want extended attribute support.])
|
||||
xattr_saved_LIBS=$LIBS
|
||||
AC_SEARCH_LIBS([attr_copy_file], [attr],
|
||||
[test "$ac_cv_search_attr_copy_file" = "none required" ||
|
||||
LIB_XATTR=$ac_cv_search_attr_copy_file])
|
||||
AC_CHECK_FUNCS([attr_copy_file])
|
||||
LIBS=$xattr_saved_LIBS
|
||||
AC_SUBST([LIB_XATTR])
|
||||
fi
|
||||
])
|
||||
624
maint.mk
624
maint.mk
@@ -2,7 +2,7 @@
|
||||
# This Makefile fragment tries to be general-purpose enough to be
|
||||
# used by at least coreutils, idutils, CPPI, Bison, and Autoconf.
|
||||
|
||||
## Copyright (C) 2001-2008 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001-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
|
||||
@@ -31,7 +31,7 @@ GIT = git
|
||||
VC = $(GIT)
|
||||
VC-tag = git tag -s -m '$(VERSION)'
|
||||
|
||||
VC_LIST = build-aux/vc-list-files
|
||||
VC_LIST = $(srcdir)/build-aux/vc-list-files
|
||||
|
||||
VC_LIST_EXCEPT = \
|
||||
$(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
|
||||
@@ -62,24 +62,25 @@ release_archive_dir ?= ../release
|
||||
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
|
||||
export LC_ALL = C
|
||||
|
||||
|
||||
|
||||
## --------------- ##
|
||||
## Sanity checks. ##
|
||||
## --------------- ##
|
||||
|
||||
# Collect the names of rules starting with `sc_'.
|
||||
syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
|
||||
$(srcdir)/$(ME))
|
||||
$(srcdir)/$(ME) $(srcdir)/cfg.mk)
|
||||
.PHONY: $(syntax-check-rules)
|
||||
|
||||
local-checks-available = \
|
||||
po-check copyright-check m4-check author_mark_check \
|
||||
patch-check strftime-check $(syntax-check-rules) \
|
||||
makefile_path_separator_check \
|
||||
patch-check $(syntax-check-rules) \
|
||||
makefile-check check-AUTHORS
|
||||
.PHONY: $(local-checks-available)
|
||||
|
||||
# Arrange to print the name of each syntax-checking rule just before running it.
|
||||
$(syntax-check-rules): %: %.m
|
||||
$(patsubst %, %.m, $(syntax-check-rules)):
|
||||
@echo $(patsubst sc_%.m, %, $@)
|
||||
|
||||
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
|
||||
|
||||
syntax-check: $(local-check)
|
||||
@@ -94,6 +95,21 @@ syntax-check: $(local-check)
|
||||
# exit 1; } || :
|
||||
# FIXME: don't allow `#include .strings\.h' anywhere
|
||||
|
||||
# By default, _prohibit_regexp does not ignore case.
|
||||
export ignore_case =
|
||||
_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
|
||||
|
||||
# There are many rules below that prohibit constructs in this package.
|
||||
# If the offending construct can be matched with a grep-E-style regexp,
|
||||
# use this macro. The shell variables "re" and "msg" must be defined.
|
||||
define _prohibit_regexp
|
||||
dummy=; : so we do not need a semicolon before each use \
|
||||
test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
|
||||
test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
|
||||
grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
|
||||
endef
|
||||
|
||||
sc_avoid_if_before_free:
|
||||
@$(srcdir)/build-aux/useless-if-before-free \
|
||||
$(useless_free_options) \
|
||||
@@ -102,56 +118,75 @@ sc_avoid_if_before_free:
|
||||
exit 1; } || :
|
||||
|
||||
sc_cast_of_argument_to_free:
|
||||
@grep -nE '\<free *\( *\(' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re='\<free *\( *\(' msg='don'\''t cast free argument' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_cast_of_x_alloc_return_value:
|
||||
@grep -nE '\*\) *x(m|c|re)alloc\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re='\*\) *x(m|c|re)alloc\>' \
|
||||
msg='don'\''t cast x*alloc return value' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_cast_of_alloca_return_value:
|
||||
@grep -nE '\*\) *alloca\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re='\*\) *alloca\>' msg='don'\''t cast alloca return value' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_space_tab:
|
||||
@grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='[ ] ' msg='found SPACE-TAB sequence; remove the SPACE' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Don't use *scanf or the old ato* functions in `real' code.
|
||||
# They provide no error checking mechanism.
|
||||
# Instead, use strto* functions.
|
||||
sc_prohibit_atoi_atof:
|
||||
@grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='\<([fs]?scanf|ato([filq]|ll)) *\(' \
|
||||
msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Use STREQ rather than comparing strcmp == 0, or != 0.
|
||||
sc_prohibit_strcmp:
|
||||
@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *==' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
$$($(VC_LIST_EXCEPT)) \
|
||||
| grep -vE ':# *define STREQ\(' && \
|
||||
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Using EXIT_SUCCESS as the first argument to error is misleading,
|
||||
# since when that parameter is 0, error does not exit. Use `0' instead.
|
||||
sc_error_exit_success:
|
||||
@grep -nF 'error (EXIT_SUCCESS,' \
|
||||
$$(find -type f -name '*.[chly]') && \
|
||||
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
|
||||
@grep -nE 'error \(EXIT_SUCCESS,' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
|
||||
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
|
||||
|
||||
# `FATAL:' should be fully upper-cased in error messages
|
||||
# `WARNING:' should be fully upper-cased, or fully lower-cased
|
||||
sc_error_message_warn_fatal:
|
||||
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -E '"Warning|"Fatal|"fatal' && \
|
||||
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Error messages should not start with a capital letter
|
||||
sc_error_message_uppercase:
|
||||
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -E '"[A-Z]' \
|
||||
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
|
||||
{ echo '$(ME): found capitalized error message' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Error messages should not end with a period
|
||||
sc_error_message_period:
|
||||
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -E '[^."]\."' && \
|
||||
{ echo '$(ME): found error message ending in period' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_file_system:
|
||||
@grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of "file''system";' \
|
||||
'rewrite to use "file system"' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re=file''system ignore_case=1 \
|
||||
msg='found use of "file''system"; spell it "file system"' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Don't use cpp tests of this symbol. All code assumes config.h is included.
|
||||
sc_no_have_config_h:
|
||||
sc_prohibit_have_config_h:
|
||||
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
|
||||
1>&2; exit 1; } || :
|
||||
@@ -167,6 +202,25 @@ sc_require_config_h:
|
||||
else :; \
|
||||
fi
|
||||
|
||||
# You must include <config.h> before including any other header file.
|
||||
sc_require_config_h_first:
|
||||
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
|
||||
fail=0; \
|
||||
for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \
|
||||
grep '^# *include\>' $$i | sed 1q \
|
||||
| grep '^# *include <config\.h>' > /dev/null \
|
||||
|| { echo $$i; fail=1; }; \
|
||||
done; \
|
||||
test $$fail = 1 && \
|
||||
{ echo '$(ME): the above files include some other header' \
|
||||
'before <config.h>' 1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
sc_prohibit_HAVE_MBRTOWC:
|
||||
@re='\bHAVE_MBRTOWC\b' msg="do not use $$re; it is always defined" \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# To use this "command" macro, you must first define two shell variables:
|
||||
# h: the header, enclosed in <> or ""
|
||||
# re: a regular expression that matches IFF something provided by $h is used.
|
||||
@@ -228,11 +282,53 @@ sc_prohibit_root_dev_ino_without_use:
|
||||
re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
|
||||
$(_header_without_use)
|
||||
|
||||
# Prohibit the inclusion of c-ctype.h without an actual use.
|
||||
ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
|
||||
|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
|
||||
sc_prohibit_c_ctype_without_use:
|
||||
@h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' $(_header_without_use)
|
||||
|
||||
_empty =
|
||||
_sp = $(_empty) $(_empty)
|
||||
# The following list was generated by running:
|
||||
# man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \
|
||||
# | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt
|
||||
_sig_functions = \
|
||||
bsd_signal kill killpg pthread_kill pthread_sigmask raise sigaction \
|
||||
sigaddset sigaltstack sigdelset sigemptyset sigfillset sighold sigignore \
|
||||
siginterrupt sigismember signal sigpause sigpending sigprocmask sigqueue \
|
||||
sigrelse sigset sigsuspend sigtimedwait sigwait sigwaitinfo
|
||||
_sig_function_re = $(subst $(_sp),|,$(strip $(_sig_functions)))
|
||||
# The following were extracted from "man signal.h" manually.
|
||||
_sig_types_and_consts = \
|
||||
MINSIGSTKSZ SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK \
|
||||
SA_RESETHAND SA_RESTART SA_SIGINFO SIGEV_NONE SIGEV_SIGNAL \
|
||||
SIGEV_THREAD SIGSTKSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SS_DISABLE \
|
||||
SS_ONSTACK mcontext_t pid_t sig_atomic_t sigevent siginfo_t sigset_t \
|
||||
sigstack sigval stack_t ucontext_t
|
||||
# generated via this:
|
||||
# perl -lne '/^#ifdef (SIG\w+)/ and print $1' lib/sig2str.c|sort -u|fmt -70
|
||||
_sig_names = \
|
||||
SIGABRT SIGALRM SIGALRM1 SIGBUS SIGCANCEL SIGCHLD SIGCLD SIGCONT \
|
||||
SIGDANGER SIGDIL SIGEMT SIGFPE SIGFREEZE SIGGRANT SIGHUP SIGILL \
|
||||
SIGINFO SIGINT SIGIO SIGIOT SIGKAP SIGKILL SIGKILLTHR SIGLOST SIGLWP \
|
||||
SIGMIGRATE SIGMSG SIGPHONE SIGPIPE SIGPOLL SIGPRE SIGPROF SIGPWR \
|
||||
SIGQUIT SIGRETRACT SIGSAK SIGSEGV SIGSOUND SIGSTKFLT SIGSTOP SIGSYS \
|
||||
SIGTERM SIGTHAW SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1 \
|
||||
SIGUSR2 SIGVIRT SIGVTALRM SIGWAITING SIGWINCH SIGWIND SIGWINDOW \
|
||||
SIGXCPU SIGXFSZ
|
||||
_sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) $(_sig_types_and_consts)))
|
||||
|
||||
# Prohibit the inclusion of signal.h without an actual use.
|
||||
sc_prohibit_signal_without_use:
|
||||
@h='<signal.h>' \
|
||||
re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \
|
||||
$(_header_without_use)
|
||||
|
||||
sc_obsolete_symbols:
|
||||
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||
msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
|
||||
|
||||
@@ -242,140 +338,43 @@ sc_changelog:
|
||||
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
||||
# with the strings from the two affected variables.
|
||||
dd_c = $(srcdir)/src/dd.c
|
||||
sc_dd_max_sym_length:
|
||||
ifneq ($(wildcard $(dd_c)),)
|
||||
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||
| wc --max-line-length); \
|
||||
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||
|tr -d '"' | wc --max-line-length); \
|
||||
if test "$$len" = "$$max"; then :; else \
|
||||
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Many m4 macros names once began with `jm_'.
|
||||
# On 2004-04-13, they were all changed to start with gl_ instead.
|
||||
# Make sure that none are inadvertently reintroduced.
|
||||
sc_prohibit_jm_in_m4:
|
||||
@grep -nE 'jm_[A-Z]' \
|
||||
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
|
||||
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Ensure that each root-requiring test is run via the "check-root" rule.
|
||||
sc_root_tests:
|
||||
@if test -d tests \
|
||||
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
|
||||
t1=sc-root.expected; t2=sc-root.actual; \
|
||||
grep -nl '^require_root_$$' \
|
||||
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
|
||||
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
|
||||
$(srcdir)/tests/Makefile.am \
|
||||
| sed 's/^ *//;/^root_tests =/d' \
|
||||
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
|
||||
diff -u $$t1 $$t2 || diff=1; \
|
||||
rm -f $$t1 $$t2; \
|
||||
test "$$diff" \
|
||||
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
headers_with_interesting_macro_defs = \
|
||||
exit.h \
|
||||
fcntl_.h \
|
||||
fnmatch_.h \
|
||||
intprops.h \
|
||||
inttypes_.h \
|
||||
lchown.h \
|
||||
openat.h \
|
||||
stat-macros.h \
|
||||
stdint_.h
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of macros that are guaranteed by parts of gnulib to be defined.
|
||||
.re-defmac:
|
||||
@(cd $(srcdir)/lib; \
|
||||
for f in $(headers_with_interesting_macro_defs); do \
|
||||
test -f $$f && \
|
||||
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
|
||||
done; \
|
||||
) | sort -u \
|
||||
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
|
||||
| sed 's/^/^# *define /' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Don't define macros that we already get from gnulib header files.
|
||||
sc_always_defined_macros: .re-defmac
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
|
||||
grep -f .re-defmac $$($(VC_LIST)) \
|
||||
&& { echo '$(ME): define the above via some gnulib .h file' \
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of files included from system.h. Exclude a couple.
|
||||
.re-list:
|
||||
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
||||
| grep -Ev 'sys/(param|file)\.h' \
|
||||
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Files in src/ should not include directly any of
|
||||
# the headers already included via system.h.
|
||||
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)$$') \
|
||||
&& { echo '$(ME): the above are already included via system.h'\
|
||||
1>&2; exit 1; } || :; \
|
||||
# Ensure that each .c file containing a "main" function also
|
||||
# calls set_program_name.
|
||||
sc_program_name:
|
||||
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
|
||||
files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
|
||||
grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \
|
||||
| grep . && \
|
||||
{ echo '$(ME): the above files do not call set_program_name' \
|
||||
1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
# Require that the final line of each test-lib.sh-using test be this one:
|
||||
# (exit $fail); exit $fail
|
||||
# Exit $fail
|
||||
# Note: this test requires GNU grep's --label= option.
|
||||
sc_require_test_exit_idiom:
|
||||
@if test -f $(srcdir)/tests/test-lib.sh; then \
|
||||
die=0; \
|
||||
for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \
|
||||
tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \
|
||||
tail -n1 $$i | grep '^Exit \$$fail$$' > /dev/null \
|
||||
&& : || { die=1; echo $$i; } \
|
||||
done; \
|
||||
test $$die = 1 && \
|
||||
{ echo 1>&2 '$(ME): the final line in each of the above is not:'; \
|
||||
echo 1>&2 '(exit $$fail); exit $$fail'; \
|
||||
echo 1>&2 'Exit $$fail'; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
sc_sun_os_names:
|
||||
@grep -nEi \
|
||||
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_the_the:
|
||||
@grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of "the ''the";' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_tight_scope:
|
||||
$(MAKE) -C src $@
|
||||
@re='\<the ''the\>' \
|
||||
ignore_case=1 msg='found use of "the ''the";' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_trailing_blank:
|
||||
@grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found trailing blank(s)' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='[ ]$$' \
|
||||
msg='found trailing blank(s)' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Match lines like the following, but where there is only one space
|
||||
# between the options and the description:
|
||||
@@ -385,7 +384,7 @@ sc_two_space_separator_in_usage:
|
||||
@grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo "$(ME): help2man requires at least two spaces between"; \
|
||||
echo "$(ME): an option and its description"; \
|
||||
echo "$(ME): an option and its description"; \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Look for diagnostics that aren't marked for translation.
|
||||
@@ -406,30 +405,67 @@ sc_useless_cpp_parens:
|
||||
|
||||
# Require the latest GPL.
|
||||
sc_GPL_version:
|
||||
@grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
|
||||
@re='either ''version [^3]' msg='GPL vN, N!=3' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
exec_perl_re = \
|
||||
exec \$$PERL -w -I\$$top_srcdir/tests -MCoreutils \
|
||||
-M"CuTmpdir qw(\$$me)" -- - <<\\EOF
|
||||
# Ensure that each test invoking $PERL with -MCoreutils uses the same line.
|
||||
sc_perl_coreutils_test:
|
||||
@if test -f $(srcdir)/tests/Coreutils.pm; then \
|
||||
die=0; \
|
||||
for i in $$(grep -l '^exec *\$$PERL.*MCoreutils' \
|
||||
$$($(VC_LIST) tests)); do \
|
||||
grep '$(exec_perl_re)' $$i > /dev/null \
|
||||
&& : || { die=1; echo $$i; } \
|
||||
cvs_keywords = \
|
||||
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
|
||||
|
||||
sc_prohibit_cvs_keyword:
|
||||
@re='\$$($(cvs_keywords))\$$' \
|
||||
msg='do not use CVS keyword expansion' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
|
||||
# This is a bit of a kludge, since it prevents use of the string
|
||||
# even in comments, but for now it does the job with no false positives.
|
||||
sc_prohibit_stat_st_blocks:
|
||||
@re='[.>]st_blocks' msg='do not use st_blocks; use ST_NBLOCKS' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Make sure we don't define any S_IS* macros in src/*.c files.
|
||||
# They're already defined via gnulib's sys/stat.h replacement.
|
||||
sc_prohibit_S_IS_definition:
|
||||
@re='^ *# *define *S_IS' \
|
||||
msg='do not define S_IS* macros; include <sys/stat.h>' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Each program that uses proper_name_utf8 must link with
|
||||
# one of the ICONV libraries.
|
||||
sc_proper_name_utf8_requires_ICONV:
|
||||
@progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
|
||||
if test "x$$progs" != x; then \
|
||||
fail=0; \
|
||||
for p in $$progs; do \
|
||||
dir=$$(dirname "$$p"); \
|
||||
base=$$(basename "$$p" .c); \
|
||||
grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
|
||||
|| { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
|
||||
done; \
|
||||
test $$die = 1 && \
|
||||
{ echo 1>&2 '$(ME): each of the above execs PERL differently:'; \
|
||||
echo 1>&2 '(exit $$fail); exit $$fail'; \
|
||||
test $$fail = 1 && \
|
||||
{ echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
NEWS_hash = \
|
||||
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
|
||||
$(srcdir)/NEWS | md5sum -)
|
||||
# Warn about "c0nst struct Foo const foo[]",
|
||||
# but not about "char const *const foo" or "#define const const".
|
||||
sc_redundant_const:
|
||||
@re='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
|
||||
msg='redundant "const" in declarations' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_const_long_option:
|
||||
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -Ev 'const struct option|struct option const' && { \
|
||||
echo 1>&2 '$(ME): add "const" to the above declarations'; \
|
||||
exit 1; } || :
|
||||
|
||||
NEWS_hash = \
|
||||
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
|
||||
$(srcdir)/NEWS \
|
||||
| grep -v '^Copyright .*Free Software' \
|
||||
| md5sum - \
|
||||
| sed 's/ .*//')
|
||||
|
||||
# Ensure that we don't accidentally insert an entry into an old NEWS block.
|
||||
sc_immutable_NEWS:
|
||||
@@ -444,15 +480,24 @@ update-NEWS-hash: NEWS
|
||||
perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
|
||||
$(srcdir)/cfg.mk
|
||||
|
||||
epoch_date = 1970-01-01 00:00:00.000000000 +0000
|
||||
# Ensure that the c99-to-c89 patch applies cleanly.
|
||||
patch-check:
|
||||
rm -rf src-c89 $@.1 $@.2
|
||||
cp -a src src-c89
|
||||
(cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
|
||||
cp -a $(srcdir)/src src-c89
|
||||
if test "x$(srcdir)" != x.; then \
|
||||
cp -a src/* src-c89; \
|
||||
dotfiles=`ls src/.[!.]* 2>/dev/null`; \
|
||||
test -z "$$dotfiles" || cp -a src/.[!.]* src-c89; \
|
||||
fi
|
||||
(cd src-c89; patch -p1 -V never --fuzz=0) < $(srcdir)/src/c99-to-c89.diff \
|
||||
> $@.1 2>&1
|
||||
if test "$$REGEN_PATCH" = yes; then \
|
||||
diff -upr src src-c89 | sed 's,src-c89/,src/,' \
|
||||
| grep -v '^Only in' > new-diff || : ; fi
|
||||
if test "$(REGEN_PATCH)" = yes; then \
|
||||
diff -upr $(srcdir)/src src-c89 | sed 's,$(srcdir)/src-c89/,src/,' \
|
||||
| grep -vE '^(Only in|File )' \
|
||||
| perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \
|
||||
-e 's/^ $$//' \
|
||||
> new-diff || : ; fi
|
||||
grep -v '^patching file ' $@.1 > $@.2 || :
|
||||
msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \
|
||||
rm -f src-c89/*.o || msg='rm failed'; \
|
||||
@@ -461,29 +506,18 @@ patch-check:
|
||||
test "$$msg" = ok && rm -rf src-c89 $@.1 $@.2 || echo "$$msg" 1>&2; \
|
||||
test "$$msg" = ok
|
||||
|
||||
# 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.
|
||||
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||
strftime-check:
|
||||
if test -f $(srcdir)/src/date.c; then \
|
||||
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||
| $(extract_char) > $@-src; \
|
||||
{ echo N; \
|
||||
info libc date calendar format | grep '^ `%.'\' \
|
||||
| $(extract_char); } | sort > $@-info; \
|
||||
diff -u $@-src $@-info || exit 1; \
|
||||
rm -f $@-src $@-info; \
|
||||
fi
|
||||
|
||||
check-AUTHORS:
|
||||
$(MAKE) -C src $@
|
||||
|
||||
# Ensure that we use only the standard $(VAR) notation,
|
||||
# not @...@ in Makefile.am, now that we can rely on automake
|
||||
# to emit a definition for each substituted variable.
|
||||
# We use perl rather than "grep -nE ..." to exempt a single
|
||||
# use of an @...@-delimited variable name in src/Makefile.am.
|
||||
makefile-check:
|
||||
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
|
||||
@perl -ne '/\@[A-Z_0-9]+\@/ && !/^cu_install_program =/' \
|
||||
-e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$') \
|
||||
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
|
||||
|
||||
news-date-check: NEWS
|
||||
@@ -505,22 +539,33 @@ changelog-check:
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
m4-check:
|
||||
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
|
||||
&& { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
|
||||
sc_makefile_TAB_only_indentation:
|
||||
@grep -nE '^ [ ]{8}' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
|
||||
&& { echo '$(ME): found TAB-8-space indentation' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_m4_quote_check:
|
||||
@grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \
|
||||
&& { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
fix_po_file_diag = \
|
||||
'you have changed the set of files with translatable diagnostics;\n\
|
||||
apply the above patch\n'
|
||||
|
||||
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||
# FIXME: don't hard-code file names below; use a more general mechanism.
|
||||
po-check:
|
||||
if test -f po/POTFILES.in; then \
|
||||
grep -E -v '^(#|$$)' po/POTFILES.in \
|
||||
po_file = po/POTFILES.in
|
||||
sc_po_check:
|
||||
@if test -f $(po_file); then \
|
||||
grep -E -v '^(#|$$)' $(po_file) \
|
||||
| grep -v '^src/false\.c$$' | sort > $@-1; \
|
||||
files=; \
|
||||
for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
|
||||
case $$file in \
|
||||
djgpp/* | man/*) continue;; \
|
||||
*/c99-to-c89.diff) continue;; \
|
||||
*.?|*.??) ;; \
|
||||
*) continue;; \
|
||||
esac; \
|
||||
case $$file in \
|
||||
*.[ch]) \
|
||||
@@ -531,34 +576,25 @@ po-check:
|
||||
done; \
|
||||
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
|
||||
| sort -u > $@-2; \
|
||||
diff -u $@-1 $@-2 || exit 1; \
|
||||
diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \
|
||||
|| { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \
|
||||
rm -f $@-1 $@-2; \
|
||||
fi
|
||||
|
||||
# In a definition of #define AUTHORS "... and ..." where the RHS contains
|
||||
# the English word `and', the string must be marked with `N_ (...)' so that
|
||||
# gettext recognizes it as a string requiring translation.
|
||||
author_mark_check:
|
||||
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
|
||||
{ echo '$(ME): enclose the above strings in N_ (...)' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Sometimes it is useful to change the PATH environment variable
|
||||
# in Makefiles. When doing so, it's better not to use the Unix-centric
|
||||
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
|
||||
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
|
||||
# and there probably aren't many projects with so many Makefile.am files
|
||||
# that we'd have to worry about limits on command line length.
|
||||
msg = '$(ME): Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
|
||||
makefile_path_separator_check:
|
||||
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
|
||||
# path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
|
||||
msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
|
||||
sc_makefile_path_separator_check:
|
||||
@grep -nE 'PATH[=].*:' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
|
||||
&& { echo $(msg) 1>&2; exit 1; } || :
|
||||
|
||||
# Check that `make alpha' will not fail at the end of the process.
|
||||
writable-files:
|
||||
if test -d $(release_archive_dir); then :; else \
|
||||
for file in $(distdir).tar.gz \
|
||||
$(release_archive_dir)/$(distdir).tar.gz; do \
|
||||
$(release_archive_dir)/$(distdir).tar.gz; do \
|
||||
test -e $$file || continue; \
|
||||
test -w $$file \
|
||||
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
||||
@@ -571,24 +607,24 @@ sample-test = tests/sample-test
|
||||
texi = doc/$(PACKAGE).texi
|
||||
# Make sure that the copyright date in $(v_etc_file) is up to date.
|
||||
# Do the same for the $(sample-test) and the main doc/.texi file.
|
||||
copyright-check:
|
||||
@if test -f $(v_etc_file); then \
|
||||
sc_copyright_check:
|
||||
@if test -f $(v_etc_file); then \
|
||||
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
|
||||
>/dev/null \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
exit 1; }; \
|
||||
fi
|
||||
@if test -f $(sample-test); then \
|
||||
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
|
||||
>/dev/null \
|
||||
@if test -f $(sample-test); then \
|
||||
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
exit 1; }; \
|
||||
fi
|
||||
@if test -f $(texi); then \
|
||||
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
@if test -f $(texi); then \
|
||||
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
fi
|
||||
|
||||
vc-diff-check:
|
||||
@@ -605,13 +641,14 @@ cvs-check: vc-diff-check
|
||||
|
||||
maintainer-distcheck:
|
||||
$(MAKE) distcheck
|
||||
$(MAKE) taint-distcheck
|
||||
$(MAKE) my-distcheck
|
||||
|
||||
|
||||
# Don't make a distribution if checks fail.
|
||||
# Also, make sure the NEWS file is up-to-date.
|
||||
vc-dist: $(local-check) cvs-check maintainer-distcheck
|
||||
$(MAKE) dist
|
||||
XZ_OPT=-9ev $(MAKE) dist
|
||||
|
||||
# Use this to make sure we don't run these programs when building
|
||||
# from a virgin tgz file, below.
|
||||
@@ -633,14 +670,44 @@ TMPDIR ?= /tmp
|
||||
t=$(TMPDIR)/$(PACKAGE)/test
|
||||
pfx=$(t)/i
|
||||
|
||||
# More than once, tainted build and source directory names would
|
||||
# have caused at least one "make check" test to apply "chmod 700"
|
||||
# to all directories under $HOME. Make sure it doesn't happen again.
|
||||
tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
|
||||
t_prefix = $(tp)/a
|
||||
t_taint = '$(t_prefix) b'
|
||||
fake_home = $(tp)/home
|
||||
|
||||
# Ensure that tests run from tainted build and src dir names work,
|
||||
# and don't affect anything in $HOME. Create witness files in $HOME,
|
||||
# record their attributes, and build/test. Then ensure that the
|
||||
# witnesses were not affected.
|
||||
taint-distcheck: $(DIST_ARCHIVES)
|
||||
test -d $(t_taint) && chmod -R 700 $(t_taint) || :
|
||||
-rm -rf $(t_taint) $(fake_home)
|
||||
mkdir -p $(t_prefix) $(t_taint) $(fake_home)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
|
||||
mkfifo $(fake_home)/fifo
|
||||
touch $(fake_home)/f
|
||||
mkdir -p $(fake_home)/d/e
|
||||
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
|
||||
cd $(t_taint)/$(distdir) \
|
||||
&& ./configure \
|
||||
&& $(MAKE) \
|
||||
&& HOME=$(fake_home) $(MAKE) check \
|
||||
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
|
||||
&& diff $(tp)/.ls-before $(tp)/.ls-after \
|
||||
&& test -d $(t_prefix)
|
||||
rm -rf $(tp)
|
||||
|
||||
# Verify that a twisted use of --program-transform-name=PROGRAM works.
|
||||
define install-transform-check
|
||||
rm -rf $(pfx); \
|
||||
$(MAKE) program_transform_name='s/.*/zyx/' \
|
||||
echo running install-transform-check \
|
||||
&& rm -rf $(pfx) \
|
||||
&& $(MAKE) program_transform_name='s/.*/zyx/' \
|
||||
prefix=$(pfx) install \
|
||||
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
|
||||
&& test "$$(echo $(pfx)/share/man/man1/*)" = \
|
||||
"$(pfx)/share/man/man1/zyx.1"
|
||||
&& test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
|
||||
endef
|
||||
|
||||
# Install, then verify that all binaries and man pages are in place.
|
||||
@@ -662,6 +729,35 @@ define my-instcheck
|
||||
}
|
||||
endef
|
||||
|
||||
define coreutils-path-check
|
||||
{ \
|
||||
if test -f $(srcdir)/src/true.c; then \
|
||||
fail=1; \
|
||||
mkdir $(bin) \
|
||||
&& ($(write_loser)) > $(bin)/loser \
|
||||
&& chmod a+x $(bin)/loser \
|
||||
&& for i in $(built_programs); do \
|
||||
case $$i in \
|
||||
rm|expr|basename|echo|sort|ls|tr);; \
|
||||
cat|dirname|mv|wc);; \
|
||||
*) ln $(bin)/loser $(bin)/$$i;; \
|
||||
esac; \
|
||||
done \
|
||||
&& ln -sf ../src/true $(bin)/false \
|
||||
&& PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \
|
||||
$(MAKE) -C tests check \
|
||||
&& { test -d gnulib-tests \
|
||||
&& $(MAKE) -C gnulib-tests check \
|
||||
|| :; } \
|
||||
&& rm -rf $(bin) \
|
||||
&& fail=0; \
|
||||
else \
|
||||
fail=0; \
|
||||
fi; \
|
||||
test $$fail = 1 && exit 1 || :; \
|
||||
}
|
||||
endef
|
||||
|
||||
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
|
||||
# Also, check for shadowing problems with -Wshadow, and for pointer
|
||||
# arithmetic problems with -Wpointer-arith.
|
||||
@@ -674,7 +770,9 @@ endef
|
||||
# the build srcdir, these always-failing programs will run.
|
||||
# Otherwise, it is too easy to test the wrong programs.
|
||||
# Note that "false" itself is a symlink to true, so it too will malfunction.
|
||||
my-distcheck: $(DIST_ARCHIVES) $(local-check) check
|
||||
my-distcheck: $(DIST_ARCHIVES) $(local-check)
|
||||
$(MAKE) syntax-check
|
||||
$(MAKE) check
|
||||
-rm -rf $(t)
|
||||
mkdir -p $(t)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
@@ -685,33 +783,11 @@ my-distcheck: $(DIST_ARCHIVES) $(local-check) check
|
||||
&& $(MAKE) dvi \
|
||||
&& $(install-transform-check) \
|
||||
&& $(my-instcheck) \
|
||||
&& mkdir $(bin) \
|
||||
&& ($(write_loser)) > $(bin)/loser \
|
||||
&& chmod a+x $(bin)/loser \
|
||||
&& for i in $(built_programs); do \
|
||||
case $$i in \
|
||||
rm|expr|basename|echo|sort|ls|tr);; \
|
||||
cat|dirname|mv|wc);; \
|
||||
*) ln $(bin)/loser $(bin)/$$i;; \
|
||||
esac; \
|
||||
done \
|
||||
&& ln -sf ../src/true $(bin)/false \
|
||||
&& PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
|
||||
&& { test -d gnulib-tests \
|
||||
&& $(MAKE) -C gnulib-tests check \
|
||||
|| :; } \
|
||||
&& rm -rf $(bin) \
|
||||
&& $(coreutils-path-check) \
|
||||
&& $(MAKE) distclean
|
||||
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||
if test -f $(srcdir)/src/c99-to-c89.diff; then \
|
||||
cd $(t)/$(distdir) \
|
||||
&& (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
|
||||
&& ./configure --disable-largefile \
|
||||
CFLAGS='-Werror -ansi -Wno-long-long' \
|
||||
&& $(MAKE); \
|
||||
fi
|
||||
-rm -rf $(t)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
@@ -743,6 +819,7 @@ announcement: NEWS ChangeLog $(rel-files)
|
||||
--news=NEWS \
|
||||
--bootstrap-tools=autoconf,automake,bison,gnulib \
|
||||
--gnulib-version=$(gnulib-version) \
|
||||
--no-print-checksums \
|
||||
$(addprefix --url-dir=, $(url_dir_list))
|
||||
|
||||
## ---------------- ##
|
||||
@@ -765,6 +842,14 @@ emit_upload_commands:
|
||||
@echo =====================================
|
||||
@echo =====================================
|
||||
|
||||
noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
define emit-commit-log
|
||||
printf '%s\n' 'post-release administrivia' '' \
|
||||
'* NEWS: Add header line for next release.' \
|
||||
'* .prev-version: Record previous version.' \
|
||||
'* cfg.mk (old_NEWS_hash): Auto-update.'
|
||||
endef
|
||||
|
||||
.PHONY: alpha beta major
|
||||
alpha beta major: $(local-check) writable-files
|
||||
test $@ = major \
|
||||
@@ -780,6 +865,17 @@ alpha beta major: $(local-check) writable-files
|
||||
fi
|
||||
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
|
||||
echo $(VERSION) > $(prev_version_file)
|
||||
$(VC) commit -m \
|
||||
'$(prev_version_file): Record previous version: $(VERSION).' \
|
||||
$(prev_version_file)
|
||||
$(MAKE) update-NEWS-hash
|
||||
perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
|
||||
$(emit-commit-log) > .ci-msg
|
||||
$(VC) commit -F .ci-msg -a
|
||||
|
||||
.PHONY: web-manual
|
||||
web-manual:
|
||||
@test -z "$(manual_title)" \
|
||||
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
|
||||
@cd '$(srcdir)/doc'; \
|
||||
$(SHELL) ../build-aux/gendocs.sh -o '$(abs_builddir)/doc/manual' \
|
||||
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
|
||||
"$(PACKAGE_NAME) - $(manual_title)"
|
||||
@echo " *** Upload the doc/manual directory to web-cvs."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make coreutils man pages. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 2002-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-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
|
||||
@@ -113,9 +113,11 @@ tac.1: $(common_dep) $(srcdir)/tac.x ../src/tac.c
|
||||
tail.1: $(common_dep) $(srcdir)/tail.x ../src/tail.c
|
||||
tee.1: $(common_dep) $(srcdir)/tee.x ../src/tee.c
|
||||
test.1: $(common_dep) $(srcdir)/test.x ../src/test.c
|
||||
timeout.1: $(common_dep) $(srcdir)/timeout.x ../src/timeout.c
|
||||
touch.1: $(common_dep) $(srcdir)/touch.x ../src/touch.c
|
||||
tr.1: $(common_dep) $(srcdir)/tr.x ../src/tr.c
|
||||
true.1: $(common_dep) $(srcdir)/true.x ../src/true.c
|
||||
truncate.1: $(common_dep) $(srcdir)/truncate.x ../src/truncate.c
|
||||
tsort.1: $(common_dep) $(srcdir)/tsort.x ../src/tsort.c
|
||||
tty.1: $(common_dep) $(srcdir)/tty.x ../src/tty.c
|
||||
uname.1: $(common_dep) $(srcdir)/uname.x ../src/uname.c
|
||||
@@ -130,6 +132,10 @@ who.1: $(common_dep) $(srcdir)/who.x ../src/who.c
|
||||
whoami.1: $(common_dep) $(srcdir)/whoami.x ../src/whoami.c
|
||||
yes.1: $(common_dep) $(srcdir)/yes.x ../src/yes.c
|
||||
|
||||
# This is required so that changes to e.g., emit_bug_reporting_address
|
||||
# provoke regeneration of all $(MAN) files.
|
||||
$(MAN): $(top_srcdir)/src/system.h
|
||||
|
||||
SUFFIXES = .x .1
|
||||
|
||||
# Ensure that help2man runs the ../src/ginstall binary as
|
||||
@@ -150,16 +156,15 @@ mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
|
||||
*) \
|
||||
rm -f $@ \
|
||||
&& { echo "Updating man page $@"; \
|
||||
rm -rf $t; \
|
||||
mkdir $t; \
|
||||
(cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
|
||||
$(PERL) -- $(srcdir)/help2man \
|
||||
--source='$(PACKAGE_STRING)' \
|
||||
--include=$(srcdir)/$*.x \
|
||||
--output=$t/$@ $t/$*; \
|
||||
rm -rf $t; \
|
||||
mkdir $t; \
|
||||
(cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
|
||||
$(PERL) -- $(srcdir)/help2man \
|
||||
--source='$(PACKAGE_STRING)' \
|
||||
--include=$(srcdir)/$*.x \
|
||||
--output=$t/$@ $t/$*; \
|
||||
} \
|
||||
&& sed 's|$*\.td/||g' $t/$@ > $@ \
|
||||
&& chmod a-w $@ \
|
||||
&& rm -rf $t ;; \
|
||||
esac
|
||||
|
||||
|
||||
2
man/du.x
2
man/du.x
@@ -19,7 +19,7 @@ will match any files whose names end in
|
||||
.BR .o .
|
||||
Therefore, the command
|
||||
.IP
|
||||
.B du --exclude='*.o'
|
||||
.B du --exclude=\(aq*.o\(aq
|
||||
.PP
|
||||
will skip all files and subdirectories ending in
|
||||
.BR .o
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Generate a short man page from --help and --version output.
|
||||
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008
|
||||
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -368,7 +368,7 @@ s/^\./\x80/mg;
|
||||
s/^'/\x81/mg;
|
||||
s/\\/\x82/g;
|
||||
|
||||
my $PAT_BUGS = _('Report +bugs|Email +bug +reports +to');
|
||||
my $PAT_BUGS = _('Report +(?:\w+ +)?bugs|Email +bug +reports +to');
|
||||
my $PAT_AUTHOR = _('Written +by');
|
||||
my $PAT_OPTIONS = _('Options');
|
||||
my $PAT_EXAMPLES = _('Examples');
|
||||
@@ -567,7 +567,7 @@ and
|
||||
.B %s
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info coreutils '%s invocation'
|
||||
.B info coreutils \(aq%s invocation\(aq
|
||||
.PP
|
||||
should give you access to the complete manual.
|
||||
EOT
|
||||
@@ -607,6 +607,9 @@ for my $sect (@pre, (grep ! /^($filter)$/o, @include), @post)
|
||||
# Convert some latin1 chars to troff equivalents
|
||||
s/\xa0/\\ /g; # non-breaking space
|
||||
|
||||
$sect eq 'REPORTING BUGS'
|
||||
and s/\n(.)/\n.br\n$1/g;
|
||||
|
||||
print;
|
||||
}
|
||||
}
|
||||
|
||||
2
man/id.x
2
man/id.x
@@ -1,4 +1,4 @@
|
||||
[NAME]
|
||||
id \- print user identity
|
||||
id \- print real and effective user and group IDs
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
|
||||
6
man/timeout.x
Normal file
6
man/timeout.x
Normal file
@@ -0,0 +1,6 @@
|
||||
[NAME]
|
||||
timeout \- run a command with a time limit
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[SEE ALSO]
|
||||
kill(1)
|
||||
6
man/truncate.x
Normal file
6
man/truncate.x
Normal file
@@ -0,0 +1,6 @@
|
||||
[NAME]
|
||||
truncate \- shrink or extend the size of a file to the specified size
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[SEE ALSO]
|
||||
dd(1), truncate(2), ftruncate(2)
|
||||
@@ -753,7 +753,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -277,7 +277,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -465,7 +465,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# List of files which contain translatable strings.
|
||||
# Copyright (C) 1996-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2009 Free Software Foundation, Inc.
|
||||
|
||||
# These are nominally temporary...
|
||||
lib/argmatch.c
|
||||
@@ -22,8 +22,10 @@ lib/rpmatch.c
|
||||
lib/set-mode-acl.c
|
||||
lib/unicodeio.c
|
||||
lib/userspec.c
|
||||
lib/verror.c
|
||||
lib/version-etc.c
|
||||
lib/xalloc-die.c
|
||||
lib/xfreopen.c
|
||||
lib/xfts.c
|
||||
lib/xmemcoll.c
|
||||
lib/xmemxfrm.c
|
||||
@@ -61,6 +63,7 @@ src/factor.c
|
||||
src/false.c
|
||||
src/fmt.c
|
||||
src/fold.c
|
||||
src/getlimits.c
|
||||
src/group-list.c
|
||||
src/groups.c
|
||||
src/head.c
|
||||
@@ -84,6 +87,7 @@ src/nice.c
|
||||
src/nl.c
|
||||
src/nohup.c
|
||||
src/od.c
|
||||
src/operand2sig.c
|
||||
src/paste.c
|
||||
src/pathchk.c
|
||||
src/pinky.c
|
||||
@@ -115,9 +119,11 @@ src/tac.c
|
||||
src/tail.c
|
||||
src/tee.c
|
||||
src/test.c
|
||||
src/timeout.c
|
||||
src/touch.c
|
||||
src/tr.c
|
||||
src/true.c
|
||||
src/truncate.c
|
||||
src/tsort.c
|
||||
src/tty.c
|
||||
src/uname.c
|
||||
|
||||
4
src/.gitignore
vendored
4
src/.gitignore
vendored
@@ -31,6 +31,7 @@ false
|
||||
fmt
|
||||
fold
|
||||
fs.h
|
||||
getlimits
|
||||
ginstall
|
||||
groups
|
||||
head
|
||||
@@ -39,6 +40,7 @@ hostname
|
||||
id
|
||||
join
|
||||
kill
|
||||
libver.a
|
||||
link
|
||||
ln
|
||||
localedir.h
|
||||
@@ -87,9 +89,11 @@ tac
|
||||
tail
|
||||
tee
|
||||
test
|
||||
timeout
|
||||
touch
|
||||
tr
|
||||
true
|
||||
truncate
|
||||
tsort
|
||||
tty
|
||||
uname
|
||||
|
||||
139
src/Makefile.am
139
src/Makefile.am
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
|
||||
## Copyright (C) 1990, 1991, 1993-2008 Free Software Foundation, Inc.
|
||||
## Copyright (C) 1990, 1991, 1993-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,6 +26,8 @@ no_install__progs = \
|
||||
build_if_possible__progs = \
|
||||
chroot df hostid nice pinky stty su uname uptime users who
|
||||
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
EXTRA_PROGRAMS = \
|
||||
$(no_install__progs) \
|
||||
$(build_if_possible__progs) \
|
||||
@@ -39,12 +41,12 @@ EXTRA_PROGRAMS = \
|
||||
basename date dirname echo env expr factor false \
|
||||
id kill logname pathchk printenv printf pwd \
|
||||
runcon seq sleep tee \
|
||||
test true tty whoami yes \
|
||||
test timeout true truncate tty whoami yes \
|
||||
base64
|
||||
|
||||
bin_PROGRAMS = $(OPTIONAL_BIN_PROGS)
|
||||
|
||||
noinst_PROGRAMS = setuidgid
|
||||
noinst_PROGRAMS = setuidgid getlimits
|
||||
|
||||
noinst_HEADERS = \
|
||||
chown-core.h \
|
||||
@@ -54,6 +56,7 @@ noinst_HEADERS = \
|
||||
fs.h \
|
||||
group-list.h \
|
||||
ls.h \
|
||||
operand2sig.h \
|
||||
prog-fprintf.h \
|
||||
remove.h \
|
||||
system.h \
|
||||
@@ -68,18 +71,24 @@ CLEANFILES = $(SCRIPTS) su
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/lib
|
||||
|
||||
noinst_LIBRARIES = libver.a
|
||||
nodist_libver_a_SOURCES = version.c version.h
|
||||
|
||||
# Sometimes, the expansion of $(LIBINTL) includes -lc which may
|
||||
# include modules defining variables like `optind', so libcoreutils.a
|
||||
# must precede $(LIBINTL) in order to ensure we use GNU getopt.
|
||||
# But libcoreutils.a must also follow $(LIBINTL), since libintl uses
|
||||
# replacement functions defined in libcoreutils.a.
|
||||
LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
|
||||
LDADD = libver.a ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
|
||||
|
||||
cat_LDADD = $(LDADD)
|
||||
df_LDADD = $(LDADD)
|
||||
du_LDADD = $(LDADD)
|
||||
getlimits_LDADD = $(LDADD)
|
||||
ptx_LDADD = $(LDADD)
|
||||
split_LDADD = $(LDADD)
|
||||
timeout_LDADD = $(LDADD)
|
||||
truncate_LDADD = $(LDADD)
|
||||
|
||||
# for eaccess in lib/euidaccess.c.
|
||||
chcon_LDADD = $(LDADD) $(LIB_SELINUX)
|
||||
@@ -98,15 +107,15 @@ __LDADD = $(LDADD) $(LIB_EACCESS)
|
||||
|
||||
# for clock_gettime and fdatasync
|
||||
dd_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
|
||||
dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
|
||||
dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
|
||||
id_LDADD = $(LDADD) $(LIB_SELINUX)
|
||||
ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
|
||||
ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
|
||||
mktemp_LDADD = $(LDADD) $(LIB_GETHRXTIME)
|
||||
pr_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
||||
shred_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
|
||||
shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
|
||||
tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
||||
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
|
||||
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
|
||||
|
||||
## If necessary, add -lm to resolve use of pow in lib/strtod.c.
|
||||
sort_LDADD = $(LDADD) $(POW_LIB) $(LIB_GETHRXTIME)
|
||||
@@ -126,6 +135,12 @@ seq_LDADD = $(LDADD) $(POW_LIB)
|
||||
# and the `nanosleep' reference in lib/xnanosleep.c.
|
||||
nanosec_libs = $(LDADD) $(POW_LIB) $(LIB_NANOSLEEP)
|
||||
|
||||
# for various GMP functions
|
||||
expr_LDADD = $(LDADD) $(LIB_GMP)
|
||||
|
||||
# for various GMP functions
|
||||
factor_LDADD = $(LDADD) $(LIB_GMP)
|
||||
|
||||
sleep_LDADD = $(nanosec_libs)
|
||||
tail_LDADD = $(nanosec_libs)
|
||||
|
||||
@@ -137,9 +152,9 @@ su_LDADD = $(LDADD) $(LIB_CRYPT)
|
||||
dir_LDADD += $(LIB_ACL)
|
||||
ls_LDADD += $(LIB_ACL)
|
||||
vdir_LDADD += $(LIB_ACL)
|
||||
cp_LDADD += $(LIB_ACL)
|
||||
mv_LDADD += $(LIB_ACL)
|
||||
ginstall_LDADD += $(LIB_ACL)
|
||||
cp_LDADD += $(LIB_ACL) $(LIB_XATTR)
|
||||
mv_LDADD += $(LIB_ACL) $(LIB_XATTR)
|
||||
ginstall_LDADD += $(LIB_ACL) $(LIB_XATTR)
|
||||
|
||||
stat_LDADD = $(LDADD) $(LIB_SELINUX)
|
||||
|
||||
@@ -148,8 +163,15 @@ cat_LDADD += $(LIBICONV)
|
||||
cp_LDADD += $(LIBICONV)
|
||||
df_LDADD += $(LIBICONV)
|
||||
du_LDADD += $(LIBICONV)
|
||||
getlimits_LDADD += $(LIBICONV)
|
||||
ptx_LDADD += $(LIBICONV)
|
||||
split_LDADD += $(LIBICONV)
|
||||
timeout_LDADD += $(LIBICONV)
|
||||
truncate_LDADD += $(LIBICONV)
|
||||
|
||||
# programs that use getaddrinfo (e.g., via canon_host)
|
||||
pinky_LDADD = $(LDADD) $(GETADDRINFO_LIB)
|
||||
who_LDADD = $(LDADD) $(GETADDRINFO_LIB)
|
||||
|
||||
$(PROGRAMS): ../lib/libcoreutils.a
|
||||
|
||||
@@ -233,6 +255,8 @@ ln_SOURCES = ln.c
|
||||
ls_SOURCES = ls.c ls-ls.c
|
||||
chown_SOURCES = chown.c chown-core.c
|
||||
chgrp_SOURCES = chgrp.c chown-core.c
|
||||
kill_SOURCES = kill.c operand2sig.c
|
||||
timeout_SOURCES = timeout.c operand2sig.c
|
||||
|
||||
mv_SOURCES = mv.c remove.c $(copy_sources)
|
||||
rm_SOURCES = rm.c remove.c
|
||||
@@ -295,6 +319,22 @@ fs.h: stat.c extract-magic
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
BUILT_SOURCES += version.c
|
||||
version.c: Makefile
|
||||
rm -f $@
|
||||
printf '#include <config.h>\n' > $@t
|
||||
printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
BUILT_SOURCES += version.h
|
||||
version.h: Makefile
|
||||
rm -f $@
|
||||
printf 'extern char const *Version;\n' > $@t
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
DISTCLEANFILES = version.c version.h
|
||||
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
# Sort in traditional ASCII order, regardless of the current locale;
|
||||
@@ -319,7 +359,7 @@ pm = progs-makefile
|
||||
pr = progs-readme
|
||||
# Ensure that the list of programs in README matches the list
|
||||
# of programs we can build.
|
||||
check: check-README check-misc check-duplicate-no-install
|
||||
check: check-README check-duplicate-no-install
|
||||
.PHONY: check-README
|
||||
check-README:
|
||||
rm -rf $(pr) $(pm)
|
||||
@@ -342,8 +382,8 @@ au_dotdot = authors-dotdot
|
||||
au_actual = authors-actual
|
||||
.PHONY: check-AUTHORS
|
||||
check-AUTHORS: $(all_programs)
|
||||
rm -f $(au_actual) $(au_dotdot)
|
||||
for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
|
||||
@rm -f $(au_actual) $(au_dotdot)
|
||||
@for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
|
||||
| $(ASSORT) -u`; do \
|
||||
test "$$i" = '[' && continue; \
|
||||
exe=$$i; \
|
||||
@@ -352,24 +392,12 @@ check-AUTHORS: $(all_programs)
|
||||
elif test "$$i" = test; then \
|
||||
exe='['; \
|
||||
fi; \
|
||||
LC_ALL=en_US.UTF-8 ./$$exe --version \
|
||||
LC_ALL=en_US.UTF-8 ./$$exe --version \
|
||||
| perl -0 -pi -e 's/,\n/, /gm' \
|
||||
|sed -n '/Written by /{ s//'"$$i"': /; s/,* and /, /; s/\.$$//; p; }'; \
|
||||
done > $(au_actual)
|
||||
sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
|
||||
diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
|
||||
|
||||
# Make sure we don't define any S_IS* macros in src/*.c files.
|
||||
# Not a big deal, but they're already defined via system.h.
|
||||
#
|
||||
# Also make sure we don't use st_blocks. Use ST_NBLOCKS instead.
|
||||
# This is a bit of a kludge, since it prevents use of the string
|
||||
# even in comments, but for now it does the job with no false positives.
|
||||
.PHONY: check-misc
|
||||
check-misc:
|
||||
cd $(srcdir); grep '^# *define *S_IS' $(SOURCES) && exit 1 || :
|
||||
cd $(srcdir); grep st_blocks $(SOURCES) && exit 1 || :
|
||||
cd $(srcdir); grep '^# *define .*defined' $(SOURCES) && exit 1 || :
|
||||
@sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
|
||||
@diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
|
||||
|
||||
# Extract the list of authors from each file.
|
||||
sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
|
||||
@@ -377,7 +405,6 @@ sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
|
||||
s1 = '/^\#define AUTHORS \([^\\]\)/{;s//\1/;$(sed_filter);p;q;}'
|
||||
# Sometimes the string is on the backslash-continued line after the #define.
|
||||
s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
|
||||
# FIXME: handle *.sh; and use $(all_programs), not $(SOURCES)
|
||||
../AUTHORS: $(SOURCES)
|
||||
rm -f $@-t
|
||||
( \
|
||||
@@ -410,55 +437,35 @@ s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
|
||||
sc_tight_scope: $(all_programs)
|
||||
@t=exceptions-$$$$; \
|
||||
trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15; \
|
||||
src=`for f in $(SOURCES); do \
|
||||
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
|
||||
hdr=`for f in $(noinst_HEADERS); do \
|
||||
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
|
||||
( printf 'main\nusage\n'; \
|
||||
grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
|
||||
grep -h -A1 '^extern .*[^;]$$' $$src \
|
||||
| grep -vE '^(extern |--)' | sed 's/ .*//'; \
|
||||
perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' \
|
||||
$(noinst_HEADERS); \
|
||||
perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' $$hdr; \
|
||||
) | $(ASSORT) -u | sed 's/^/^/;s/$$/$$/' > $$t; \
|
||||
nm -e *.$(OBJEXT) \
|
||||
| sed -n 's/.* T //p' \
|
||||
| sed 's/^_//' \
|
||||
| grep -Ev -f $$t && \
|
||||
{ echo 'the above functions should have static scope' 1>&2; \
|
||||
exit 1; } || : ; \
|
||||
( printf '^program_name$$\n'; \
|
||||
sed -n 's/^extern int \([^ ][^ ]*\);$$/^\1$$/p' \
|
||||
$(noinst_HEADERS) ) > $$t; \
|
||||
perl -ne '/^extern .*?\**(\w+);/ and print "^$$1\$$\n"' \
|
||||
$$hdr *.h ) | $(ASSORT) -u > $$t; \
|
||||
nm -e *.$(OBJEXT) \
|
||||
| sed -n 's/.* [BD] //p' \
|
||||
| sed 's/^_//' \
|
||||
| grep -Ev -f $$t && \
|
||||
{ echo 'the above variables should have static scope' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
.PHONY: cu-install-binPROGRAMS
|
||||
install-exec-am:
|
||||
@case '$(program_transform_name):$(EXEEXT)' in \
|
||||
's,x,x,:') cu=cu-;; *) cu= ;; esac; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) binPROGRAMS_INSTALL=./ginstall \
|
||||
$${cu}install-binPROGRAMS
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
|
||||
|
||||
# The following rule is used only when --program-transform-name
|
||||
# has not been used and there is no .exe "extension".
|
||||
# Override the automake-generated rule so that we can install
|
||||
# all binaries with a single install command. However, ...
|
||||
# install ginstall and [ separately. "ginstall" because we rename
|
||||
# it to "install", and "[" because using it unquoted will cause a
|
||||
# syntax error with some shells. Be careful to install each of these
|
||||
# exceptions only if it is to be installed (i.e., not excluded via
|
||||
# --enable-no-install-program=PROG_LIST.
|
||||
filtered_PROGS = \
|
||||
`echo "$(bin_PROGRAMS)" | sed 's/ *\<ginstall\> */ /;s/ *\[ */ /'`
|
||||
d_bindir = $(DESTDIR)$(bindir)
|
||||
cu-install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(d_bindir)"
|
||||
test x = 'x$(bin_PROGRAMS)' && exit || :
|
||||
case '$(bin_PROGRAMS)' in *\[*) \
|
||||
echo "$(binPROGRAMS_INSTALL) '[' '$(d_bindir)/['"; \
|
||||
$(binPROGRAMS_INSTALL) '[' '$(d_bindir)/[';; esac
|
||||
case '$(bin_PROGRAMS)' in *ginstall*) \
|
||||
echo "$(binPROGRAMS_INSTALL) ginstall '$(d_bindir)/install'";\
|
||||
$(binPROGRAMS_INSTALL) ginstall '$(d_bindir)/install';; esac
|
||||
$(binPROGRAMS_INSTALL) $(filtered_PROGS) '$(d_bindir)'
|
||||
# Use the just-built ./ginstall, when not cross-compiling.
|
||||
if CROSS_COMPILING
|
||||
cu_install_program = @INSTALL_PROGRAM@
|
||||
else
|
||||
cu_install_program = ./ginstall
|
||||
endif
|
||||
INSTALL_PROGRAM = $(cu_install_program)
|
||||
|
||||
18
src/base64.c
18
src/base64.c
@@ -37,10 +37,8 @@
|
||||
|
||||
#define AUTHORS proper_name ("Simon Josefsson")
|
||||
|
||||
/* The invocation name of this program. */
|
||||
char *program_name;
|
||||
|
||||
static const struct option long_options[] = {
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"decode", no_argument, 0, 'd'},
|
||||
{"wrap", required_argument, 0, 'w'},
|
||||
{"ignore-garbage", no_argument, 0, 'i'},
|
||||
@@ -50,7 +48,7 @@ static const struct option long_options[] = {
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
if (status != EXIT_SUCCESS)
|
||||
@@ -59,7 +57,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION] [FILE]\n\
|
||||
Usage: %s [OPTION]... [FILE]\n\
|
||||
Base64 encode or decode FILE, or standard input, to standard output.\n\
|
||||
\n"), program_name);
|
||||
fputs (_("\
|
||||
@@ -216,7 +214,7 @@ do_decode (FILE *in, FILE *out, bool ignore_garbage)
|
||||
However, when it processes the final input buffer, we want
|
||||
to iterate it one additional time, but with an indicator
|
||||
telling it to flush what is in CTX. */
|
||||
for (k = 0; k < 1 + feof (in); k++)
|
||||
for (k = 0; k < 1 + !!feof (in); k++)
|
||||
{
|
||||
if (k == 1 && ctx.i == 0)
|
||||
break;
|
||||
@@ -240,15 +238,15 @@ main (int argc, char **argv)
|
||||
FILE *input_fh;
|
||||
const char *infile;
|
||||
|
||||
/* True if --decode has bene given and we should decode data. */
|
||||
/* True if --decode has been given and we should decode data. */
|
||||
bool decode = false;
|
||||
/* True if we should ignore non-alphabetic characters. */
|
||||
/* True if we should ignore non-base64-alphabetic characters. */
|
||||
bool ignore_garbage = false;
|
||||
/* Wrap encoded base64 data around the 76:th column, by default. */
|
||||
uintmax_t wrap_column = 76;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
@@ -37,10 +37,7 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "basename"
|
||||
|
||||
#define AUTHORS proper_name ("FIXME unknown")
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
#define AUTHORS proper_name ("David MacKenzie")
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
@@ -99,14 +96,14 @@ main (int argc, char **argv)
|
||||
char *name;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
|
||||
usage (EXIT_FAILURE);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--- src/remove.c 2007-07-23 12:56:20.000000000 +0200
|
||||
+++ src/remove.c 2007-07-23 13:03:12.000000000 +0200
|
||||
@@ -264,9 +264,10 @@ pop_dir (Dirstack_state *ds)
|
||||
diff -upr src/remove.c src/remove.c
|
||||
--- src/remove.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/remove.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -262,9 +262,10 @@ pop_dir (Dirstack_state *ds)
|
||||
{
|
||||
size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
|
||||
size_t *length = obstack_base (&ds->len_stack);
|
||||
@@ -12,7 +13,7 @@
|
||||
assert (top_len >= 2);
|
||||
|
||||
/* Pop the specified length of file name. */
|
||||
@@ -424,10 +425,11 @@ AD_stack_top (Dirstack_state const *ds)
|
||||
@@ -422,10 +423,11 @@ AD_stack_top (Dirstack_state const *ds)
|
||||
static void
|
||||
AD_stack_pop (Dirstack_state *ds)
|
||||
{
|
||||
@@ -25,7 +26,7 @@
|
||||
if (top->unremovable)
|
||||
hash_free (top->unremovable);
|
||||
obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
|
||||
@@ -836,14 +838,13 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
@@ -834,14 +836,13 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
{
|
||||
int write_protected = 0;
|
||||
int dirent_type = *pdirent_type;
|
||||
@@ -41,7 +42,7 @@
|
||||
if (!x->ignore_missing_files
|
||||
&& ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
|
||||
&& dirent_type != DT_LNK)
|
||||
@@ -891,6 +892,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
@@ -889,6 +890,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -49,7 +50,7 @@
|
||||
char const *quoted_name = quote (full_filename (filename));
|
||||
|
||||
if (write_protected < 0)
|
||||
@@ -930,6 +932,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
@@ -928,6 +930,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
: _("%s: remove %s %s? ")),
|
||||
program_name, file_type (sbuf), quoted_name);
|
||||
}
|
||||
@@ -57,7 +58,7 @@
|
||||
|
||||
if (!yesno ())
|
||||
return RM_USER_DECLINED;
|
||||
@@ -1549,6 +1552,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
@@ -1547,6 +1550,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
return RM_ERROR;
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@
|
||||
struct stat st;
|
||||
cache_stat_init (&st);
|
||||
cycle_check_init (&ds->cycle_check_state);
|
||||
@@ -1571,6 +1575,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
@@ -1569,6 +1573,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
AD_push_initial (ds);
|
||||
AD_INIT_OTHER_MEMBERS ();
|
||||
|
||||
@@ -73,7 +74,7 @@
|
||||
enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
|
||||
DT_UNKNOWN, &st, x);
|
||||
if (status == RM_NONEMPTY_DIR)
|
||||
@@ -1589,6 +1594,8 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
@@ -1587,6 +1592,8 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
ds_clear (ds);
|
||||
return status;
|
||||
}
|
||||
@@ -83,9 +84,9 @@
|
||||
/* Remove all files and/or directories specified by N_FILES and FILE.
|
||||
Apply the options in X. */
|
||||
diff -upr src/rm.c src/rm.c
|
||||
--- src/rm.c 2007-07-23 12:56:20.000000000 +0200
|
||||
+++ src/rm.c 2007-07-23 13:03:12.000000000 +0200
|
||||
@@ -357,6 +357,7 @@ main (int argc, char **argv)
|
||||
--- src/rm.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/rm.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -354,6 +354,7 @@ main (int argc, char **argv)
|
||||
quote ("/"));
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ diff -upr src/rm.c src/rm.c
|
||||
size_t n_files = argc - optind;
|
||||
char const *const *file = (char const *const *) argv + optind;
|
||||
|
||||
@@ -370,7 +371,10 @@ main (int argc, char **argv)
|
||||
@@ -367,7 +368,10 @@ main (int argc, char **argv)
|
||||
if (!yesno ())
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
@@ -105,9 +106,9 @@ diff -upr src/rm.c src/rm.c
|
||||
+ }
|
||||
}
|
||||
diff -upr src/seq.c src/seq.c
|
||||
--- src/seq.c 2008-04-14 11:17:15.000000000 +0200
|
||||
+++ src/seq.c 2008-04-14 11:26:57.000000000 +0200
|
||||
@@ -166,6 +166,7 @@ scan_arg (const char *arg)
|
||||
--- src/seq.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/seq.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -163,6 +163,7 @@ scan_arg (const char *arg)
|
||||
: (decimal_point == arg /* .# -> 0.# */
|
||||
|| ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
|
||||
}
|
||||
@@ -115,7 +116,7 @@ diff -upr src/seq.c src/seq.c
|
||||
char const *e = strchr (arg, 'e');
|
||||
if (! e)
|
||||
e = strchr (arg, 'E');
|
||||
@@ -174,6 +175,7 @@ scan_arg (const char *arg)
|
||||
@@ -171,6 +172,7 @@ scan_arg (const char *arg)
|
||||
long exponent = strtol (e + 1, NULL, 10);
|
||||
ret.precision += exponent < 0 ? -exponent : 0;
|
||||
}
|
||||
@@ -123,7 +124,7 @@ diff -upr src/seq.c src/seq.c
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -349,6 +351,7 @@ get_default_format (operand first, opera
|
||||
@@ -346,6 +348,7 @@ get_default_format (operand first, opera
|
||||
size_t last_width = last.width + (prec - last.precision);
|
||||
if (last.precision && prec == 0)
|
||||
last_width--; /* don't include space for '.' */
|
||||
@@ -131,7 +132,7 @@ diff -upr src/seq.c src/seq.c
|
||||
size_t width = MAX (first_width, last_width);
|
||||
if (width <= INT_MAX)
|
||||
{
|
||||
@@ -356,6 +359,7 @@ get_default_format (operand first, opera
|
||||
@@ -353,6 +356,7 @@ get_default_format (operand first, opera
|
||||
sprintf (format_buf, "%%0%d.%dLf", w, prec);
|
||||
return format_buf;
|
||||
}
|
||||
@@ -139,7 +140,7 @@ diff -upr src/seq.c src/seq.c
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -444,6 +448,7 @@ main (int argc, char **argv)
|
||||
@@ -441,6 +445,7 @@ main (int argc, char **argv)
|
||||
if (format_str)
|
||||
{
|
||||
validate_format (format_str);
|
||||
@@ -147,7 +148,7 @@ diff -upr src/seq.c src/seq.c
|
||||
char const *f = long_double_format (format_str, &layout);
|
||||
if (! f)
|
||||
{
|
||||
@@ -451,6 +456,7 @@ main (int argc, char **argv)
|
||||
@@ -448,6 +453,7 @@ main (int argc, char **argv)
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
format_str = f;
|
||||
@@ -156,9 +157,9 @@ diff -upr src/seq.c src/seq.c
|
||||
|
||||
last = scan_arg (argv[optind++]);
|
||||
diff -upr src/shred.c src/shred.c
|
||||
--- src/shred.c 2007-07-23 12:56:20.000000000 +0200
|
||||
+++ src/shred.c 2007-07-23 13:03:12.000000000 +0200
|
||||
@@ -461,7 +461,7 @@ dopass (int fd, char const *qname, off_t
|
||||
--- src/shred.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/shred.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -468,7 +468,7 @@ dopass (int fd, char const *qname, off_t
|
||||
out. Thus, it shouldn't give up on bad blocks. This
|
||||
code works because lim is always a multiple of
|
||||
SECTOR_SIZE, except at the end. */
|
||||
|
||||
26
src/cat.c
26
src/cat.c
@@ -1,5 +1,5 @@
|
||||
/* cat -- concatenate files and print on the standard output.
|
||||
Copyright (C) 88, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 88, 90, 91, 1995-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
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "full-write.h"
|
||||
#include "quote.h"
|
||||
#include "safe-read.h"
|
||||
#include "xfreopen.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "cat"
|
||||
@@ -47,13 +48,6 @@
|
||||
proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \
|
||||
proper_name ("Richard M. Stallman")
|
||||
|
||||
/* Undefine, to avoid warning about redefinition on some systems. */
|
||||
#undef max
|
||||
#define max(h,i) ((h) > (i) ? (h) : (i))
|
||||
|
||||
/* Name under which this program was invoked. */
|
||||
char *program_name;
|
||||
|
||||
/* Name of input file. May be "-". */
|
||||
static char const *infile;
|
||||
|
||||
@@ -93,7 +87,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION] [FILE]...\n\
|
||||
Usage: %s [OPTION]... [FILE]...\n\
|
||||
"),
|
||||
program_name);
|
||||
fputs (_("\
|
||||
@@ -339,7 +333,7 @@ cat (
|
||||
input_pending = true;
|
||||
#endif
|
||||
|
||||
if (input_pending)
|
||||
if (!input_pending)
|
||||
write_pending (outbuf, &bpout);
|
||||
|
||||
/* Read more input into INBUF. */
|
||||
@@ -565,7 +559,7 @@ main (int argc, char **argv)
|
||||
};
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -642,7 +636,7 @@ main (int argc, char **argv)
|
||||
if (fstat (STDOUT_FILENO, &stat_buf) < 0)
|
||||
error (EXIT_FAILURE, errno, _("standard output"));
|
||||
|
||||
outsize = ST_BLKSIZE (stat_buf);
|
||||
outsize = io_blksize (stat_buf);
|
||||
/* Input file can be output file for non-regular files.
|
||||
fstat on pipes returns S_IFSOCK on some systems, S_IFIFO
|
||||
on others, so the checking should not be done for those types,
|
||||
@@ -667,7 +661,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
file_open_mode |= O_BINARY;
|
||||
if (O_BINARY && ! isatty (STDOUT_FILENO))
|
||||
freopen (NULL, "wb", stdout);
|
||||
xfreopen (NULL, "wb", stdout);
|
||||
}
|
||||
|
||||
/* Check if any of the input files are the same as the output file. */
|
||||
@@ -687,7 +681,7 @@ main (int argc, char **argv)
|
||||
have_read_stdin = true;
|
||||
input_desc = STDIN_FILENO;
|
||||
if ((file_open_mode & O_BINARY) && ! isatty (STDIN_FILENO))
|
||||
freopen (NULL, "rb", stdin);
|
||||
xfreopen (NULL, "rb", stdin);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -706,7 +700,7 @@ main (int argc, char **argv)
|
||||
ok = false;
|
||||
goto contin;
|
||||
}
|
||||
insize = ST_BLKSIZE (stat_buf);
|
||||
insize = io_blksize (stat_buf);
|
||||
|
||||
/* Compare the device and i-node numbers of this input file with
|
||||
the corresponding values of the (output file associated with)
|
||||
@@ -728,7 +722,7 @@ main (int argc, char **argv)
|
||||
if (! (number | show_ends | show_nonprinting
|
||||
| show_tabs | squeeze_blank))
|
||||
{
|
||||
insize = max (insize, outsize);
|
||||
insize = MAX (insize, outsize);
|
||||
inbuf = xmalloc (insize + page_size - 1);
|
||||
|
||||
ok &= simple_cat (ptr_align (inbuf, page_size), insize);
|
||||
|
||||
30
src/chcon.c
30
src/chcon.c
@@ -35,29 +35,6 @@
|
||||
proper_name ("Russell Coker"), \
|
||||
proper_name ("Jim Meyering")
|
||||
|
||||
enum Change_status
|
||||
{
|
||||
CH_NOT_APPLIED,
|
||||
CH_SUCCEEDED,
|
||||
CH_FAILED,
|
||||
CH_NO_CHANGE_REQUESTED
|
||||
};
|
||||
|
||||
enum Verbosity
|
||||
{
|
||||
/* Print a message for each file that is processed. */
|
||||
V_high,
|
||||
|
||||
/* Print a message for each file whose attributes we change. */
|
||||
V_changes_only,
|
||||
|
||||
/* Do not be verbose. This is the default. */
|
||||
V_off
|
||||
};
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* If nonzero, and the systems has support for it, change the context
|
||||
of symbolic links rather than any files they point to. */
|
||||
static bool affect_symlink_referent;
|
||||
@@ -303,7 +280,7 @@ process_file (FTS *fts, FTSENT *ent)
|
||||
if (ok)
|
||||
{
|
||||
if (verbose)
|
||||
printf (_("changing security context of %s"),
|
||||
printf (_("changing security context of %s\n"),
|
||||
quote (file_full_name));
|
||||
|
||||
if (change_file_context (fts->fts_cwd_fd, file) != 0)
|
||||
@@ -372,7 +349,6 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\
|
||||
Change the security context of each FILE to CONTEXT.\n\
|
||||
With --reference, change the security context of each FILE to that of RFILE.\n\
|
||||
\n\
|
||||
-c, --changes like verbose but report only when a change is made\n\
|
||||
-h, --no-dereference affect symbolic links instead of any referenced file\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
@@ -426,14 +402,14 @@ main (int argc, char **argv)
|
||||
int optc;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "HLPRchvu:r:t:l:", long_options, NULL))
|
||||
while ((optc = getopt_long (argc, argv, "HLPRhvu:r:t:l:", long_options, NULL))
|
||||
!= -1)
|
||||
{
|
||||
switch (optc)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* chgrp -- change group ownership of files
|
||||
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-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
|
||||
@@ -42,9 +42,6 @@
|
||||
# define endgrent() ((void) 0)
|
||||
#endif
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* The argument to the --reference option. Use the group ID of this file.
|
||||
This file must exist. */
|
||||
static char *reference_file;
|
||||
@@ -184,7 +181,7 @@ main (int argc, char **argv)
|
||||
int optc;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -305,6 +302,7 @@ main (int argc, char **argv)
|
||||
quote ("/"));
|
||||
}
|
||||
|
||||
bit_flags |= FTS_DEFER_STAT;
|
||||
ok = chown_files (argv + optind, bit_flags,
|
||||
(uid_t) -1, gid,
|
||||
(uid_t) -1, (gid_t) -1, &chopt);
|
||||
|
||||
34
src/chmod.c
34
src/chmod.c
@@ -1,5 +1,5 @@
|
||||
/* chmod -- change permission modes of files
|
||||
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-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
|
||||
@@ -58,9 +58,6 @@ enum Verbosity
|
||||
V_off
|
||||
};
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* The desired change to the mode. */
|
||||
static struct mode_change *change;
|
||||
|
||||
@@ -70,7 +67,7 @@ static mode_t umask_value;
|
||||
/* If true, change the modes of directories recursively. */
|
||||
static bool recurse;
|
||||
|
||||
/* If true, force silence (no error messages). */
|
||||
/* If true, force silence (suppress most of error messages). */
|
||||
static bool force_silent;
|
||||
|
||||
/* If true, diagnose surprises from naive misuses like "chmod -r file".
|
||||
@@ -124,7 +121,7 @@ mode_changed (char const *file, mode_t old_mode, mode_t new_mode)
|
||||
|
||||
if (stat (file, &new_stats) != 0)
|
||||
{
|
||||
if (!force_silent)
|
||||
if (! force_silent)
|
||||
error (0, errno, _("getting new attributes of %s"), quote (file));
|
||||
return false;
|
||||
}
|
||||
@@ -206,24 +203,29 @@ process_file (FTS *fts, FTSENT *ent)
|
||||
fts_set (fts, ent, FTS_AGAIN);
|
||||
return true;
|
||||
}
|
||||
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, ent->fts_errno, _("cannot access %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_ERR:
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_DNR:
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_SLNONE:
|
||||
error (0, 0, _("cannot operate on dangling symlink %s"),
|
||||
quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, 0, _("cannot operate on dangling symlink %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
|
||||
default:
|
||||
@@ -322,7 +324,8 @@ process_files (char **files, int bit_flags)
|
||||
if (errno != 0)
|
||||
{
|
||||
/* FIXME: try to give a better message */
|
||||
error (0, errno, _("fts_read failed"));
|
||||
if (! force_silent)
|
||||
error (0, errno, _("fts_read failed"));
|
||||
ok = false;
|
||||
}
|
||||
break;
|
||||
@@ -394,7 +397,7 @@ main (int argc, char **argv)
|
||||
int c;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -531,7 +534,8 @@ main (int argc, char **argv)
|
||||
root_dev_ino = NULL;
|
||||
}
|
||||
|
||||
ok = process_files (argv + optind, FTS_COMFOLLOW | FTS_PHYSICAL);
|
||||
ok = process_files (argv + optind,
|
||||
FTS_COMFOLLOW | FTS_PHYSICAL | FTS_DEFER_STAT);
|
||||
|
||||
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "system.h"
|
||||
#include "chown-core.h"
|
||||
#include "error.h"
|
||||
#include "inttostr.h"
|
||||
#include "quote.h"
|
||||
#include "root-dev-ino.h"
|
||||
#include "xfts.h"
|
||||
@@ -297,18 +296,22 @@ change_file_owner (FTS *fts, FTSENT *ent,
|
||||
fts_set (fts, ent, FTS_AGAIN);
|
||||
return true;
|
||||
}
|
||||
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, ent->fts_errno, _("cannot access %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_ERR:
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_DNR:
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
@@ -339,8 +342,9 @@ change_file_owner (FTS *fts, FTSENT *ent,
|
||||
{
|
||||
if (fstatat (fts->fts_cwd_fd, file, &stat_buf, 0) != 0)
|
||||
{
|
||||
error (0, errno, _("cannot dereference %s"),
|
||||
quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, errno, _("cannot dereference %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
}
|
||||
|
||||
@@ -493,7 +497,8 @@ chown_files (char **files, int bit_flags,
|
||||
if (errno != 0)
|
||||
{
|
||||
/* FIXME: try to give a better message */
|
||||
error (0, errno, _("fts_read failed"));
|
||||
if (! chopt->force_silent)
|
||||
error (0, errno, _("fts_read failed"));
|
||||
ok = false;
|
||||
}
|
||||
break;
|
||||
|
||||
10
src/chown.c
10
src/chown.c
@@ -1,5 +1,5 @@
|
||||
/* chown -- change user and group ownership of files
|
||||
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-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
|
||||
@@ -47,9 +47,6 @@
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Jim Meyering")
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* The argument to the --reference option. Use the owner and group IDs
|
||||
of this file. This file must exist. */
|
||||
static char *reference_file;
|
||||
@@ -186,7 +183,7 @@ main (int argc, char **argv)
|
||||
int optc;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -315,7 +312,7 @@ main (int argc, char **argv)
|
||||
empty string so that diagnostics say "ownership :GROUP"
|
||||
rather than "group GROUP". */
|
||||
if (!chopt.user_name && chopt.group_name)
|
||||
chopt.user_name = "";
|
||||
chopt.user_name = bad_cast ("");
|
||||
|
||||
optind++;
|
||||
}
|
||||
@@ -329,6 +326,7 @@ main (int argc, char **argv)
|
||||
quote ("/"));
|
||||
}
|
||||
|
||||
bit_flags |= FTS_DEFER_STAT;
|
||||
ok = chown_files (argv + optind, bit_flags,
|
||||
uid, gid,
|
||||
required_uid, required_gid, &chopt);
|
||||
|
||||
18
src/chroot.c
18
src/chroot.c
@@ -1,5 +1,5 @@
|
||||
/* chroot -- run command or shell with special root directory
|
||||
Copyright (C) 95, 96, 1997, 1999-2004, 2007-2008
|
||||
Copyright (C) 95, 96, 1997, 1999-2004, 2007-2009
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -32,9 +32,6 @@
|
||||
|
||||
#define AUTHORS proper_name ("Roland McGrath")
|
||||
|
||||
/* The name this program was run with, for error messages. */
|
||||
char *program_name;
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
@@ -44,7 +41,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s NEWROOT [COMMAND...]\n\
|
||||
Usage: %s NEWROOT [COMMAND [ARG]...]\n\
|
||||
or: %s OPTION\n\
|
||||
"), program_name, program_name);
|
||||
fputs (_("\
|
||||
@@ -66,7 +63,7 @@ int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -74,7 +71,7 @@ main (int argc, char **argv)
|
||||
initialize_exit_failure (EXIT_FAILURE);
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
|
||||
usage (EXIT_FAILURE);
|
||||
@@ -86,7 +83,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (chroot (argv[optind]) != 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot change root directory to %s"), argv[1]);
|
||||
error (EXIT_FAILURE, errno, _("cannot change root directory to %s"),
|
||||
argv[optind]);
|
||||
|
||||
if (chdir ("/"))
|
||||
error (EXIT_FAILURE, errno, _("cannot chdir to root directory"));
|
||||
@@ -96,9 +94,9 @@ main (int argc, char **argv)
|
||||
/* No command. Run an interactive shell. */
|
||||
char *shell = getenv ("SHELL");
|
||||
if (shell == NULL)
|
||||
shell = "/bin/sh";
|
||||
shell = bad_cast ("/bin/sh");
|
||||
argv[0] = shell;
|
||||
argv[1] = "-i";
|
||||
argv[1] = bad_cast ("-i");
|
||||
argv[2] = NULL;
|
||||
}
|
||||
else
|
||||
|
||||
11
src/cksum.c
11
src/cksum.c
@@ -43,6 +43,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include "system.h"
|
||||
#include "xfreopen.h"
|
||||
|
||||
#ifdef CRCTAB
|
||||
|
||||
@@ -108,14 +109,10 @@ main (void)
|
||||
# include <getopt.h>
|
||||
# include "long-options.h"
|
||||
# include "error.h"
|
||||
# include "inttostr.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
# define BUFLEN (1 << 16)
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
static uint_fast32_t const crctab[256] =
|
||||
{
|
||||
0x00000000,
|
||||
@@ -196,7 +193,7 @@ cksum (const char *file, bool print_name)
|
||||
fp = stdin;
|
||||
have_read_stdin = true;
|
||||
if (O_BINARY && ! isatty (STDIN_FILENO))
|
||||
freopen (NULL, "rb", stdin);
|
||||
xfreopen (NULL, "rb", stdin);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -284,14 +281,14 @@ main (int argc, char **argv)
|
||||
bool ok;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
|
||||
usage (EXIT_FAILURE);
|
||||
|
||||
219
src/comm.c
219
src/comm.c
@@ -1,5 +1,5 @@
|
||||
/* comm -- compare two sorted files line by line.
|
||||
Copyright (C) 86, 90, 91, 1995-2005, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 90, 91, 1995-2005, 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
|
||||
@@ -23,25 +23,22 @@
|
||||
#include "system.h"
|
||||
#include "linebuffer.h"
|
||||
#include "error.h"
|
||||
#include "hard-locale.h"
|
||||
#include "quote.h"
|
||||
#include "stdio--.h"
|
||||
#include "memcmp2.h"
|
||||
#include "xmemcoll.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "comm"
|
||||
|
||||
#define AUTHORS \
|
||||
proper_name ("Richard Stallman"), \
|
||||
proper_name ("Richard M. Stallman"), \
|
||||
proper_name ("David MacKenzie")
|
||||
|
||||
/* Undefine, to avoid warning about redefinition on some systems. */
|
||||
#undef min
|
||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* True if the LC_COLLATE locale is hard. */
|
||||
static bool hard_LC_COLLATE;
|
||||
|
||||
@@ -54,8 +51,39 @@ static bool only_file_2;
|
||||
/* If true, print lines that are found in both files. */
|
||||
static bool both;
|
||||
|
||||
/* If nonzero, we have seen at least one unpairable line. */
|
||||
static bool seen_unpairable;
|
||||
|
||||
/* If nonzero, we have warned about disorder in that file. */
|
||||
static bool issued_disorder_warning[2];
|
||||
|
||||
/* If nonzero, check that the input is correctly ordered. */
|
||||
static enum
|
||||
{
|
||||
CHECK_ORDER_DEFAULT,
|
||||
CHECK_ORDER_ENABLED,
|
||||
CHECK_ORDER_DISABLED
|
||||
} check_input_order;
|
||||
|
||||
/* Output columns will be delimited with this string, which may be set
|
||||
on the command-line with --output-delimiter=STR. The default is a
|
||||
single TAB character. */
|
||||
static char const *delimiter;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
CHECK_ORDER_OPTION = CHAR_MAX + 1,
|
||||
NOCHECK_ORDER_OPTION,
|
||||
OUTPUT_DELIMITER_OPTION
|
||||
};
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"check-order", no_argument, NULL, CHECK_ORDER_OPTION},
|
||||
{"nocheck-order", no_argument, NULL, NOCHECK_ORDER_OPTION},
|
||||
{"output-delimiter", required_argument, NULL, OUTPUT_DELIMITER_OPTION},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
@@ -89,6 +117,15 @@ and column three contains lines common to both files.\n\
|
||||
-1 suppress lines unique to FILE1\n\
|
||||
-2 suppress lines unique to FILE2\n\
|
||||
-3 suppress lines that appear in both files\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
\n\
|
||||
--check-order check that the input is correctly sorted, even\n\
|
||||
if all input lines are pairable\n\
|
||||
--nocheck-order do not check that the input is correctly sorted\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
--output-delimiter=STR separate columns with STR\n\
|
||||
"), stdout);
|
||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
||||
@@ -103,7 +140,7 @@ and column three contains lines common to both files.\n\
|
||||
2 for a line only in file 2, 3 for a line in both. */
|
||||
|
||||
static void
|
||||
writeline (const struct linebuffer *line, FILE *stream, int class)
|
||||
writeline (struct linebuffer const *line, FILE *stream, int class)
|
||||
{
|
||||
switch (class)
|
||||
{
|
||||
@@ -115,26 +152,71 @@ writeline (const struct linebuffer *line, FILE *stream, int class)
|
||||
case 2:
|
||||
if (!only_file_2)
|
||||
return;
|
||||
/* Print a TAB if we are printing lines from file 1. */
|
||||
/* Print a delimiter if we are printing lines from file 1. */
|
||||
if (only_file_1)
|
||||
putc ('\t', stream);
|
||||
fputs (delimiter, stream);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (!both)
|
||||
return;
|
||||
/* Print a TAB if we are printing lines from file 1. */
|
||||
/* Print a delimiter if we are printing lines from file 1. */
|
||||
if (only_file_1)
|
||||
putc ('\t', stream);
|
||||
/* Print a TAB if we are printing lines from file 2. */
|
||||
fputs (delimiter, stream);
|
||||
/* Print a delimiter if we are printing lines from file 2. */
|
||||
if (only_file_2)
|
||||
putc ('\t', stream);
|
||||
fputs (delimiter, stream);
|
||||
break;
|
||||
}
|
||||
|
||||
fwrite (line->buffer, sizeof (char), line->length, stream);
|
||||
}
|
||||
|
||||
/* Check that successive input lines PREV and CURRENT from input file
|
||||
WHATFILE are presented in order.
|
||||
|
||||
If the user specified --nocheck-order, the check is not made.
|
||||
If the user specified --check-order, the problem is fatal.
|
||||
Otherwise (the default), the message is simply a warning.
|
||||
|
||||
A message is printed at most once per input file.
|
||||
|
||||
This funtion was copied (nearly) verbatim from `src/join.c'. */
|
||||
|
||||
static void
|
||||
check_order (struct linebuffer const *prev,
|
||||
struct linebuffer const *current,
|
||||
int whatfile)
|
||||
{
|
||||
|
||||
if (check_input_order != CHECK_ORDER_DISABLED
|
||||
&& ((check_input_order == CHECK_ORDER_ENABLED) || seen_unpairable))
|
||||
{
|
||||
if (!issued_disorder_warning[whatfile - 1])
|
||||
{
|
||||
int order;
|
||||
|
||||
if (hard_LC_COLLATE)
|
||||
order = xmemcoll (prev->buffer, prev->length - 1,
|
||||
current->buffer, current->length - 1);
|
||||
else
|
||||
order = memcmp2 (prev->buffer, prev->length - 1,
|
||||
current->buffer, current->length - 1);
|
||||
|
||||
if (0 < order)
|
||||
{
|
||||
error ((check_input_order == CHECK_ORDER_ENABLED
|
||||
? EXIT_FAILURE : 0),
|
||||
0, _("file %d is not in sorted order"), whatfile);
|
||||
|
||||
/* If we get to here, the message was just a warning, but we
|
||||
want only to issue it once. */
|
||||
issued_disorder_warning[whatfile - 1] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Compare INFILES[0] and INFILES[1].
|
||||
If either is "-", use the standard input for that file.
|
||||
Assume that each input file is sorted;
|
||||
@@ -143,28 +225,42 @@ writeline (const struct linebuffer *line, FILE *stream, int class)
|
||||
static void
|
||||
compare_files (char **infiles)
|
||||
{
|
||||
/* For each file, we have one linebuffer in lb1. */
|
||||
struct linebuffer lb1[2];
|
||||
/* For each file, we have four linebuffers in lba. */
|
||||
struct linebuffer lba[2][4];
|
||||
|
||||
/* thisline[i] points to the linebuffer holding the next available line
|
||||
in file i, or is NULL if there are no lines left in that file. */
|
||||
struct linebuffer *thisline[2];
|
||||
|
||||
/* all_line[i][alt[i][0]] also points to the linebuffer holding the
|
||||
current line in file i. We keep two buffers of history around so we
|
||||
can look two lines back when we get to the end of a file. */
|
||||
struct linebuffer *all_line[2][4];
|
||||
|
||||
/* This is used to rotate through the buffers for each input file. */
|
||||
int alt[2][3];
|
||||
|
||||
/* streams[i] holds the input stream for file i. */
|
||||
FILE *streams[2];
|
||||
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
/* Initialize the storage. */
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
initbuffer (&lb1[i]);
|
||||
thisline[i] = &lb1[i];
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
initbuffer (&lba[i][j]);
|
||||
all_line[i][j] = &lba[i][j];
|
||||
}
|
||||
alt[i][0] = 0;
|
||||
alt[i][1] = 0;
|
||||
alt[i][2] = 0;
|
||||
streams[i] = (STREQ (infiles[i], "-") ? stdin : fopen (infiles[i], "r"));
|
||||
if (!streams[i])
|
||||
error (EXIT_FAILURE, errno, "%s", infiles[i]);
|
||||
|
||||
thisline[i] = readlinebuffer (thisline[i], streams[i]);
|
||||
thisline[i] = readlinebuffer (all_line[i][alt[i][0]], streams[i]);
|
||||
if (ferror (streams[i]))
|
||||
error (EXIT_FAILURE, errno, "%s", infiles[i]);
|
||||
}
|
||||
@@ -172,6 +268,7 @@ compare_files (char **infiles)
|
||||
while (thisline[0] || thisline[1])
|
||||
{
|
||||
int order;
|
||||
bool fill_up[2] = { false, false };
|
||||
|
||||
/* Compare the next available lines of the two files. */
|
||||
|
||||
@@ -198,25 +295,47 @@ compare_files (char **infiles)
|
||||
/* Output the line that is lesser. */
|
||||
if (order == 0)
|
||||
writeline (thisline[1], stdout, 3);
|
||||
else if (order > 0)
|
||||
writeline (thisline[1], stdout, 2);
|
||||
else
|
||||
writeline (thisline[0], stdout, 1);
|
||||
{
|
||||
seen_unpairable = true;
|
||||
if (order <= 0)
|
||||
writeline (thisline[0], stdout, 1);
|
||||
else
|
||||
writeline (thisline[1], stdout, 2);
|
||||
}
|
||||
|
||||
/* Step the file the line came from.
|
||||
If the files match, step both files. */
|
||||
if (order >= 0)
|
||||
{
|
||||
thisline[1] = readlinebuffer (thisline[1], streams[1]);
|
||||
if (ferror (streams[1]))
|
||||
error (EXIT_FAILURE, errno, "%s", infiles[1]);
|
||||
}
|
||||
if (0 <= order)
|
||||
fill_up[1] = true;
|
||||
if (order <= 0)
|
||||
{
|
||||
thisline[0] = readlinebuffer (thisline[0], streams[0]);
|
||||
if (ferror (streams[0]))
|
||||
error (EXIT_FAILURE, errno, "%s", infiles[0]);
|
||||
}
|
||||
fill_up[0] = true;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
if (fill_up[i])
|
||||
{
|
||||
/* Rotate the buffers for this file. */
|
||||
alt[i][2] = alt[i][1];
|
||||
alt[i][1] = alt[i][0];
|
||||
alt[i][0] = (alt[i][0] + 1) & 0x03;
|
||||
|
||||
thisline[i] = readlinebuffer (all_line[i][alt[i][0]], streams[i]);
|
||||
|
||||
if (thisline[i])
|
||||
check_order (all_line[i][alt[i][1]], thisline[i], i + 1);
|
||||
|
||||
/* If this is the end of the file we may need to re-check
|
||||
the order of the previous two lines, since we might have
|
||||
discovered an unpairable match since we checked before. */
|
||||
else if (all_line[i][alt[i][2]]->buffer)
|
||||
check_order (all_line[i][alt[i][2]],
|
||||
all_line[i][alt[i][1]], i + 1);
|
||||
|
||||
if (ferror (streams[i]))
|
||||
error (EXIT_FAILURE, errno, "%s", infiles[i]);
|
||||
|
||||
fill_up[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
@@ -230,7 +349,7 @@ main (int argc, char **argv)
|
||||
int c;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -242,6 +361,10 @@ main (int argc, char **argv)
|
||||
only_file_2 = true;
|
||||
both = true;
|
||||
|
||||
seen_unpairable = false;
|
||||
issued_disorder_warning[0] = issued_disorder_warning[1] = false;
|
||||
check_input_order = CHECK_ORDER_DEFAULT;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "123", long_options, NULL)) != -1)
|
||||
switch (c)
|
||||
{
|
||||
@@ -257,6 +380,25 @@ main (int argc, char **argv)
|
||||
both = false;
|
||||
break;
|
||||
|
||||
case NOCHECK_ORDER_OPTION:
|
||||
check_input_order = CHECK_ORDER_DISABLED;
|
||||
break;
|
||||
|
||||
case CHECK_ORDER_OPTION:
|
||||
check_input_order = CHECK_ORDER_ENABLED;
|
||||
break;
|
||||
|
||||
case OUTPUT_DELIMITER_OPTION:
|
||||
if (delimiter && !STREQ (delimiter, optarg))
|
||||
error (EXIT_FAILURE, 0, _("multiple delimiters specified"));
|
||||
delimiter = optarg;
|
||||
if (!*delimiter)
|
||||
{
|
||||
error (EXIT_FAILURE, 0, _("empty %s not allowed"),
|
||||
quote ("--output-delimiter"));
|
||||
}
|
||||
break;
|
||||
|
||||
case_GETOPT_HELP_CHAR;
|
||||
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -280,7 +422,14 @@ main (int argc, char **argv)
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* The default delimiter is a TAB. */
|
||||
if (!delimiter)
|
||||
delimiter = "\t";
|
||||
|
||||
compare_files (argv + optind);
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
if (issued_disorder_warning[0] || issued_disorder_warning[1])
|
||||
exit (EXIT_FAILURE);
|
||||
else
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
210
src/copy.c
210
src/copy.c
@@ -1,5 +1,5 @@
|
||||
/* copy.c -- core functions for copying files and directories
|
||||
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-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,7 +35,6 @@
|
||||
#include "buffer-lcm.h"
|
||||
#include "copy.h"
|
||||
#include "cp-hash.h"
|
||||
#include "euidaccess.h"
|
||||
#include "error.h"
|
||||
#include "fcntl--.h"
|
||||
#include "file-set.h"
|
||||
@@ -44,7 +43,7 @@
|
||||
#include "full-write.h"
|
||||
#include "hash.h"
|
||||
#include "hash-triple.h"
|
||||
#include "lchmod.h"
|
||||
#include "ignore-value.h"
|
||||
#include "quote.h"
|
||||
#include "same.h"
|
||||
#include "savedir.h"
|
||||
@@ -55,6 +54,13 @@
|
||||
#include "areadlink.h"
|
||||
#include "yesno.h"
|
||||
|
||||
#if USE_XATTR
|
||||
# include <attr/error_context.h>
|
||||
# include <attr/libattr.h>
|
||||
# include <stdarg.h>
|
||||
# include "verror.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FCHOWN
|
||||
# define HAVE_FCHOWN false
|
||||
# define fchown(fd, uid, gid) (-1)
|
||||
@@ -72,7 +78,7 @@ rpl_mkfifo (char const *file, mode_t mode)
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
#define mkfifo rpl_mkfifo
|
||||
# define mkfifo rpl_mkfifo
|
||||
#endif
|
||||
|
||||
#ifndef USE_ACL
|
||||
@@ -98,6 +104,7 @@ static bool copy_internal (char const *src_name, char const *dst_name,
|
||||
struct dir_list *ancestors,
|
||||
const struct cp_options *x,
|
||||
bool command_line_arg,
|
||||
bool *first_dir_created_per_command_line_arg,
|
||||
bool *copy_into_self,
|
||||
bool *rename_succeeded);
|
||||
static bool owner_failure_ok (struct cp_options const *x);
|
||||
@@ -107,9 +114,6 @@ static bool owner_failure_ok (struct cp_options const *x);
|
||||
static char const *top_level_src_name;
|
||||
static char const *top_level_dst_name;
|
||||
|
||||
/* The invocation name of this program. */
|
||||
extern char *program_name;
|
||||
|
||||
/* FIXME: describe */
|
||||
/* FIXME: rewrite this to use a hash table so we avoid the quadratic
|
||||
performance hit that's probably noticeable only on trees deeper
|
||||
@@ -127,18 +131,91 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if USE_XATTR
|
||||
static void
|
||||
copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
|
||||
char const *fmt, ...)
|
||||
{
|
||||
int err = errno;
|
||||
va_list ap;
|
||||
|
||||
/* use verror module to print error message */
|
||||
va_start (ap, fmt);
|
||||
verror (0, err, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static char const *
|
||||
copy_attr_quote (struct error_context *ctx ATTRIBUTE_UNUSED, char const *str)
|
||||
{
|
||||
return quote (str);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_attr_free (struct error_context *ctx ATTRIBUTE_UNUSED,
|
||||
char const *str ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static bool
|
||||
copy_attr_by_fd (char const *src_path, int src_fd,
|
||||
char const *dst_path, int dst_fd, const struct cp_options *x)
|
||||
{
|
||||
struct error_context ctx =
|
||||
{
|
||||
.error = copy_attr_error,
|
||||
.quote = copy_attr_quote,
|
||||
.quote_free = copy_attr_free
|
||||
};
|
||||
return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0,
|
||||
x->reduce_diagnostics ? NULL : &ctx);
|
||||
}
|
||||
|
||||
static bool
|
||||
copy_attr_by_name (char const *src_path, char const *dst_path,
|
||||
const struct cp_options *x)
|
||||
{
|
||||
struct error_context ctx =
|
||||
{
|
||||
.error = copy_attr_error,
|
||||
.quote = copy_attr_quote,
|
||||
.quote_free = copy_attr_free
|
||||
};
|
||||
return 0 == attr_copy_file (src_path, dst_path, 0,
|
||||
x-> reduce_diagnostics ? NULL :&ctx);
|
||||
}
|
||||
#else /* USE_XATTR */
|
||||
|
||||
static bool
|
||||
copy_attr_by_fd (char const *src_path, int src_fd,
|
||||
char const *dst_path, int dst_fd, const struct cp_options *x)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
copy_attr_by_name (char const *src_path, char const *dst_path,
|
||||
const struct cp_options *x)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif /* USE_XATTR */
|
||||
|
||||
/* Read the contents of the directory SRC_NAME_IN, and recursively
|
||||
copy the contents to DST_NAME_IN. NEW_DST is true if
|
||||
DST_NAME_IN is a directory that was created previously in the
|
||||
recursion. SRC_SB and ANCESTORS describe SRC_NAME_IN.
|
||||
Set *COPY_INTO_SELF if SRC_NAME_IN is a parent of
|
||||
FIRST_DIR_CREATED_PER_COMMAND_LINE_ARG FIXME
|
||||
(or the same as) DST_NAME_IN; otherwise, clear it.
|
||||
Return true if successful. */
|
||||
|
||||
static bool
|
||||
copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst,
|
||||
const struct stat *src_sb, struct dir_list *ancestors,
|
||||
const struct cp_options *x, bool *copy_into_self)
|
||||
const struct cp_options *x,
|
||||
bool *first_dir_created_per_command_line_arg,
|
||||
bool *copy_into_self)
|
||||
{
|
||||
char *name_space;
|
||||
char *namep;
|
||||
@@ -168,12 +245,19 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst,
|
||||
|
||||
ok &= copy_internal (src_name, dst_name, new_dst, src_sb->st_dev,
|
||||
ancestors, &non_command_line_options, false,
|
||||
first_dir_created_per_command_line_arg,
|
||||
&local_copy_into_self, NULL);
|
||||
*copy_into_self |= local_copy_into_self;
|
||||
|
||||
free (dst_name);
|
||||
free (src_name);
|
||||
|
||||
/* If we're copying into self, there's no point in continuing,
|
||||
and in fact, that would even infloop, now that we record only
|
||||
the first created directory per command line argument. */
|
||||
if (local_copy_into_self)
|
||||
break;
|
||||
|
||||
namep += strlen (namep) + 1;
|
||||
}
|
||||
free (name_space);
|
||||
@@ -206,7 +290,7 @@ set_owner (const struct cp_options *x, char const *dst_name, int dest_desc,
|
||||
group. Avoid the window by first changing to a restrictive
|
||||
temporary mode if necessary. */
|
||||
|
||||
if (!new_dst & (x->preserve_mode | x->move_mode | x->set_mode))
|
||||
if (!new_dst && (x->preserve_mode | x->move_mode | x->set_mode))
|
||||
{
|
||||
mode_t old_mode = dst_sb->st_mode;
|
||||
mode_t new_mode =
|
||||
@@ -233,7 +317,7 @@ set_owner (const struct cp_options *x, char const *dst_name, int dest_desc,
|
||||
/* We've failed to set *both*. Now, try to set just the group
|
||||
ID, but ignore any failure here, and don't change errno. */
|
||||
int saved_errno = errno;
|
||||
(void) fchown (dest_desc, -1, gid);
|
||||
ignore_value (fchown (dest_desc, -1, gid));
|
||||
errno = saved_errno;
|
||||
}
|
||||
}
|
||||
@@ -246,7 +330,7 @@ set_owner (const struct cp_options *x, char const *dst_name, int dest_desc,
|
||||
/* We've failed to set *both*. Now, try to set just the group
|
||||
ID, but ignore any failure here, and don't change errno. */
|
||||
int saved_errno = errno;
|
||||
(void) lchown (dst_name, -1, gid);
|
||||
ignore_value (lchown (dst_name, -1, gid));
|
||||
errno = saved_errno;
|
||||
}
|
||||
}
|
||||
@@ -381,7 +465,8 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
security_context_t con = NULL;
|
||||
if (getfscreatecon (&con) < 0)
|
||||
{
|
||||
error (0, errno, _("failed to get file system create context"));
|
||||
if (!x->reduce_diagnostics)
|
||||
error (0, errno, _("failed to get file system create context"));
|
||||
if (x->require_preserve_context)
|
||||
{
|
||||
return_val = false;
|
||||
@@ -393,9 +478,10 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
{
|
||||
if (fsetfilecon (dest_desc, con) < 0)
|
||||
{
|
||||
error (0, errno,
|
||||
_("failed to set the security context of %s to %s"),
|
||||
quote_n (0, dst_name), quote_n (1, con));
|
||||
if (!x->reduce_diagnostics)
|
||||
error (0, errno,
|
||||
_("failed to set the security context of %s to %s"),
|
||||
quote_n (0, dst_name), quote_n (1, con));
|
||||
if (x->require_preserve_context)
|
||||
{
|
||||
return_val = false;
|
||||
@@ -403,7 +489,7 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
goto close_src_and_dst_desc;
|
||||
}
|
||||
}
|
||||
freecon(con);
|
||||
freecon (con);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +512,7 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
if (*new_dst)
|
||||
{
|
||||
int open_flags = O_WRONLY | O_CREAT | O_BINARY;
|
||||
dest_desc = open (dst_name, open_flags | O_EXCL ,
|
||||
dest_desc = open (dst_name, open_flags | O_EXCL,
|
||||
dst_mode & ~omitted_permissions);
|
||||
dest_errno = errno;
|
||||
|
||||
@@ -486,7 +572,7 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
/* Choose a suitable buffer size; it may be adjusted later. */
|
||||
size_t buf_alignment = lcm (getpagesize (), sizeof (word));
|
||||
size_t buf_alignment_slop = sizeof (word) + buf_alignment - 1;
|
||||
size_t buf_size = ST_BLKSIZE (sb);
|
||||
size_t buf_size = io_blksize (sb);
|
||||
|
||||
/* Deal with sparse files. */
|
||||
bool last_write_made_hole = false;
|
||||
@@ -514,21 +600,12 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
buffer size. */
|
||||
if (! make_holes)
|
||||
{
|
||||
/* These days there's no point ever messing with buffers smaller
|
||||
than 8 KiB. It would be nice to configure SMALL_BUF_SIZE
|
||||
dynamically for this host and pair of files, but there doesn't
|
||||
seem to be a good way to get readahead info portably. */
|
||||
enum { SMALL_BUF_SIZE = 8 * 1024 };
|
||||
|
||||
/* Compute the least common multiple of the input and output
|
||||
buffer sizes, adjusting for outlandish values. */
|
||||
size_t blcm_max = MIN (SIZE_MAX, SSIZE_MAX) - buf_alignment_slop;
|
||||
size_t blcm = buffer_lcm (ST_BLKSIZE (src_open_sb), buf_size,
|
||||
size_t blcm = buffer_lcm (io_blksize (src_open_sb), buf_size,
|
||||
blcm_max);
|
||||
|
||||
/* Do not use a block size that is too small. */
|
||||
buf_size = MAX (SMALL_BUF_SIZE, blcm);
|
||||
|
||||
/* Do not bother with a buffer larger than the input file, plus one
|
||||
byte to make sure the file has not grown while reading it. */
|
||||
if (S_ISREG (src_open_sb.st_mode) && src_open_sb.st_size < buf_size)
|
||||
@@ -685,6 +762,11 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
|
||||
set_author (dst_name, dest_desc, src_sb);
|
||||
|
||||
if (x->preserve_xattr && ! copy_attr_by_fd (src_name, source_desc,
|
||||
dst_name, dest_desc, x)
|
||||
&& x->require_preserve_xattr)
|
||||
return false;
|
||||
|
||||
if (x->preserve_mode || x->move_mode)
|
||||
{
|
||||
if (copy_acl (src_name, source_desc, dst_name, dest_desc, src_mode) != 0
|
||||
@@ -1049,6 +1131,7 @@ restore_default_fscreatecon_or_die (void)
|
||||
not known. ANCESTORS points to a linked, null terminated list of
|
||||
devices and inodes of parent directories of SRC_NAME. COMMAND_LINE_ARG
|
||||
is true iff SRC_NAME was specified on the command line.
|
||||
FIRST_DIR_CREATED_PER_COMMAND_LINE_ARG is both input and output.
|
||||
Set *COPY_INTO_SELF if SRC_NAME is a parent of (or the
|
||||
same as) DST_NAME; otherwise, clear it.
|
||||
Return true if successful. */
|
||||
@@ -1059,6 +1142,7 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
struct dir_list *ancestors,
|
||||
const struct cp_options *x,
|
||||
bool command_line_arg,
|
||||
bool *first_dir_created_per_command_line_arg,
|
||||
bool *copy_into_self,
|
||||
bool *rename_succeeded)
|
||||
{
|
||||
@@ -1415,6 +1499,10 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
we can arrange to create a hard link between the corresponding names
|
||||
in the destination tree.
|
||||
|
||||
When using the --link (-l) option, there is no need to take special
|
||||
measures, because (barring race conditions) files that are hard-linked
|
||||
in the source tree will also be hard-linked in the destination tree.
|
||||
|
||||
Sometimes, when preserving links, we have to record dev/ino even
|
||||
though st_nlink == 1:
|
||||
- when in move_mode, since we may be moving a group of N hard-linked
|
||||
@@ -1433,27 +1521,29 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
- likewise for -L except that it applies to all files, not just
|
||||
command line arguments.
|
||||
|
||||
Also record directory dev/ino when using --recursive. We'll use that
|
||||
info to detect this problem: cp -R dir dir. FIXME-maybe: ideally,
|
||||
directory info would be recorded in a separate hash table, since
|
||||
such entries are useful only while a single command line hierarchy
|
||||
is being copied -- so that separate table could be cleared between
|
||||
command line args. Using the same hash table to preserve hard
|
||||
links means that it may not be cleared. */
|
||||
Also, with --recursive, record dev/ino of each command-line directory.
|
||||
We'll use that info to detect this problem: cp -R dir dir. */
|
||||
|
||||
if (x->move_mode && src_sb.st_nlink == 1)
|
||||
{
|
||||
earlier_file = src_to_dest_lookup (src_sb.st_ino, src_sb.st_dev);
|
||||
}
|
||||
else if ((x->preserve_links
|
||||
&& (1 < src_sb.st_nlink
|
||||
|| (command_line_arg
|
||||
&& x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)
|
||||
|| x->dereference == DEREF_ALWAYS))
|
||||
|| (x->recursive && S_ISDIR (src_mode)))
|
||||
else if (x->preserve_links
|
||||
&& !x->hard_link
|
||||
&& (1 < src_sb.st_nlink
|
||||
|| (command_line_arg
|
||||
&& x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)
|
||||
|| x->dereference == DEREF_ALWAYS))
|
||||
{
|
||||
earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev);
|
||||
}
|
||||
else if (x->recursive && S_ISDIR (src_mode))
|
||||
{
|
||||
if (command_line_arg)
|
||||
earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev);
|
||||
else
|
||||
earlier_file = src_to_dest_lookup (src_sb.st_ino, src_sb.st_dev);
|
||||
}
|
||||
|
||||
/* Did we copy this inode somewhere else (in this command line argument)
|
||||
and therefore this is a second hard link to the inode? */
|
||||
@@ -1641,9 +1731,10 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
{
|
||||
if (setfscreatecon (con) < 0)
|
||||
{
|
||||
error (0, errno,
|
||||
_("failed to set default file creation context to %s"),
|
||||
quote (con));
|
||||
if (!x->reduce_diagnostics)
|
||||
error (0, errno,
|
||||
_("failed to set default file creation context to %s"),
|
||||
quote (con));
|
||||
if (x->require_preserve_context)
|
||||
{
|
||||
freecon (con);
|
||||
@@ -1656,9 +1747,10 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
{
|
||||
if (errno != ENOTSUP && errno != ENODATA)
|
||||
{
|
||||
error (0, errno,
|
||||
_("failed to get security context of %s"),
|
||||
quote (src_name));
|
||||
if (!x->reduce_diagnostics)
|
||||
error (0, errno,
|
||||
_("failed to get security context of %s"),
|
||||
quote (src_name));
|
||||
if (x->require_preserve_context)
|
||||
return false;
|
||||
}
|
||||
@@ -1731,11 +1823,15 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert the created directory's inode and device
|
||||
numbers into the search structure, so that we can
|
||||
avoid copying it again. */
|
||||
|
||||
remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);
|
||||
/* Record the created directory's inode and device numbers into
|
||||
the search structure, so that we can avoid copying it again.
|
||||
Do this only for the first directory that is created for each
|
||||
source command line argument. */
|
||||
if (!*first_dir_created_per_command_line_arg)
|
||||
{
|
||||
remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);
|
||||
*first_dir_created_per_command_line_arg = true;
|
||||
}
|
||||
|
||||
if (x->verbose)
|
||||
emit_verbose (src_name, dst_name, NULL);
|
||||
@@ -1754,6 +1850,7 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
in a source directory would cause the containing destination
|
||||
directory not to have owner/perms set properly. */
|
||||
delayed_ok = copy_dir (src_name, dst_name, new_dst, &src_sb, dir, x,
|
||||
first_dir_created_per_command_line_arg,
|
||||
copy_into_self);
|
||||
}
|
||||
}
|
||||
@@ -1983,6 +2080,10 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
|
||||
set_author (dst_name, -1, &src_sb);
|
||||
|
||||
if (x->preserve_xattr && ! copy_attr_by_name (src_name, dst_name, x)
|
||||
&& x->require_preserve_xattr)
|
||||
return false;
|
||||
|
||||
if (x->preserve_mode || x->move_mode)
|
||||
{
|
||||
if (copy_acl (src_name, -1, dst_name, -1, src_mode) != 0
|
||||
@@ -2097,8 +2198,11 @@ copy (char const *src_name, char const *dst_name,
|
||||
top_level_src_name = src_name;
|
||||
top_level_dst_name = dst_name;
|
||||
|
||||
bool first_dir_created_per_command_line_arg = false;
|
||||
return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL,
|
||||
options, true, copy_into_self, rename_succeeded);
|
||||
options, true,
|
||||
&first_dir_created_per_command_line_arg,
|
||||
copy_into_self, rename_succeeded);
|
||||
}
|
||||
|
||||
/* Set *X to the default options for a value of type struct cp_options. */
|
||||
|
||||
22
src/copy.h
22
src/copy.h
@@ -1,5 +1,5 @@
|
||||
/* core functions for copying files and directories
|
||||
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-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,7 +21,6 @@
|
||||
|
||||
# include <stdbool.h>
|
||||
# include "hash.h"
|
||||
# include "lstat.h"
|
||||
|
||||
/* Control creation of sparse files (files with holes). */
|
||||
enum Sparse_type
|
||||
@@ -174,6 +173,25 @@ struct cp_options
|
||||
fail if it is unable to do so. */
|
||||
bool require_preserve_context;
|
||||
|
||||
/* If true, attempt to preserve extended attributes using libattr.
|
||||
Ignored if coreutils are compiled without xattr support. */
|
||||
bool preserve_xattr;
|
||||
|
||||
/* Useful only when preserve_xattr is true.
|
||||
If true, a failed attempt to preserve file's extended attributes
|
||||
propagates failure "out" to the caller. If false, a failure to
|
||||
preserve file's extended attributes does not change the invoking
|
||||
application's exit status. Give diagnostics for failed syscalls
|
||||
regardless of this setting. For example, with "cp --preserve=xattr"
|
||||
this flag is "true", while with "cp --preserve=all", it is false. */
|
||||
bool require_preserve_xattr;
|
||||
|
||||
/* Used as difference boolean between cp -a and cp -dR --preserve=all.
|
||||
If true, non-mandatory failure diagnostics are not displayed. This
|
||||
should prevent poluting cp -a output.
|
||||
*/
|
||||
bool reduce_diagnostics;
|
||||
|
||||
/* If true, copy directories recursively and copy special files
|
||||
as themselves rather than copying their contents. */
|
||||
bool recursive;
|
||||
|
||||
@@ -19,14 +19,11 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "same.h"
|
||||
#include "quote.h"
|
||||
#include "hash.h"
|
||||
#include "error.h"
|
||||
#include "cp-hash.h"
|
||||
|
||||
/* Use ST_DEV and ST_INO as the key, FILENAME as the value.
|
||||
@@ -97,24 +94,6 @@ forget_created (ino_t ino, dev_t dev)
|
||||
src_to_dest_free (ent);
|
||||
}
|
||||
|
||||
/* Add FILE to the list of files that we have created.
|
||||
Return true if successful. */
|
||||
|
||||
extern bool
|
||||
remember_created (char const *file)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
if (stat (file, &sb) < 0)
|
||||
{
|
||||
error (0, errno, "%s", quote (file));
|
||||
return false;
|
||||
}
|
||||
|
||||
remember_copied (file, sb.st_ino, sb.st_dev);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* If INO/DEV correspond to an already-copied source file, return the
|
||||
name of the corresponding destination file. Otherwise, return NULL. */
|
||||
|
||||
|
||||
@@ -2,5 +2,4 @@ void hash_init (void);
|
||||
void forget_all (void);
|
||||
void forget_created (ino_t ino, dev_t dev);
|
||||
char *remember_copied (const char *node, ino_t ino, dev_t dev);
|
||||
bool remember_created (char const *file);
|
||||
char *src_to_dest_lookup (ino_t ino, dev_t dev);
|
||||
|
||||
97
src/cp.c
97
src/cp.c
@@ -1,5 +1,5 @@
|
||||
/* cp.c -- file copying (main routines)
|
||||
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-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
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "cp-hash.h"
|
||||
#include "error.h"
|
||||
#include "filenamecat.h"
|
||||
#include "lchmod.h"
|
||||
#include "ignore-value.h"
|
||||
#include "quote.h"
|
||||
#include "stat-time.h"
|
||||
#include "utimens.h"
|
||||
@@ -76,21 +76,11 @@ enum
|
||||
NO_PRESERVE_ATTRIBUTES_OPTION,
|
||||
PARENTS_OPTION,
|
||||
PRESERVE_ATTRIBUTES_OPTION,
|
||||
REPLY_OPTION,
|
||||
SPARSE_OPTION,
|
||||
STRIP_TRAILING_SLASHES_OPTION,
|
||||
UNLINK_DEST_BEFORE_OPENING
|
||||
};
|
||||
|
||||
/* Initial number of entries in each hash table entry's table of inodes. */
|
||||
#define INITIAL_HASH_MODULE 100
|
||||
|
||||
/* Initial number of entries in the inode hash table. */
|
||||
#define INITIAL_ENTRY_TAB_SIZE 70
|
||||
|
||||
/* The invocation name of this program. */
|
||||
char *program_name;
|
||||
|
||||
/* True if the kernel is SELinux enabled. */
|
||||
static bool selinux_enabled;
|
||||
|
||||
@@ -111,18 +101,6 @@ static enum Sparse_type const sparse_type[] =
|
||||
};
|
||||
ARGMATCH_VERIFY (sparse_type_string, sparse_type);
|
||||
|
||||
/* Valid arguments to the `--reply' option. */
|
||||
static char const* const reply_args[] =
|
||||
{
|
||||
"yes", "no", "query", NULL
|
||||
};
|
||||
/* The values that correspond to the above strings. */
|
||||
static int const reply_vals[] =
|
||||
{
|
||||
I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER
|
||||
};
|
||||
ARGMATCH_VERIFY (reply_args, reply_vals);
|
||||
|
||||
static struct option const long_opts[] =
|
||||
{
|
||||
{"archive", no_argument, NULL, 'a'},
|
||||
@@ -132,6 +110,7 @@ static struct option const long_opts[] =
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"link", no_argument, NULL, 'l'},
|
||||
{"no-clobber", no_argument, NULL, 'n'},
|
||||
{"no-dereference", no_argument, NULL, 'P'},
|
||||
{"no-preserve", required_argument, NULL, NO_PRESERVE_ATTRIBUTES_OPTION},
|
||||
{"no-target-directory", no_argument, NULL, 'T'},
|
||||
@@ -141,8 +120,6 @@ static struct option const long_opts[] =
|
||||
{"preserve", optional_argument, NULL, PRESERVE_ATTRIBUTES_OPTION},
|
||||
{"recursive", no_argument, NULL, 'R'},
|
||||
{"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING},
|
||||
{"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03,
|
||||
remove in 2008. */
|
||||
{"sparse", required_argument, NULL, SPARSE_OPTION},
|
||||
{"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
|
||||
{"suffix", required_argument, NULL, 'S'},
|
||||
@@ -177,7 +154,7 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-a, --archive same as -dpR\n\
|
||||
-a, --archive same as -dR --preserve=all\n\
|
||||
--backup[=CONTROL] make a backup of each existing destination file\n\
|
||||
-b like --backup but does not accept an argument\n\
|
||||
--copy-contents copy contents of special files when recursive\n\
|
||||
@@ -185,8 +162,10 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-f, --force if an existing destination file cannot be\n\
|
||||
opened, remove it and try again\n\
|
||||
-i, --interactive prompt before overwrite\n\
|
||||
opened, remove it and try again (redundant if\n\
|
||||
the -n option is used)\n\
|
||||
-i, --interactive prompt before overwrite (overrides a previous -n\n\
|
||||
option)\n\
|
||||
-H follow command-line symbolic links in SOURCE\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
@@ -194,13 +173,16 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
-L, --dereference always follow symbolic links in SOURCE\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-n, --no-clobber do not overwrite an existing file (overrides\n\
|
||||
a previous -i option)\n\
|
||||
-P, --no-dereference never follow symbolic links in SOURCE\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-p same as --preserve=mode,ownership,timestamps\n\
|
||||
--preserve[=ATTR_LIST] preserve the specified attributes (default:\n\
|
||||
mode,ownership,timestamps), if possible\n\
|
||||
additional attributes: context, links, all\n\
|
||||
additional attributes: context, links, xattr,\n\
|
||||
all\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
|
||||
@@ -238,9 +220,9 @@ corresponding DEST file is made sparse as well. That is the behavior\n\
|
||||
selected by --sparse=auto. Specify --sparse=always to create a sparse DEST\n\
|
||||
file whenever the SOURCE file contains a long enough sequence of zero bytes.\n\
|
||||
Use --sparse=never to inhibit creation of sparse files.\n\
|
||||
\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
\n\
|
||||
The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n\
|
||||
The version control method may be selected via the --backup option or through\n\
|
||||
the VERSION_CONTROL environment variable. Here are the values:\n\
|
||||
@@ -329,7 +311,7 @@ re_protect (char const *const_dst_name, size_t src_offset,
|
||||
}
|
||||
/* Failing to preserve ownership is OK. Still, try to preserve
|
||||
the group, but ignore the possible error. */
|
||||
(void) lchown (dst_name, -1, p->st.st_gid);
|
||||
ignore_value (lchown (dst_name, -1, p->st.st_gid));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +577,7 @@ do_copy (int n_files, char **file, const char *target_directory,
|
||||
{
|
||||
if (target_directory)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("Cannot combine --target-directory (-t) "
|
||||
_("cannot combine --target-directory (-t) "
|
||||
"and --no-target-directory (-T)"));
|
||||
if (2 < n_files)
|
||||
{
|
||||
@@ -777,6 +759,9 @@ cp_option_init (struct cp_options *x)
|
||||
x->preserve_timestamps = false;
|
||||
x->preserve_security_context = false;
|
||||
x->require_preserve_context = false;
|
||||
x->preserve_xattr = false;
|
||||
x->reduce_diagnostics = false;
|
||||
x->require_preserve_xattr = false;
|
||||
|
||||
x->require_preserve = false;
|
||||
x->recursive = false;
|
||||
@@ -813,18 +798,20 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off)
|
||||
PRESERVE_OWNERSHIP,
|
||||
PRESERVE_LINK,
|
||||
PRESERVE_CONTEXT,
|
||||
PRESERVE_XATTR,
|
||||
PRESERVE_ALL
|
||||
};
|
||||
static enum File_attribute const preserve_vals[] =
|
||||
{
|
||||
PRESERVE_MODE, PRESERVE_TIMESTAMPS,
|
||||
PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_CONTEXT, PRESERVE_ALL
|
||||
PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_CONTEXT, PRESERVE_XATTR,
|
||||
PRESERVE_ALL
|
||||
};
|
||||
/* Valid arguments to the `--preserve' option. */
|
||||
static char const* const preserve_args[] =
|
||||
{
|
||||
"mode", "timestamps",
|
||||
"ownership", "links", "context", "all", NULL
|
||||
"ownership", "links", "context", "xattr", "all", NULL
|
||||
};
|
||||
ARGMATCH_VERIFY (preserve_args, preserve_vals);
|
||||
|
||||
@@ -865,6 +852,11 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off)
|
||||
x->require_preserve_context = on_off;
|
||||
break;
|
||||
|
||||
case PRESERVE_XATTR:
|
||||
x->preserve_xattr = on_off;
|
||||
x->require_preserve_xattr = on_off;
|
||||
break;
|
||||
|
||||
case PRESERVE_ALL:
|
||||
x->preserve_mode = on_off;
|
||||
x->preserve_timestamps = on_off;
|
||||
@@ -872,6 +864,7 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off)
|
||||
x->preserve_links = on_off;
|
||||
if (selinux_enabled)
|
||||
x->preserve_security_context = on_off;
|
||||
x->preserve_xattr = on_off;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -898,7 +891,7 @@ main (int argc, char **argv)
|
||||
bool no_target_directory = false;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -912,7 +905,7 @@ main (int argc, char **argv)
|
||||
we'll actually use backup_suffix_string. */
|
||||
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
|
||||
|
||||
while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T",
|
||||
while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:T",
|
||||
long_opts, NULL))
|
||||
!= -1)
|
||||
{
|
||||
@@ -923,13 +916,17 @@ main (int argc, char **argv)
|
||||
sparse_type_string, sparse_type);
|
||||
break;
|
||||
|
||||
case 'a': /* Like -dpPR. */
|
||||
case 'a': /* Like -dR --preserve=all with reduced failure diagnostics. */
|
||||
x.dereference = DEREF_NEVER;
|
||||
x.preserve_links = true;
|
||||
x.preserve_ownership = true;
|
||||
x.preserve_mode = true;
|
||||
x.preserve_timestamps = true;
|
||||
x.require_preserve = true;
|
||||
if (selinux_enabled)
|
||||
x.preserve_security_context = true;
|
||||
x.preserve_xattr = true;
|
||||
x.reduce_diagnostics = true;
|
||||
x.recursive = true;
|
||||
break;
|
||||
|
||||
@@ -968,6 +965,10 @@ main (int argc, char **argv)
|
||||
x.dereference = DEREF_ALWAYS;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
x.interactive = I_ALWAYS_NO;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
x.dereference = DEREF_NEVER;
|
||||
break;
|
||||
@@ -1004,13 +1005,6 @@ main (int argc, char **argv)
|
||||
x.recursive = true;
|
||||
break;
|
||||
|
||||
case REPLY_OPTION: /* Deprecated */
|
||||
x.interactive = XARGMATCH ("--reply", optarg,
|
||||
reply_args, reply_vals);
|
||||
error (0, 0,
|
||||
_("the --reply option is deprecated; use -i or -f instead"));
|
||||
break;
|
||||
|
||||
case UNLINK_DEST_BEFORE_OPENING:
|
||||
x.unlink_dest_before_opening = true;
|
||||
break;
|
||||
@@ -1075,6 +1069,13 @@ main (int argc, char **argv)
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (make_backups && x.interactive == I_ALWAYS_NO)
|
||||
{
|
||||
error (0, 0,
|
||||
_("options --backup and --no-clobber are mutually exclusive"));
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (backup_suffix_string)
|
||||
simple_backup_suffix = xstrdup (backup_suffix_string);
|
||||
|
||||
@@ -1108,6 +1109,12 @@ main (int argc, char **argv)
|
||||
"without an SELinux-enabled kernel"));
|
||||
}
|
||||
|
||||
#if !USE_XATTR
|
||||
if (x.require_preserve_xattr)
|
||||
error (EXIT_FAILURE, 0, _("cannot preserve extended attributes, cp is "
|
||||
"built without xattr support"));
|
||||
#endif
|
||||
|
||||
/* Allocate space for remembering copied and created files. */
|
||||
|
||||
hash_init ();
|
||||
|
||||
41
src/csplit.c
41
src/csplit.c
@@ -1,5 +1,5 @@
|
||||
/* csplit - split a file into sections determined by context lines
|
||||
Copyright (C) 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 91, 1995-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
|
||||
@@ -29,23 +29,11 @@
|
||||
|
||||
#include "error.h"
|
||||
#include "fd-reopen.h"
|
||||
#include "inttostr.h"
|
||||
#include "quote.h"
|
||||
#include "safe-read.h"
|
||||
#include "stdio--.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
/* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is
|
||||
present. */
|
||||
#ifndef SA_NOCLDSTOP
|
||||
# define SA_NOCLDSTOP 0
|
||||
# define sigprocmask(How, Set, Oset) /* empty */
|
||||
# define sigset_t int
|
||||
# if ! HAVE_SIGINTERRUPT
|
||||
# define siginterrupt(sig, flag) /* empty */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "csplit"
|
||||
|
||||
@@ -53,9 +41,6 @@
|
||||
proper_name ("Stuart Kemp"), \
|
||||
proper_name ("David MacKenzie")
|
||||
|
||||
/* Increment size of area for control records. */
|
||||
#define ALLOC_SIZE 20
|
||||
|
||||
/* The default prefix for output file names. */
|
||||
#define DEFAULT_PREFIX "xx"
|
||||
|
||||
@@ -128,9 +113,6 @@ static void delete_all_files (bool);
|
||||
static void save_line_to_file (const struct cstring *line);
|
||||
void usage (int status);
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* Start of buffer list. */
|
||||
static struct buffer_record *head = NULL;
|
||||
|
||||
@@ -242,12 +224,10 @@ xalloc_die (void)
|
||||
static void
|
||||
interrupt_handler (int sig)
|
||||
{
|
||||
if (! SA_NOCLDSTOP)
|
||||
signal (sig, SIG_IGN);
|
||||
|
||||
delete_all_files (true);
|
||||
|
||||
signal (sig, SIG_DFL);
|
||||
/* The signal has been reset to SIG_DFL, but blocked during this
|
||||
handler. Force the default action of this signal once the
|
||||
handler returns and the block is removed. */
|
||||
raise (sig);
|
||||
}
|
||||
|
||||
@@ -1330,7 +1310,7 @@ main (int argc, char **argv)
|
||||
unsigned long int val;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -1425,7 +1405,6 @@ main (int argc, char **argv)
|
||||
};
|
||||
enum { nsigs = sizeof sig / sizeof sig[0] };
|
||||
|
||||
#if SA_NOCLDSTOP
|
||||
struct sigaction act;
|
||||
|
||||
sigemptyset (&caught_signals);
|
||||
@@ -1438,19 +1417,11 @@ main (int argc, char **argv)
|
||||
|
||||
act.sa_handler = interrupt_handler;
|
||||
act.sa_mask = caught_signals;
|
||||
act.sa_flags = 0;
|
||||
act.sa_flags = SA_NODEFER | SA_RESETHAND;
|
||||
|
||||
for (i = 0; i < nsigs; i++)
|
||||
if (sigismember (&caught_signals, sig[i]))
|
||||
sigaction (sig[i], &act, NULL);
|
||||
#else
|
||||
for (i = 0; i < nsigs; i++)
|
||||
if (signal (sig[i], SIG_IGN) != SIG_IGN)
|
||||
{
|
||||
signal (sig[i], interrupt_handler);
|
||||
siginterrupt (sig[i], 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
split_file ();
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#define PROGRAM_NAME "cut"
|
||||
|
||||
#define AUTHORS \
|
||||
proper_name ("David Ihnat"), \
|
||||
proper_name ("David M. Ihnat"), \
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Jim Meyering")
|
||||
|
||||
@@ -120,9 +120,6 @@ enum operating_mode
|
||||
field_mode
|
||||
};
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
static enum operating_mode operating_mode;
|
||||
|
||||
/* If true do not output lines containing no delimeter characters.
|
||||
@@ -213,7 +210,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
--complement complement the set of selected bytes, characters\n\
|
||||
or fields.\n\
|
||||
or fields\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-s, --only-delimited do not print lines not containing delimiters\n\
|
||||
@@ -762,7 +759,7 @@ main (int argc, char **argv)
|
||||
char *spec_list_string IF_LINT(= NULL);
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
24
src/date.c
24
src/date.c
@@ -28,7 +28,6 @@
|
||||
#include "argmatch.h"
|
||||
#include "error.h"
|
||||
#include "getdate.h"
|
||||
#include "inttostr.h"
|
||||
#include "posixtm.h"
|
||||
#include "quote.h"
|
||||
#include "stat-time.h"
|
||||
@@ -39,8 +38,6 @@
|
||||
|
||||
#define AUTHORS proper_name ("David MacKenzie")
|
||||
|
||||
int putenv ();
|
||||
|
||||
static bool show_date (const char *format, struct timespec when);
|
||||
|
||||
enum Time_spec
|
||||
@@ -77,9 +74,6 @@ ARGMATCH_VERIFY (time_spec_string, time_spec);
|
||||
/* A format suitable for Internet RFC 2822. */
|
||||
static char const rfc_2822_format[] = "%a, %d %b %Y %H:%M:%S %z";
|
||||
|
||||
/* The name this program was run with, for error messages. */
|
||||
char *program_name;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
@@ -156,8 +150,7 @@ Display the current time in the given FORMAT, or set the system date.\n\
|
||||
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
||||
fputs (_("\
|
||||
\n\
|
||||
FORMAT controls the output. The only valid option for the second form\n\
|
||||
specifies Coordinated Universal Time. Interpreted sequences are:\n\
|
||||
FORMAT controls the output. Interpreted sequences are:\n\
|
||||
\n\
|
||||
%% a literal %\n\
|
||||
%a locale's abbreviated weekday name (e.g., Sun)\n\
|
||||
@@ -169,7 +162,7 @@ specifies Coordinated Universal Time. Interpreted sequences are:\n\
|
||||
%c locale's date and time (e.g., Thu Mar 3 23:05:25 2005)\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
%C century; like %Y, except omit last two digits (e.g., 21)\n\
|
||||
%C century; like %Y, except omit last two digits (e.g., 20)\n\
|
||||
%d day of month (e.g, 01)\n\
|
||||
%D date; same as %m/%d/%y\n\
|
||||
%e day of month, space padded; same as %_d\n\
|
||||
@@ -325,7 +318,7 @@ main (int argc, char **argv)
|
||||
int option_specified_date;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -390,7 +383,7 @@ main (int argc, char **argv)
|
||||
/* POSIX says that `date -u' is equivalent to setting the TZ
|
||||
environment variable, so this option should do nothing other
|
||||
than setting TZ. */
|
||||
if (putenv ("TZ=UTC0") != 0)
|
||||
if (putenv (bad_cast ("TZ=UTC0")) != 0)
|
||||
xalloc_die ();
|
||||
TZSET;
|
||||
break;
|
||||
@@ -444,8 +437,8 @@ main (int argc, char **argv)
|
||||
{
|
||||
error (0, 0,
|
||||
_("the argument %s lacks a leading `+';\n"
|
||||
"When using an option to specify date(s), any non-option\n"
|
||||
"argument must be a format string beginning with `+'."),
|
||||
"when using an option to specify date(s), any non-option\n"
|
||||
"argument must be a format string beginning with `+'"),
|
||||
quote (argv[optind]));
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
@@ -543,10 +536,7 @@ show_date (const char *format, struct timespec when)
|
||||
if (! tm)
|
||||
{
|
||||
char buf[INT_BUFSIZE_BOUND (intmax_t)];
|
||||
error (0, 0, _("time %s is out of range"),
|
||||
(TYPE_SIGNED (time_t)
|
||||
? imaxtostr (when.tv_sec, buf)
|
||||
: umaxtostr (when.tv_sec, buf)));
|
||||
error (0, 0, _("time %s is out of range"), timetostr (when.tv_sec, buf));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
197
src/dd.c
197
src/dd.c
@@ -1,5 +1,5 @@
|
||||
/* dd -- convert a file while copying it.
|
||||
Copyright (C) 85, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 85, 90, 91, 1995-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
|
||||
@@ -66,11 +66,16 @@ static void process_signals (void);
|
||||
# define SIGINFO SIGUSR1
|
||||
#endif
|
||||
|
||||
/* This may belong in GNULIB's fcntl module instead.
|
||||
Define O_CIO to 0 if it is not supported by this OS. */
|
||||
#ifndef O_CIO
|
||||
# define O_CIO 0
|
||||
#endif
|
||||
|
||||
#if ! HAVE_FDATASYNC
|
||||
# define fdatasync(fd) (errno = ENOSYS, -1)
|
||||
#endif
|
||||
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define output_char(c) \
|
||||
do \
|
||||
{ \
|
||||
@@ -128,9 +133,6 @@ enum
|
||||
STATUS_NOXFER = 01
|
||||
};
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* The name of the input file, or NULL for the standard input. */
|
||||
static char const *input_file = NULL;
|
||||
|
||||
@@ -197,8 +199,7 @@ static bool input_seekable;
|
||||
static int input_seek_errno;
|
||||
|
||||
/* File offset of the input, in bytes, along with a flag recording
|
||||
whether it overflowed. The offset is valid only if the input is
|
||||
seekable and if the offset has not overflowed. */
|
||||
whether it overflowed. */
|
||||
static uintmax_t input_offset;
|
||||
static bool input_offset_overflow;
|
||||
|
||||
@@ -228,6 +229,9 @@ static sig_atomic_t volatile interrupt_signal;
|
||||
/* A count of the number of pending info signals that have been received. */
|
||||
static sig_atomic_t volatile info_signal_count;
|
||||
|
||||
/* Function used for read (to handle iflag=fullblock parameter). */
|
||||
static ssize_t (*iread_fnc) (int fd, char *buf, size_t size);
|
||||
|
||||
/* A longest symbol in the struct symbol_values tables below. */
|
||||
#define LONGEST_SYMBOL "fdatasync"
|
||||
|
||||
@@ -259,11 +263,43 @@ static struct symbol_value const conversions[] =
|
||||
{"", 0}
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
/* Compute a value that's bitwise disjoint from the union
|
||||
of all O_ values. */
|
||||
v = ~(0
|
||||
| O_APPEND
|
||||
| O_BINARY
|
||||
| O_CIO
|
||||
| O_DIRECT
|
||||
| O_DIRECTORY
|
||||
| O_DSYNC
|
||||
| O_NOATIME
|
||||
| O_NOCTTY
|
||||
| O_NOFOLLOW
|
||||
| O_NOLINKS
|
||||
| O_NONBLOCK
|
||||
| O_SYNC
|
||||
| O_TEXT
|
||||
),
|
||||
/* Use its lowest bit. */
|
||||
O_FULLBLOCK = v ^ (v & (v - 1))
|
||||
};
|
||||
|
||||
/* Ensure that we got something. */
|
||||
verify (O_FULLBLOCK != 0);
|
||||
|
||||
#define MULTIPLE_BITS_SET(i) (((i) & ((i) - 1)) != 0)
|
||||
|
||||
/* Ensure that this is a single-bit value. */
|
||||
verify ( ! MULTIPLE_BITS_SET (O_FULLBLOCK));
|
||||
|
||||
/* Flags, for iflag="..." and oflag="...". */
|
||||
static struct symbol_value const flags[] =
|
||||
{
|
||||
{"append", O_APPEND},
|
||||
{"binary", O_BINARY},
|
||||
{"cio", O_CIO},
|
||||
{"direct", O_DIRECT},
|
||||
{"directory", O_DIRECTORY},
|
||||
{"dsync", O_DSYNC},
|
||||
@@ -274,6 +310,7 @@ static struct symbol_value const flags[] =
|
||||
{"nonblock", O_NONBLOCK},
|
||||
{"sync", O_SYNC},
|
||||
{"text", O_TEXT},
|
||||
{"fullblock", O_FULLBLOCK}, /* Accumulate full blocks from input. */
|
||||
{"", 0}
|
||||
};
|
||||
|
||||
@@ -430,16 +467,16 @@ Usage: %s [OPERAND]...\n\
|
||||
fputs (_("\
|
||||
Copy a file, converting and formatting according to the operands.\n\
|
||||
\n\
|
||||
bs=BYTES force ibs=BYTES and obs=BYTES\n\
|
||||
bs=BYTES read and write BYTES bytes at a time (also see ibs=,obs=)\n\
|
||||
cbs=BYTES convert BYTES bytes at a time\n\
|
||||
conv=CONVS convert the file as per the comma separated symbol list\n\
|
||||
count=BLOCKS copy only BLOCKS input blocks\n\
|
||||
ibs=BYTES read BYTES bytes at a time\n\
|
||||
ibs=BYTES read BYTES bytes at a time (default: 512)\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
if=FILE read from FILE instead of stdin\n\
|
||||
iflag=FLAGS read as per the comma separated symbol list\n\
|
||||
obs=BYTES write BYTES bytes at a time\n\
|
||||
obs=BYTES write BYTES bytes at a time (default: 512)\n\
|
||||
of=FILE write to FILE instead of stdout\n\
|
||||
oflag=FLAGS write as per the comma separated symbol list\n\
|
||||
seek=BLOCKS skip BLOCKS obs-sized blocks at start of output\n\
|
||||
@@ -449,8 +486,8 @@ Copy a file, converting and formatting according to the operands.\n\
|
||||
fputs (_("\
|
||||
\n\
|
||||
BLOCKS and BYTES may be followed by the following multiplicative suffixes:\n\
|
||||
xM M, c 1, w 2, b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,\n\
|
||||
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.\n\
|
||||
c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024, xM =M\n\
|
||||
GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.\n\
|
||||
\n\
|
||||
Each CONV symbol may be:\n\
|
||||
\n\
|
||||
@@ -483,14 +520,18 @@ Each FLAG symbol may be:\n\
|
||||
\n\
|
||||
append append mode (makes sense only for output; conv=notrunc suggested)\n\
|
||||
"), stdout);
|
||||
if (O_CIO)
|
||||
fputs (_(" cio use concurrent I/O for data\n"), stdout);
|
||||
if (O_DIRECT)
|
||||
fputs (_(" direct use direct I/O for data\n"), stdout);
|
||||
if (O_DIRECTORY)
|
||||
fputs (_(" directory fail unless a directory\n"), stdout);
|
||||
fputs (_(" directory fail unless a directory\n"), stdout);
|
||||
if (O_DSYNC)
|
||||
fputs (_(" dsync use synchronized I/O for data\n"), stdout);
|
||||
if (O_SYNC)
|
||||
fputs (_(" sync likewise, but also for metadata\n"), stdout);
|
||||
fputs (_(" fullblock accumulate full blocks of input (iflag only)\n"),
|
||||
stdout);
|
||||
if (O_NONBLOCK)
|
||||
fputs (_(" nonblock use non-blocking I/O\n"), stdout);
|
||||
if (O_NOATIME)
|
||||
@@ -548,7 +589,7 @@ translate_charset (char const *new_trans)
|
||||
static inline bool
|
||||
multiple_bits_set (int i)
|
||||
{
|
||||
return (i & (i - 1)) != 0;
|
||||
return MULTIPLE_BITS_SET (i);
|
||||
}
|
||||
|
||||
/* Print transfer statistics. */
|
||||
@@ -632,7 +673,7 @@ cleanup (void)
|
||||
_("closing output file %s"), quote (output_file));
|
||||
}
|
||||
|
||||
static inline void ATTRIBUTE_NORETURN
|
||||
static void ATTRIBUTE_NORETURN
|
||||
quit (int code)
|
||||
{
|
||||
cleanup ();
|
||||
@@ -765,6 +806,27 @@ iread (int fd, char *buf, size_t size)
|
||||
}
|
||||
}
|
||||
|
||||
/* Wrapper around iread function to accumulate full blocks. */
|
||||
static ssize_t
|
||||
iread_fullblock (int fd, char *buf, size_t size)
|
||||
{
|
||||
ssize_t nread = 0;
|
||||
|
||||
while (0 < size)
|
||||
{
|
||||
ssize_t ncurr = iread (fd, buf, size);
|
||||
if (ncurr < 0)
|
||||
return ncurr;
|
||||
if (ncurr == 0)
|
||||
break;
|
||||
nread += ncurr;
|
||||
buf += ncurr;
|
||||
size -= ncurr;
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
/* Write to FD the buffer BUF of size SIZE, processing any signals
|
||||
that arrive. Return the number of bytes written, setting errno if
|
||||
this is less than SIZE. Keep trying if there are partial
|
||||
@@ -950,13 +1012,11 @@ scanargs (int argc, char *const *argv)
|
||||
{
|
||||
invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (INPUT_BLOCK_SLOP));
|
||||
input_blocksize = n;
|
||||
conversions_mask |= C_TWOBUFS;
|
||||
}
|
||||
else if (operand_is (name, "obs"))
|
||||
{
|
||||
invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (OUTPUT_BLOCK_SLOP));
|
||||
output_blocksize = n;
|
||||
conversions_mask |= C_TWOBUFS;
|
||||
}
|
||||
else if (operand_is (name, "bs"))
|
||||
{
|
||||
@@ -987,12 +1047,13 @@ scanargs (int argc, char *const *argv)
|
||||
|
||||
if (blocksize)
|
||||
input_blocksize = output_blocksize = blocksize;
|
||||
else
|
||||
{
|
||||
/* POSIX says dd aggregates short reads into
|
||||
output_blocksize if bs= is not specified. */
|
||||
conversions_mask |= C_TWOBUFS;
|
||||
}
|
||||
|
||||
/* If bs= was given, both `input_blocksize' and `output_blocksize' will
|
||||
have been set to positive values. If either has not been set,
|
||||
bs= was not given, so make sure two buffers are used. */
|
||||
if (input_blocksize == 0 || output_blocksize == 0)
|
||||
conversions_mask |= C_TWOBUFS;
|
||||
if (input_blocksize == 0)
|
||||
input_blocksize = DEFAULT_BLOCKSIZE;
|
||||
if (output_blocksize == 0)
|
||||
@@ -1003,6 +1064,16 @@ scanargs (int argc, char *const *argv)
|
||||
if (input_flags & (O_DSYNC | O_SYNC))
|
||||
input_flags |= O_RSYNC;
|
||||
|
||||
if (output_flags & O_FULLBLOCK)
|
||||
{
|
||||
error (0, 0, "%s: %s", _("invalid output flag"), "'fullblock'");
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
iread_fnc = ((input_flags & O_FULLBLOCK)
|
||||
? iread_fullblock
|
||||
: iread);
|
||||
input_flags &= ~O_FULLBLOCK;
|
||||
|
||||
if (multiple_bits_set (conversions_mask & (C_ASCII | C_EBCDIC | C_IBM)))
|
||||
error (EXIT_FAILURE, 0, _("cannot combine any two of {ascii,ebcdic,ibm}"));
|
||||
if (multiple_bits_set (conversions_mask & (C_BLOCK | C_UNBLOCK)))
|
||||
@@ -1191,16 +1262,66 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize,
|
||||
&& 0 <= skip_via_lseek (file, fdesc, offset, SEEK_CUR))
|
||||
{
|
||||
if (fdesc == STDIN_FILENO)
|
||||
advance_input_offset (offset);
|
||||
return 0;
|
||||
{
|
||||
struct stat st;
|
||||
if (fstat (STDIN_FILENO, &st) != 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot fstat %s"), quote (file));
|
||||
if (S_ISREG (st.st_mode) && st.st_size < (input_offset + offset))
|
||||
{
|
||||
/* When skipping past EOF, return the number of _full_ blocks
|
||||
* that are not skipped, and set offset to EOF, so the caller
|
||||
* can determine the requested skip was not satisfied. */
|
||||
records = ( offset - st.st_size ) / blocksize;
|
||||
offset = st.st_size - input_offset;
|
||||
}
|
||||
else
|
||||
records = 0;
|
||||
advance_input_offset (offset);
|
||||
}
|
||||
else
|
||||
records = 0;
|
||||
return records;
|
||||
}
|
||||
else
|
||||
{
|
||||
int lseek_errno = errno;
|
||||
off_t soffset;
|
||||
|
||||
/* The seek request may have failed above if it was too big
|
||||
(> device size, > max file size, etc.)
|
||||
Or it may not have been done at all (> OFF_T_MAX).
|
||||
Therefore try to seek to the end of the file,
|
||||
to avoid redundant reading. */
|
||||
if ((soffset = skip_via_lseek (file, fdesc, 0, SEEK_END)) >= 0)
|
||||
{
|
||||
/* File is seekable, and we're at the end of it, and
|
||||
size <= OFF_T_MAX. So there's no point using read to advance. */
|
||||
|
||||
if (!lseek_errno)
|
||||
{
|
||||
/* The original seek was not attempted as offset > OFF_T_MAX.
|
||||
We should error for write as can't get to the desired
|
||||
location, even if OFF_T_MAX < max file size.
|
||||
For read we're not going to read any data anyway,
|
||||
so we should error for consistency.
|
||||
It would be nice to not error for /dev/{zero,null}
|
||||
for any offset, but that's not a significant issue. */
|
||||
lseek_errno = EOVERFLOW;
|
||||
}
|
||||
|
||||
if (fdesc == STDIN_FILENO)
|
||||
error (0, lseek_errno, _("%s: cannot skip"), quote (file));
|
||||
else
|
||||
error (0, lseek_errno, _("%s: cannot seek"), quote (file));
|
||||
/* If the file has a specific size and we've asked
|
||||
to skip/seek beyond the max allowable, then quit. */
|
||||
quit (EXIT_FAILURE);
|
||||
}
|
||||
/* else file_size && offset > OFF_T_MAX or file ! seekable */
|
||||
|
||||
do
|
||||
{
|
||||
ssize_t nread = iread (fdesc, buf, blocksize);
|
||||
ssize_t nread = iread_fnc (fdesc, buf, blocksize);
|
||||
if (nread < 0)
|
||||
{
|
||||
if (fdesc == STDIN_FILENO)
|
||||
@@ -1469,10 +1590,22 @@ dd_copy (void)
|
||||
|
||||
if (skip_records != 0)
|
||||
{
|
||||
skip (STDIN_FILENO, input_file, skip_records, input_blocksize, ibuf);
|
||||
uintmax_t us_bytes = input_offset + (skip_records * input_blocksize);
|
||||
uintmax_t us_blocks = skip (STDIN_FILENO, input_file,
|
||||
skip_records, input_blocksize, ibuf);
|
||||
us_bytes -= input_offset;
|
||||
|
||||
/* POSIX doesn't say what to do when dd detects it has been
|
||||
asked to skip past EOF, so I assume it's non-fatal if the
|
||||
call to 'skip' returns nonzero. FIXME: maybe give a warning. */
|
||||
asked to skip past EOF, so I assume it's non-fatal.
|
||||
There are 3 reasons why there might be unskipped blocks/bytes:
|
||||
1. file is too small
|
||||
2. pipe has not enough data
|
||||
3. short reads */
|
||||
if (us_blocks || (!input_offset_overflow && us_bytes))
|
||||
{
|
||||
error (0, 0,
|
||||
_("%s: cannot skip to specified offset"), quote (input_file));
|
||||
}
|
||||
}
|
||||
|
||||
if (seek_records != 0)
|
||||
@@ -1511,7 +1644,7 @@ dd_copy (void)
|
||||
(conversions_mask & (C_BLOCK | C_UNBLOCK)) ? ' ' : '\0',
|
||||
input_blocksize);
|
||||
|
||||
nread = iread (STDIN_FILENO, ibuf, input_blocksize);
|
||||
nread = iread_fnc (STDIN_FILENO, ibuf, input_blocksize);
|
||||
|
||||
if (nread == 0)
|
||||
break; /* EOF. */
|
||||
@@ -1671,7 +1804,7 @@ main (int argc, char **argv)
|
||||
off_t offset;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -1681,7 +1814,7 @@ main (int argc, char **argv)
|
||||
|
||||
page_size = getpagesize ();
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
close_stdout_required = false;
|
||||
|
||||
@@ -1710,7 +1843,7 @@ main (int argc, char **argv)
|
||||
|
||||
offset = lseek (STDIN_FILENO, 0, SEEK_CUR);
|
||||
input_seekable = (0 <= offset);
|
||||
input_offset = offset;
|
||||
input_offset = MAX(0, offset);
|
||||
input_seek_errno = errno;
|
||||
|
||||
if (output_file == NULL)
|
||||
|
||||
112
src/df.c
112
src/df.c
@@ -28,7 +28,6 @@
|
||||
#include "error.h"
|
||||
#include "fsusage.h"
|
||||
#include "human.h"
|
||||
#include "inttostr.h"
|
||||
#include "mountlist.h"
|
||||
#include "quote.h"
|
||||
#include "save-cwd.h"
|
||||
@@ -42,9 +41,6 @@
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Paul Eggert")
|
||||
|
||||
/* Name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* If true, show inode information. */
|
||||
static bool inode_format;
|
||||
|
||||
@@ -112,6 +108,12 @@ static struct mount_entry *mount_list;
|
||||
/* If true, print file system type as well. */
|
||||
static bool print_type;
|
||||
|
||||
/* If true, print a grand total at the end. */
|
||||
static bool print_grand_total;
|
||||
|
||||
/* Grand total data. */
|
||||
static struct fs_usage grand_fsu;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
@@ -133,6 +135,7 @@ static struct option const long_options[] =
|
||||
{"print-type", no_argument, NULL, 'T'},
|
||||
{"sync", no_argument, NULL, SYNC_OPTION},
|
||||
{"no-sync", no_argument, NULL, NO_SYNC_OPTION},
|
||||
{"total", no_argument, NULL, 'c'},
|
||||
{"type", required_argument, NULL, 't'},
|
||||
{"exclude-type", required_argument, NULL, 'x'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
@@ -228,18 +231,28 @@ excluded_fstype (const char *fstype)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true if N is a known integer value. On many file systems,
|
||||
UINTMAX_MAX represents an unknown value; on AIX, UINTMAX_MAX - 1
|
||||
represents unknown. Use a rule that works on AIX file systems, and
|
||||
that almost-always works on other types. */
|
||||
static bool
|
||||
known_value (uintmax_t n)
|
||||
{
|
||||
return n < UINTMAX_MAX - 1;
|
||||
}
|
||||
|
||||
/* Like human_readable (N, BUF, human_output_opts, INPUT_UNITS, OUTPUT_UNITS),
|
||||
except:
|
||||
|
||||
- If NEGATIVE, then N represents a negative number,
|
||||
expressed in two's complement.
|
||||
- Otherwise, return "-" if N is UINTMAX_MAX. */
|
||||
- Otherwise, return "-" if N is unknown. */
|
||||
|
||||
static char const *
|
||||
df_readable (bool negative, uintmax_t n, char *buf,
|
||||
uintmax_t input_units, uintmax_t output_units)
|
||||
{
|
||||
if (n == UINTMAX_MAX && !negative)
|
||||
if (! known_value (n) && !negative)
|
||||
return "-";
|
||||
else
|
||||
{
|
||||
@@ -251,6 +264,41 @@ df_readable (bool negative, uintmax_t n, char *buf,
|
||||
}
|
||||
}
|
||||
|
||||
/* Logical equivalence */
|
||||
#define LOG_EQ(a, b) (!(a) == !(b))
|
||||
|
||||
/* Add integral value while using uintmax_t for value part and separate
|
||||
negation flag. It adds value of SRC and SRC_NEG to DEST and DEST_NEG.
|
||||
The result will be in DEST and DEST_NEG. See df_readable to understand
|
||||
how the negation flag is used. */
|
||||
static void
|
||||
add_uint_with_neg_flag (uintmax_t *dest, bool *dest_neg,
|
||||
uintmax_t src, bool src_neg)
|
||||
{
|
||||
if (LOG_EQ (*dest_neg, src_neg))
|
||||
{
|
||||
*dest += src;
|
||||
return;
|
||||
}
|
||||
|
||||
if (*dest_neg)
|
||||
*dest = -*dest;
|
||||
|
||||
if (src_neg)
|
||||
src = -src;
|
||||
|
||||
if (src < *dest)
|
||||
*dest -= src;
|
||||
else
|
||||
{
|
||||
*dest = src - *dest;
|
||||
*dest_neg = src_neg;
|
||||
}
|
||||
|
||||
if (*dest_neg)
|
||||
*dest = -*dest;
|
||||
}
|
||||
|
||||
/* Display a space listing for the disk device with absolute file name DISK.
|
||||
If MOUNT_POINT is non-NULL, it is the name of the root of the
|
||||
file system on DISK.
|
||||
@@ -267,7 +315,8 @@ df_readable (bool negative, uintmax_t n, char *buf,
|
||||
static void
|
||||
show_dev (char const *disk, char const *mount_point,
|
||||
char const *stat_file, char const *fstype,
|
||||
bool me_dummy, bool me_remote)
|
||||
bool me_dummy, bool me_remote,
|
||||
const struct fs_usage *force_fsu)
|
||||
{
|
||||
struct fs_usage fsu;
|
||||
char buf[3][LONGEST_HUMAN_READABLE + 2];
|
||||
@@ -300,7 +349,9 @@ show_dev (char const *disk, char const *mount_point,
|
||||
if (!stat_file)
|
||||
stat_file = mount_point ? mount_point : disk;
|
||||
|
||||
if (get_fs_usage (stat_file, disk, &fsu))
|
||||
if (force_fsu)
|
||||
fsu = *force_fsu;
|
||||
else if (get_fs_usage (stat_file, disk, &fsu))
|
||||
{
|
||||
error (0, errno, "%s", quote (stat_file));
|
||||
exit_status = EXIT_FAILURE;
|
||||
@@ -351,6 +402,11 @@ show_dev (char const *disk, char const *mount_point,
|
||||
available = fsu.fsu_ffree;
|
||||
negate_available = false;
|
||||
available_to_root = available;
|
||||
|
||||
if (known_value (total))
|
||||
grand_fsu.fsu_files += total;
|
||||
if (known_value (available))
|
||||
grand_fsu.fsu_ffree += available;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -375,13 +431,22 @@ show_dev (char const *disk, char const *mount_point,
|
||||
total = fsu.fsu_blocks;
|
||||
available = fsu.fsu_bavail;
|
||||
negate_available = (fsu.fsu_bavail_top_bit_set
|
||||
& (available != UINTMAX_MAX));
|
||||
& known_value (available));
|
||||
available_to_root = fsu.fsu_bfree;
|
||||
|
||||
if (known_value (total))
|
||||
grand_fsu.fsu_blocks += input_units * total;
|
||||
if (known_value (available_to_root))
|
||||
grand_fsu.fsu_bfree += input_units * available_to_root;
|
||||
if (known_value (available))
|
||||
add_uint_with_neg_flag (&grand_fsu.fsu_bavail,
|
||||
&grand_fsu.fsu_bavail_top_bit_set,
|
||||
input_units * available, negate_available);
|
||||
}
|
||||
|
||||
used = UINTMAX_MAX;
|
||||
negate_used = false;
|
||||
if (total != UINTMAX_MAX && available_to_root != UINTMAX_MAX)
|
||||
if (known_value (total) && known_value (available_to_root))
|
||||
{
|
||||
used = total - available_to_root;
|
||||
negate_used = (total < available_to_root);
|
||||
@@ -396,7 +461,7 @@ show_dev (char const *disk, char const *mount_point,
|
||||
width, df_readable (negate_available, available,
|
||||
buf[2], input_units, output_units));
|
||||
|
||||
if (used == UINTMAX_MAX || available == UINTMAX_MAX)
|
||||
if (! known_value (used) || ! known_value (available))
|
||||
;
|
||||
else if (!negate_used
|
||||
&& used <= TYPE_MAXIMUM (uintmax_t) / 100
|
||||
@@ -554,7 +619,7 @@ show_disk (char const *disk)
|
||||
{
|
||||
show_dev (best_match->me_devname, best_match->me_mountdir, NULL,
|
||||
best_match->me_type, best_match->me_dummy,
|
||||
best_match->me_remote);
|
||||
best_match->me_remote, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -658,7 +723,8 @@ show_point (const char *point, const struct stat *statp)
|
||||
|
||||
if (best_match)
|
||||
show_dev (best_match->me_devname, best_match->me_mountdir, point,
|
||||
best_match->me_type, best_match->me_dummy, best_match->me_remote);
|
||||
best_match->me_type, best_match->me_dummy, best_match->me_remote,
|
||||
NULL);
|
||||
else
|
||||
{
|
||||
/* We couldn't find the mount entry corresponding to POINT. Go ahead and
|
||||
@@ -669,7 +735,7 @@ show_point (const char *point, const struct stat *statp)
|
||||
char *mp = find_mount_point (point, statp);
|
||||
if (mp)
|
||||
{
|
||||
show_dev (NULL, mp, NULL, NULL, false, false);
|
||||
show_dev (NULL, mp, NULL, NULL, false, false, NULL);
|
||||
free (mp);
|
||||
}
|
||||
}
|
||||
@@ -698,7 +764,7 @@ show_all_entries (void)
|
||||
|
||||
for (me = mount_list; me; me = me->me_next)
|
||||
show_dev (me->me_devname, me->me_mountdir, NULL, me->me_type,
|
||||
me->me_dummy, me->me_remote);
|
||||
me->me_dummy, me->me_remote, NULL);
|
||||
}
|
||||
|
||||
/* Add FSTYPE to the list of file system types to display. */
|
||||
@@ -747,6 +813,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
fputs (_("\
|
||||
-a, --all include dummy file systems\n\
|
||||
-B, --block-size=SIZE use SIZE-byte blocks\n\
|
||||
--total produce a grand total\n\
|
||||
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\
|
||||
-H, --si likewise, but use powers of 1000 not 1024\n\
|
||||
"), stdout);
|
||||
@@ -781,7 +848,7 @@ main (int argc, char **argv)
|
||||
struct stat *stats IF_LINT (= 0);
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -798,6 +865,8 @@ main (int argc, char **argv)
|
||||
file_systems_processed = false;
|
||||
posix_format = false;
|
||||
exit_status = EXIT_SUCCESS;
|
||||
print_grand_total = false;
|
||||
grand_fsu.fsu_blocksize = 1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@@ -868,6 +937,10 @@ main (int argc, char **argv)
|
||||
add_excluded_fs_type (optarg);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
print_grand_total = true;
|
||||
break;
|
||||
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
|
||||
@@ -963,6 +1036,13 @@ main (int argc, char **argv)
|
||||
else
|
||||
show_all_entries ();
|
||||
|
||||
if (print_grand_total)
|
||||
{
|
||||
if (inode_format)
|
||||
grand_fsu.fsu_blocks = 1;
|
||||
show_dev ("total", NULL, NULL, NULL, false, false, &grand_fsu);
|
||||
}
|
||||
|
||||
if (! file_systems_processed)
|
||||
error (EXIT_FAILURE, 0, _("no file systems processed"));
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user