mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
357 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ae4336f4f | ||
|
|
120118c7d8 | ||
|
|
875cae47a9 | ||
|
|
269bb7362f | ||
|
|
0e945ebcc5 | ||
|
|
71ebb443d8 | ||
|
|
428db13557 | ||
|
|
0a28715b10 | ||
|
|
74171b693c | ||
|
|
c4dfd3138e | ||
|
|
d76a1c2a2d | ||
|
|
dbd17157d7 | ||
|
|
cb9fd93743 | ||
|
|
8259a73a85 | ||
|
|
e0cf592f48 | ||
|
|
1fa226772c | ||
|
|
941bd48235 | ||
|
|
819ee4272b | ||
|
|
a81441557b | ||
|
|
6debf54e61 | ||
|
|
c86509d86e | ||
|
|
9e7edf0006 | ||
|
|
b726914a4c | ||
|
|
207daac5c1 | ||
|
|
98dbd8cc53 | ||
|
|
52c4018a9c | ||
|
|
0e414d9e4a | ||
|
|
25eb4c6909 | ||
|
|
f41f926aab | ||
|
|
cbc4d9bd13 | ||
|
|
c74fbaefeb | ||
|
|
2ad7da7594 | ||
|
|
4298108f46 | ||
|
|
e453e720b9 | ||
|
|
51a6c63496 | ||
|
|
2977df8e7d | ||
|
|
48430d6a4a | ||
|
|
f08504b43b | ||
|
|
ea6abe343d | ||
|
|
a46c077467 | ||
|
|
4404198c12 | ||
|
|
0523f45f66 | ||
|
|
b571b61970 | ||
|
|
03490e3565 | ||
|
|
854f76ed4f | ||
|
|
6a51c69b05 | ||
|
|
0df3a91b25 | ||
|
|
bf87a2c8ea | ||
|
|
148ddb3232 | ||
|
|
6fb27500ee | ||
|
|
0f1b8c021d | ||
|
|
af5723c71e | ||
|
|
9fdf5845fc | ||
|
|
e22f096d10 | ||
|
|
33e7070464 | ||
|
|
1974dc34b6 | ||
|
|
8e8b025c90 | ||
|
|
7008e33441 | ||
|
|
100d4983e7 | ||
|
|
d75bcea4cf | ||
|
|
eaacc89a45 | ||
|
|
e1e5963a9d | ||
|
|
612b647dd1 | ||
|
|
34f0c3e522 | ||
|
|
a5ba6c8ef8 | ||
|
|
2ade7643de | ||
|
|
4145a1e54c | ||
|
|
1417251e29 | ||
|
|
30071248c9 | ||
|
|
f8268d3bae | ||
|
|
7a21310eb3 | ||
|
|
278ae924be | ||
|
|
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 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -56,6 +56,7 @@ lib/selinux
|
||||
lib/uniwidth
|
||||
m4/.cvsignore
|
||||
m4/.gitignore
|
||||
maint.mk
|
||||
po/*.gmo
|
||||
po/*.po
|
||||
po/.gitignore
|
||||
|
||||
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.12
|
||||
7.2
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
ChangeLog(-[0-9]+)?$
|
||||
^old/
|
||||
^src/c99-to-c98\.diff$
|
||||
^gl/.*
|
||||
1
.x-sc_po_check
Normal file
1
.x-sc_po_check
Normal file
@@ -0,0 +1 @@
|
||||
^gl/
|
||||
@@ -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$
|
||||
2
AUTHORS
2
AUTHORS
@@ -25,7 +25,7 @@ du: Torbjörn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
|
||||
echo: Brian Fox, Chet Ramey
|
||||
env: Richard Mlynarik, David MacKenzie
|
||||
expand: David MacKenzie
|
||||
expr: Mike Parker, James Youngman
|
||||
expr: Mike Parker, James Youngman, Paul Eggert
|
||||
factor: Paul Rubin
|
||||
false: Jim Meyering
|
||||
fmt: Ross Paterson
|
||||
|
||||
@@ -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.
|
||||
|
||||
72
HACKING
72
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
|
||||
@@ -288,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
|
||||
@@ -323,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"
|
||||
================================================
|
||||
@@ -345,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
|
||||
@@ -402,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.
|
||||
|
||||
99
Makefile.am
99
Makefile.am
@@ -1,6 +1,6 @@
|
||||
# Make coreutils. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1990, 1993-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1990, 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
|
||||
@@ -15,49 +15,69 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
SUBDIRS = lib src doc man po tests gnulib-tests
|
||||
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_program_name \
|
||||
.x-sc_prohibit_atoi_atof \
|
||||
.x-sc_prohibit_strcmp \
|
||||
.x-sc_require_config_h \
|
||||
.x-sc_space_tab .x-sc_sun_os_names \
|
||||
.x-sc_trailing_blank \
|
||||
.x-sc_unmarked_diagnostics \
|
||||
.x-sc_useless_cpp_parens \
|
||||
ChangeLog-2005 \
|
||||
ChangeLog-2006 \
|
||||
ChangeLog-2007 \
|
||||
ChangeLog-2008 \
|
||||
bootstrap \
|
||||
bootstrap.conf \
|
||||
build-aux/cvsu \
|
||||
build-aux/git-version-gen \
|
||||
build-aux/vc-list-files \
|
||||
gl/modules/getloadavg.diff \
|
||||
m4/ChangeLog \
|
||||
old/fileutils/ChangeLog \
|
||||
old/fileutils/ChangeLog-1997 \
|
||||
old/fileutils/NEWS \
|
||||
old/sh-utils/ChangeLog \
|
||||
old/sh-utils/ChangeLog.0 \
|
||||
old/sh-utils/NEWS \
|
||||
old/textutils/ChangeLog \
|
||||
old/textutils/NEWS
|
||||
ALL_RECURSIVE_TARGETS =
|
||||
|
||||
SUBDIRS = lib src doc man po tests gnulib-tests
|
||||
|
||||
changelog_etc = \
|
||||
ChangeLog-2005 \
|
||||
ChangeLog-2006 \
|
||||
ChangeLog-2007 \
|
||||
ChangeLog-2008 \
|
||||
build-aux/ChangeLog-2007 \
|
||||
doc/ChangeLog-2007 \
|
||||
lib/ChangeLog-2007 \
|
||||
m4/ChangeLog-2007 \
|
||||
old/fileutils/ChangeLog \
|
||||
old/fileutils/ChangeLog-1997 \
|
||||
old/fileutils/NEWS \
|
||||
old/sh-utils/ChangeLog \
|
||||
old/sh-utils/ChangeLog.0 \
|
||||
old/sh-utils/NEWS \
|
||||
old/textutils/ChangeLog \
|
||||
old/textutils/NEWS \
|
||||
po/ChangeLog-2007
|
||||
|
||||
syntax_check_exceptions = \
|
||||
.x-sc_GPL_version \
|
||||
.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 \
|
||||
.x-sc_trailing_blank \
|
||||
.x-sc_unmarked_diagnostics \
|
||||
.x-sc_useless_cpp_parens
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(changelog_etc) \
|
||||
$(syntax_check_exceptions) \
|
||||
.prev-version \
|
||||
.version \
|
||||
.vg-suppressions \
|
||||
THANKS-to-translators \
|
||||
THANKStt.in \
|
||||
bootstrap \
|
||||
bootstrap.conf \
|
||||
build-aux/cvsu \
|
||||
cfg.mk \
|
||||
dist-check.mk \
|
||||
gl/modules/getloadavg.diff \
|
||||
maint.mk
|
||||
|
||||
ALL_RECURSIVE_TARGETS += install-root
|
||||
install-root:
|
||||
cd src && $(MAKE) $@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# Some tests always need root privileges, others need them only sometimes.
|
||||
ALL_RECURSIVE_TARGETS += check-root
|
||||
check-root:
|
||||
cd tests && $(MAKE) $@ SUBDIRS=
|
||||
|
||||
@@ -93,6 +113,7 @@ gen-ChangeLog:
|
||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
|
||||
fi
|
||||
|
||||
ALL_RECURSIVE_TARGETS += distcheck-hook
|
||||
distcheck-hook: check-ls-dircolors
|
||||
$(MAKE) my-distcheck
|
||||
|
||||
@@ -101,8 +122,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 $@
|
||||
|
||||
|
||||
173
NEWS
173
NEWS
@@ -1,5 +1,175 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 7.3 (2009-05-01) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp now diagnoses failure to preserve selinux/xattr attributes when
|
||||
--preserve=context,xattr is specified in combination with -a.
|
||||
Also, cp no longer suppresses attribute-preservation diagnostics
|
||||
when preserving SELinux context was explicitly requested.
|
||||
|
||||
ls now aligns output correctly in the presence of abbreviated month
|
||||
names from the locale database that have differing widths.
|
||||
|
||||
ls -v and sort -V now order names like "#.b#" properly
|
||||
|
||||
mv: do not print diagnostics when failing to preserve xattr's on file
|
||||
systems without xattr support.
|
||||
|
||||
sort -m no longer segfaults when its output file is also an input file.
|
||||
E.g., with this, touch 1; sort -m -o 1 1, sort would segfault.
|
||||
[introduced in coreutils-7.2]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
shred, sort, shuf: now use an internal pseudorandom generator by default.
|
||||
This is mainly noticable in shred where the 3 random passes it does by
|
||||
default should proceed at the speed of the disk. Previously /dev/urandom
|
||||
was used if available, which is relatively slow on GNU/Linux systems.
|
||||
|
||||
** Improved robustness
|
||||
|
||||
cp would exit successfully after copying less than the full contents
|
||||
of a file larger than ~4000 bytes from a linux-/proc file system to a
|
||||
destination file system with a fundamental block size of 4KiB or greater.
|
||||
Reading into a 4KiB-or-larger buffer, cp's "read" syscall would return
|
||||
a value smaller than 4096, and cp would interpret that as EOF (POSIX
|
||||
allows this). This optimization, now removed, saved 50% of cp's read
|
||||
syscalls when copying small files. Affected linux kernels: at least
|
||||
2.6.9 through 2.6.29.
|
||||
[the optimization was introduced in coreutils-6.0]
|
||||
|
||||
** Portability
|
||||
|
||||
df now pre-mounts automountable directories even with automounters for
|
||||
which stat-like syscalls no longer provoke mounting. Now, df uses open.
|
||||
|
||||
`id -G $USER` now works correctly even on Darwin and NetBSD. Previously it
|
||||
would either truncate the group list to 10, or go into an infinite loop,
|
||||
due to their non-standard getgrouplist implementations.
|
||||
[truncation introduced in coreutils-6.11]
|
||||
[infinite loop introduced in coreutils-7.1]
|
||||
|
||||
|
||||
* 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
|
||||
|
||||
cat,cp,install,mv,split: these programs now read and write a minimum
|
||||
of 32KiB at a time. This was seen to double throughput when reading
|
||||
cached files on GNU/Linux-based systems.
|
||||
|
||||
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
|
||||
@@ -2304,8 +2474,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
|
||||
|
||||
35
README
35
README
@@ -41,7 +41,7 @@ Special thanks to Paul Eggert, Brian Matthews, Bruce Evans, Karl Berry,
|
||||
Kaveh Ghazi, and François Pinard for help with debugging and porting
|
||||
these programs. Many thanks to all of the people who have taken the
|
||||
time to submit problem reports and fixes. All contributed changes are
|
||||
attributed in the ChangeLog files.
|
||||
attributed in the commit logs.
|
||||
|
||||
And thanks to the following people who have provided accounts for
|
||||
portability testing on many different types of systems: Bob Proulx,
|
||||
@@ -92,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
|
||||
@@ -161,17 +165,17 @@ 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:
|
||||
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.
|
||||
|
||||
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.
|
||||
Send bug reports, questions, comments, etc. to bug-coreutils@gnu.org.
|
||||
If you would like to suggest a patch, see the files README-hacking
|
||||
and HACKING for tips.
|
||||
|
||||
***************************************
|
||||
|
||||
@@ -209,13 +213,7 @@ subtle bugs.
|
||||
WARNING: If you modify files like configure.in, m4/*.m4, aclocal.m4,
|
||||
or any Makefile.am, then don't be surprised if what gets regenerated no
|
||||
longer works. To make things work, you'll have to be using appropriate
|
||||
versions of automake and autoconf. As for what versions are `appropriate',
|
||||
use the versions of
|
||||
|
||||
* autoconf specified via AC_PREREQ in m4/jm-macros.m4
|
||||
* automake specified via AM_INIT_AUTOMAKE in configure.ac
|
||||
|
||||
Usually it's fine to use versions that are newer than those specified.
|
||||
versions of the tools listed in bootstrap.conf's buildreq string.
|
||||
|
||||
All of these programs except `test' recognize the `--version' option.
|
||||
When reporting bugs, please include in the subject line both the package
|
||||
@@ -231,8 +229,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,41 +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
|
||||
|
||||
This package's build procedure uses LZMA to create a compressed
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture. See also README-valgrind.
|
||||
|
||||
- XZ utils (successor to LZMA)
|
||||
|
||||
This package's build procedure uses XZ to create a compressed
|
||||
distribution tarball. Using this feature of Automake requires
|
||||
version 1.10.1 or newer, as well as the lzma program itself.
|
||||
Make sure you have the latest stable version of the LZMA Utils
|
||||
from <http://tukaani.org/lzma/>.
|
||||
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.
|
||||
|
||||
@@ -64,7 +68,7 @@ Enjoy!
|
||||
|
||||
-----
|
||||
|
||||
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
|
||||
@@ -78,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:
|
||||
|
||||
35
README-prereq
Normal file
35
README-prereq
Normal file
@@ -0,0 +1,35 @@
|
||||
Detailed below are concrete examples for
|
||||
getting the prerequisites for particular systems.
|
||||
|
||||
- GNU/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 GNU/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.10b in step 3.
|
||||
Apply the same method to install the lzma package.
|
||||
[FIXME: mention xz when it's packaged]
|
||||
|
||||
3. The latest stable automake (1.10.1) was not new enough, so we download
|
||||
and build automake-1.10b or newer from its repository and make it available
|
||||
just to coreutils:
|
||||
# yum install help2man #required to build automake fully
|
||||
$ git clone git://git.sv.gnu.org/automake.git
|
||||
$ cd automake
|
||||
$ git checkout -b next --track origin/next
|
||||
$ ./bootstrap
|
||||
$ ./configure --prefix=$HOME/coreutils/deps
|
||||
$ make install
|
||||
|
||||
Now we can build coreutils as described in README-hacking
|
||||
as long as $PATH starts with $HOME/coreutils/deps
|
||||
96
README-release
Normal file
96
README-release
Normal file
@@ -0,0 +1,96 @@
|
||||
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 -j1 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 e.g.,:
|
||||
|
||||
v=7.3
|
||||
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
|
||||
git tag -s -m "coreutils $v" v$v HEAD
|
||||
|
||||
* 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:
|
||||
|
||||
Subject: coreutils-7.2 released [stable]
|
||||
The announcement is here:
|
||||
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/49
|
||||
|
||||
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.
|
||||
@@ -23,7 +23,7 @@
|
||||
# find tests -name Makefile.am|xargs grep -wl PATH|xargs perl -pi -e 's,src/vg,src,'
|
||||
#
|
||||
# Create this symlink for suppressions (this is no longer necessary,
|
||||
# with linux-2.6.9 and valgrind-2.2.0):
|
||||
# with Linux kernel 2.6.9 and valgrind-2.2.0):
|
||||
# ln -s $PWD/.vg-suppressions /tmp/cu-vg
|
||||
|
||||
# Create src/vg:
|
||||
|
||||
39
THANKS
39
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,11 +84,13 @@ 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
|
||||
@@ -114,7 +121,7 @@ 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
|
||||
@@ -125,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
|
||||
@@ -132,6 +140,7 @@ 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
|
||||
@@ -196,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
|
||||
@@ -224,6 +235,7 @@ Hugh Daniel hugh@xanadu.com
|
||||
Ian Bruce ian.bruce@myrealbox.com
|
||||
Iain Calder ic56@rogers.com
|
||||
Ian Jackson ijackson@chiark.greenend.org.uk
|
||||
Ian Kent ikent@redhat.com
|
||||
Ian Lance Taylor ian@cygnus.com
|
||||
Ian Turner vectro@pipeline.com
|
||||
Iida Yosiaki iida@gnu.org
|
||||
@@ -237,9 +249,10 @@ 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
|
||||
@@ -281,6 +294,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
|
||||
@@ -354,6 +368,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
|
||||
@@ -367,6 +382,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
|
||||
@@ -390,6 +406,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
|
||||
@@ -403,11 +420,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
|
||||
@@ -417,8 +436,10 @@ Ole Laursen olau@hardworking.dk
|
||||
Oliver Kiddle okiddle@yahoo.co.uk
|
||||
Ørn E. Hansen oehansen@daimi.aau.dk
|
||||
Oskar Liljeblad osk@hem.passagen.se
|
||||
Otavio Salvador otavio@ossystems.com.br
|
||||
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
|
||||
@@ -440,6 +461,7 @@ 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
|
||||
@@ -479,6 +501,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
|
||||
@@ -488,6 +511,7 @@ Santiago Vila Doncel sanvila@unex.es
|
||||
Savochkin Andrey Vladimirovich saw@msu.ru
|
||||
Scott Lurndal slurn@griffin.engr.sgi.com
|
||||
Sébastien Maret smaret@umich.edu
|
||||
Sergei Steshenko sergstesh@yahoo.com
|
||||
Shing-Shong Shei shei@cs.indiana.edu
|
||||
Soeren Sonnenburg sonnenburg@informatik.hu-berlin.de
|
||||
Solar Designer solar@owl.openwall.com
|
||||
@@ -503,8 +527,11 @@ Steve McIntyre steve@einval.com
|
||||
Steve Ward planet36@gmail.com
|
||||
Steven G. Johnson stevenj@alum.mit.edu
|
||||
Steven Mocking ufo@quicknet.nl
|
||||
Steven Parkes smparkes@smparkes.net
|
||||
Steven Schveighoffer schveiguy@yahoo.com
|
||||
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
|
||||
@@ -525,6 +552,7 @@ 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
|
||||
@@ -541,6 +569,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
|
||||
@@ -548,7 +577,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
|
||||
|
||||
8
TODO
8
TODO
@@ -12,12 +12,9 @@ Modify chmod so that it does not change an inode's st_ctime
|
||||
Discussed more recently on <http://bugs.debian.org/497514>.
|
||||
|
||||
document the following in coreutils.texi:
|
||||
runcon
|
||||
chcon
|
||||
mktemp
|
||||
[
|
||||
pinky
|
||||
Also document the SELinux changes.
|
||||
|
||||
Suggestion from Paul Eggert:
|
||||
More generally, there's not that much use for imaxtostr nowadays,
|
||||
@@ -104,6 +101,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)
|
||||
|
||||
@@ -170,7 +170,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
|
||||
|
||||
138
bootstrap
138
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
|
||||
@@ -52,6 +52,9 @@ Options:
|
||||
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.
|
||||
"
|
||||
}
|
||||
@@ -195,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
|
||||
}
|
||||
@@ -222,6 +225,100 @@ 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 comparison
|
||||
echo "$2 $1"
|
||||
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
|
||||
echo "$1 $2"
|
||||
else # numeric, then lexicographic 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.
|
||||
@@ -245,7 +342,7 @@ cleanup_gnulib() {
|
||||
}
|
||||
|
||||
git_modules_config () {
|
||||
GIT_CONFIG_LOCAL=.gitmodules git config "$@"
|
||||
GIT_CONFIG=.gitmodules git config "$@"
|
||||
}
|
||||
|
||||
# Get gnulib files.
|
||||
@@ -262,7 +359,8 @@ case ${GNULIB_SRCDIR--} in
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
git clone --depth 2 git://git.sv.gnu.org/gnulib ||
|
||||
git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
|
||||
git clone $shallow git://git.sv.gnu.org/gnulib ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
@@ -322,9 +420,9 @@ update_po_files() {
|
||||
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
|
||||
}
|
||||
@@ -487,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
|
||||
@@ -569,9 +667,9 @@ 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
|
||||
fi
|
||||
rm -fr $bt $bt2 || exit
|
||||
@@ -592,15 +690,23 @@ find "$m4_base" "$source_base" \
|
||||
|
||||
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-automake} --add-missing --copy --force-missing"
|
||||
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
|
||||
|
||||
315
bootstrap.conf
315
bootstrap.conf
@@ -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,93 +16,228 @@
|
||||
# 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=canonicalize-lgpl
|
||||
--avoid=dummy
|
||||
--avoid=lock
|
||||
'
|
||||
|
||||
# These modules are obsolete and can probably be removed soon,
|
||||
# but leave them in for now to minimize changes.
|
||||
obsolete_gnulib_modules='
|
||||
atexit memchr memcmp memcpy memmove memset rename
|
||||
strcspn strtod strtol utime
|
||||
atexit
|
||||
memchr
|
||||
memcmp
|
||||
memcpy
|
||||
memmove
|
||||
memset
|
||||
rename
|
||||
strcspn
|
||||
strtod
|
||||
strtol
|
||||
'
|
||||
|
||||
# gnulib modules used by this package.
|
||||
gnulib_modules="
|
||||
$avoided_gnulib_modules
|
||||
$obsolete_gnulib_modules
|
||||
acl alloca announce-gen argmatch assert
|
||||
autobuild
|
||||
backupfile base64
|
||||
c-strcase c-strtod
|
||||
c-strtold calloc canon-host canonicalize chown cloexec
|
||||
config-h configmake
|
||||
closein closeout
|
||||
crypto/md5
|
||||
crypto/sha1
|
||||
crypto/sha256
|
||||
crypto/sha512
|
||||
cycle-check
|
||||
d-ino d-type diacrit dirfd dirname dup2
|
||||
error euidaccess exclude exitfail fchdir fcntl fcntl-safer fdl
|
||||
file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu
|
||||
fopen-safer
|
||||
fprintftime
|
||||
fseeko
|
||||
fsusage ftruncate
|
||||
ftello
|
||||
fts getdate getgroups gethrxtime
|
||||
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
|
||||
inttostr inttypes isapipe
|
||||
lchmod lchown lib-ignore linebuffer link-follow
|
||||
long-options lstat malloc mbswidth memcasecmp 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
|
||||
randint
|
||||
randperm
|
||||
readtokens
|
||||
readtokens0 readutmp
|
||||
realloc regex rename-dest-slash rmdir rmdir-errno
|
||||
root-dev-ino
|
||||
rpmatch
|
||||
safe-read same
|
||||
save-cwd savedir savewd
|
||||
selinux-at
|
||||
settime sig2str ssize_t stat-macros
|
||||
stat-time stdbool stdlib-safer stpcpy
|
||||
stpncpy
|
||||
strftime
|
||||
strpbrk strtoimax strtoumax strverscmp sys_stat timespec tzset
|
||||
unicodeio unistd-safer unlink-busy unlinkdir unlocked-io
|
||||
uptime
|
||||
useless-if-before-free
|
||||
userspec utimecmp utimens
|
||||
vasprintf-posix
|
||||
vc-list-files
|
||||
verify version-etc-fsf
|
||||
wcwidth winsz-ioctl winsz-termios write-any-file
|
||||
xalloc xgetcwd xgethostname
|
||||
xmemcoll xnanosleep
|
||||
xprintf
|
||||
xprintf-posix
|
||||
xstrtod xstrtoimax
|
||||
xstrtol xstrtold xstrtoumax yesno
|
||||
$avoided_gnulib_modules
|
||||
$obsolete_gnulib_modules
|
||||
acl
|
||||
alloca
|
||||
announce-gen
|
||||
areadlink-with-size
|
||||
argmatch
|
||||
argv-iter
|
||||
assert
|
||||
autobuild
|
||||
backupfile
|
||||
base64
|
||||
c-strcase
|
||||
c-strtod
|
||||
c-strtold
|
||||
calloc
|
||||
canon-host
|
||||
canonicalize
|
||||
chown
|
||||
cloexec
|
||||
closein
|
||||
closeout
|
||||
config-h
|
||||
configmake
|
||||
crypto/md5
|
||||
crypto/sha1
|
||||
crypto/sha256
|
||||
crypto/sha512
|
||||
cycle-check
|
||||
d-ino
|
||||
d-type
|
||||
diacrit
|
||||
dirfd
|
||||
dirname
|
||||
dup2
|
||||
error
|
||||
euidaccess
|
||||
exclude
|
||||
exitfail
|
||||
fchdir
|
||||
fcntl
|
||||
fcntl-safer
|
||||
fdl
|
||||
file-type
|
||||
fileblocks
|
||||
filemode
|
||||
filenamecat
|
||||
filevercmp
|
||||
fnmatch-gnu
|
||||
fopen-safer
|
||||
fprintftime
|
||||
fseeko
|
||||
fsusage
|
||||
ftello
|
||||
ftruncate
|
||||
fts
|
||||
gendocs
|
||||
getdate
|
||||
getgroups
|
||||
gethrxtime
|
||||
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
|
||||
maintainer-makefile
|
||||
malloc
|
||||
manywarnings
|
||||
mbrtowc
|
||||
mbsalign
|
||||
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
|
||||
randint
|
||||
randperm
|
||||
readlink
|
||||
readtokens
|
||||
readtokens0
|
||||
readutmp
|
||||
realloc
|
||||
regex
|
||||
rename-dest-slash
|
||||
rmdir
|
||||
rmdir-errno
|
||||
root-dev-ino
|
||||
rpmatch
|
||||
safe-read
|
||||
same
|
||||
save-cwd
|
||||
savedir
|
||||
savewd
|
||||
selinux-at
|
||||
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
|
||||
uptime
|
||||
useless-if-before-free
|
||||
userspec
|
||||
utimecmp
|
||||
utimens
|
||||
vasprintf-posix
|
||||
vc-list-files
|
||||
verify
|
||||
verror
|
||||
version-etc-fsf
|
||||
warnings
|
||||
wcwidth
|
||||
winsz-ioctl
|
||||
winsz-termios
|
||||
write-any-file
|
||||
xalloc
|
||||
xfreopen
|
||||
xgetcwd
|
||||
xgethostname
|
||||
xmemcoll
|
||||
xnanosleep
|
||||
xprintf
|
||||
xprintf-posix
|
||||
xstrtod
|
||||
xstrtoimax
|
||||
xstrtol
|
||||
xstrtold
|
||||
xstrtoumax
|
||||
yesno
|
||||
"
|
||||
|
||||
# Other locale categories that need message catalogs.
|
||||
@@ -110,17 +245,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.
|
||||
@@ -160,5 +297,21 @@ fi
|
||||
|
||||
gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
|
||||
|
||||
# Build prerequisites
|
||||
buildreq="\
|
||||
autoconf 2.61
|
||||
automake 1.10b
|
||||
autopoint -
|
||||
bison -
|
||||
gettext -
|
||||
git 1.4.4
|
||||
gperf -
|
||||
gzip -
|
||||
makeinfo -
|
||||
perl 5.5
|
||||
rsync -
|
||||
tar -
|
||||
"
|
||||
|
||||
# Automake requires that ChangeLog exist.
|
||||
touch ChangeLog
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
## Vaucanson, a generic library for finite state machines.
|
||||
## Copyright (C) 2006, 2007 The Vaucanson Group.
|
||||
##
|
||||
## 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 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## The complete GNU General Public Licence Notice can be found as the
|
||||
## `COPYING' file in the root directory.
|
||||
|
||||
## Override the definition from Automake to generate a log file with
|
||||
## failed tests. It also supports parallel make checks.
|
||||
##
|
||||
## This file provides special support for "unit tests", that is to
|
||||
## say, tests that (once run) no longer need to be re-compiled and
|
||||
## re-run at each "make check", unless their sources changed. To
|
||||
## enable unit-test supports, define LAZY_TEST_SUITE. In such a
|
||||
## setting, that heavily relies on correct dependencies, its users may
|
||||
## prefer to define EXTRA_PROGRAMS instead of check_PROGRAMS, because
|
||||
## it allows intertwined compilation and execution of the tests.
|
||||
## Sometimes this helps catching errors earlier (you don't have to
|
||||
## wait for all the tests to be compiled).
|
||||
##
|
||||
## Define TEST_SUITE_LOG to be the name of the global log to create.
|
||||
## Define TEST_LOGS to the set of logs to include in it. One possibility
|
||||
## is $(TESTS:.test=.log).
|
||||
##
|
||||
## In addition to the magic "exit 77 means SKIP" feature (which was
|
||||
## imported from automake), there is a magic "exit 177 means FAIL" feature
|
||||
## which is useful if you need to issue a hard error no matter whether the
|
||||
## test is XFAIL or not.
|
||||
|
||||
# Use a POSIX-compatible shell if available, as this file uses
|
||||
# features of the POSIX shell that are not supported by some standard
|
||||
# shell implementations (e.g., Solaris 10 /bin/sh).
|
||||
SHELL = $(PREFERABLY_POSIX_SHELL)
|
||||
|
||||
# Set this to `false' to disable hard errors.
|
||||
ENABLE_HARD_ERRORS = :
|
||||
|
||||
## We use GNU Make extensions (%-rules) inside GNU_MAKE checks,
|
||||
## and we override check-TESTS.
|
||||
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/.*//'
|
||||
am__rst_section = sed 'p;s/./=/g;p;g'
|
||||
|
||||
# Put stdin (possibly several lines separated by ". ") in a box.
|
||||
am__text_box = $(AWK) '{gsub ("\\. ", "\n"); print $$0; }' | \
|
||||
$(AWK) ' \
|
||||
max < length($$0) { \
|
||||
final= final (final ? "\n" : "") " " $$0; \
|
||||
max = length($$0); \
|
||||
} \
|
||||
END { \
|
||||
for (i = 0; i < max + 2 ; ++i) \
|
||||
line = line "="; \
|
||||
print line; \
|
||||
print final; \
|
||||
print line; \
|
||||
}'
|
||||
|
||||
# If stdout is a tty and TERM is smart then use colors. If test -t or
|
||||
# tput are not supported then this fails; a conservative approach. Of
|
||||
# course do not redirect stdout here, just stderr...
|
||||
am__tty_colors = \
|
||||
red=; \
|
||||
grn=; \
|
||||
lgn=; \
|
||||
blu=; \
|
||||
std=; \
|
||||
test "X$$TERM" != Xdumb && \
|
||||
test -t 1 2>/dev/null && \
|
||||
tput bold 1 >/dev/null 2>&1 && \
|
||||
tput setaf 1 >/dev/null 2>&1 && \
|
||||
tput sgr0 >/dev/null 2>&1 && \
|
||||
{ \
|
||||
red=$$(tput setaf 1); \
|
||||
grn=$$(tput setaf 2); \
|
||||
lgn=$$(tput bold)$$(tput setaf 2); \
|
||||
blu=$$(tput setaf 4); \
|
||||
std=$$(tput sgr0); \
|
||||
}
|
||||
|
||||
# Solaris 10 'make', and several other traditional 'make' implementations,
|
||||
# pass "-e" to $(SHELL). This contradicts POSIX. Work around the problem
|
||||
# by disabling -e (using the XSI extension "set +e") if it's set.
|
||||
SH_E_WORKAROUND = case $$- in *e*) set +e;; esac
|
||||
|
||||
# Emulate dirname with sed.
|
||||
_d_no_slash = s,^[^/]*$$,.,
|
||||
_d_strip_trailing = s,\([^/]\)//*$$,\1,
|
||||
_d_abs_trivial = s,^//*[^/]*$$,/,
|
||||
_d_rm_basename = s,\([^/]\)//*[^/]*$$,\1,
|
||||
_dirname = \
|
||||
sed '$(_d_no_slash);$(_d_strip_trailing);$(_d_abs_trivial);$(_d_rm_basename)'
|
||||
|
||||
# To be inserted before the command running the test. Creates the
|
||||
# directory for the log if needed. Stores in $dir the directory
|
||||
# containing $src, and passes TESTS_ENVIRONMENT.
|
||||
# Save and restore TERM around use of TESTS_ENVIRONMENT,
|
||||
# in case that unsets it.
|
||||
am__check_pre = \
|
||||
$(SH_E_WORKAROUND); \
|
||||
tst=`echo "$$src" | sed 's|^.*/||'`; \
|
||||
rm -f $@-t; \
|
||||
trap 'st=$$?; rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st' \
|
||||
1 2 13 15; \
|
||||
$(mkdir_p) "$$(echo '$@'|$(_dirname))" || exit; \
|
||||
if test -f "./$$src"; then dir=./; \
|
||||
elif test -f "$$src"; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
__SAVED_TERM=$$TERM; \
|
||||
$(TESTS_ENVIRONMENT)
|
||||
|
||||
# To be appended to the command running the test. Handles the stdout
|
||||
# and stderr redirection, and catch the exit status.
|
||||
am__check_post = \
|
||||
>$@-t 2>&1; \
|
||||
estatus=$$?; \
|
||||
if test $$estatus -eq 177; then \
|
||||
$(ENABLE_HARD_ERRORS) || estatus=1; \
|
||||
fi; \
|
||||
TERM=$$__SAVED_TERM; export TERM; \
|
||||
$(am__tty_colors); \
|
||||
xfailed=PASS; \
|
||||
for xfail in : $(XFAIL_TESTS); do \
|
||||
case $$src in \
|
||||
$$xfail | */$$xfail) xfailed=XFAIL; break; \
|
||||
esac; \
|
||||
done; \
|
||||
case $$estatus:$$xfailed in \
|
||||
0:XFAIL) col=$$red; res=XPASS;; \
|
||||
0:*) col=$$grn; res=PASS ;; \
|
||||
77:*) col=$$blu; res=SKIP ;; \
|
||||
177:*) col=$$red; res=FAIL ;; \
|
||||
*:XFAIL) col=$$lgn; res=XFAIL;; \
|
||||
*:*) col=$$red; res=FAIL ;; \
|
||||
esac; \
|
||||
echo "$${col}$$res$${std}: $@"; \
|
||||
echo "$$res: $@ (exit: $$estatus)" | \
|
||||
$(am__rst_section) >$@; \
|
||||
cat $@-t >>$@; \
|
||||
rm $@-t
|
||||
|
||||
SUFFIXES += .html .log
|
||||
|
||||
# From a test (with no extension) to a log file.
|
||||
if GNU_MAKE
|
||||
%.log: %
|
||||
@src='$<'; $(am__check_pre) "$$dir$$src" $(am__check_post)
|
||||
else
|
||||
# With POSIX 'make', inference rules cannot have FOO.log depend on FOO.
|
||||
# Work around the problem by calculating the dependency dynamically, and
|
||||
# then invoking a submake with the calculated dependency.
|
||||
CHECK-FORCE:
|
||||
DEPENDENCY = CHECK-FORCE
|
||||
$(TEST_LOGS): $(DEPENDENCY)
|
||||
@if test '$(DEPENDENCY)' = CHECK-FORCE; then \
|
||||
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); \
|
||||
fi
|
||||
endif
|
||||
|
||||
#TEST_LOGS = $(TESTS:.test=.log)
|
||||
TEST_SUITE_LOG = test-suite.log
|
||||
|
||||
$(TEST_SUITE_LOG): $(TEST_LOGS)
|
||||
@$(SH_E_WORKAROUND); \
|
||||
results=$$(for f in $(TEST_LOGS); do sed 1q $$f; done); \
|
||||
all=$$(echo "$$results" | wc -l | sed -e 's/^[ \t]*//'); \
|
||||
fail=$$(echo "$$results" | grep -c '^FAIL'); \
|
||||
pass=$$(echo "$$results" | grep -c '^PASS'); \
|
||||
skip=$$(echo "$$results" | grep -c '^SKIP'); \
|
||||
xfail=$$(echo "$$results" | grep -c '^XFAIL'); \
|
||||
xpass=$$(echo "$$results" | grep -c '^XPASS'); \
|
||||
failures=$$(expr $$fail + $$xpass); \
|
||||
case fail=$$fail:xpass=$$xpass:xfail=$$xfail in \
|
||||
fail=0:xpass=0:xfail=0) \
|
||||
msg="All $$all tests passed. "; \
|
||||
exit=true;; \
|
||||
fail=0:xpass=0:xfail=*) \
|
||||
msg="All $$all tests behaved as expected"; \
|
||||
msg="$$msg ($$xfail expected failures). "; \
|
||||
exit=true;; \
|
||||
fail=*:xpass=0:xfail=*) \
|
||||
msg="$$fail of $$all tests failed. "; \
|
||||
exit=false;; \
|
||||
fail=*:xpass=*:xfail=*) \
|
||||
msg="$$failures of $$all tests did not behave as expected"; \
|
||||
msg="$$msg ($$xpass unexpected passes). "; \
|
||||
exit=false;; \
|
||||
*) \
|
||||
echo >&2 "incorrect case"; exit 4;; \
|
||||
esac; \
|
||||
if test "$$skip" -ne 0; then \
|
||||
msg="$$msg($$skip tests were not run). "; \
|
||||
fi; \
|
||||
if test "$$failures" -ne 0; then \
|
||||
{ \
|
||||
echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
|
||||
$(am__rst_title); \
|
||||
echo "$$msg"; \
|
||||
echo; \
|
||||
echo ".. contents:: :depth: 2"; \
|
||||
echo; \
|
||||
for f in $(TEST_LOGS); \
|
||||
do \
|
||||
case $$(sed 1q $$f) in \
|
||||
SKIP:*|PASS:*|XFAIL:*);; \
|
||||
*) echo; cat $$f;; \
|
||||
esac; \
|
||||
done; \
|
||||
} >$(TEST_SUITE_LOG).tmp; \
|
||||
mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
|
||||
msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG). "; \
|
||||
if test -n "$(PACKAGE_BUGREPORT)"; then \
|
||||
msg="$${msg}Please report it to $(PACKAGE_BUGREPORT). "; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(am__tty_colors); \
|
||||
if $$exit; then echo $$grn; else echo $$red; fi; \
|
||||
echo "$$msg" | $(am__text_box); \
|
||||
echo $$std; \
|
||||
test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG); \
|
||||
$$exit
|
||||
|
||||
# if test x"$$VERBOSE" != x && ! $exit; then
|
||||
|
||||
# Run all the tests.
|
||||
check-TESTS:
|
||||
@if test -z '$(LAZY_TEST_SUITE)'; then \
|
||||
rm -f $(TEST_SUITE_LOG) $(TEST_LOGS); \
|
||||
fi
|
||||
@$(MAKE) $(TEST_SUITE_LOG)
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Produce HTML. ##
|
||||
## -------------- ##
|
||||
|
||||
TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
|
||||
|
||||
.log.html:
|
||||
@for r2h in $(RST2HTML) $$RST2HTML rst2html rst2html.py; \
|
||||
do \
|
||||
if ($$r2h --version) >/dev/null 2>&1; then \
|
||||
R2H=$$r2h; \
|
||||
fi; \
|
||||
done; \
|
||||
if test -z "$$R2H"; then \
|
||||
echo >&2 "cannot find rst2html, cannot create $@"; \
|
||||
exit 2; \
|
||||
fi; \
|
||||
$$R2H $< >$@.tmp
|
||||
@mv $@.tmp $@
|
||||
|
||||
# Be sure to run check-TESTS first, and then to convert the result.
|
||||
# Beware of concurrent executions. And expect check-TESTS to fail.
|
||||
check-html:
|
||||
@if $(MAKE) $(AM_MAKEFLAGS) check-TESTS; then :; else \
|
||||
rv=$$?; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML); \
|
||||
exit $$rv; \
|
||||
fi
|
||||
|
||||
.PHONY: check-html
|
||||
|
||||
|
||||
## ------- ##
|
||||
## Clean. ##
|
||||
## ------- ##
|
||||
|
||||
check-clean:
|
||||
rm -f $(CHECK_CLEANFILES) $(TEST_SUITE_LOG) $(TEST_SUITE_HTML) $(TEST_LOGS)
|
||||
.PHONY: check-clean
|
||||
clean-local: check-clean
|
||||
176
cfg.mk
176
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
|
||||
|
||||
@@ -28,18 +31,169 @@ url_dir_list = \
|
||||
gpg_key_ID = B9AB9A16
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
# Exclude changelog-check here so that there's less churn in ChangeLog
|
||||
# files -- otherwise, you'd need to have the upcoming version number
|
||||
# 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
|
||||
local-checks-to-skip = strftime-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
|
||||
# release. Used to get gnulib's SHA1 for the "announcement" target and
|
||||
# for signing release tags.
|
||||
gnulib_dir = gnulib
|
||||
|
||||
# Now that we have better (check.mk) tests, make this the default.
|
||||
# Tools used to bootstrap this package, used for "announcement".
|
||||
bootstrap-tools = autoconf,automake,gnulib,bison
|
||||
|
||||
# Now that we have better tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
old_NEWS_hash = 95fc7a26fa253d57cabe4b058167a4f9 -
|
||||
old_NEWS_hash = 40279d1aa0a0ef3ca9d1f0a001eb9e2f
|
||||
|
||||
# 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; } || :
|
||||
|
||||
ALL_RECURSIVE_TARGETS += sc_tight_scope
|
||||
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
|
||||
|
||||
include $(srcdir)/dist-check.mk
|
||||
|
||||
141
configure.ac
141
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,13 @@ 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.10a dist-lzma])
|
||||
AM_INIT_AUTOMAKE([1.10b dist-xz color-tests parallel-tests])
|
||||
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
|
||||
|
||||
AC_PROG_CC_STDC
|
||||
AM_PROG_CC_C_O
|
||||
@@ -44,20 +45,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 +161,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 +210,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 +244,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 +269,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 +282,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 +294,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
|
||||
|
||||
|
||||
135
dist-check.mk
Normal file
135
dist-check.mk
Normal file
@@ -0,0 +1,135 @@
|
||||
# Most of this is probably too coreutils-centric to be useful to other packages.
|
||||
|
||||
warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
|
||||
bin=bin-$$$$
|
||||
|
||||
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
|
||||
|
||||
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.
|
||||
ALL_RECURSIVE_TARGETS += taint-distcheck
|
||||
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
|
||||
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 "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
|
||||
endef
|
||||
|
||||
# Install, then verify that all binaries and man pages are in place.
|
||||
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
|
||||
define my-instcheck
|
||||
$(MAKE) prefix=$(pfx) install \
|
||||
&& test ! -f $(pfx)/bin/ginstall \
|
||||
&& { fail=0; \
|
||||
for i in $(built_programs); do \
|
||||
test "$$i" = ginstall && i=install; \
|
||||
for j in "$(pfx)/bin/$$i" \
|
||||
"$(pfx)/share/man/man1/$$i.1"; do \
|
||||
case $$j in *'[.1') continue;; esac; \
|
||||
test -f "$$j" && : \
|
||||
|| { echo "$$j not installed"; fail=1; }; \
|
||||
done; \
|
||||
done; \
|
||||
test $$fail = 1 && exit 1 || :; \
|
||||
}
|
||||
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.
|
||||
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||
# have to have a recent version of gcc and glibc headers.
|
||||
# The hard-linking for-loop below ensures that there is a bin/ directory
|
||||
# full of all of the programs under test (except the ones that are required
|
||||
# for basic Makefile rules), all symlinked to the just-built "false" program.
|
||||
# This is to ensure that if ever a test neglects to make PATH include
|
||||
# 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.
|
||||
ALL_RECURSIVE_TARGETS += my-distcheck
|
||||
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
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --disable-nls \
|
||||
&& $(MAKE) CFLAGS='$(warn_cflags)' \
|
||||
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(install-transform-check) \
|
||||
&& $(my-instcheck) \
|
||||
&& $(coreutils-path-check) \
|
||||
&& $(MAKE) distclean
|
||||
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||
-rm -rf $(t)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
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-2008 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,50 +53,69 @@ 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; \
|
||||
grep '@url{' $(srcdir)/*.texi && fail=1; \
|
||||
grep '\$$@"' $(srcdir)/*.texi && fail=1; \
|
||||
grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \
|
||||
grep -n filename $(srcdir)/*.texi \
|
||||
| $(EGREP) -v 'setfilename|[{]filename[}]' \
|
||||
&& fail=1; \
|
||||
$(PERL) -e 1 2> /dev/null && { $(PERL) -ne \
|
||||
$(AM_V_GEN)fail=0; \
|
||||
grep '@url{' $(srcdir)/*.texi && fail=1; \
|
||||
grep '\$$@"' $(srcdir)/*.texi && fail=1; \
|
||||
grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \
|
||||
grep -n filename $(srcdir)/*.texi \
|
||||
| $(EGREP) -v 'setfilename|[{]filename[}]' \
|
||||
&& fail=1; \
|
||||
$(PERL) -e 1 2> /dev/null && { $(PERL) -ne \
|
||||
'/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \
|
||||
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
|
||||
$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \
|
||||
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
|
||||
$(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 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
|
||||
exit $$fail
|
||||
|
||||
# Use `time zone', not `timezone'.
|
||||
sc-avoid-timezone:
|
||||
$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
|
||||
$(AM_V_GEN)$(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 || :
|
||||
$(AM_V_GEN)$(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 || :
|
||||
$(AM_V_GEN)$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# Say I/O, not IO.
|
||||
sc-avoid-io:
|
||||
$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
$(AM_V_GEN)$(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 || :
|
||||
$(AM_V_GEN)$(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 || :
|
||||
$(AM_V_GEN)$(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:
|
||||
$(AM_V_GEN)$(PERL) -e 1 \
|
||||
&& $(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
|
||||
|
||||
check: check-texinfo
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
perl -pi -e \
|
||||
's/\@code\{('"$(echo cp dd df dir dircolors du install ln ls mkdir mkfifo mknod mv shred touch vdir|tr ' ' '|')"')\}/\@command{$1}/' coreutils.texi
|
||||
|
||||
perl -pi -e \
|
||||
's/\@code\{('"$(echo cp dd df dir dircolors du install ln ls mkdir mkfifo mknod mv shred touch vdir|tr ' ' '|')"')\}/\@command{$1}/' coreutils.texi
|
||||
|
||||
regex=$((textutils; shellutils) | tr -s ' ' '|')
|
||||
perl -pi -e 's/\@code\{('"$regex"')\}/\@command{$1}/' coreutils.texi
|
||||
1157
doc/coreutils.texi
1157
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);
|
||||
236
gl/lib/mbsalign.c
Normal file
236
gl/lib/mbsalign.c
Normal file
@@ -0,0 +1,236 @@
|
||||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Pádraig Brady. */
|
||||
|
||||
#include <config.h>
|
||||
#include "mbsalign.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/* Replace non printable chars.
|
||||
Return 1 if replacement made, 0 otherwise. */
|
||||
|
||||
static bool
|
||||
wc_ensure_printable (wchar_t *wchars)
|
||||
{
|
||||
bool replaced = false;
|
||||
wchar_t *wc = wchars;
|
||||
while (*wc)
|
||||
{
|
||||
if (!iswprint ((wint_t) *wc))
|
||||
{
|
||||
*wc = 0xFFFD; /* L'\uFFFD' (replacement char) */
|
||||
replaced = true;
|
||||
}
|
||||
wc++;
|
||||
}
|
||||
return replaced;
|
||||
}
|
||||
|
||||
/* Truncate wchar string to width cells.
|
||||
* Returns number of cells used. */
|
||||
|
||||
static size_t
|
||||
wc_truncate (wchar_t *wc, size_t width)
|
||||
{
|
||||
size_t cells = 0;
|
||||
int next_cells = 0;
|
||||
|
||||
while (*wc)
|
||||
{
|
||||
next_cells = wcwidth (*wc);
|
||||
if (next_cells == -1) /* non printable */
|
||||
{
|
||||
*wc = 0xFFFD; /* L'\uFFFD' (replacement char) */
|
||||
next_cells = 1;
|
||||
}
|
||||
if (cells + next_cells > width)
|
||||
break;
|
||||
cells += next_cells;
|
||||
wc++;
|
||||
}
|
||||
*wc = L'\0';
|
||||
return cells;
|
||||
}
|
||||
|
||||
/* FIXME: move this function to gnulib as it's missing on:
|
||||
OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS */
|
||||
|
||||
static int
|
||||
rpl_wcswidth (const wchar_t *s, size_t n)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
while (n-- > 0 && *s != L'\0')
|
||||
{
|
||||
int nwidth = wcwidth (*s++);
|
||||
if (nwidth == -1) /* non printable */
|
||||
return -1;
|
||||
if (ret > (INT_MAX - nwidth)) /* overflow */
|
||||
return -1;
|
||||
ret += nwidth;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Write N_SPACES space characters to DEST while ensuring
|
||||
nothing is written beyond DEST_END. A terminating NUL
|
||||
is always added to DEST.
|
||||
A pointer to the terminating NUL is returned. */
|
||||
|
||||
static char*
|
||||
mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
|
||||
{
|
||||
/* FIXME: Should we pad with "figure space" (\u2007)
|
||||
if non ascii data present? */
|
||||
while (n_spaces-- && (dest < dest_end))
|
||||
*dest++ = ' ';
|
||||
*dest = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Align a string, SRC, in a field of *WIDTH columns, handling multi-byte
|
||||
characters; write the result into the DEST_SIZE-byte buffer, DEST.
|
||||
ALIGNMENT specifies whether to left- or right-justify or to center.
|
||||
If SRC requires more than *WIDTH columns, truncate it to fit.
|
||||
When centering, the number of trailing spaces may be one less than the
|
||||
number of leading spaces. The FLAGS parameter is unused at present.
|
||||
Return the length in bytes required for the final result, not counting
|
||||
the trailing NUL. A return value of DEST_SIZE or larger means there
|
||||
wasn't enough space. DEST will be NUL terminated in any case.
|
||||
Return (size_t) -1 upon error (invalid multi-byte sequence in SRC,
|
||||
or malloc failure).
|
||||
Update *WIDTH to indicate how many columns were used before padding. */
|
||||
|
||||
size_t
|
||||
mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
size_t *width, mbs_align_t align, int flags)
|
||||
{
|
||||
size_t ret = -1;
|
||||
size_t src_size = strlen (src) + 1;
|
||||
char *newstr = NULL;
|
||||
wchar_t *str_wc = NULL;
|
||||
const char *str_to_print = src;
|
||||
size_t n_cols = src_size - 1;
|
||||
size_t n_used_bytes = n_cols; /* Not including NUL */
|
||||
size_t n_spaces = 0;
|
||||
bool conversion = false;
|
||||
bool wc_enabled = false;
|
||||
|
||||
/* In multi-byte locales convert to wide characters
|
||||
to allow easy truncation. Also determine number
|
||||
of screen columns used. */
|
||||
if (MB_CUR_MAX > 1)
|
||||
{
|
||||
size_t src_chars = mbstowcs (NULL, src, 0);
|
||||
if (src_chars == (size_t) -1)
|
||||
goto mbsalign_cleanup;
|
||||
src_chars += 1; /* make space for NUL */
|
||||
str_wc = malloc (src_chars * sizeof (wchar_t));
|
||||
if (str_wc == NULL)
|
||||
goto mbsalign_cleanup;
|
||||
if (mbstowcs (str_wc, src, src_chars) > 0)
|
||||
{
|
||||
str_wc[src_chars - 1] = L'\0';
|
||||
wc_enabled = true;
|
||||
conversion = wc_ensure_printable (str_wc);
|
||||
n_cols = rpl_wcswidth (str_wc, src_chars);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we transformed or need to truncate the source string
|
||||
then create a modified copy of it. */
|
||||
if (conversion || (n_cols > *width))
|
||||
{
|
||||
newstr = malloc (src_size);
|
||||
if (newstr == NULL)
|
||||
goto mbsalign_cleanup;
|
||||
str_to_print = newstr;
|
||||
if (wc_enabled)
|
||||
{
|
||||
n_cols = wc_truncate (str_wc, *width);
|
||||
n_used_bytes = wcstombs (newstr, str_wc, src_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
n_cols = *width;
|
||||
n_used_bytes = n_cols;
|
||||
memcpy (newstr, src, n_cols);
|
||||
newstr[n_cols] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (*width > n_cols)
|
||||
n_spaces = *width - n_cols;
|
||||
|
||||
/* indicate to caller how many cells needed (not including padding). */
|
||||
*width = n_cols;
|
||||
|
||||
/* indicate to caller how many bytes needed (not including NUL). */
|
||||
ret = n_used_bytes + (n_spaces * 1);
|
||||
|
||||
/* Write as much NUL terminated output to DEST as possible. */
|
||||
if (dest_size != 0)
|
||||
{
|
||||
char *dest_end = dest + dest_size - 1;
|
||||
size_t start_spaces = n_spaces / 2 + n_spaces % 2;
|
||||
size_t end_spaces = n_spaces / 2;
|
||||
|
||||
switch (align)
|
||||
{
|
||||
case MBS_ALIGN_CENTER:
|
||||
start_spaces = n_spaces / 2 + n_spaces % 2;
|
||||
end_spaces = n_spaces / 2;
|
||||
break;
|
||||
case MBS_ALIGN_LEFT:
|
||||
start_spaces = 0;
|
||||
end_spaces = n_spaces;
|
||||
break;
|
||||
case MBS_ALIGN_RIGHT:
|
||||
start_spaces = n_spaces;
|
||||
end_spaces = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
dest = mbs_align_pad (dest, dest_end, start_spaces);
|
||||
dest = mempcpy(dest, str_to_print, MIN (n_used_bytes, dest_end - dest));
|
||||
dest = mbs_align_pad (dest, dest_end, end_spaces);
|
||||
}
|
||||
|
||||
mbsalign_cleanup:
|
||||
|
||||
free (str_wc);
|
||||
free (newstr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
23
gl/lib/mbsalign.h
Normal file
23
gl/lib/mbsalign.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 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 <stddef.h>
|
||||
|
||||
typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
|
||||
|
||||
size_t
|
||||
mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
size_t *width, mbs_align_t align, int flags);
|
||||
@@ -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,33 @@ 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;
|
||||
int last_n_groups = max_n_groups;
|
||||
|
||||
/* 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. */
|
||||
/* Some systems (like Darwin) have a bug where they
|
||||
never increase max_n_groups. */
|
||||
if (ng < 0 && last_n_groups == max_n_groups)
|
||||
max_n_groups *= 2;
|
||||
|
||||
if (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 +99,14 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
return -1;
|
||||
}
|
||||
g = h;
|
||||
|
||||
if (0 <= ng)
|
||||
{
|
||||
*groups = g;
|
||||
/* On success some systems just return 0 from getgrouplist,
|
||||
so return max_n_groups rather than ng. */
|
||||
return max_n_groups;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* else no username, so fall through and use getgroups. */
|
||||
@@ -125,7 +121,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;
|
||||
|
||||
|
||||
@@ -50,10 +50,6 @@ main (int argc, char **argv)
|
||||
|
||||
#include "xalloc.h"
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
/* A source of random data for generating random integers. */
|
||||
struct randint_source
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -39,18 +39,18 @@
|
||||
#include "unlocked-io.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
# define __attribute__(x)
|
||||
# define __attribute__(x) /* empty */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#ifndef ATTRIBUTE_NORETURN
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#if _STRING_ARCH_unaligned
|
||||
@@ -60,10 +60,6 @@
|
||||
# define ALIGNED_POINTER(ptr, type) ((size_t) (ptr) % alignof (type) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_RANDOM_FILE
|
||||
# define DEFAULT_RANDOM_FILE "/dev/urandom"
|
||||
#endif
|
||||
|
||||
/* The maximum buffer size used for reads of random data. Using the
|
||||
value 2 * ISAAC_BYTES makes this the largest power of two that
|
||||
would not otherwise cause struct randread_source to grow. */
|
||||
@@ -72,10 +68,8 @@
|
||||
/* A source of random data for generating random buffers. */
|
||||
struct randread_source
|
||||
{
|
||||
/* Stream to read random bytes from. If null, the behavior is
|
||||
undefined; the current implementation uses ISAAC in this case,
|
||||
but this is for old-fashioned implementations that lack
|
||||
/dev/urandom and callers should not rely on this. */
|
||||
/* Stream to read random bytes from. If null, the current
|
||||
implementation uses an internal PRNG (ISAAC). */
|
||||
FILE *source;
|
||||
|
||||
/* Function to call, and its argument, if there is an input error or
|
||||
@@ -116,7 +110,7 @@ struct randread_source
|
||||
|
||||
/* The default error handler. */
|
||||
|
||||
static void
|
||||
static void ATTRIBUTE_NORETURN
|
||||
randread_error (void const *file_name)
|
||||
{
|
||||
if (file_name)
|
||||
@@ -157,18 +151,14 @@ randread_new (char const *name, size_t bytes_bound)
|
||||
return simple_new (NULL, NULL);
|
||||
else
|
||||
{
|
||||
char const *file_name = (name ? name : DEFAULT_RANDOM_FILE);
|
||||
FILE *source = fopen_safer (file_name, "rb");
|
||||
FILE *source = NULL;
|
||||
struct randread_source *s;
|
||||
|
||||
if (! source)
|
||||
{
|
||||
if (name)
|
||||
return NULL;
|
||||
file_name = NULL;
|
||||
}
|
||||
if (name)
|
||||
if (! (source = fopen_safer (name, "rb")))
|
||||
return NULL;
|
||||
|
||||
s = simple_new (source, file_name);
|
||||
s = simple_new (source, name);
|
||||
|
||||
if (source)
|
||||
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
26
gl/modules/mbsalign
Normal file
26
gl/modules/mbsalign
Normal file
@@ -0,0 +1,26 @@
|
||||
Description:
|
||||
Align/Truncate a string in a given screen width.
|
||||
|
||||
Files:
|
||||
lib/mbsalign.c
|
||||
lib/mbsalign.h
|
||||
|
||||
Depends-on:
|
||||
wchar
|
||||
wctype
|
||||
wcwidth
|
||||
mempcpy
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += mbsalign.c mbsalign.h
|
||||
|
||||
Include:
|
||||
"mbsalign.h"
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Pádraig Brady
|
||||
@@ -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 278d609ead
@@ -1,6 +1 @@
|
||||
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 \
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/* stdopen.c - ensure that the three standard file descriptors are in use
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert and Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "stdopen.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Try to ensure that all of the standard file numbers (0, 1, 2)
|
||||
are in use. Without this, each application would have to guard
|
||||
every call to open, dup, fopen, etc. with tests to ensure they
|
||||
don't use one of the special file numbers when opening a file.
|
||||
Return false if at least one of the file descriptors is initially
|
||||
closed and an attempt to reopen it fails. Otherwise, return true. */
|
||||
bool
|
||||
stdopen (void)
|
||||
{
|
||||
int fd;
|
||||
bool ok = true;
|
||||
|
||||
for (fd = 0; fd <= 2; fd++)
|
||||
{
|
||||
if (fcntl (fd, F_GETFD) < 0)
|
||||
{
|
||||
if (errno != EBADF)
|
||||
ok = false;
|
||||
else
|
||||
{
|
||||
static const int contrary_mode[]
|
||||
= { O_WRONLY, O_RDONLY, O_RDONLY };
|
||||
int mode = contrary_mode[fd];
|
||||
int new_fd;
|
||||
/* Open /dev/null with the contrary mode so that the typical
|
||||
read (stdin) or write (stdout, stderr) operation will fail.
|
||||
With descriptor 0, we can do even better on systems that
|
||||
have /dev/full, by opening that write-only instead of
|
||||
/dev/null. The only drawback is that a write-provoked
|
||||
failure comes with a misleading errno value, ENOSPC. */
|
||||
if (mode == O_RDONLY
|
||||
|| (new_fd = open ("/dev/full", mode) != fd))
|
||||
new_fd = open ("/dev/null", mode);
|
||||
if (new_fd != fd)
|
||||
{
|
||||
if (0 <= new_fd)
|
||||
close (new_fd);
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef STDOPEN_H
|
||||
# define STDOPEN_H 1
|
||||
|
||||
# include <stdbool.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
bool stdopen (void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ AC_DEFUN([cu_GMP],
|
||||
[test "$ac_cv_search___gmpz_init" = "none required" ||
|
||||
{
|
||||
LIB_GMP=$ac_cv_search___gmpz_init
|
||||
AC_DEFINE([HAVE_GMP], 1,
|
||||
AC_DEFINE([HAVE_GMP], [1],
|
||||
[Define if you have GNU libgmp (or replacement)])
|
||||
}])
|
||||
LIBS=$cu_saved_libs
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#serial 107 -*- autoconf -*-
|
||||
#serial 109 -*- autoconf -*-
|
||||
|
||||
dnl Misc type-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1998, 2000-2008 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,15 @@ 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])
|
||||
@@ -79,7 +79,7 @@ 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
|
||||
@@ -88,8 +88,9 @@ AC_DEFUN([coreutils_MACROS],
|
||||
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])]
|
||||
[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])])
|
||||
])
|
||||
@@ -100,16 +101,16 @@ AC_DEFUN([coreutils_MACROS],
|
||||
# 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"
|
||||
])
|
||||
|
||||
@@ -132,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>
|
||||
@@ -153,7 +154,7 @@ 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_TYPE_UNSIGNED_LONG_LONG_INT])
|
||||
@@ -173,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
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#serial 1
|
||||
dnl Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_STDOPEN],
|
||||
[
|
||||
AC_LIBSOURCES([stdopen.c, stdopen.h])
|
||||
AC_LIBOBJ([stdopen])
|
||||
|
||||
dnl Prerequisites.
|
||||
])
|
||||
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
|
||||
])
|
||||
891
maint.mk
891
maint.mk
@@ -1,891 +0,0 @@
|
||||
# -*-Makefile-*-
|
||||
# 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.
|
||||
##
|
||||
## 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/>.
|
||||
|
||||
# This is reported not to work with make-3.79.1
|
||||
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
ME := maint.mk
|
||||
|
||||
# Do not save the original name or timestamp in the .tar.gz file.
|
||||
# Use --rsyncable if available.
|
||||
gzip_rsyncable := \
|
||||
$(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
|
||||
GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
|
||||
|
||||
GIT = git
|
||||
VC = $(GIT)
|
||||
VC-tag = git tag -s -m '$(VERSION)'
|
||||
|
||||
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
|
||||
|
||||
ifeq ($(origin prev_version_file), undefined)
|
||||
prev_version_file = $(srcdir)/.prev-version
|
||||
endif
|
||||
|
||||
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||
VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
|
||||
|
||||
ifeq ($(VC),$(GIT))
|
||||
this-vc-tag = v$(VERSION)
|
||||
this-vc-tag-regexp = v$(VERSION_REGEXP)
|
||||
else
|
||||
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
||||
tag-this-version = $(subst .,_,$(VERSION))
|
||||
this-vc-tag = $(tag-package)-$(tag-this-version)
|
||||
this-vc-tag-regexp = $(this-vc-tag)
|
||||
endif
|
||||
my_distdir = $(PACKAGE)-$(VERSION)
|
||||
|
||||
# Old releases are stored here.
|
||||
release_archive_dir ?= ../release
|
||||
|
||||
# Prevent programs like 'sort' from considering distinct strings to be equal.
|
||||
# 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))
|
||||
.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 \
|
||||
makefile-check check-AUTHORS
|
||||
.PHONY: $(local-checks-available)
|
||||
|
||||
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
|
||||
|
||||
syntax-check: $(local-check)
|
||||
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
|
||||
# $$(find -type f -name '*.[chly]') && \
|
||||
# { echo '$(ME): found conditional include' 1>&2; \
|
||||
# exit 1; } || :
|
||||
|
||||
# grep -nE '^# *include <(string|stdlib)\.h>' \
|
||||
# $(srcdir)/{lib,src}/*.[chy] && \
|
||||
# { echo '$(ME): FIXME' 1>&2; \
|
||||
# exit 1; } || :
|
||||
# FIXME: don't allow `#include .strings\.h' anywhere
|
||||
|
||||
sc_avoid_if_before_free:
|
||||
@$(srcdir)/build-aux/useless-if-before-free \
|
||||
$(useless_free_options) \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found useless "if" before "free" above' 1>&2; \
|
||||
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; } || :
|
||||
|
||||
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; } || :
|
||||
|
||||
sc_cast_of_alloca_return_value:
|
||||
@grep -nE '\*\) *alloca\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_space_tab:
|
||||
@grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# 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; } || :
|
||||
|
||||
# Use STREQ rather than comparing strcmp == 0, or != 0.
|
||||
sc_prohibit_strcmp:
|
||||
@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *==' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ 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; \
|
||||
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; } || :
|
||||
|
||||
# Don't use cpp tests of this symbol. All code assumes config.h is included.
|
||||
sc_no_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; } || :
|
||||
|
||||
# Nearly all .c files must include <config.h>.
|
||||
sc_require_config_h:
|
||||
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
|
||||
grep -L '^# *include <config\.h>' \
|
||||
$$($(VC_LIST_EXCEPT) | grep '\.c$$') \
|
||||
| grep . && \
|
||||
{ echo '$(ME): the above files do not include <config.h>' \
|
||||
1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
# 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.
|
||||
define _header_without_use
|
||||
h_esc=`echo "$$h"|sed 's/\./\\./'`; \
|
||||
if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
|
||||
files=$$(grep -l '^# *include '"$$h_esc" \
|
||||
$$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \
|
||||
grep -LE "$$re" $$files | grep . && \
|
||||
{ echo "$(ME): the above files include $$h but don't use it" \
|
||||
1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
endef
|
||||
|
||||
# Prohibit the inclusion of assert.h without an actual use of assert.
|
||||
sc_prohibit_assert_without_use:
|
||||
@h='<assert.h>' re='\<assert *\(' $(_header_without_use)
|
||||
|
||||
# Prohibit the inclusion of getopt.h without an actual use.
|
||||
sc_prohibit_getopt_without_use:
|
||||
@h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
|
||||
|
||||
# Don't include quotearg.h unless you use one of its functions.
|
||||
sc_prohibit_quotearg_without_use:
|
||||
@h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_header_without_use)
|
||||
|
||||
# Don't include quote.h unless you use one of its functions.
|
||||
sc_prohibit_quote_without_use:
|
||||
@h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
|
||||
|
||||
# Don't include this header unless you use one of its functions.
|
||||
sc_prohibit_long_options_without_use:
|
||||
@h='"long-options.h"' re='\<parse_long_options *\(' \
|
||||
$(_header_without_use)
|
||||
|
||||
# Don't include this header unless you use one of its functions.
|
||||
sc_prohibit_inttostr_without_use:
|
||||
@h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
|
||||
$(_header_without_use)
|
||||
|
||||
# Don't include this header unless you use one of its functions.
|
||||
sc_prohibit_error_without_use:
|
||||
@h='"error.h"' \
|
||||
re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
|
||||
$(_header_without_use)
|
||||
|
||||
sc_prohibit_safe_read_without_use:
|
||||
@h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
|
||||
$(_header_without_use)
|
||||
|
||||
sc_prohibit_argmatch_without_use:
|
||||
@h='"argmatch.h"' \
|
||||
re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
|
||||
$(_header_without_use)
|
||||
|
||||
sc_prohibit_root_dev_ino_without_use:
|
||||
@h='"root-dev-ino.h"' \
|
||||
re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
|
||||
$(_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; } || :
|
||||
|
||||
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
|
||||
|
||||
# Each nonempty line must start with a year number, or a TAB.
|
||||
sc_changelog:
|
||||
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name 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; } || :; \
|
||||
fi
|
||||
|
||||
# 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
|
||||
# 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$$' > /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 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 $@
|
||||
|
||||
sc_trailing_blank:
|
||||
@grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found trailing blank(s)' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Match lines like the following, but where there is only one space
|
||||
# between the options and the description:
|
||||
# -D, --all-repeated[=delimit-method] print all duplicate lines\n
|
||||
longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
|
||||
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"; \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Look for diagnostics that aren't marked for translation.
|
||||
# This won't find any for which error's format string is on a separate line.
|
||||
sc_unmarked_diagnostics:
|
||||
@grep -nE \
|
||||
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -v '_''(' && \
|
||||
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Avoid useless parentheses like those in this example:
|
||||
# #if defined (SYMBOL) || defined (SYM2)
|
||||
sc_useless_cpp_parens:
|
||||
@grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found useless parentheses in cpp directive' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# 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; } || :
|
||||
|
||||
# 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
|
||||
|
||||
NEWS_hash = \
|
||||
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
|
||||
$(srcdir)/NEWS | md5sum -)
|
||||
|
||||
# Ensure that we don't accidentally insert an entry into an old NEWS block.
|
||||
sc_immutable_NEWS:
|
||||
@if test -f $(srcdir)/NEWS; then \
|
||||
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
|
||||
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
|
||||
fi
|
||||
|
||||
# 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 $$fail = 1 && \
|
||||
{ echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Warn about "c0nst struct Foo const foo[]",
|
||||
# but not about "char const *const foo" or "#define const const".
|
||||
sc_redundant_const:
|
||||
@grep -E '\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo 1>&2 '$(ME): redundant "const" in declarations'; \
|
||||
exit 1; } || :
|
||||
|
||||
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; } || :
|
||||
|
||||
# Update the hash stored above. Do this after each release and
|
||||
# for any corrections to old entries.
|
||||
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 $(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 $(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'; \
|
||||
$(MAKE) -C src-c89 CFLAGS='-Wdeclaration-after-statement -Werror' \
|
||||
|| msg='compile failure with extra options'; \
|
||||
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:
|
||||
@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
|
||||
today=`date +%Y-%m-%d`; \
|
||||
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
|
||||
>/dev/null; then \
|
||||
:; \
|
||||
else \
|
||||
echo "version or today's date is not in NEWS" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
changelog-check:
|
||||
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
|
||||
>/dev/null; then \
|
||||
:; \
|
||||
else \
|
||||
echo "$(VERSION) not in ChangeLog" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
m4-check:
|
||||
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
|
||||
&& { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||
po-check:
|
||||
@if test -f po/POTFILES.in; then \
|
||||
grep -E -v '^(#|$$)' po/POTFILES.in \
|
||||
| grep -v '^src/false\.c$$' | sort > $@-1; \
|
||||
files=; \
|
||||
for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
|
||||
case $$file in \
|
||||
*.?|*.??) ;; \
|
||||
*) continue;; \
|
||||
esac; \
|
||||
case $$file in \
|
||||
*.[ch]) \
|
||||
base=`expr " $$file" : ' \(.*\)\..'`; \
|
||||
{ test -f $$base.l || test -f $$base.y; } && continue;; \
|
||||
esac; \
|
||||
files="$$files $$file"; \
|
||||
done; \
|
||||
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
|
||||
| sort -u > $@-2; \
|
||||
diff -u $@-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` \
|
||||
&& { 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 \
|
||||
test -e $$file || continue; \
|
||||
test -w $$file \
|
||||
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
||||
done; \
|
||||
test "$$fail" && exit 1 || : ; \
|
||||
fi
|
||||
|
||||
v_etc_file = lib/version-etc.c
|
||||
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 \
|
||||
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
fi
|
||||
@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; }; \
|
||||
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; }; \
|
||||
fi
|
||||
|
||||
vc-diff-check:
|
||||
$(VC) diff > vc-diffs || :
|
||||
if test -s vc-diffs; then \
|
||||
cat vc-diffs; \
|
||||
echo "Some files are locally modified:" 1>&2; \
|
||||
exit 1; \
|
||||
else \
|
||||
rm vc-diffs; \
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
# Use this to make sure we don't run these programs when building
|
||||
# from a virgin tgz file, below.
|
||||
null_AM_MAKEFLAGS = \
|
||||
ACLOCAL=false \
|
||||
AUTOCONF=false \
|
||||
AUTOMAKE=false \
|
||||
AUTOHEADER=false \
|
||||
MAKEINFO=false
|
||||
|
||||
built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
|
||||
|
||||
warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
|
||||
bin=bin-$$$$
|
||||
|
||||
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
|
||||
|
||||
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/' \
|
||||
prefix=$(pfx) install \
|
||||
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
|
||||
&& test "$$(echo $(pfx)/share/man/man1/*)" = \
|
||||
"$(pfx)/share/man/man1/zyx.1"
|
||||
endef
|
||||
|
||||
# Install, then verify that all binaries and man pages are in place.
|
||||
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
|
||||
define my-instcheck
|
||||
$(MAKE) prefix=$(pfx) install \
|
||||
&& test ! -f $(pfx)/bin/ginstall \
|
||||
&& { fail=0; \
|
||||
for i in $(built_programs); do \
|
||||
test "$$i" = ginstall && i=install; \
|
||||
for j in "$(pfx)/bin/$$i" \
|
||||
"$(pfx)/share/man/man1/$$i.1"; do \
|
||||
case $$j in *'[.1') continue;; esac; \
|
||||
test -f "$$j" && : \
|
||||
|| { echo "$$j not installed"; fail=1; }; \
|
||||
done; \
|
||||
done; \
|
||||
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.
|
||||
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||
# have to have a recent version of gcc and glibc headers.
|
||||
# The hard-linking for-loop below ensures that there is a bin/ directory
|
||||
# full of all of the programs under test (except the ones that are required
|
||||
# for basic Makefile rules), all symlinked to the just-built "false" program.
|
||||
# This is to ensure that if ever a test neglects to make PATH include
|
||||
# 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)
|
||||
$(MAKE) syntax-check
|
||||
$(MAKE) check
|
||||
-rm -rf $(t)
|
||||
mkdir -p $(t)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --disable-nls \
|
||||
&& $(MAKE) CFLAGS='$(warn_cflags)' \
|
||||
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||
&& $(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) \
|
||||
&& $(MAKE) distclean
|
||||
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||
-rm -rf $(t)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
|
||||
WGET = wget
|
||||
WGETFLAGS = -C off
|
||||
|
||||
rel-check:
|
||||
tarz=/tmp/rel-check-tarz-$$$$; \
|
||||
md5_tmp=/tmp/rel-check-md5-$$$$; \
|
||||
set -e; \
|
||||
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
|
||||
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
|
||||
echo "$(md5) -" > $$md5_tmp; \
|
||||
md5sum -c $$md5_tmp < $$tarz
|
||||
|
||||
rel-files = $(DIST_ARCHIVES)
|
||||
|
||||
gnulib-version = $$(cd $(gnulib_dir) && git describe)
|
||||
|
||||
announcement: NEWS ChangeLog $(rel-files)
|
||||
@./build-aux/announce-gen \
|
||||
--release-type=$(RELEASE_TYPE) \
|
||||
--package=$(PACKAGE) \
|
||||
--prev=$(PREV_VERSION) \
|
||||
--curr=$(VERSION) \
|
||||
--gpg-key-id=$(gpg_key_ID) \
|
||||
--news=NEWS \
|
||||
--bootstrap-tools=autoconf,automake,bison,gnulib \
|
||||
--gnulib-version=$(gnulib-version) \
|
||||
$(addprefix --url-dir=, $(url_dir_list))
|
||||
|
||||
## ---------------- ##
|
||||
## Updating files. ##
|
||||
## ---------------- ##
|
||||
|
||||
ftp-gnu = ftp://ftp.gnu.org/gnu
|
||||
www-gnu = http://www.gnu.org
|
||||
|
||||
# Use mv, if you don't have/want move-if-change.
|
||||
move_if_change ?= move-if-change
|
||||
|
||||
emit_upload_commands:
|
||||
@echo =====================================
|
||||
@echo =====================================
|
||||
@echo "$(srcdir)/build-aux/gnupload $(GNUPLOADFLAGS) \\"
|
||||
@echo " --to $(gnu_rel_host):$(PACKAGE) \\"
|
||||
@echo " $(rel-files)"
|
||||
@echo '# send the /tmp/announcement e-mail'
|
||||
@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 \
|
||||
&& { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
|
||||
|| { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
|
||||
|| :
|
||||
$(MAKE) vc-dist
|
||||
$(MAKE) news-date-check
|
||||
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
|
||||
if test -d $(release_archive_dir); then \
|
||||
ln $(rel-files) $(release_archive_dir); \
|
||||
chmod a-w $(rel-files); \
|
||||
fi
|
||||
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
|
||||
echo $(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
|
||||
@@ -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
|
||||
@@ -132,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
|
||||
@@ -152,13 +156,13 @@ 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/$@ > $@ \
|
||||
&& rm -rf $t ;; \
|
||||
|
||||
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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[NAME]
|
||||
truncate \- shrink or extend the size of a file to the specifed size
|
||||
truncate \- shrink or extend the size of a file to the specified size
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[SEE ALSO]
|
||||
|
||||
@@ -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
|
||||
|
||||
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@@ -31,6 +31,7 @@ false
|
||||
fmt
|
||||
fold
|
||||
fs.h
|
||||
getlimits
|
||||
ginstall
|
||||
groups
|
||||
head
|
||||
|
||||
132
src/Makefile.am
132
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) \
|
||||
@@ -44,7 +46,7 @@ EXTRA_PROGRAMS = \
|
||||
|
||||
bin_PROGRAMS = $(OPTIONAL_BIN_PROGS)
|
||||
|
||||
noinst_PROGRAMS = setuidgid
|
||||
noinst_PROGRAMS = setuidgid getlimits
|
||||
|
||||
noinst_HEADERS = \
|
||||
chown-core.h \
|
||||
@@ -67,6 +69,10 @@ EXTRA_DIST = dcgen dircolors.hin tac-pipe.c \
|
||||
BUILT_SOURCES =
|
||||
CLEANFILES = $(SCRIPTS) su
|
||||
|
||||
# Also remove these sometimes-built programs.
|
||||
# For example, even when excluded, they're built via check-AUTHORS.
|
||||
CLEANFILES += $(no_install__progs)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/lib
|
||||
|
||||
noinst_LIBRARIES = libver.a
|
||||
@@ -82,6 +88,7 @@ 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)
|
||||
@@ -149,9 +156,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)
|
||||
|
||||
@@ -160,11 +167,16 @@ 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
|
||||
|
||||
# Get the release year from ../lib/version-etc.c.
|
||||
@@ -278,26 +290,26 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g'
|
||||
|
||||
BUILT_SOURCES += dircolors.h
|
||||
dircolors.h: dcgen dircolors.hin
|
||||
@rm -f $@ $@-t
|
||||
$(PERL) -w -- $(srcdir)/dcgen $(srcdir)/dircolors.hin > $@-t
|
||||
@chmod a-w $@-t
|
||||
mv $@-t $@
|
||||
$(AM_V_GEN)rm -f $@ $@-t
|
||||
$(AM_V_at)$(PERL) -w -- $(srcdir)/dcgen $(srcdir)/dircolors.hin > $@-t
|
||||
$(AM_V_at)chmod a-w $@-t
|
||||
$(AM_V_at)mv $@-t $@
|
||||
|
||||
wheel_size = 5
|
||||
|
||||
BUILT_SOURCES += wheel-size.h
|
||||
wheel-size.h: Makefile.am
|
||||
@rm -f $@ $@-t
|
||||
echo '#define WHEEL_SIZE $(wheel_size)' > $@-t
|
||||
@chmod a-w $@-t
|
||||
mv $@-t $@
|
||||
$(AM_V_GEN)rm -f $@ $@-t
|
||||
$(AM_V_at)echo '#define WHEEL_SIZE $(wheel_size)' > $@-t
|
||||
$(AM_V_at)chmod a-w $@-t
|
||||
$(AM_V_at)mv $@-t $@
|
||||
|
||||
BUILT_SOURCES += wheel.h
|
||||
wheel.h: wheel-gen.pl Makefile.am
|
||||
@rm -f $@ $@-t
|
||||
$(srcdir)/wheel-gen.pl $(wheel_size) > $@-t
|
||||
@chmod a-w $@-t
|
||||
mv $@-t $@
|
||||
$(AM_V_GEN)rm -f $@ $@-t
|
||||
$(AM_V_at)$(srcdir)/wheel-gen.pl $(wheel_size) > $@-t
|
||||
$(AM_V_at)chmod a-w $@-t
|
||||
$(AM_V_at)mv $@-t $@
|
||||
|
||||
# false exits nonzero even with --help or --version.
|
||||
# test doesn't support --help or --version.
|
||||
@@ -306,25 +318,25 @@ AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = false test
|
||||
|
||||
BUILT_SOURCES += fs.h
|
||||
fs.h: stat.c extract-magic
|
||||
rm -f $@
|
||||
$(PERL) $(srcdir)/extract-magic $(srcdir)/stat.c > $@t
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
$(AM_V_GEN)rm -f $@
|
||||
$(AM_V_at)$(PERL) $(srcdir)/extract-magic $(srcdir)/stat.c > $@t
|
||||
$(AM_V_at)chmod a-w $@t
|
||||
$(AM_V_at)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 $@
|
||||
$(AM_V_GEN)rm -f $@
|
||||
$(AM_V_at)printf '#include <config.h>\n' > $@t
|
||||
$(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
|
||||
$(AM_V_at)chmod a-w $@t
|
||||
$(AM_V_at)mv $@t $@
|
||||
|
||||
BUILT_SOURCES += version.h
|
||||
version.h: Makefile
|
||||
rm -f $@
|
||||
printf 'extern char const *Version;\n' > $@t
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
$(AM_V_GEN)rm -f $@
|
||||
$(AM_V_at)printf 'extern char const *Version;\n' > $@t
|
||||
$(AM_V_at)chmod a-w $@t
|
||||
$(AM_V_at)mv $@t $@
|
||||
|
||||
DISTCLEANFILES = version.c version.h
|
||||
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
|
||||
@@ -351,7 +363,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 check-AUTHORS
|
||||
.PHONY: check-README
|
||||
check-README:
|
||||
rm -rf $(pr) $(pm)
|
||||
@@ -370,11 +382,16 @@ check-duplicate-no-install: tr
|
||||
test -z "`echo '$(EXTRA_PROGRAMS)'| ./tr ' ' '\n' | uniq -d`"
|
||||
|
||||
# Ensure that the list of programs and author names is accurate.
|
||||
# We need a UTF8 locale, and any one should do, but since configure
|
||||
# already tries to find a French one, use it. It's fine to skip this test.
|
||||
au_dotdot = authors-dotdot
|
||||
au_actual = authors-actual
|
||||
.PHONY: check-AUTHORS
|
||||
check-AUTHORS: $(all_programs)
|
||||
rm -f $(au_actual) $(au_dotdot)
|
||||
@locale='$(LOCALE_FR_UTF8)'; \
|
||||
case "$$locale" in \
|
||||
''|none) echo "$@: skipping this check"; exit 0;; esac; \
|
||||
rm -f $(au_actual) $(au_dotdot); \
|
||||
for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
|
||||
| $(ASSORT) -u`; do \
|
||||
test "$$i" = '[' && continue; \
|
||||
@@ -384,51 +401,14 @@ check-AUTHORS: $(all_programs)
|
||||
elif test "$$i" = test; then \
|
||||
exe='['; \
|
||||
fi; \
|
||||
LC_ALL=en_US.UTF-8 ./$$exe --version \
|
||||
LC_ALL="$$locale" ./$$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)
|
||||
| sed -n -e '/Written by /{ s//'"$$i"': /;' \
|
||||
-e '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 || :
|
||||
|
||||
# Extract the list of authors from each file.
|
||||
sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
|
||||
# Sometimes the string is on the same line as the #define...
|
||||
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
|
||||
( \
|
||||
set -e; \
|
||||
echo "Here are the names of the programs in this package,"; \
|
||||
echo "each followed by the name(s) of its author(s)."; \
|
||||
echo; \
|
||||
for i in $(SOURCES); do \
|
||||
a=`sed -n $(s1) $$i`; \
|
||||
test "$$a" && : \
|
||||
|| a=`sed -n $(s2) $$i`; \
|
||||
if test "$$a"; then \
|
||||
prog=`echo $$i|sed 's/\.c$$//'`; \
|
||||
echo "$$prog: $$a"; \
|
||||
fi; \
|
||||
done | $(ASSORT) -u ) > $@-t
|
||||
chmod a-w $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# The following rule is not designed to be portable,
|
||||
# and relies on tools that not everyone has.
|
||||
|
||||
@@ -439,7 +419,7 @@ s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
|
||||
#
|
||||
# The second nm|grep checks for file-scope variables with `extern' scope.
|
||||
.PHONY: sc_tight_scope
|
||||
sc_tight_scope: $(all_programs)
|
||||
sc_tight_scope: $(bin_PROGRAMS)
|
||||
@t=exceptions-$$$$; \
|
||||
trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15; \
|
||||
src=`for f in $(SOURCES); do \
|
||||
@@ -453,6 +433,7 @@ sc_tight_scope: $(all_programs)
|
||||
) | $(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; } || : ; \
|
||||
@@ -461,6 +442,7 @@ sc_tight_scope: $(all_programs)
|
||||
$$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; } || :
|
||||
|
||||
@@ -48,7 +48,7 @@ static struct option const long_options[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
if (status != EXIT_SUCCESS)
|
||||
|
||||
19
src/cat.c
19
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,10 +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 of input file. May be "-". */
|
||||
static char const *infile;
|
||||
|
||||
@@ -336,7 +333,7 @@ cat (
|
||||
input_pending = true;
|
||||
#endif
|
||||
|
||||
if (input_pending)
|
||||
if (!input_pending)
|
||||
write_pending (outbuf, &bpout);
|
||||
|
||||
/* Read more input into INBUF. */
|
||||
@@ -639,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,
|
||||
@@ -664,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. */
|
||||
@@ -684,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
|
||||
{
|
||||
@@ -703,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)
|
||||
@@ -725,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);
|
||||
|
||||
23
src/chcon.c
23
src/chcon.c
@@ -35,26 +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
|
||||
};
|
||||
|
||||
/* 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;
|
||||
@@ -369,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 (_("\
|
||||
@@ -430,7 +409,7 @@ main (int argc, char **argv)
|
||||
|
||||
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
|
||||
@@ -302,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);
|
||||
|
||||
29
src/chmod.c
29
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
|
||||
@@ -67,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".
|
||||
@@ -121,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;
|
||||
}
|
||||
@@ -203,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:
|
||||
@@ -319,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;
|
||||
@@ -528,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);
|
||||
}
|
||||
|
||||
@@ -296,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;
|
||||
|
||||
@@ -338,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;
|
||||
}
|
||||
|
||||
@@ -417,7 +422,7 @@ change_file_owner (FTS *fts, FTSENT *ent,
|
||||
}
|
||||
}
|
||||
|
||||
/* On some systems (e.g., Linux-2.4.x),
|
||||
/* On some systems (e.g., GNU/Linux 2.4.x),
|
||||
the chown function resets the `special' permission bits.
|
||||
Do *not* restore those bits; doing so would open a window in
|
||||
which a malicious user, M, could subvert a chown command run
|
||||
@@ -492,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;
|
||||
|
||||
@@ -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
|
||||
@@ -312,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++;
|
||||
}
|
||||
@@ -326,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);
|
||||
|
||||
@@ -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
|
||||
@@ -83,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"));
|
||||
@@ -93,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
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include "system.h"
|
||||
#include "xfreopen.h"
|
||||
|
||||
#ifdef CRCTAB
|
||||
|
||||
@@ -192,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
|
||||
{
|
||||
|
||||
10
src/comm.c
10
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,9 +23,9 @@
|
||||
#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). */
|
||||
@@ -200,10 +200,8 @@ check_order (struct linebuffer const *prev,
|
||||
order = xmemcoll (prev->buffer, prev->length - 1,
|
||||
current->buffer, current->length - 1);
|
||||
else
|
||||
{
|
||||
size_t len = min (prev->length, current->length) - 1;
|
||||
order = memcmp (prev->buffer, current->buffer, len);
|
||||
}
|
||||
order = memcmp2 (prev->buffer, prev->length - 1,
|
||||
current->buffer, current->length - 1);
|
||||
|
||||
if (0 < order)
|
||||
{
|
||||
|
||||
239
src/copy.c
239
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)
|
||||
@@ -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);
|
||||
@@ -124,18 +131,116 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
errno_unsupported (int err)
|
||||
{
|
||||
return err == ENOTSUP || err == ENODATA;
|
||||
}
|
||||
|
||||
#if USE_XATTR
|
||||
static void
|
||||
copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
|
||||
char const *fmt, ...)
|
||||
{
|
||||
int err = errno;
|
||||
va_list ap;
|
||||
|
||||
if (!errno_unsupported (errno))
|
||||
if (errno != ENOTSUP && errno != ENODATA)
|
||||
{
|
||||
/* use verror module to print error message */
|
||||
va_start (ap, fmt);
|
||||
verror (0, err, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copy_attr_allerror (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 = x->require_preserve_xattr ? copy_attr_allerror : 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
|
||||
&& !x->require_preserve_xattr)? 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 = x->require_preserve_xattr ? copy_attr_allerror : 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
|
||||
&& !x->require_preserve_xattr) ? 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;
|
||||
@@ -165,12 +270,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);
|
||||
@@ -203,7 +315,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 =
|
||||
@@ -230,7 +342,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;
|
||||
}
|
||||
}
|
||||
@@ -243,7 +355,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;
|
||||
}
|
||||
}
|
||||
@@ -378,7 +490,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 || x->require_preserve_context)
|
||||
error (0, errno, _("failed to get file system create context"));
|
||||
if (x->require_preserve_context)
|
||||
{
|
||||
return_val = false;
|
||||
@@ -390,9 +503,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 || x->require_preserve_context)
|
||||
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;
|
||||
@@ -400,7 +514,7 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
goto close_src_and_dst_desc;
|
||||
}
|
||||
}
|
||||
freecon(con);
|
||||
freecon (con);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +537,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;
|
||||
|
||||
@@ -483,7 +597,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;
|
||||
@@ -511,21 +625,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)
|
||||
@@ -620,9 +725,10 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
}
|
||||
last_write_made_hole = false;
|
||||
|
||||
/* A short read on a regular file means EOF. */
|
||||
if (n_read != buf_size && S_ISREG (src_open_sb.st_mode))
|
||||
break;
|
||||
/* It is tempting to return early here upon a short read from a
|
||||
regular file. That would save the final read syscall for each
|
||||
file. Unfortunately that doesn't work for certain files in
|
||||
/proc with linux kernels from at least 2.6.9 .. 2.6.29. */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,6 +788,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
|
||||
@@ -1046,6 +1157,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. */
|
||||
@@ -1056,6 +1168,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)
|
||||
{
|
||||
@@ -1412,6 +1525,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
|
||||
@@ -1430,27 +1547,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? */
|
||||
@@ -1638,9 +1757,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 || x->require_preserve_context)
|
||||
error (0, errno,
|
||||
_("failed to set default file creation context to %s"),
|
||||
quote (con));
|
||||
if (x->require_preserve_context)
|
||||
{
|
||||
freecon (con);
|
||||
@@ -1651,11 +1771,12 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (errno != ENOTSUP && errno != ENODATA)
|
||||
if (!errno_unsupported (errno) || x->require_preserve_context)
|
||||
{
|
||||
error (0, errno,
|
||||
_("failed to get security context of %s"),
|
||||
quote (src_name));
|
||||
if (!x->reduce_diagnostics || x->require_preserve_context)
|
||||
error (0, errno,
|
||||
_("failed to get security context of %s"),
|
||||
quote (src_name));
|
||||
if (x->require_preserve_context)
|
||||
return false;
|
||||
}
|
||||
@@ -1728,11 +1849,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);
|
||||
@@ -1751,6 +1876,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);
|
||||
}
|
||||
}
|
||||
@@ -1980,6 +2106,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
|
||||
@@ -2094,8 +2224,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. */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user