Compare commits

...

399 Commits
v7.2 ... next

Author SHA1 Message Date
Eric Blake
6c935a0554 Merge remote branch 'origin/next' into next 2009-10-10 09:28:19 -06:00
Jim Meyering
3b7dc2b522 rm: record timing data
* README-rm-timing-compare: new file
* README-rm-timing-2: New file.
2009-10-10 09:21:36 -06:00
Eric Blake
aeaa6bf7ae touch: optimize use of utimens
* src/touch.c (main): Use UTIME_NOW rather than calling gettime.
(touch): Use UTIME_OMIT rather than stat.
2009-10-10 09:14:39 -06:00
Eric Blake
82e344ca09 copy: allow symlink timestamp preservation on more systems
* src/copy.c (utimens_symlink): Simplify by using lutimens.
* m4/jm-macros.m4 (coreutils_MACROS): Drop utimensat; gnulib does
this for us.
* tests/cp/preserve-slink-time: Recognize lutimes support.
2009-10-10 09:14:35 -06:00
Eric Blake
2cd1577554 build: update gnulib submodule to latest, for utimens improvements 2009-10-10 09:14:17 -06:00
Eric Blake
c2bebf63ed maint: touch up previous LDADD patch
* src/Makefile.am (dir_LDADD): Delete; the ls_LDADD line covers this.
2009-10-10 06:28:40 -06:00
Jim Meyering
d74a1b005c build: build uname(1) unconditionally
Before, on a system without the uname function, the build
system would detect that and not build/install a uname program.
Now that gnulib guarantees a uname function, ...
* configure.ac: Don't check for the uname function.
* src/Makefile.am (build_if_possible__progs): Move uname...
(EXTRA_PROGRAMS): ...to this list.
2009-10-10 09:03:15 +02:00
Jim Meyering
4f1a3eda10 maint: list program names one per line
* src/Makefile.am (EXTRA_PROGRAMS): List them one per line.
(build_if_possible__progs): Likewise.
2009-10-10 08:58:43 +02:00
Jim Meyering
c9e7b8844b build: ls: fix link failure due to missing -lacl
* src/Makefile.am (ls_LDADD): Re-add $(LIB_ACL).
Inadvertently-removed by commit 78c93601.
2009-10-10 08:24:02 +02:00
Eric Blake
219f2f0538 maint: touch up previous LDADD patch
* src/Makefile.am (stdbuf_LDADD): Add missing primer.
(hostname_LDADD, uname_LDADD): Add GETHOSTNAME_LIB.
* bootstrap.conf (gnulib_modules): Add uname.
2009-10-09 20:08:03 -06:00
Eric Blake
78c9360178 maint: improve additional library tracking
* src/Makefile.am (LDADD): Refactor, to make per-library additions
to individual programs easier to maintain.
2009-10-09 19:28:07 -06:00
Jim Meyering
0023f65fd7 chcon: don't disable just because SELinux is disabled
* src/chcon.c (main): Now that gnulib provides getfilecon wrappers,
we can revert most of the 2009-10-05 commit 3a97d664, "chcon: exit
immediately if SELinux is disabled", since chcon is still useful as
long as the file system provides handlers for the security.*
name space.  gnulib's getfilecon wrappers ensure that an offending
context now evokes a return value of -1.
Prompted by comments from Stephen Smalley in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18378/focus=18394
* NEWS (Bug fixes): Mention it.
2009-10-09 14:33:10 +02:00
Jim Meyering
57d9263ca5 ls: remove explicit getfilecon work-around
* src/ls.c (gobble_file): Remove l?getfilecon work-around,
now that the gnulib wrappers handle it for us.
2009-10-09 14:33:10 +02:00
Jim Meyering
e11a0319b3 build: update gnulib submodule to latest, for getfilecon wrappers 2009-10-09 14:33:10 +02:00
Eric Blake
c039c96449 maint: use X2NREALLOC in more places
* src/chroot.c (set_additional_groups): Use X2NREALLOC rather than
x2nrealloc.
* src/factor.c (emit_factor): Likewise.
* src/setuidgid.c (main): Likewise.
2009-10-08 20:30:08 -06:00
Eric Blake
aa092ccf6a maint: remove unused macros and declarations
* src/system.h (EDQUOT, EISDIR, ENOSYS, EOVERFLOW, F_OK, X_OK)
(W_OK, R_OK): Delete; macros provided by gnulib.
(includes): Gnulib guarantees both <time.h> and <sys/time.h>, in
either order.
(free, malloc, memchr, realloc, getenv, lseek): Delete, gnulib
guarantees these declarations.
* m4/check-decl.m4 (gl_CHECK_DECLS): Delete checks now done by
gnulib.
2009-10-08 20:30:06 -06:00
Eric Blake
2a876d901d maint: move timeout exit statuses
* src/timeout.c (EXIT_TIMEDOUT, EXIT_CANCELED): Remove as
macros...
* src/system.h (EXIT_TIMEDOUT, EXIT_CANCELED): ...and provide as
enum values instead.
* src/stdbuf.c (EXIT_CANCELED): Delete.
2009-10-08 20:30:03 -06:00
Eric Blake
a797c4d7d3 stat: test recent patch
* tests/misc/stat-slash: New test.
* tests/Makefile.am (TESTS): Run it.
2009-10-08 20:30:00 -06:00
Eric Blake
7a3bc1bf27 stdbuf: improve path search
* src/stdbuf.c (set_program_path): Use gnulib methods for better
file name handling.
* bootstrap.conf (gnulib_modules): Add xreadlink.
2009-10-08 06:52:18 -06:00
Eric Blake
00674c7475 stat: work with recent gnulib changes
* src/stat.c (do_stat): Don't mask function-like stat macro.
2009-10-08 06:52:15 -06:00
Jim Meyering
eb5f06f2a6 stat: add support for many more file system types
* src/stat.c (human_fstype): Add the following FS types,
from <linux/magic.h>: afs, anon-inode FS, btrfs, cgroupfs,
cramfs-wend, debugfs, futexfs, inotifyfs, minux3, securityfs,
selinux, xenfs.
Also add "nilfs".
* src/Makefile.am (fs-kernel-magic): New rule.
* NEWS (Bug fixes): Mention this.
2009-10-08 10:18:28 +02:00
Jim Meyering
8e32390716 stat: recognize CIFS and HFS file system types
* src/stat.c (human_fstype) [CIFS, HFS]: Add new file system types.
Prompted by a report from Stuart Kemp.
Normalize the form of a few hexadecimal magic numbers.
Alphabetize on S_MAGIC_ case names.
* src/Makefile.am (fs-magic-compare, fs-def, fs-magic): New rules, to
automate comparison of our list with that in the Linux statfs man page.
* NEWS (Bug fixes): Mention it.
2009-10-08 09:07:12 +02:00
Guenter Knauf
b95be30e3f md5sum, sha*sum: also accept openssl checksum syntax
* src/md5sum.c (split_3): Accept openssl checksum syntax, which
differs only by two spaces from that of the bsd checksum tools:
openssl: MD5(f)= d41d8cd98f00b204e9800998ecf8427e
bsd:     MD5 (f) = d41d8cd98f00b204e9800998ecf8427e
2009-10-07 09:31:27 +02:00
Jim Meyering
d183a15cbb maint: make release-making instructions more generic
* README-release: Make instructions more generic.
2009-10-06 16:49:36 +02:00
Jim Meyering
96829a9ff0 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-10-06 13:20:18 +02:00
Jim Meyering
ca1e31f3c5 version 8.0
* NEWS: Record release date.
2009-10-06 13:04:16 +02:00
Jim Meyering
3c40fdfba6 build: update gnulib submodule to latest 2009-10-06 11:15:54 +02:00
Ondřej Vašík
3a97d664b9 chcon: exit immediately if SELinux is disabled
This change happens to avoid an abort in chcon when SELinux is
disabled while operating on a file with an "unlabeled" context from
back in 2006.  However, that same abort can still be triggered by the
same file when running chcon with SELinux enabled.  This bug in chcon
will be fixed in a subsequent commit via a getfilecon wrapper.  See
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18378/focus=18384
for how to correct your disk attributes to avoid triggering this bug.
* src/chcon.c (main): Exit immediately if SELinux is disabled.
Reported in http://bugzilla.redhat.com/527142 by Yanko Kaneti.
* src/runcon.c (main): Do not hardcode program name in error message.
* THANKS: Update.
2009-10-06 10:10:51 +02:00
Jim Meyering
addb62da92 build: update gnulib submodule to latest 2009-10-03 06:56:55 +02:00
James R. Van Zandt
569df689e3 dircolors: highlight .cgm and .emf as images
* src/dircolors.hin: Add .cgm, .emf.
* THANKS: Update.
2009-10-02 10:58:05 -06:00
Jim Meyering
df0c0381ab maint: remove obsolete syntax-check exclusion
* cfg.mk (local-checks-to-skip): Remove strftime-check.
2009-10-02 15:48:08 +02:00
Pádraig Brady
f8726e05c4 tail: avoid a race where we could miss new data with --pid
* src/tail.c (tail_forever, tail_forever_inotify): Close a race in
tail_forever_inotify where new data written after the file check by
a now dead process, but before the pid check, is not output.  We use
the POSIX guarantee that read() and write() are serialized wrt each
other even in separate processes, to assume full file consistency
after exit() and so poll for new data _after_ the writer has exited.
This also allows us to not redundantly _wait_ for new data if the
process is dead.
* tests/tail-2/pid: Remove the now partially invalid sub second sleep
check as we now don't unconditionally wait, and replace it with a check
for the redundant sleep.  Also clarify some of the existing comments.
* NEWS: Mention the fix.
2009-10-02 14:00:06 +01:00
Jim Meyering
95c01c656e maint: move gnu-web-doc-update script to gnulib
* bootstrap.conf (gnulib_modules): Add gnu-web-doc-update.
Remove gendocs, since gnu-web-doc-update depends on it.
* gnu-web-doc-update: Remove file, now that we get it from gnulib.
2009-10-02 12:10:21 +02:00
Jim Meyering
8a7f66feb4 build: update gnulib submodule to latest 2009-10-02 12:10:21 +02:00
Jim Meyering
30a227673e tests: tail-2/pid: use a 3-second timeout, not 1
* tests/tail-2/pid: When using the timeout program to ensuring that
tail -s.1 --pid=$PID_T_MAX does not wait forever, use a timeout longer
than 1 second.  A 1-second timeout could be too short on a very busy
system, and result in a timeout, and hence false-positive failure.

2009-09-30  Jim Meyering  <meyering@redhat.com>
2009-09-30 23:28:13 +02:00
Jim Meyering
dd8db19cc7 build: update gnulib submodule to latest 2009-09-30 17:46:42 +02:00
Jim Meyering
569e387b8a build: translate diagnostics from two new files
* po/POTFILES.in: Add two new files: lib/siglist.h, lib/strsignal.c
2009-09-30 17:04:29 +02:00
Jim Meyering
9ca7d6b49e build: now that we use the lock module, don't exclude lock.m4
* bootstrap.conf: Don't exclude lock.m4.
2009-09-30 17:04:29 +02:00
Pádraig Brady
d4c7114bce ls: always print "?" for allocated size of a dereferenced dangling symlink
Previously for `ls -Ls` (but not `ls -Lsl`), we referenced
the st_blocks returned from the previous failed stat() call.
This undefined value was seen to be 0 for dangling symlinks at least.
* src/ls.c (print_file_name_and_frills, length_of_file_name_and_frills):
Don't use st_blocks if the previous stat() failed
* tests/ls/dangle: Add a test case
* NEWS: Mention the fix, and roll up related items into a single entry.
2009-09-30 15:42:35 +01:00
Jim Meyering
ce1069c215 build: use gnulib's freopen module
* bootstrap.conf (gnulib_modules): Add freopen, strsignal, fsync.
Exposed via make CFLAGS=-DGNULIB_POSIXCHECK 2>&1 \
|perl -lne '/.* use gnulib module (\S+).*/ and print $1' \
|sort |uniq -c|sort -nr
(avoided_gnulib_modules): Don't avoid the "lock" module.
Now it's required, as a dependency of the strsignal module.
2009-09-30 09:39:48 +02:00
Jim Meyering
a033e28737 stat: interpret "-" as standard input
* src/stat.c (do_stat): Interpret a command line argument of "-"
to mean "standard input", like many other tools do.
(do_statfs): Fail upon any attempt to use "-".
* NEWS (Changes in behavior): Mention it.
* tests/misc/stat-hyphen: New test, to exercise the above.
* tests/Makefile.am (TESTS): Add misc/stat-hyphen.
2009-09-29 16:04:12 +02:00
Jim Meyering
b7aaa0da8b ls: don't use an undefined struct stat after failed stat/lstat
* src/ls.c (format_inode): Access f->stat only if f->stat_ok is set.
* NEWS (Bug fixes): Mention it.
Improved-by: Pádraig Brady <P@draigBrady.com>
2009-09-29 14:12:30 +02:00
Jim Meyering
36edf7bad2 ls: print "?", not "0" as inode of dereferenced dangling symlink
ls prints inode numbers two ways: for long (-l) listings,
and for short ones, e.g., ls -li and ls -i.  The code to print
long listings properly printed "?" when the inode was unknown,
but the code for handling short listings would print 0 instead.
Factor out the formatting code into a new function so ls prints
the right string ("?") from both places:
* NEWS (Bug fixes): Mention it.
* src/ls.c (format_inode): New function.
(print_long_format): Use it here.
(print_file_name_and_frills): Use it here, too.
* tests/ls/dangle: Exercise this fix.
Reported by Yang Ren in http://bugzilla.redhat.com/525400
2009-09-29 11:42:45 +02:00
Jim Meyering
242689c7f9 ls: with -LR, exit with status 2 upon detecting a cycle
* src/ls.c (print_dir): Diagnosing the cycle is not enough.
Also set exit status to 2.  This is what Solaris' /bin/ls does, too.
* tests/ls/infloop: Rework test: match both expected stdout and stderr.
Require an exit status of 2 in this case.
* doc/coreutils.texi (ls invocation): Mention that a loop provokes
in an exit status of 2.
* NEWS (Bug fixes): Mention it.
Reported by Yang Ren in http://bugzilla.redhat.com/525402.
* THANKS: Correct ordering of Yang Ren's names.
2009-09-29 07:28:39 +02:00
Jim Meyering
30c65cd49c maint: factor coreutils-specific code out of bootstrap
* bootstrap (bootstrap_epilogue): Define a default, empty function.
Remove coreutils-specific code, and instead,
invoke this new function at the end of this script.
* bootstrap.conf (bootstrap_epilogue): Define, to override the default.
2009-09-26 14:45:50 +02:00
Eric Blake
ca9e212cf8 cp, mv: use linkat to guarantee semantics
* src/copy.c (copy_internal): Use linkat, not link.
2009-09-25 07:03:36 -06:00
Eric Blake
efcee783e4 ln: add -L/-P options
* src/ln.c (STAT_LIKE_LINK): Delete.
(logical): New flag.
(long_options): Add -L, -P.
(usage): Mention them.
(main): Choose between them.
(do_link): Perform correct action.
* tests/ln/misc: Move hard-to-sym portion of test...
* tests/ln/hard-to-sym: ...into new test, and add more.
* tests/Makefile.am (TESTS): Run new test.
* NEWS: Document this.
* doc/coreutils.texi (link invocation, ln invocation): Likewise.
* bootstrap.conf (gnulib_modules): Add linkat.
2009-09-25 07:03:03 -06:00
Eric Blake
fb59d72f0a build: update gnulib submodule to latest 2009-09-24 19:40:31 -06:00
Pádraig Brady
a037e838e1 maint: Use logical rather than bitwise operators on bools
This is because bitwise operators are:
- confusing and inconsistent in a boolean context
- non short circuiting
- brittle in C89 where bool can be an int (so > 1)
2009-09-23 14:33:40 +01:00
Pádraig Brady
ade8dd2096 maint: expr: avoid compiler warnings without GMP
* src/expr.c (mpz_clear, mpz_get_str, mpz_out_str)
[!HAVE_GMP]: Reference unused arguments.
2009-09-23 14:32:07 +01:00
Eric Blake
0cce690850 build: update gnulib submodule to latest 2009-09-23 06:47:46 -06:00
Eric Blake
82124c3c06 maint: summarize gnulib changes
* NEWS: Provide a blurb about recent gnulib improvements.  Fix typo
in readlink blurb.
2009-09-23 06:45:07 -06:00
Jim Meyering
38f1c2006e doc: ls: further improve --help message re --color
* src/ls.c (usage): Correct grammar, change voice, shorten.
Inspired by a report from Bruno Schulenberg.
2009-09-23 09:11:08 +02:00
Eric Blake
8a1edc971f readlink: pick up gnulib changes to readlink -f
* bootstrap.conf (obsolete_gnulib_modules): Move rename...
(gnulib_modules): ...here.  Add symlink.
* NEWS: Document the change in readlink.
* doc/coreutils.texi (readlink invocation): Likewise.
* tests/readlink/can-f: Update test to new semantics, and add test
of loop.
2009-09-23 08:45:08 +02:00
Jim Meyering
70253e9179 maint: df.c: adapt to newer gnulib
* src/df.c: Don't include "canonicalize.h".  No longer needed,
since canonicalize_file_name is now guaranteed to be declared
in <stdlib.h>, thanks to gnulib.
2009-09-23 08:38:00 +02:00
Jim Meyering
b18b6912e8 build: update gnulib submodule to latest 2009-09-23 08:37:59 +02:00
Pádraig Brady
fbfca3c675 doc: stdbuf: mention it can have a non standard exit status
* doc/coreutils.texi (Exit status): Add stdbuf to the list
2009-09-22 12:22:47 +01:00
Pádraig Brady
7a404d10f5 maint: uptime: fix a theoretical compile warning
* src/uptime.c (print_uptime) [!HAVE_UTMPX_H && !HAVE_UTMP_H]:
Reference possibly unused arguments.
2009-09-22 12:21:00 +01:00
Pádraig Brady
8c92bb3441 ls: fix a performance regression
* src/ls.c (print_color_indicator): This reinstates commit f3f1ccfd,
21-10-2008, "ls: make it possible to disable file capabilities checking"
which was inadvertently reverted with commit 3a169f4c, 14-09-2009,
"ls: handle disabling of colors consistently ...".
2009-09-22 10:07:21 +01:00
Eric Blake
32f987af12 build: avoid compiler warnings on cygwin 1.5
* src/copy.c (utimens_symlink): Avoid unused variables.
* src/su.c (getusershell): Rely on gnulib for prototype.
2009-09-21 20:42:16 -06:00
Jim Meyering
fee8694886 doc: ls: add an article, "the"
* src/ls.c (usage): Tweak wording.
2009-09-21 15:30:38 +02:00
Pádraig Brady
3a169f4c5d ls: handle disabling of colors consistently for all tile types
* src/ls.c (print_color_indicator): Use consistent syntax for
all file and directory subtypes, and fall back to the color
of the base type if there is no enabled color for the subtype.
This allows turning off specific colors for o+w dirs for example.
* tests/ls/color-dtype-dir: Add a case to test that turning off
coloring for o+w directories, falls back to standard dir color.
* NEWS: Mention the fix
Introduced by commit ac467814, 2005-09-05,
"Colorize set-user-ID ... files and sticky ... directories."
2009-09-21 13:16:44 +01:00
Pádraig Brady
29ec834c3b doc: ls: make help for --color more concise and accurate
* src/ls.c (usage): Shorten the --color ancillary info by
two lines, while replacing --color=none with --color=never.
Mention "always" is the default parameter of the --color option,
along with the primary help for that option.
Mention the ancillary --color info in the --color primary help.
2009-09-21 12:44:35 +01:00
Pádraig Brady
9837344837 doc: normalize and add missing entries to texinfo menu
* doc/coreutils.texi: Add the missing arch, base64, link, readlink,
and unlink entries.  Also remove extraneous '.' from some entries
and try to align all entries on the same column.
* THANKS: Add Benno Schulenberg.
2009-09-21 12:42:19 +01:00
Pádraig Brady
5d4f09d83a doc: mention the texinfo documentation in --help
* src/system.h: Rename emit_bug_reporting_address() to
emit_ancillary_info() and update it to not print the translation
project address in en_* locales, and _do_ print it in the 'C'
(and other) locales so that it's included in the default man page.
Also mention how to invoke the texinfo documentation for each command.
Also move the "hard-locale.h" include to the 8 files that now use it.
* man/help2man: Strip the newly added texinfo reference from the
--help output as a more verbose version is already added by help2man.
Suggestion from C de-Avillez
2009-09-21 12:37:57 +01:00
Jim Meyering
c48003a53c maint: automate the web-doc updating procedure
* gnu-web-doc-update: New script, destined for gnulib.
* README-release: Refer to the new script.
2009-09-21 08:56:17 +02:00
Jim Meyering
a2883947bc dircolors: arrange to highlight names with the .lz suffix
* src/dircolors.hin: Add .lz, for GNU lzip.
Suggested by Matias A. Fonzo.
2009-09-19 12:26:41 +02:00
Jim Meyering
99f59aaaf8 mktemp: adapt to new, 3-argument gen_tempname_len
* src/mktemp.c (mkstemp_len, mkdtemp_len): Update callers of
gen_tempname_len.
* gl/lib/tempname.c, gl/lib/tempname.h: Rebase against recently
API-modified copy of tempname module in gnulib.
Reported by Lluís Batlle.
2009-09-19 11:16:56 +02:00
Jim Meyering
6504d7e193 build: merge bootstrap changes from gnulib
* bootstrap: Update from gnulib.
2009-09-17 14:30:01 +02:00
Eric Blake
2bad8c0dea rm, rmdir: improve cross-compilation support
* bootstrap.conf (gnulib_modules): Drop rmdir-errno.
* src/rmdir.c (errno_rmdir_non_empty): Check both cases allowed by
POSIX, rather than relying on configure-time check that might
fail during cross-compilation.  Reverts commit 9b6eb98d41.
2009-09-16 21:26:58 -06:00
Ondřej Vašík
fe6f4e305c cp: fix a probably redundant chmod when setting xattrs
* src/copy.c (copy_reg): Fix initial value of access_changed variable.
This was introduced by Pádraig Brady in commit cca83faf, 2009-09-14,
"cp,mv: preserve extended attributes even for read-only files"
2009-09-15 10:51:13 +01:00
Jim Meyering
a77fb35364 doc: NEWS: mention origin of touch -t ....60 bug
* NEWS: It is an old bug.
2009-09-14 15:57:13 +02:00
Jim Meyering
94eca76776 doc: touch, document that it accepts .60
* doc/coreutils.texi (touch invocation): Document that SS may be 60.
2009-09-14 15:37:26 +02:00
Jim Meyering
20761ce686 touch: don't reject "60" as number of seconds in a legacy time stamp
A valid command like "touch -t 197101010000.60 F" would fail due
to the suffix of ".60".  This bug is fixed via the latest change
to gnulib's posixtm module.
* tests/touch/60-seconds: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2009-09-14 15:27:51 +02:00
Jim Meyering
df84346ebc build: update gnulib submodule to latest, for fixed posixtm module 2009-09-14 15:27:51 +02:00
Jim Meyering
71bac0dac3 maint: use #!/bin/sh consistently in shell-based test scripts
* tests/misc/sort-continue: Change first line to standard #!/bin/sh,
not #!/bin/bash (though it doesn't matter, since each is invoked
via $(SHELL) dir/test-name.
2009-09-14 15:27:02 +02:00
Pádraig Brady
d41dbb187f tests: fix dd/skip-seek-past-file to work on ecryptfs
* tests/dd/skip-seek-past-file: Require sparse support
to ensure that when we're checking if we can create an
$OFF_T_MAX length file, that we don't actually allocate
any space.  This was an issue on ecryptfs and was reported
by Bert Wesarg.
2009-09-14 14:22:02 +01:00
Ondřej Vašík
cca83fafa6 cp,mv: preserve extended attributes even for read-only files
* src/copy.c (copy_reg): Temporarily set u+rw on the destination file
to allow GNU/Linux to set xattrs.
* tests/misc/xattr: Test that change.
* NEWS (Bug fixes): Mention it.
Reported by Ernest N. Mamikonyan.
2009-09-14 14:19:03 +01:00
Jim Meyering
eb1299481a doc: improve timeout's --help message
* src/timeout.c (usage): Improve --help description.
2009-09-14 09:18:30 +02:00
Jim Meyering
255a6a201e maint: use consistent cpp indentation in all .c files
* src/stty.c: Make cpp indentation reflect nesting.
* src/factor.c: Likewise.
2009-09-13 22:05:37 +02:00
Jim Meyering
f6f78f093b doc: NEWS: say quadratic and linear, rather than O(N^2) and O(N)
* NEWS: Use a slightly less technical description.
Suggested by Andreas Schwab.
2009-09-13 12:11:57 +02:00
Jim Meyering
21b617b78b doc: improve NEWS
* NEWS (rm -r, without -f): Mention that the N in "O(N)" represents
hierarchy depth.  Suggested by Ralf Wildenhues.
(rm -r, standards conformance): Make wording more accurate.
2009-09-13 11:58:48 +02:00
Jim Meyering
ebbf0a1f0f id: don't print context=... when POSIXLY_CORRECT is set
* src/id.c (print_full_info) [POSIXLY_CORRECT]: Don't print context.
Reported by Ulrich Drepper.
* NEWS (Changes in behavior): Mention it.
* doc/coreutils.texi (id invocation): Document that id also prints the
security context, when possible, and when POSIXLY_CORRECT is not set.
* tests/id/no-context: New file.  Test for this.
* tests/Makefile.am (TESTS): Add it.
2009-09-11 19:58:18 +02:00
Eric Blake
398749b0cc rm: avoid compiler warning
* src/remove.c (rm_fts): Don't allow fall-through when assertions
are disabled.
2009-09-11 14:08:58 +02:00
Eric Blake
e5dba03d2f euidaccess-stat: remove unnecessary macros
* lib/euidaccess-stat.c (F_OK, R_OK, W_OK, X_OK): Delete; now
guaranteed by gnulib.
2009-09-11 14:08:58 +02:00
Eric Blake
c756343503 rm: use gnulib faccessat
* bootstrap.conf (gnulib_modules): Add faccessat.  Replace strdup
with strdup-posix.
* m4/jm-macros.m4 (coreutils_MACROS): Revert previous change, now
that gnulib does it for us.
* src/remove.c (write_protected_non_symlink): Use faccessat in
more situations.
2009-09-11 14:08:58 +02:00
Jim Meyering
722287e443 rm: improve efficiency of rm -r (without -f) from O(N^2) to O(N)
where N is the depth of the deepest hierarchy rm is processing.
* src/remove.c (write_protected_non_symlink): Use faccessat to
avoid O(N)-per-entry cost of calling euidaccess.
* m4/jm-macros.m4 (coreutils_MACROS): Check for faccessat.
* NEWS (Improvements): Mention it.
2009-09-11 14:08:58 +02:00
Jim Meyering
9966c92dd4 build: placate gcc's new -Wskip-jump-init
* remove.c (rm_fts): Put braces around each of the two offending blocks.
* configure.ac: Don't turn off -Wjump-misses-init.
With the rewrite of remove.c, it is no longer needed.
2009-09-11 14:08:58 +02:00
Jim Meyering
4f73ecaf7d rm: rewrite to use fts
* remove.c: Don't include "unlinkdir.h"; no longer used.
Do not include <setjmp.h> or "cycle-check.h".  Likewise.
Include "xfts.h".
(dir_name, dir_len): Remove definitions.
(CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Likewise.
(INODE_SORT_DIR_ENTRIES_THRESHOLD, NEED_REWIND, D_TYPE): Likewise.
(struct dirstack_state, Dirstack_state): Likewise.
(g_buf, g_n_allocated): Remove declarations.
(hash_freer, hash_compare_strings, rm_malloc): Remove functions.
(rm_free, push_dir, top_dir, pop_dir, right_justify): Likewise.
(full_filename0, xfull_filename, full_filename_): Likewise.
(AD_stack_height, AD_stack_top, AD_stack_pop, AD_stack_clear): Likewise.
(obstack_init_minimal, ds_init, ds_clear, ds_free): Likewise.
(AD_pop_and_chdir, AD_ensure_initialized, AD_mark_helper): Likewise.
(AD_mark_as_unremovable, AD_mark_current_as_unremovable): Likewise.
(AD_push_initial, AD_push, AD_push, AD_is_removable): Likewise.
(write_protected_non_symlink): Change 3rd parameter from
dirstack_state "ds" to full_name.
(prompt): Adjust parameters.  Now, state comes from FTS/FTSENT pair.
Those replace fd_cwd and "ds".  Remove "filename".  Remove pdirent_type
in favor of new "is_dir" parameter.  Rename is_empty to is_empty_p.
(DO_RMDIR, DO_UNLINK): Remove definitions.
(remove_entry, fd_to_subdirp, compare_ino): Remove functions.
(dirent_count, dirent_inode_sort_may_be_useful): Likewise.
(preprocess_dir): Likewise.
(fts_skip_tree, mark_ancestor_dirs, excise, rm_fts): New functions.
(remove_cwd_entries, remove_dir, rm_1): Remove functions.
(rm): Rewrite as a simple loop calling fts_read and dispatching
each entry via rm_fts.
* src/rm.c (main): Adapt to new signature of rm().
* bootstrap.conf (gnulib_modules): Remove unlinkdir, no longer used.
* src/Makefile.am (sc_tight_scope): Also recognize an extern "enum"
declaration.
* tests/rm/empty-name: Adjust expected output to match new diagnostic.
* NEWS (Improvements): Mention it.
2009-09-11 14:08:51 +02:00
Jim Meyering
880a6e7723 maint: doc: adjust README-release
* README-release: Remove mention of bootstrap's old
--gnulib-srcdir=/gnulib option.  No longer needed, and its
use can lead to subtle problems.
2009-09-11 13:14:07 +02:00
Jim Meyering
bd11475627 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-09-11 08:16:18 +02:00
Jim Meyering
aa2f797c7d version 7.6
* NEWS: Record release date.
2009-09-11 07:53:16 +02:00
Jim Meyering
ebc7aacf7b link,ln: use gnulib's link module to work around Solaris 10 deficiency
Before this change, :>f; ln -T f no-such/ would succeed on Solaris 10.
After it, ln fails, as it should: ln: accessing `z/': Not a directory
The command, link f no-such/, had the same problem on that system.
* bootstrap.conf (gnulib_modules): Add "link".
* tests/ln/slash-decorated-nonexistent-dest: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Portability): Mention the improvement.
2009-09-10 18:52:12 +02:00
Jim Meyering
15223b0c3b build: update gnulib submodule to latest 2009-09-10 16:58:15 +02:00
Ondřej Vašík
b64d9b6d9e doc: improve various BLOCKSIZE and SIZE help
* doc/coreutils.texi (multiplierSuffixes): Mention that
the suffix can be specified without a leading number
* src/split.c (usage): Refactor SIZE help to within a function
* src/truncate.c (usage): Likewise
* src/ls.c (usage): Likewise
* src/df.c (usage): Likewise. Also add a function with BLOCKSIZE help
* src/du.c (usage): Likewise.
* src/system.h: Define 2 functions to emit common help text
This was prompted by https://bugzilla.redhat.com/show_bug.cgi?id=511188
2009-09-10 15:28:50 +01:00
Jim Meyering
0bbb9d7785 dd conv=unblock: print final newline consistently
* src/dd.c (dd_copy) [C_UNBLOCK]: Always print the final newline for
non-empty output, not just when output size is a multiple of cbs.
* doc/coreutils.texi (dd invocation) [conv=unblock]: Mention that dd
prints a newline after each output record, not just when replacing
trailing spaces.
Reported by Ulrich Drepper.
* tests/dd/unblock: New file.  Test for this.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2009-09-10 12:25:04 +02:00
Jim Meyering
f1e1e89e81 maint: make cfg.mk slightly more generic
* cfg.mk (url_dir_list): Don't hard-code "coreutils".  Use $(PACKAGE).
2009-09-09 16:44:37 +02:00
Jim Meyering
1c0ec3541c * gnulib: Update submodule to latest. 2009-09-08 13:30:38 +02:00
Jim Meyering
f0ff8c73fe tail: make the new piped-stdin test as portable as the old one
* src/tail.c (main): Adapt piped-stdin test to use the same isapipe,
test as was used in the preceding POSIXLY_CORRECT condition.
Remove the now-subsumed POSIXLY_CORRECT test.
Reported by Pádraig Brady.
* doc/coreutils.texi (tail invocation): Document this change.
* NEWS (Changes in behavior): Reclassify, clarify.
2009-09-08 13:30:38 +02:00
Pádraig Brady
e8591fd39f tests: tail-2/assert: reduce risk of race condition
* tests/tail2/assert: This reverts commit be853120, 25-08-2009,
"tests: tail-2/assert: avoid risk of race condition"
kill -0 doesn't send a signal and so will only confirm that the
background process was forked, which we know already because
we have its pid.
2009-09-08 10:01:45 +01:00
Pádraig Brady
a863644397 tests: address a race condition in misc/cat-buf
* tests/misc/cat-buf: Increase the delay between writes
to decrease the chance that dd will read both at once.
Since the test is inherently racy, print a warning via
skip_test_ rather than failing outright.
Reported by Jim Meyering.
2009-09-08 01:43:31 +01:00
Jim Meyering
f6d1f70183 tail: syntax-only: use "false", rather than equivalent, 0
* src/tail.c (record_open_fd): Initialize "->ignore" to false, not 0.
2009-09-07 23:20:01 +02:00
Jim Meyering
af6436559c tail: ignore -f for piped-stdin, as POSIX requires
* src/tail.c (main): Tailing a pipe "forever" is not useful,
and POSIX specifies that tail ignore the -f when there is no
file argument and stdin is a FIFO or pipe.  So we do that.
In addition, GNU tail excludes "-" arguments from the list of files
to tail forever, when the associated file descriptor is connected
to a FIFO or pipe.  Before this change, ":|tail -f" would hang.
Reported by Ren Yang and Ulrich Drepper.
* tests/tail-2/pipe-f: Test for this.
* tests/tail-2/pipe-f2: Ensure tail doesn't exit early for a fifo.
* tests/Makefile.am (TESTS): Add these tests.
* NEWS (POSIX conformance): Mention it.
2009-09-07 23:19:56 +02:00
Pádraig Brady
fd9750b0ff tests: tail-2/flush-initial should not rely on stdbuf
* tests/tail-2/flush-initial: stdbuf is not built on all systems.
In any case it's redundant since stdout will automatically be buffered
since we're redirecting to file. So just call tail without using stdbuf.
2009-09-07 21:52:30 +01:00
Jim Meyering
a8d26b3ce1 tail: don't give up on inotify mode for an already-ignored "-"
* src/tail.c (main): Adjust today's change to honor the
F[i].ignore flag that may have been set in tail_file.
2009-09-07 20:56:38 +02:00
Jim Meyering
a4a864da36 tests: misc/cat-buf: clean up syntax
* tests/misc/cat-buf: Don't suppress dd's stderr.
Remove useless quotes.
2009-09-07 20:23:03 +02:00
Jim Meyering
9547a78bda tests: ls/color-clear-to-eol: append NL to accommodate old sed
* tests/ls/color-clear-to-eol: Some vendor sed programs fail
to operate on lines that are not NL-terminated.
This affects at least Solaris 10's /bin/sed.
Reported by Pádraig Brady.
2009-09-07 19:36:37 +02:00
Jim Meyering
494fed0271 tests: tail-2/infloop-1: avoid rare test failure on a busy system
* tests/tail-2/infloop-1: Sleep 3 seconds, not 1, but in increments
of 0.1 second.  Before, this test would fail ~1 time in 20 via
"make -j9 check" on a quad-core system.
Correct comment.
2009-09-07 13:55:37 +02:00
Jim Meyering
61cc6fbc27 build: update gnulib submodule to latest 2009-09-07 09:23:57 +02:00
Jim Meyering
f68f5f23c6 doc: tweak NEWS
* NEWS (dd): Tweak wording.
Two blank lines between sections.
2009-09-07 09:23:48 +02:00
Jim Meyering
cdfb703c5d tail -f: handle "-"/stdin once again
* src/tail.c (main) [HAVE_INOTIFY]: When stdin (i.e., "-", or no args,
but not /dev/stdin) is specified on the command line, don't use inotify.
Reported by Bill Brelsford in <http://bugs.debian.org/545422>.
* tests/tail-2/follow-stdin: New file.  Test for this.
* tests/Makefile.am (TESTS): Add the test.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".
2009-09-07 09:01:14 +02:00
Jim Meyering
15f26e296b tests: tail-2/flush-initial: correct race avoidance code
* tests/tail-2/flush-initial: Wait for the file to be nonempty,
not for the process.  Based on a suggestion from Pádraig Brady.
2009-09-06 20:00:34 +02:00
Jim Meyering
467cc9bb43 tests: ls-misc: don't let a bogus umask cause test failure
* tests/misc/ls-misc: Set umask to 022.  A umask setting permitting
world-write access, e.g., umask o+w, would cause this test to fail.
Report by Mathias Brodala and analysis by Tom Fitzhenry in
<http://bugs.debian.org/544965>.
2009-09-06 18:40:40 +02:00
Jim Meyering
d54376db68 tail: flush initial output before possibly blocking
* src/tail.c (main): Flush any output from tail_file,
before calling tail_forever_inotify, which can block.
* tests/tail-2/flush-initial: New file.  Test for the bug.
* tests/Makefile.am (TESTS): Add tail-2/flush-initial.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".
2009-09-06 09:40:43 +02:00
Jim Meyering
af054f80b2 maint: remove unused file: lib/fdopendir-glibc.c
* lib/fdopendir-glibc.c: Remove unused file.

2009-09-05  Jim Meyering  <meyering@redhat.com>
2009-09-05 19:52:16 +02:00
Jim Meyering
c392c4b8ef tests: ls/stat-vs-dirent: avoid spurious test failure
* tests/ls/stat-vs-dirent: Avoid test failure when run from a
directory whose name (or ancestor directory name) starts with ".".
2009-09-05 19:06:31 +02:00
Pádraig Brady
471f219ac7 doc: make the tail --sleep-interval help less confusing
* src/tail.c (usage): I read "approximately S seconds"
as "approximately 5 seconds" for approximately 5 seconds.
2009-09-05 17:25:40 +01:00
Pádraig Brady
a5e224d793 maint: remove some tab indentation from copy.c
* src/copy.c (copy_internal): Remove tabs erroneously added
in commit 3346c0af.
2009-09-05 17:22:09 +01:00
Pádraig Brady
526a057602 tests: test old tail -f method even on systems with inotify
* src/tail.c (main): Add an undocumented ---disable-inotify option
to allow disabling inotify.
* tests/tail-2/pid: Run test in both normal and "disable_inotify" modes.
* tests/tail-2/tail-n0f: Likewise.
* tests/tail-2/wait: Likewise.
* tests/tail-2/append-only: Likewise.
2009-09-05 17:19:03 +01:00
Eric Blake
41c9e064a6 rm: avoid compiler warning
* src/remove.c (rm_fts): Don't allow fall-through when assertions
are disabled.
2009-09-05 16:28:46 +02:00
Eric Blake
5f303a1293 euidaccess-stat: remove unnecessary macros
* lib/euidaccess-stat.c (F_OK, R_OK, W_OK, X_OK): Delete; now
guaranteed by gnulib.
2009-09-05 16:28:46 +02:00
Eric Blake
2df272914b rm: use gnulib faccessat
* bootstrap.conf (gnulib_modules): Add faccessat.  Replace strdup
with strdup-posix.
* m4/jm-macros.m4 (coreutils_MACROS): Revert previous change, now
that gnulib does it for us.
* src/remove.c (write_protected_non_symlink): Use faccessat in
more situations.
2009-09-05 16:28:46 +02:00
Jim Meyering
278109b9f4 NEWS: mention recent improvements in rm 2009-09-05 16:28:46 +02:00
Jim Meyering
0f3f7d495c rm: improve efficiency of rm -r (without -f) from O(N^2) to O(N)
where N is the depth of the deepest hierarchy rm is processing.
* src/remove.c (write_protected_non_symlink): Use faccessat to
avoid O(N)-per-entry cost of calling euidaccess.
* m4/jm-macros.m4 (coreutils_MACROS): Check for faccessat.
2009-09-05 16:28:46 +02:00
Jim Meyering
4f87cc0364 build: placate gcc's new -Wskip-jump-init
* remove.c (rm_fts): Put braces around each of the two offending blocks.
* configure.ac: Don't turn off -Wjump-misses-init.
With the rewrite of remove.c, it is no longer needed.
2009-09-05 16:28:46 +02:00
Jim Meyering
18c5fbd5dc rm: rewrite to use fts
* remove.c: Don't include "unlinkdir.h"; no longer used.
Do not include <setjmp.h> or "cycle-check.h".  Likewise.
Include "xfts.h".
(dir_name, dir_len): Remove definitions.
(CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Likewise.
(INODE_SORT_DIR_ENTRIES_THRESHOLD, NEED_REWIND, D_TYPE): Likewise.
(struct dirstack_state, Dirstack_state): Likewise.
(g_buf, g_n_allocated): Remove declarations.
(hash_freer, hash_compare_strings, rm_malloc): Remove functions.
(rm_free, push_dir, top_dir, pop_dir, right_justify): Likewise.
(full_filename0, xfull_filename, full_filename_): Likewise.
(AD_stack_height, AD_stack_top, AD_stack_pop, AD_stack_clear): Likewise.
(obstack_init_minimal, ds_init, ds_clear, ds_free): Likewise.
(AD_pop_and_chdir, AD_ensure_initialized, AD_mark_helper): Likewise.
(AD_mark_as_unremovable, AD_mark_current_as_unremovable): Likewise.
(AD_push_initial, AD_push, AD_push, AD_is_removable): Likewise.
(write_protected_non_symlink): Change 3rd parameter from
dirstack_state "ds" to full_name.
(prompt): Adjust parameters.  Now, state comes from FTS/FTSENT pair.
Those replace fd_cwd and "ds".  Remove "filename".  Remove pdirent_type
in favor of new "is_dir" parameter.  Rename is_empty to is_empty_p.
(DO_RMDIR, DO_UNLINK): Remove definitions.
(remove_entry, fd_to_subdirp, compare_ino): Remove functions.
(dirent_count, dirent_inode_sort_may_be_useful): Likewise.
(preprocess_dir): Likewise.
(fts_skip_tree, mark_ancestor_dirs, excise, rm_fts): New functions.
(remove_cwd_entries, remove_dir, rm_1): Remove functions.
(rm): Rewrite as a simple loop calling fts_read and dispatching
each entry via rm_fts.
* src/rm.c (main): Adapt to new signature of rm().
* bootstrap.conf (gnulib_modules): Remove unlinkdir, no longer used.
* src/Makefile.am (sc_tight_scope): Also recognize an extern "enum"
declaration.
* tests/rm/empty-name: Adjust expected output to match new diagnostic.
2009-09-05 16:28:46 +02:00
Jim Meyering
cf963e5a54 rm: record timing data
* README-rm-timing-compare: new file
* README-rm-timing-2: New file.
2009-09-05 16:28:46 +02:00
Jim Meyering
70eadcb4e6 build: update gnulib submodule to latest 2009-09-05 16:28:24 +02:00
Petr Salinger
305bbd99b2 stty: use TAB0, TAB1, and TAB2 only if defined
* src/stty.c (mode_info) [TAB0, TAB1, TAB2]: Guard each
entry with #ifdef.  Required for GNU/kFreeBSD.
Reported by Petr Salinger in http://bugs.debian.org/520368.
2009-09-05 15:54:26 +02:00
Eric Blake
c45b4237bc build: update from gnulib
* gnulib: Update submodule to latest.
2009-09-04 20:46:01 -06:00
Eric Blake
c692280926 ln: add comments related to POSIX 2008
* src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Delete.
(do_link): Update comments per POSIX; add FIXME for -L, -P.
2009-09-04 14:54:55 -06:00
Eric Blake
3346c0afbc mv, cp: tweak LINK_FOLLOWS_SYMLINKS logic
* gnulib: Update to latest gnulib.
* src/copy.c (copy_internal): Adjust comment in light of POSIX
2008, and deal with macro now being tri-state.
2009-09-04 14:54:52 -06:00
Petr Salinger
a23afe7b72 tests: fix a tail-2/pid failure on GNU/kFreeBSD
* tests/tail-2/wait: Increase the file name recheck frequency to
fix a failure on systems without inotify and a file timestamp precision
of 1 second (like GNU/kFreeBSD).
2009-09-04 18:14:55 +01:00
Pádraig Brady
82f09f4762 tests: fix a failure when running tail-2/wait as root
* tests/tail-2/wait: Silently skip a portion of the test
when running as root, rather than failing the whole test.
This regression was introduced with commit 84b5844d, 2009-09-03,
"tests: simplify and fix a race in 2 tail --follow tests".
2009-09-04 17:39:26 +01:00
Mike Frysinger
370fa0fa42 build: fix libcap configure flag handling
* m4/jm-macros.m4 (coreutils_MACROS): The code to handle configure-time
enabling or disabling of libcap support was broken.  It would treat any
libcap configure option as --disable-libcap because it doesn't check
$enableval at all.  This change makes sure we do the sane thing:
  --disable-libcap -> disable and don't run any tests
  --enable-libcap -> run tests and fail if not found
  default -> run tests and warn if not found
2009-09-04 08:48:03 +02:00
Jim Meyering
e0e8429c24 df: don't fail due to an unreadable argument
* src/df.c (main): If open or fstat fails when we're trying to ensure
that all arg-partitions are automounted, fall back on using stat.
Inspired by the report and patch from Olivier Fourdan in
http://bugzilla.redhat.com/520630.
* NEWS (Bug fixes): Mention it.
* tests/df/unreadable: New test for the above.
* tests/Makefile.am (TESTS): Add df/unreadable.
The bug was introduced in coreutils-7.3 via commit dbd17157,
2009-04-28, "df: use open(2), not stat, to trigger automounting".
2009-09-03 19:52:47 +02:00
Kamil Dudka
1422cabf93 doc: install -C: fix bug in the texi documentation
* doc/coreutils.texi: Move the documentation for install --compare (-C)
from the section on fmt to that for install.
Reported by Florian Schlichting.
2009-09-03 16:24:14 +02:00
Pádraig Brady
84b5844d21 tests: simplify and fix a race in 2 tail --follow tests
* tests/tail-2/pid: Use the timeout command to determine process
longevity, rather than querying /proc/$pid/status.
The latter was racy in any case when inotify is used, as then
tail wakes up periodically even for unchanging files therefore
causing the check for "S (sleeping)" state to fail intermittently.
* tests/tail-2/wait: Likewise.
2009-09-03 10:08:06 +01:00
Ondřej Vašík
1a94ac4a05 cp: don't leak resources for each xattr preservation failure
* src/copy.c (copy_reg): Don't return from the function after an
unsuccessful and required preservation of extended attributes.
This resulted in leaking the copy buffer and file descriptors.
* NEWS (Bug fixes): Mention the fix.
The bug was introduced in coreutils-7.1 via commit 0889381c, 2009-01-23,
"cp/mv: add xattr support".
2009-09-03 10:00:32 +01:00
Pádraig Brady
1b2d2635ee chcon, chmod, chgrp, chown, du: report fts_close failure
* src/du.c (du_files): Don't fail silently upon fts_close failure.
* src/chcon.c (process_files): Likewise.
* src/chmod.c (process_files): Likewise.
* src/chown-core.c (chown_files): Likewise.
2009-09-01 13:05:06 +02:00
Jim Meyering
fa3e9cb9af build: update from gnulib
* gnulib: Update submodule to latest.
2009-09-01 12:10:07 +02:00
Jim Meyering
228c8e9eec chcon, chmod, chgrp, chown, du: do not ignore fts_close failure
This is probably never visible, but who knows...
* src/chcon.c (process_files): Don't ignore fts_close failure.
* src/chmod.c (process_files): Likewise.
* src/chown-core.c (chown_files): Likewise.
* src/du.c (du_files): Likewise.
2009-09-01 12:10:07 +02:00
Jim Meyering
1ce27f74ec maint: du: remove unnecessary initialization
* src/du.c (main): Don't set "skip_file" unnecessarily.
2009-09-01 12:10:07 +02:00
Jim Meyering
b2c30136dc maint: chown, chgrp, chmod, chcon: remove unnecessary initialization
* src/chown-core.c: Include "ignore-value.h".
(change_file_owner): Don't set "ent" only to ignore it.
* src/chcon.c (process_file): Likewise.
* src/chmod.c: Include "ignore-value.h".
(process_file): Don't set "ent" only to ignore it.
After diagnosing root-dev/ino failure, return false immediately:
Now that we don't set "ent" we must be sure not to use it uninitialized,
and there's no point in issuing --verbose-related output in this case.
2009-09-01 12:10:07 +02:00
Jim Meyering
e3b14643f4 maint: shred: remove unnecessary initialization
* src/shred.c (genpattern): Value stored to "n" is never used.
2009-09-01 12:10:07 +02:00
Jim Meyering
e579a697b2 maint: dd: remove unnecessary initialization
* src/dd.c (skip): Remove set-but-never-used variable, soffset.
2009-09-01 12:10:07 +02:00
Jim Meyering
68c9b31834 maint: tail: remove unnecessary initialization
* src/tail.c (tail_bytes): Don't compute "diff" twice.
2009-09-01 12:10:07 +02:00
Jim Meyering
856ba44297 maint: mbsalign.c: remove unnecessary assignment
* gl/lib/mbsalign.c (mbsalign): Remove assignment, the result of which
is never used.
2009-09-01 12:10:06 +02:00
Pádraig Brady
8f7d8e3bc3 timeout: remove a redundant assignment
* src/timeout.c (main): While keeping argc and argv in
sync may be marginally useful, it is redundant to update argc,
so just remove that to suppress the clang warning.
2009-09-01 11:07:15 +01:00
Pádraig Brady
0b1dcf33f5 timeout: defensive handling of all wait() errors
* src/timeout.c (main): Handle all possible cases of unexpected
failures from wait().  This was prompted by the clang tool reporting
the possible non-initialization of the status variable.
2009-09-01 11:02:18 +01:00
Jim Meyering
a977dbbe78 ls -i: print consistent inode numbers also for mount points
On most unix- and linux-based kernels, ls -i DIR_CONTAINING_MOUNT_POINT
would print the wrong inode number for any entry that is a mount point.
It would do that by relying on readdir's dirent.d_ino values, while
most readdir implementations return the inode number of the underlying,
inaccessible directory.  Thus, it is not consistent with what you'd
get when applying stat to the same entry.  This bug led to surprising
results like "ls -i" and "ls -i --color" printing different numbers (ls
must usually "stat" a file to colorize its name).  This change makes it
so that on offending systems, ls must stat non-command-line-arguments
for which otherwise it would be able to use "for free" dirent.d_ino
values.  Regardless of this change, ls is already required to stat every
command-line argument.  Note: versions of GNU ls prior to coreutils-6.0
did not perform the invalid optimization, and hence always printed
correct inode numbers.  Thus, for the sake of correctness, ls -i is
forgoing the readdir optimization, for any kernel (including linux!)
with POSIX-nonconforming readdir.  Note that currently, only Cygwin has
been agile enough to conform.

* src/ls.c (RELIABLE_D_INO): Define.
(print_dir): Use it.
For plenty of discussion, see this long thread:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14020
This bug was introduced by the 2006-02-26 commit, 33eb3efe:
"In ls, avoid calling stat for --inode (-i), when possible."
* tests/ls/readdir-mountpoint-inode: New test.
* tests/Makefile.am (TESTS): Add it.
* tests/ls/stat-vs-dirent: Don't suppress failure of this test,
now that ls -i is fixed.  Though note that it doesn't test well,
since it compares only the always-stat'd command-line arguments.
* NEWS (Bug fixes): Mention it.
2009-09-01 07:07:45 +02:00
Jim Meyering
a4e123abd3 maint: revert my stdbuf change: the result didn't even compile
This reverts commit c1e158489d.
2009-08-31 09:44:30 +02:00
Jim Meyering
c1e158489d maint: stdbuf: move a declaration; no-semantic-change
* src/stdbuf.c (set_program_path): Move a declaration down into
the scope where it's used.
2009-08-30 22:34:06 +02:00
Jim Meyering
12a104b45e build: quiet "make check" in src/
* src/Makefile.am (check-duplicate-no-install): Use $(AM_V_GEN).
(check-README): Likewise.  And $(AM_V_at).
2009-08-30 12:22:30 +02:00
Jim Meyering
e3ccc324d3 doc: cp: update note on preserving symlink time stamps
* doc/coreutils.texi (cp invocation): Now, we *do* preserve time
stamps on symlinks, when possible.
2009-08-30 12:02:02 +02:00
Jim Meyering
a10ba58f3c build: update bootstrap from gnulib
* bootstrap: Merge from gnulib.
2009-08-30 12:02:02 +02:00
Pádraig Brady
56300b1dc2 tests: don't misbehave if $TMPDIR contains spaces
* tests/misc/xattr: Add quotes.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
2009-08-30 10:58:13 +01:00
Jim Meyering
0a859a6cb0 tests: other-fs-tmpdir: don't misbehave for quote-unfriendly $TMPDIR
* tests/other-fs-tmpdir: Quote uses of variables that might expand
to strings containing e.g., whitespace.
2009-08-29 19:19:37 +02:00
Jim Meyering
450df0f26d build: update from gnulib
* gnulib: Update submodule to latest.
2009-08-29 17:30:14 +02:00
Jim Meyering
98ec4beba5 tests: move a coreutils-specific test from maint.mk to Makefile.am
* Makefile.am (distcheck-hook): Make taint-distcheck here, since it's
no longer done via maint.mk.
2009-08-29 17:29:45 +02:00
Jim Meyering
6c497c6c2d tests: cp/reflink-auto guard against a pathological $TMPDIR
* tests/cp/reflink-auto: Add quotes.
2009-08-29 17:29:32 +02:00
Pádraig Brady
9e59f8c47c cp --reflink: preserve attributes on cloned files if asked
* src/copy.c (copy_reg): When cloning only skip the data copying
* tests/cp/reflink-perm: New test to check times and modes copied
* tests/Makefile.am: Reference the new test
* NEWS: Mention the fix
2009-08-29 01:37:05 +01:00
Pádraig Brady
72f98388c3 cp --reflink: add an "auto" parameter to fall back to a normal copy
* doc/coreutils.texi (cp invocation): Document the new
"auto" and "always" options to --reflink.
* src/copy.c (copy_reg): Fall back to a standard copy
when reflink() is not supported and --reflink=auto specified.
* src/copy.h [struct cp_options] (reflink): Change type s/bool/enum/.
* src/cp.c (usage): Describe the --reflink={always,auto} options
and expand a little on what --reflink does.
(main): parse the new parameters to --reflink and allow all
--sparse options with --reflink=auto.
* src/install.c (cp_option_init): Init the enum instead of bool.
* src/mv.c (cp_option_init): Likewise.
* tests/cp/reflink-auto: A new test for falling back to normal copy.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
2009-08-29 00:24:49 +01:00
Pádraig Brady
f296cf4052 stdbuf: fix a small typo in --help output
* src/stdbuf.c (usage): s/then/the/
2009-08-28 23:35:48 +01:00
Eric Blake
359fa92f2a build: avoid unused variable warnings on cygwin
* src/copy.c (clone_file, copy_attr_by_fd, copy_attr_by_name):
Mark up unused variables.
* src/remove.c (dirent_inode_sort_may_be_useful): Likewise.
2009-08-28 12:56:53 -06:00
Eric Blake
31fa922e57 dd: detect closed stderr
* src/dd.c (maybe_close_stdout): Always flush stderr; regression
introduced in commit 381e69ea.
* tests/misc/close-stdout (p): Use consistent style.
* tests/dd/stderr: New test, borrowing from misc/close-stdout.
* tests/Makefile.am (TESTS): Run it.
* NEWS: Mention this.
2009-08-28 12:56:51 -06:00
Jim Meyering
59a6ddfca3 maint: ignore only man/*.1, not all *.1 files
* .gitignore: Ignore *.1 only in man/
2009-08-28 14:29:02 +02:00
Jim Meyering
de619c8fa5 build: prefix a few rules with $(AM_V_GEN)
* Makefile.am (.version, dist-hook, gen-ChangeLog): Use $(AM_V_GEN)
and $(AM_V_at), so that automake's silent-rules option (make V=1/V=0)
now controls whether the commands are printed at build time.
(THANKS-to-translators, check-ls-dircolors): Likewise.
2009-08-27 10:18:08 +02:00
Jim Meyering
847359b11d build: stop earlier if touching ChangeLog fails
* bootstrap.conf: Exit right away if touching ChangeLog fails.
Otherwise, the touch failure message is buried under configure output.
2009-08-26 18:21:12 +02:00
Jim Meyering
d6639ee63b tests: mkdir/selinux: avoid spurious failure on some SELinux systems
* tests/test-lib.sh (require_selinux_enforcing_): New function.
* tests/mkdir/selinux: Use it.
Otherwise, this test would fail on Rawhide with SELinux disabled.
2009-08-26 10:06:53 +02:00
Jim Meyering
be8531206b tests: tail-2/assert: avoid risk of race condition
* tests/tail-2/assert: Avoid spurious failure due to race condition.
Rather than sleeping for 1 second and crossing fingers,
wait explicitly for backgrounded tail process to start.
Otherwise, this test would fail under heavy load.
2009-08-26 09:25:21 +02:00
Jim Meyering
899c1d00fa maint: ensure we don't embed Emacs indent-tabs-mode setting lines
Now that we prohibit indentation via TABs, there's no need for
Emacs indent-tabs-mode setting lines, so prohibit those, too.
* cfg.mk (sc_prohibit_emacs__indent_tabs_mode__setting): New rule.
2009-08-25 09:21:00 +02:00
Jim Meyering
e2808a3999 maint: remove Local Variables: indent-tabs-mode: nil from all sources
* src/getlimits.c: Likewise.
* src/group-list.c: Likewise.
* src/groups.c: Likewise.
* src/mktemp.c: Likewise.
* src/setuidgid.c: Likewise.
* src/stdbuf.c: Likewise.
* src/timeout.c: Likewise.
* src/truncate.c: Likewise.
* gl/lib/mbsalign.c: Likewise.
* tests/test-lib.sh: Likewise.
* bootstrap: Likewise.
* README-hacking: Likewise.
2009-08-25 09:21:00 +02:00
Jim Meyering
ddfcccce51 doc: HACKING: mention the new space-only indentation policy 2009-08-25 09:21:00 +02:00
Jim Meyering
1130e181ee maint: teach "make syntax-check" the space-only indentation rule
* cfg.mk (sc_prohibit_tab_based_indentation): New rule.
* .x-sc_prohibit_tab_based_indentation: New file.
* Makefile.am (syntax_check_exceptions): Add file,
.x-sc_prohibit_tab_based_indentation.
2009-08-25 09:21:00 +02:00
Jim Meyering
5e778f7c8d global: convert indentation-TABs to spaces
Transformed via this shell code:
t=$'\t'
git ls-files \
  | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \
  | grep -vE 'tests/pr/|help2man' \
  | xargs grep -lE "^ *$t" \
  | xargs perl -MText::Tabs -ni -le \
    '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-08-25 09:21:00 +02:00
Jim Meyering
2bc0f3caaa cp: ignore obscure failure to preserve symlink time stamps,
...when run on a kernel older than what was implied by headers and
libraries tested at configure time.
* src/copy.c (utimens_symlink): Ignore failure when errno == ENOSYS.
* NEWS (Bug fixes): Mention it.
Reported by Todd Zullinger and Kamil Dudka.
Details in this thread:
http://thread.gmane.org/gmane.linux.redhat.fedora.devel/119834
2009-08-24 12:44:13 +02:00
Jim Meyering
831acb987e tests: skip (don't fail) a cp test, upon mount-related failure
* tests/cp/cp-mv-enotsup-xattr: Upon a set-up failiure, rather than
failing the test with a "framework failure" diagnostic, just skip it.
Russell Whitaker reported that this test failed on slackware.
2009-08-23 22:05:58 +02:00
Jim Meyering
1d651b954f build: update from *public* gnulib
* gnulib: Update submodule to latest.
Kamil Dudka reported that bootstrap was broken.
2009-08-23 10:13:36 +02:00
Jim Meyering
99e607b910 build: update from gnulib
* gnulib: Update submodule to latest.
2009-08-22 16:12:26 +02:00
Jim Meyering
04a31ad99d post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-08-20 21:48:45 +02:00
Jim Meyering
af1996dde2 version 7.5
* NEWS: Record release date.
2009-08-20 21:19:36 +02:00
Jim Meyering
7f242fadfa tests: skip the stdbuf tests when the abs build directory name is bogus
* tests/misc/stdbuf: Avoid spurious failure when the directory name
from which we'd set LD_PRELOAD contains unsafe characters.
2009-08-20 19:47:12 +02:00
Jim Meyering
3db7c2c03c install: avoid a portability bug when compiling with non-gcc
* src/install.c (extra_mode): Be careful to return only a 0 or 1
value, since this is a "bool" function, and there are still some
compilers for which this is necessary.  Without this change,
Bernhard Voelker reported that the Forte Developer 7 C 5.4 2002/03/09
compiler would produce a malfunctioning "install" binary.  Details in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17710/focus=17760
2009-08-20 10:46:22 +02:00
Jim Meyering
a70ac4ef32 tests: make install-C slightly less prone to confusion
* tests/install/install-C: Invoke framework_failure, if necessary.
2009-08-19 17:10:23 +02:00
Jim Meyering
112bccb26b build: avoid "make dist" failure in man/
Now that "make check" no longer builds programs like arch, ...
* src/Makefile.am (dist-hook): Depend on $(all_programs), so that the
subsequent build in man/ doesn't fail due to lack of a program like
arch that is not going to be installed.
2009-08-19 08:44:40 +02:00
Jim Meyering
611870a8f3 build: update from gnulib
* gnulib: Update submodule to latest.
2009-08-18 21:07:44 +02:00
Giuseppe Scrivano
718b2790c0 nl: deprecate --page-increment in favor of --line-increment
* NEWS: Mention the change.
* doc/coreutils.texi: Document the new --line-increment option.
* src/nl.c (struct option): Add --line-increment,
(usage): Describe it,
(main): Use it.
2009-08-18 18:40:41 +02:00
Jim Meyering
6f6599a006 tests: stdbuf: fix a bug in test script
* tests/misc/stdbuf: Use skip_test_ only after it's defined.
Reported by Berhnard Voelker.

(sc_check-AUTHORS): Rename rule from check-AUTHORS.
2009-08-18 17:53:20 +02:00
Jim Meyering
d25101cc30 build: perform check-AUTHORS via syntax-check, not via "make check"
* src/Makefile.am (check): Don't depend on check-AUTHORS.
That check fails on systems for which a program like stdbuf is
not built.  Instead, move this check to "make syntax-check".
(sc_check-AUTHORS): Rename rule from check-AUTHORS.
* cfg.mk (sc_check-AUTHORS): New rule.
Reported by Berhnard Voelker.
2009-08-18 12:16:36 +02:00
Jim Meyering
ea57d46482 sort: use more portable initialization syntax
* src/sort.c (find_unit_order): Spell out 256-element static
initializer, rather than relying on C99 syntax.
Required for Forte Developer 7 C 5.4 2002/03/09 on Solaris 10.
Reported by Bernhard Voelker.
2009-08-18 11:02:36 +02:00
Jim Meyering
eca6a4a21a build: suppress warnings due to gcc's new -Wjump-misses-init
* configure.ac: Ignore -Wjump-misses-init violations in remove.c.
2009-08-17 19:37:47 +02:00
Jim Meyering
60d0413fe6 build: update from gnulib
* gnulib: Update submodule to latest.
2009-08-17 19:17:18 +02:00
Jim Meyering
dc1618fbd8 tests: tail-2/append-only: don't discard stderr
* tests/tail-2/append-only: Don't discard a diagnostic that
may help explain why this test fails for some.  Details in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17621/focus=17641
2009-08-16 13:54:40 +02:00
Jim Meyering
e4dcb20e83 tests: skip the misc/stdbuf test if stdbuf was not built
* tests/misc/stdbuf: Skip this test when stdbuf is not built.
Reported by Eric Blake.
2009-08-14 21:34:05 +02:00
Jim Meyering
ea5b7124b4 build: use gnulib's getopt-gnu module (getopt is now deprecated)
* bootstrap.conf (gnulib_modules): Gnulib's getopt module is now
deprecated; use the new, preferred name, getopt-gnu.
* gnulib: Update to latest.
2009-08-14 17:15:50 +02:00
Pádraig Brady
f0a1f0df22 cp,mv: fix issues with preserving timestamps of copied symlinks
* src/copy.c (copy_internal): On systems without utimensat don't
use utimens on a symlink, as that would dereference the symlink.
* tests/cp/abuse: To work around possible attribute preservation
failures breaking the test, use cp -dR rather than cp -a.
2009-08-14 17:10:53 +02:00
Pádraig Brady
8574c74325 doc: clarify the cp --reflink NEWS
* NEWS: Remove the description associated with the removed
experimental code which unconditionally tried to reflink() on copy.
Also clarify where --reflink works exactly.
2009-08-14 10:48:07 +01:00
Jim Meyering
11ccbdab27 tests: raise ulimit virt-mem limit to avoid new failure
* tests/cp/link-heap: Raise limit from 16MB to ~20MB,
to avoid spurious failure on rawhide.
2009-08-13 17:25:39 +02:00
Pádraig Brady
f43f028652 tail: fix tail -f failure when inotify used
* src/tail.c (tail_forever_inotify): Remove the redundant and
incorrect error check of the return from inotify_add_watch().
Also initialize the wd member of each File_spec to an invalid value.
Reported by C de-Avillez.
2009-08-13 16:09:27 +01:00
Pádraig Brady
e4caea5775 dd: fix a signal handling race
* src/dd.c (main): Install the signal handlers at startup
rather than just before the copy starts. In this way signals
received before the copy (like during a slow truncate for e.g.)
will be deferred and handled consistently.
* THANKS: Add Bernhard's email address.
* NEWS: Mention the fix.
Reported by Bernhard Voelker.
2009-08-13 16:06:50 +01:00
Pádraig Brady
ab274c428d tests: improve one of the tail --pid tests
* tests/tail-2/pid: Speed up the test by specifying a
timeout of 100ms rather than the default 1s.  Also
skip the test instead of failing in the unlikely case
were the pid required to be missing pid is present.
2009-08-12 22:03:33 +01:00
Jim Meyering
e32320de66 nl, pinky: replace uses of strcat
* src/nl.c (main): Avoid strcat, on principle.  Use stpcpy instead.
* src/pinky.c (print_long_entry): Likewise.
2009-08-10 09:17:07 +02:00
Jim Meyering
eb2f9e84b9 build: update from gnulib, for HOST_NAME_MAX on solaris 10
* gnulib: Update submodule to latest.
2009-08-10 09:16:57 +02:00
Giuseppe Scrivano
a1d7469835 cp: accept the --reflink option
* NEWS: Mention it.
* doc/coreutils.texi (cp invocation): Describe it.
* src/copy.h (struct cp_options) [reflink]: New member.
* src/copy.c (usage): Describe it.
(copy_reg): If reflink is true try to clone the file.
(main): Check for --reflink.
(cp_option_init): Initialize the new member.
* src/install.c (cp_option_init): Initialize the new member.
* src/mv.c (cp_option_init): Likewise.
* tests/cp/sparse: Add a new test case.
2009-08-07 17:14:22 +02:00
Jim Meyering
ff159a605e dd: preserve semantics of O_DIRECT even for final block
* src/dd.c: Include "ignore-value.h"
(iwrite): When disabling O_DIRECT, try to compensate
via POSIX_FADV_DONTNEED and fsync.
Suggested by Eric Sandeen.
2009-08-07 16:21:35 +02:00
Jim Meyering
c5c15884df maint: move selinux-at module from gl/ to gnulib
* gl/lib/selinux-at.c: Remove file.
* gl/lib/selinux-at.h: Likewise.
* gl/modules/selinux-at: Likewise.
* gnulib: update to latest, to get the new module.
2009-08-06 14:32:38 +02:00
Jim Meyering
5929322ccb dd: work around buffer length restrictions with oflag=direct (O_DIRECT)
dd oflag=direct would fail to copy a file with size that is
not a multiple of 512 (destination file system specific)

* NEWS (Bug fixes): Mention it.
* src/dd.c (iwrite): Turn off O_DIRECT for any
smaller-than-obs-sized write.  Don't bother to restore it.
* tests/dd/direct: New test for the above.
* tests/Makefile.am (TESTS): Add dd/direct.
* doc/coreutils.texi (dd invocation): Mention oflag=direct
buffer size restriction.
Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17586
Reported by Eric Sandeen.
2009-08-06 09:41:50 +02:00
Jim Meyering
365fb90eaa dd: remove unnecessary #if HAVE_FTRUNCATE
* src/dd.c (main): Remove unnecessary cpp directives.
Gnulib guarantees that ftruncate is usable.
2009-08-04 20:06:03 +02:00
Jim Meyering
eae535e1a3 cp -pP (and e.g., -a): preserve time stamps on symlinks, too
* src/copy.c (utimensat_if_possible): New function.
(copy_internal): Remove variable, "preserve_metadata".
Replace with "dest_is_symlink".  That covers all cases but one:
the one in which cp --link has created hard links to non-directories.
In that case, there is no need to update attributes of the links.
Use utimensat_if_possible, to preserve timestamps of symlinks.
* NEWS (New features): Mention this.
* tests/Makefile.am (TESTS): Add cp/preserve-slink-time.
* tests/cp/preserve-slink-time: New file.
* m4/jm-macros.m4 (coreutils_MACROS): Test for utimensat.
Reported in http://bugzilla.redhat.com/230866
2009-08-04 17:38:54 +02:00
Kamil Dudka
1762092901 install runs faster again with SELinux enabled
* m4/jm-macros.m4: Pull in SELinux libraries while checking for
matchpathcon_init_prefix ().  Emit configure warning when not found
with SELinux enabled.
* NEWS (Bug fixes): Mention it.
The bug was introduced in coreutils-7.0 via commit 0647f3eb, 2008-06-02,
"accommodate older SELinux which lacks matchpathcon_init_prefix".
2009-08-04 16:51:52 +02:00
Jim Meyering
c60f151ebd maint: move the update-copyright rule to gnulib's maint.mk
* gnulib: Update submodule to get latest maint.mk.
* Makefile.am (update-copyright): Remove rule; now it's in maint.mk.
* m4/check-decl.m4: Update sole remaining copyright year list.
2009-08-04 12:06:32 +02:00
Jim Meyering
48726556ca build: *really* update to a usable gnulib commit 2009-07-31 18:05:10 +02:00
Jim Meyering
81ae3611d3 build: update to a usable gnulib commit
The commit, 5ef90695, 2009-07-29, "maint: move update-copyright
to gnulib" recorded a local-only commit.
Reported by Pádraig Brady.
2009-07-31 09:05:25 +02:00
Jim Meyering
c06547cade tests: new function: require_openat_support_
* tests/rm/inaccessible: Factor out openat-support-detection code...
* tests/test-lib.sh (require_openat_support_): ...into this new function.
2009-07-30 17:47:21 +02:00
Jim Meyering
28e3946ef0 tail: tweak indentation
* src/tail.c (tail_forever_inotify): Adjust indentation of continued line.
2009-07-30 17:45:53 +02:00
Pádraig Brady
c9871986eb tail: properly parse fractional seconds when monitoring a pid
* src/tail.c (tail_forever_inotify): The fractional
part of the delay was 1000 times too large.
* tests/tail-2/pid: Add a test to ensure the
timeout happens for this case.
2009-07-30 17:40:43 +02:00
Jim Meyering
2ac2cace15 tests: test for just-fixed tail --pid bug
* tests/tail-2/pid: Ensure tail exits successfully when PID dies.
2009-07-30 10:27:51 +02:00
Giuseppe Scrivano
d3feea0181 tail: exit successfully upon watched process death
* src/tail.c (tail_forever_inotify): If a PID is specified and the
watched process dies, exit with status EXIT_SUCCESS, rather than
falling through to an EXIT_FAILURE.
2009-07-30 10:24:17 +02:00
Jim Meyering
5ef9069576 maint: move update-copyright to gnulib
* build-aux/update-copyright: Remove file.
* bootstrap.conf (gnulib_modules): Add update-copyright.
* gnulib: Update submodule to latest.
2009-07-29 19:30:58 +02:00
Jim Meyering
e40c5f735c maint: make update-copyright work in yet another case
* build-aux/update-copyright: Handle the case in which "\n#"
appears between the final year number and the copyright holder name.
* m4/lib-check.m4: Update copyright year list.
Reported by Joel E. Denny.
2009-07-29 15:39:25 +02:00
Jim Meyering
bc51349ccd maint: update NEWS
* NEWS (New features): Mention it.
2009-07-29 12:27:08 +02:00
Giuseppe Scrivano
4533017669 cp: support btrfs' copy-on-write file clone operation
* src/copy.c [HAVE_SYS_IOCTL_H]: Include <sys/ioctl.h>.
(BTRFS_IOCTL_MAGIC, BTRFS_IOC_CLONE): Define.
(clone_file): New function.
(copy_reg): Use the btrfs clone operation if possible.
2009-07-29 12:15:50 +02:00
Jim Meyering
095861179c maint: update sleep.c's copyright year list
* src/sleep.c: Update copyright year list to include 2009.
* tests/sort-time/rand-gen: Remove long-unused file.
* tests/sort-time/README: Likewise.
2009-07-29 11:21:21 +02:00
Joel E. Denny
1bc5395e92 maint: improve update-copyright rule
* Makefile.am (update-copyright): Relax the selection rule
to match any file containing the word "Copyright".
Correct the exclusion rule so that it also excludes ChangeLog
and COPYING files that are not in the top level directory.
2009-07-29 11:05:54 +02:00
Jim Meyering
c91c85647c maint: update-copyright: fix just-introduced bug
* build-aux/update-copyright: ... and revert-for-now the
change that made this script invoke localtime only once.
2009-07-29 10:56:10 +02:00
Jim Meyering
9d87a45b2f maint: make update-copyright handle more cases
* build-aux/update-copyright: Handle cases in which the final
year number and copyright holder are on separate lines.
Prompted by a report from Joel E. Denny.
Also, do not invoke localtime for each line we process.
2009-07-29 10:25:24 +02:00
Pádraig Brady
8aeda9b930 doc: fix the generated HTML index
* doc/coreutils.texi: Move the "SELinux context" section
down below the "System context" nodes so that the HTML
index is generated correctly. Also some extraneous and missing
'.' characters were corrected in the index.
Reported by Benno Schulenberg.
2009-07-28 23:21:43 +01:00
Giuseppe Scrivano
e81c4d88c2 tail: use the inotify backend also with --pid=PID
* src/tail.c (tail_forever_inotify): When a PID is specified, use
select to block for no more than sleep_interval seconds at a time,
and check for process death upon timeout.
(main): Adapt to new tail_forever_inotify interface.
2009-07-28 09:31:54 +02:00
Jim Meyering
5874a8215d tests: new test for bug in ls -1U dir arg ...
* tests/misc/ls-misc (multi-arg-U1): New test.
2009-07-27 17:12:58 +02:00
Kamil Dudka
493c481684 ls -1U dir arg ... now works again
* src/ls.c (print_dir): Emit "$dir_name:\n" *before* accumulating (and
possibly printing) directory entry names.
The bug was introduced in coreutils-7.0 via commit
8d974b00, 2008-07-30, "ls -U1 now uses constant memory".
Reported by Julian Bradfield.
* NEWS (Bug fixes): Mention it.
2009-07-27 17:10:39 +02:00
Heikki Orsila
6edc9c972e tr: improve --help's description of --complement (-c) 2009-07-27 11:55:35 +02:00
Pádraig Brady
2f4188ebec doc: add a sort by line length example
* doc/coreutils.texi (sort invocation): Add an example showing how
to sort data not directly supported by the sort command.
2009-07-27 01:34:35 +01:00
Pádraig Brady
0bf77fc8ec doc: mention realpath in the readlink info
* doc/coreutils.texi (readlink invocation): Add realpath to the index,
and also mention it in the readlink description so people
searching for that functionality can easily make the connection.
2009-07-27 00:53:04 +01:00
Jim Meyering
394e3ef72a build: use a fixed-name temporary in man/Makefile.am
* man/Makefile.am (check-x-vs-1): Using a fixed-name temporary file
is better than one ending in -$$, because many -$$-suffixed files
may accumulate over time.
2009-07-26 20:42:31 +02:00
Kamil Dudka
9f9e2d81d1 doc: improve readlink description here, too
* doc/coreutils.texi (readlink invocation): Update menus.
Add @cindex entries.
2009-07-24 10:25:23 +02:00
Jim Meyering
571b7e3eee readlink: improve one-line summary: prints canonical file names, too
* src/readlink.c (usage): Adjust one-line summary.
* man/readlink.x: Likewise.
Suggested by Kamil Dudka.
2009-07-24 09:33:38 +02:00
Jim Meyering
954dba24d4 build: update from gnulib
* gnulib: Update submodule to latest.
2009-07-21 18:35:28 +02:00
Jim Meyering
4612670f46 doc: point to Guile's ChangeLog-writing guidelines
* HACKING (Commit log requirements): Point to Guile's
http://www.gnu.org/software/guile/changelogs/guile-changelogs_3.html.
Mention that a bit of prose can be welcome.
2009-07-14 20:43:49 +02:00
Jim Meyering
8f3171bbc4 tail: adjust type of a local variable
* src/tail.c (tail_forever_inotify): Declare "len" to be of type
size_t, not ssize_t, since the former is what safe_read returns.
2009-07-11 09:43:25 +02:00
Jim Meyering
68149832bd tests: avoid false-positive cp/link-heap failure
* tests/cp/link-heap: Increase address space limit from 14000KB
to 16000KB, to avoid failure with Debian unstable's libc6-dev-2.9-19
2009-07-09 15:50:49 +02:00
Jim Meyering
a9461064b8 build: avoid build warn/failure due to -Wstack-protector
* configure.ac: Do not enable -Wstack-protector.
Otherwise, at least df.c would provoke a warning.
2009-07-09 15:21:53 +02:00
Ondřej Vašík
ad7b37bfd4 copy.c: remove a duplicate expression
* src/copy.c (copy_attr_error): remove a redundant expression
added in commit e0cf592f, 2009-04-27, "factor out test for errno ...".
2009-07-08 22:59:56 +01:00
Jim Meyering
0d64bc4429 build: update from gnulib
* gnulib: Update submodule to latest.
2009-07-08 22:37:29 +02:00
Jim Meyering
0e93175301 tail: use size_t for counter and index variables, ...
* src/tail.c (any_live_files): ... not "int" or even unsigned int
(tail_forever, tail_forever_inotify, main): Likewise.
2009-07-08 19:53:43 +02:00
Jim Meyering
3639a880aa tail: declare "file descriptor" variable to be "int", not size_t
* src/tail.c (tail_forever_inotify): Use "int", not size_t
as the type of a file descriptor variable.
2009-07-08 19:52:58 +02:00
Jim Meyering
ec34511ccf move argv-iter module to gnulib
* gl/lib/argv-iter.c: Remove file.
* gl/lib/argv-iter.h: Remove file.
* gl/modules/argv-iter: Remove file.
* gl/modules/argv-iter-tests: Remove file.
* gl/tests/test-argv-iter.c: Remove file.
* gnulib: Update submodule, to get argv-iter
2009-07-04 17:41:39 +02:00
Giuseppe Scrivano
2c20fd053b tests: refactor code to use require_proc_pid_status_
* tests/tail-2/tail-n0f: Read the process status using the test-lib.sh
require_proc_pid_status_ function.
2009-07-04 10:47:56 +02:00
Giuseppe Scrivano
42cd6653b0 tests: use the "nobody" user's group as the default group id
* tests/chroot/credentials: Use the group id, not its name.
* tests/test-lib.sh (NON_ROOT_GROUP): Use the "nobody" user's group in
place of "nogroup".
2009-07-04 10:47:56 +02:00
Jim Meyering
065ce24361 build: update from gnulib
* gnulib: Update submodule to latest.
2009-07-03 20:28:33 +02:00
Pádraig Brady
acc01947af sort: allow SI and IEC units on separate human sort fields
* src/sort.c: Store the si_present state per key rather than globally
* tests/misc/sort: Add a check that would have previously failed.
Also add a test to demonstrate that invalid IEC/SI mixtures are not
always noticed when they're not significant to the sort.
2009-07-03 17:00:55 +01:00
Giuseppe Scrivano
d9f83f9a60 tail: avoid an inotify portability problem in kernels prior to 2.6.21
* src/tail.c (tail_forever_inotify): Handle the special case in which
an old inotify watcher returns 0.  Affects kernels in [2.6.13, 2.6.21).
2009-07-03 17:52:30 +02:00
Jim Meyering
66ac50e723 tests: tail-2/wait: rename internal file name
* tests/tail-2/wait: Rename file from not_accessible to unreadable,
since all the test cares about is readability.
2009-07-03 17:52:30 +02:00
Giuseppe Scrivano
d106277d45 tests: tail-2/wait: don't fail when run as root
* tests/tail-2/wait: Ensure that the unreadable file really is not
readable before trying to run "tail -f" on it.
2009-07-03 17:52:30 +02:00
Pádraig Brady
962878499c doc: update the info on sort -b and -k
* doc/coreutils.texi (sort invocation): Mention in the description
of -b, that the locale can also affect whether blanks are significant.
Update the list of ordering options for a --key that cause it
to not inherit any global ordering options.
Update the list of ordering options that implicitly skip whitespace.
2009-07-03 16:49:04 +01:00
Pádraig Brady
3e565eb3a6 maint: generalize the development prerequisites docs
* README-hacking: Add a little more high level info and
merge notes on specific developer prerequisites into README-prereq
* README-prereq: Remove the Fedora 8 specific information
and generalize the information to be applicable to any system.
2009-07-03 16:47:17 +01:00
Jim Meyering
6d0d1c47b2 tail: add comments noting potential inotify-related problems
* src/tail.c (tail_forever_inotify): Add two FIXME comments.
2009-06-29 20:43:26 +02:00
Jim Meyering
5718733510 maint: bootstrap: merge changes from gnulib
* bootstrap: Indent using spaces, not TABs.
2009-06-28 12:16:28 +02:00
Jim Meyering
f24b825171 maint: bootstrap: sync submodule usage from gnulib
* bootstrap: Config for git submodule use only if .gitmodules exists.
2009-06-28 11:25:13 +02:00
Jim Meyering
07c6f21b81 maint: bootstrap: split a few long lines
* bootstrap (found_aux_dir): Avoid lines longer than 80 columns.
2009-06-28 11:17:50 +02:00
Jim Meyering
b3f293c61b maint: don't change COPYING
* COPYING: Don't modify Copyright date list in imported file.
This file is one of very few exceptions in that we version-control it,
even though its primary source is another package.
Spotted by Eric Blake.
2009-06-27 09:16:59 +02:00
Jim Meyering
e472f8fece maint: add a rule to automate the annual copyright-year-update process
* build-aux/update-copyright: New file.
* Makefile.am (changelog_etc): Add update-copyright.
(update-copyright): New rule.
2009-06-27 09:16:59 +02:00
Pádraig Brady
1c16c9598e stdbuf: fix to stop -i option causing an assertion
* src/stdbuf.c (main): Fix the array bounds check in the assert
* tests/misc/stdbuf: Add a test for all standard streams
2009-06-27 02:21:43 +01:00
Pádraig Brady
9c6c621c32 doc: clarify the tail inotify NEWS
* NEWS: Say why inotify was used
2009-06-25 14:50:05 +01:00
Jim Meyering
2232b4d08f maint: update all Copyright year lists to include 2009 2009-06-23 22:33:15 +02:00
Jim Meyering
ec00727a72 maint: remove old TODO files
* lib/TODO: Remove file.
* tests/join/TODO: Likewise.
2009-06-23 22:30:29 +02:00
Jim Meyering
f9554bbe25 doc: README-hacking tweak
* README-hacking: Move the "While building..." sentence down
to where it belongs.
2009-06-23 16:54:38 +02:00
Jim Meyering
fc66fb4d99 tests: tail-2/pid: include more info upon failure
* tests/tail-2/pid: Print unexpected $state upon failing.
2009-06-23 16:53:43 +02:00
Jim Meyering
0975852c50 doc: typo fix in README-hacking
* README-hacking: Fix a typo.
Don't make building from a git-cloned tree sound so hard.
2009-06-20 14:48:59 +02:00
Jim Meyering
0c131d4c10 build: update from gnulib (hash module updates; maint.mk tweak)
* gnulib: Update submodule to latest.
2009-06-20 00:06:42 +02:00
Jim Meyering
25a18dafb8 doc: fix a typo
* doc/coreutils.texi (stdbuf invocation): Insert missing "to".
2009-06-17 16:17:19 +02:00
Pádraig Brady
a5a2a406f8 stdbuf: A new program to run a command with modified stdio buffering
* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add stdbuf command to list.
* configure.ac: Only enable on ELF systems with GCC.
* cfg.mk (sc_system_h_headers): Use VC_LIST_EXCEPT rather than
VC_LIST, so we can add an exception, if needed.
* .x-sc_system_h_headers: New file.  Exempt libstdbuf.c.
* Makefile.am (syntax_check_exceptions): Add .x-sc_system_h_headers.
* doc/coreutils.texi (stdbuf invocation): Add stdbuf info.
* man/.gitignore: Ignore generated manpage.
* src/.gitignore: Ignore stdbuf and libstdbuf.so binaries.
* man/Makefile.am (stdbuf.1): Add dependency.
* man/stdbuf.x: New file with example usage.
* po/POTFILES.in: Reference new command and shared library sources.
* src/Makefile.am (build_if_possible__progs): Add stdbuf and libstdbuf,
(pkglib_PROGRAMS): Reference optional shared lib,
(libstdbuf_so_LDADD): Ensure we don't link with non PIC libcoreutils.a.
(libstdbuf_so_LDFLAGS): Add -shared GCC option,
(libstdbuf_so_CFLAGS): Add -fPIC GCC option.
(check-README): Exclude libstbuf.
(check-AUTHORS): ditto.
(sc_tight_scope): Exclude functions starting with __.
* src/libstdbuf.c: The LD_PRELOAD shared library to control buffering.
* src/stdbuf.c: New file to setup env variables before execing command.
* tests/Makefile.am: Reference new test file.
* tests/misc/help-version: Set expected exit codes.
* tests/misc/invalid-opt: ditto.
* tests/misc/stdbuf: Add 9 tests.
2009-06-17 14:54:29 +01:00
Jim Meyering
ff6fe3d17d doc: cp: describe an oddity of combining -H/-L and --preserve=links
* doc/coreutils.texi (cp invocation) [-L]: Elaborate.
[--preserve=links]: Remove comments saying that we need documentation
for just this situation.  Provide more explanation and examples.
Reported by Brian M. Carlson in http://bugs.debian.org/525048.
2009-06-16 18:08:01 +02:00
Jim Meyering
f51a401bc2 maint: revert last change: we're not ready for "local" in scripts, yet
Revert "use a local var: more readable"
This reverts commit c0d8245288.
2009-06-15 19:37:42 +02:00
Jim Meyering
c0d8245288 use a local var: more readable 2009-06-15 18:34:21 +02:00
Giuseppe Scrivano
ae494d4be8 tail: use inotify if it is available
* NEWS: Document the new feature.
* m4/jm-macros.m4: Check if inotify is present.
* src/tail.c (tail_forever_inotify): New function.
(main): Use the inotify-based function, if possible.
* tests/Makefile.am: Add new tests for tail.
* tests/test-lib.sh (require_proc_pid_status_, get_process_status_):
New functions.
* tests/tail-2/pid: New file.
* tests/tail-2/wait: New file.
* tests/tail-2/tail-n0f: Refactor code into the test-lib.sh
require_proc_pid_status_ function.
2009-06-15 18:34:14 +02:00
Jim Meyering
358aca5fb9 diag: say "failed to...", rather than "cannot..." in a few diagnostics
* src/chroot.c (main): ...it's more precise.
* src/nohup.c (main): Likewise.
* src/setuidgid.c (main): Likewise.
* src/timeout.c (main): Likewise.
2009-06-13 16:37:13 +02:00
Cliff Miller
24c727d3c2 sort: Ignore fields where end position is before the start position
* NEWS: Mention the fix
* THANKS: Add Cliff Miller
* src/sort.c (keycompare): Ensure lima >= texta
* tests/misc/sort: Add 3 corresponding tests

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2009-06-13 01:25:06 +01:00
Pádraig Brady
ba1c5239bc tests: ls --color, permissions override hardlink coloring
* tests/ls/multihardlink: Add a test case to demonstrate
and test this non obvious behavior.
2009-06-11 11:39:24 +01:00
Kamil Dudka
0df338f671 ls --color: do not colorize files with multiple hard links by default
* src/ls.c: Rename hl->mh, do not colorize files with multiple
hard links by default.
* src/dircolors.c: Rename HARDLINK -> MULTIHARDLINK, hl -> mh.
* src/dircolors.hin: Do not colorize files with multiple hard links by
default.
* tests/Makefile.am: Rename the test case accordingly.
* tests/ls/multihardlink: Additionally test ls' default behavior
and factor out some duplication.
* NEWS: Mention the change in behavior.
2009-06-11 09:53:50 +02:00
Pádraig Brady
502be19e0f maint: Add a syntax-check to ensure all .x-sc_ files are distributed
* Makefile.am: Add a couple of missing entries to
syntax_check_exceptions for distribution.
* cfg.mk: Add a rule to ensure the syntax_check_exceptions list
stays in sync with the .x-sc_* files in the repository.
2009-06-08 15:35:31 +01:00
Jim Meyering
523c40505c build: update from gnulib
* gnulib: Update submodule to latest.
2009-06-07 13:58:24 +02:00
Jim Meyering
f9a950b87f sort: die immediately upon heap allocation failure
* src/sort.c (register_proc): Handle hash_insert failure.
2009-06-07 13:58:24 +02:00
Mike Frysinger
5424a74725 dircolors: add screen-256color-bce to TERM list
* src/dircolors.hin: Add screen-256color-bce.
2009-06-04 07:16:06 +02:00
Jim Meyering
d8243c25cd doc: HACKING: minor adjustments, additions
* HACKING (Amending...): Remove spurious "-e" used with commit --amend.
(log message policy): Mention the 72-column limit.
"build:" and "maint:" are common prefixes, these days.
2009-06-03 18:30:40 +02:00
Jim Meyering
59400b2884 doc: adjust wording in README-prereq 2009-06-03 14:58:57 +02:00
Jim Meyering
d7397c1e7b dircolors: recognize .xz, .txz, .tbz and .tlz suffixes
* src/dircolors.hin: Add .xz, .txz, .tbz and .tlz.
2009-06-03 14:07:27 +02:00
Jim Meyering
a65957da77 doc: use newer URL for XZ utils
* README-hacking: Use <http://tukaani.org/xz/>
* README-prereq: Mention xz, not lzma.
2009-06-03 07:19:20 +02:00
Matěj Cepl
ba6e08c627 doc: adjust README-prereq instructions
* README-prereq: Mention new requirement on automake-1.11,
with its new location and updated dependency on autoconf-2.62.
Remove the reference to coreutils-7.0 so that this file
implicitly refers to the latest or release version of coreutils.
Fix and clarify the instructions for updating the $PATH.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2009-06-03 01:03:47 +01:00
Jim Meyering
18db64ba7e doc: HACKING: mention the GNU Coding Standards
* HACKING (Add documentation): Add a link to the GCS.
2009-06-02 16:35:14 +02:00
Jim Meyering
4dbfbf3fd0 build: no longer list gnulib's "memchr" module as obsolete
* bootstrap.conf (obsolete_gnulib_modules): Remove memchr from
the list, now that it fixes a problem in some modern C libraries.
(gnulib_modules): Add it here.
2009-06-02 16:35:14 +02:00
Jim Meyering
0818c52874 build: make generated man/*.1 files read-only
This should help people notice that they are generated.
Note: each file already has a comment to that effect from help2man.
* man/Makefile.am (.x.1): Make generated files read-only.
Also, don't redirect directly to the target, $@.
2009-06-02 16:35:14 +02:00
Jim Meyering
a5c627f9c6 build (man/): use automake's new $(AM_V_GEN) variable
* man/Makefile.am (.x.1, check-x-vs-1, check-programs-vs-x):
Mark with $(AM_V_GEN), so that automake-1.11 prints
"GEN $@" by default (stick with "GEN" in spite of the latter two
rules not officially generating anything -- they're just tests).
2009-06-02 16:35:14 +02:00
Jim Meyering
b96cd035ff chroot: make --groups= work without --userspec=; be more robust
* src/chroot.c (set_additional_groups): Add comments.
Given an empty or all-comma group list, diagnose it and return nonzero.
When more than one group is invalid, diagnose all of them,
not just the first.
(main): Honor --groups= also when --userspec= is not specified.
Now that set_additional_groups consistently diagnoses its failures,
don't diagnose it separately here.
* tests/chroot/credentials: Do not invoke with an empty group list.
2009-06-02 16:34:54 +02:00
Jim Meyering
2e62250e98 chroot: don't set bogus user-ID or group-ID for --u=U: or --u=:G
* src/chroot.c (main): Initialize both "uid" and "gid".  To -1.
This also allows one to set the user-ID or primary group-ID to 0,
in case it's not that already.
* tests/chroot/credentials: Test for the above.
2009-06-02 16:34:53 +02:00
Jim Meyering
bb7ff3bccd chroot: set-*-ID failure must provoke nonzero exit before execvp
* src/chroot.c (main): Exit upon set-group-ID or set-user-ID failure.
2009-06-02 16:34:53 +02:00
Jim Meyering
df356c22ba tests: use "nobody" as the default group name in chroot test
* tests/test-lib.sh (NON_ROOT_GROUP): Use "nobody", not "nogroup".
2009-06-02 16:34:53 +02:00
Jim Meyering
f9bb168f56 build: make distcheck rules use --enable-gcc-warnings
* dist-check.mk (warn_cflags): Remove definition, now that it's
been subsumed by --enable-gcc-warnings.
(my-distcheck): Use configure with --enable-gcc-warnings and remove
use of $(warn_cflags).
2009-06-02 16:34:36 +02:00
Eric Blake
c43333419b head, tail: make --help less ambiguous
* src/head.c (usage): Use -n K, not -n N, to avoid confusion.
* src/tail.c (usage): Likewise.
* doc/coreutils.texi (head invocation, tail invocation):
Likewise.
Reported by Christophe Lyon.
2009-05-29 16:14:56 -06:00
Michael Speer
159faba137 sort: new --human-numeric-sort option to sort KiB MB etc.
* NEWS: Document the new option
* doc/coreutils.texi (sort invocation): ditto
* src/sort.c (main): handle the new --human-numeric-sort option (-h).
(human_numcompare): A new function to compare SI and IEC suffixes
before falling back to the standard --numeric comparison.
(find_unit_order): A new helper function to find the order
of magnitude of a number string as determined by its suffix.
(check_mixed_SI_IEC): A new helper function to exit with error
if both SI and IEC suffixes are presented.
* tests/misc/sort: Add 8 tests to test the new functionality.
* THANKS: Update
2009-05-26 14:49:17 +01:00
Giuseppe Scrivano
c45c51fe97 chroot: accept new options --userspec=U:G and --groups=G1,G2,G3
* NEWS: Note chroot's new options.
* doc/coreutils.texi: Document them.
* src/chroot.c (main): Add support for --userspec and --groups.
* tests/Makefile.am (root-tests): Add chroot/credentials.
* tests/chroot/credentials: New file.
* tests/test-lib.sh: Define NON_ROOT_GROUP to a default value.
2009-05-26 15:10:22 +02:00
Pádraig Brady
39285f6008 doc: clarify the operation of the comm -123 parameters
* src/comm.c (usage): give more information on the -123 parameters,
with examples to show that they can be combined.
Addresses <http://savannah.gnu.org/bugs/?24974>.
* doc/coreutils.texi (comm invocation): Mention that the
column separators are suppressed along with the column.
Suggestion from Dan Jacobson.
* man/comm.x: Reference other commands that match adjacent lines.
* man/join.x: ditto.
* man/uniq.x: ditto.
2009-05-18 16:17:31 +01:00
Jim Meyering
b7f6e0d516 build: require automake-1.11
* bootstrap.conf (buildreq): Require automake-1.11, not 1.10b,
for our use of AM_SILENT_RULES.
* configure.ac (AM_INIT_AUTOMAKE): Likewise.
2009-05-18 07:06:34 +02:00
Jim Meyering
088a7ca9b1 maint: HACKING: mention a few more useful git commands
* HACKING (Miscellaneous useful git commands): Add a few.
2009-05-17 17:51:13 +02:00
Jim Meyering
564622fbea build: avoid new "make distcheck" failure with gcc 4.5.0 20090517
* dist-check.mk (warn_cflags): Add -Wno-enum-compare.
2009-05-17 15:55:35 +02:00
Jim Meyering
2726826c72 build: avoid new warnings from gcc 4.5.0 20090517
* configure.ac: Add an explicit -Wno-logical-op,
now that not listing -Wlogical-op is insufficient.
2009-05-17 13:59:12 +02:00
Jim Meyering
9593a3d8e7 maint: use ARRAY_CARDINALITY more
* src/sort.c (main): Use ARRAY_CARDINALITY, rather than open-coding it.
* src/factor.c (WHEEL_END): Likewise.
* src/csplit.c (main): Likewise.
* src/od.c: Likewise,
* src/ls.c (main): Likewise.
(N_ENTRIES): Remove definition.  Use ARRAY_CARDINALITY instead.
* src/dircolors.c: Likewise.
(array_len): Remove definition.
2009-05-17 13:59:12 +02:00
Jim Meyering
65ed4ca07b build: tr: avoid a warning due to newer gcc's -Wenum-compare
* src/tr.c (N_CHAR_CLASSES): Remove anonymous enum definition.
(look_up_char_class): Use ARRAY_CARDINALITY, rather than N_CHAR_CLASSES.
2009-05-17 13:59:12 +02:00
Jim Meyering
9b54961b13 maint: define ARRAY_CARDINALITY in system.h
* src/system.h (ARRAY_CARDINALITY): Define if not already defined.
2009-05-17 13:59:12 +02:00
Jim Meyering
50ca12c28d build: turn off -Wlong-long
* configure.ac: With --enable-gcc-warnings, -Wlong-long would
cause compilation failure due to inclusion of lib/gethrxtime.h.
Initialize "nw".
2009-05-17 13:59:12 +02:00
Jim Meyering
242f801adf maint: cfg.mk: remove now-unnecessary gnulib_dir definition
* cfg.mk (gnulib_dir): Remove definition, now that gnulib's
maint.mk provides the default we want.
* gnulib: Update submodule to latest.
2009-05-16 09:59:53 +02:00
Pádraig Brady
bba5fed6ba tests: fix date-next-dow failure on older systems
* tests/misc/date-next-dow: In the strftime call use %Y-%m-%d
rather than the newer %F equivalent which is not available
on Solaris 8 for example.
2009-05-15 15:46:11 +01:00
Jim Meyering
fc9fdd18b3 build: update from gnulib, for rename.m4 fix, improved tests, etc.
* gnulib: Update submodule to latest.
2009-05-14 09:55:44 +02:00
Jim Meyering
42e3278f8f maint: README-release: minor improvements
* README-release: Mention gnu_ftp_host-{alpha,...} settings in cfg.mk.
Now that XZ_OPT is set via maint.mk, don't mention it here.
2009-05-14 09:54:22 +02:00
Eric Blake
60e7332dc0 truncate: fix bug in use of isspace
* src/truncate.c (main): Pass unsigned characters to isspace.
* NEWS: Mention this.
2009-05-11 05:52:50 -06:00
Jim Meyering
034cbb3923 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-05-07 15:52:50 +02:00
Jim Meyering
4e54ea0480 version 7.4
* NEWS (Build-related): Mention make check fixes.
2009-05-07 15:35:19 +02:00
Jim Meyering
5aa7858385 admin: update NEWS
* NEWS (Bug fixes): Mention the date-related fixes.
(Portability): Mention the ACL-related fixes on *BSD.
2009-05-07 15:20:56 +02:00
Pádraig Brady
a6c9dd74d8 doc: note the use of LC_COLLATE in comm, join and uniq
* doc/coreutils.texi (uniq invocation): Simplify the
text to remove the inconsequential mentioning of order,
while implying that LC_COLLATE can alter equality comparisons.
* src/comm.c (usage): Mention LC_COLLATE is significant.
* src/join.c (usage): Ditto.
* src/uniq.c (usage): Ditto. Also improve the summary.
Suggestion from Andries Brouwer
2009-05-05 17:14:51 +01:00
Jim Meyering
8d00fb26f1 tests: rm/one-file-system: umount more reliably
* tests/rm/one-file-system: Run umount via trap, so it runs
also upon irregular termination.
2009-05-05 08:52:09 +02:00
Andreas Schwab
1d02be3b9d tests: fix typo in check-AUTHORS rule
* src/Makefile.am (check-AUTHORS): Set locale.
2009-05-05 08:52:03 +02:00
Jim Meyering
3a9072079c build: use a gnulib SHA1 that is not private
* gnulib: Update submodule to latest *public*.
2009-05-04 07:47:56 +02:00
Jim Meyering
975a38a267 build: update from gnulib, for ACL-related fixes
* gnulib: Update submodule to latest.
2009-05-04 07:10:12 +02:00
David Bartley
6249eb0596 mv, rm: adapt to new and improved gnulib interfaces
Use gnulib's new priv-set module and updated write-any-file.
With them, the remove-called can_write_any_file function no
longer tries to drop the unlink-directory privilege, so now
each caller of remove must do that separately, calling
priv_set_remove_linkdir.
* bootstrap.conf (gnulib_modules): Add priv-set.
* src/rm.c: Include "priv-set.h".
(main): Call priv_set_remove_linkdir.
* src/mv.c (main): Likewise.
* gnulib: Update submodule to latest.
2009-05-03 19:12:16 +02:00
Jim Meyering
181615b22a tests: correct the "make check"-run check-AUTHORS test
* src/Makefile.am (check-AUTHORS): Revert back to using
en_US.UTF-8, to ease parsing (English-only) text around the
list of names, even when .po files are not installed.
Reported by Andreas Schwab.
Along the way, use $(AM_V_GEN), not "@".
(sc_tight_scope): Use $(AM_V_GEN) here, too.
* gnulib: Update submodule to latest, for the proper_name_utf8 fix
that makes --version output print the UTF-8 rendering of author names
in more cases.
2009-05-03 15:51:27 +02:00
Jim Meyering
59e8a5e2b2 tests: add tests of e.g., date -d 'next monday'
* tests/misc/date-next-dow: New file.
* tests/Makefile.am (TESTS): Add misc/date-next-dow.
* gnulib: Update submodule to latest, for getdate.y that
handles "next Monday" properly when run on a Monday.
2009-05-03 12:03:50 +02:00
Jim Meyering
40d50b821f post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-05-01 18:19:19 +02:00
Jim Meyering
0ae4336f4f version 7.3
* NEWS: Record release date.
2009-05-01 18:03:50 +02:00
Jim Meyering
120118c7d8 maint: tweak release-building notes
* README-release: Specify -j1 on the command to run all tests.
Otherwise, running some in parallel would cause failures, e.g.,
for rm/ext3-perf and tail-2/assert-2.
2009-05-01 17:55:11 +02:00
Eric Blake
875cae47a9 stdopen: remove unused code
* m4/stdopen.m4: Delete now-unused file.
* lib/stdopen.h: Likewise.
* lib/stdopen.c: Likewise.
2009-04-30 16:47:13 -06:00
Jim Meyering
269bb7362f build: update from gnulib, for fixed lib/signbitl.c
* gnulib: Update submodule to latest.
2009-04-30 17:23:49 +02:00
Jim Meyering
0e945ebcc5 build: "make check" now fails in a friendlier manner for missing Perl
* doc/Makefile.am (sc-lower-case-var): Don't redirect stderr of
$(PERL) (which is sometimes build-aux/missing) to /dev/null,
so that a failing "make check" explains that Perl is not installed.
Reported by James Youngman.
2009-04-30 13:50:40 +02:00
Jim Meyering
71ebb443d8 build: doc: emit something for each "make check"-run rule
* doc/Makefile.am: Use $(AM_V_GEN) in place of each leading "@".
(check-texinfo): Align line-continuation backslashes.
2009-04-30 13:47:46 +02:00
Jim Meyering
428db13557 build: update from gnulib, for the lib/*-state.c compilation fixes
* gnulib: Update submodule to latest.
2009-04-29 07:35:43 +02:00
Pádraig Brady
0a28715b10 misc: correct NEWS entry about id -G portability
* NEWS (Portability): getgrouplist has the portability issues,
not getgroups.
2009-04-28 15:52:29 +01:00
Jim Meyering
74171b693c df: adjust comment to match recent code change
* src/df.c (main): Update comment to match.
2009-04-28 14:45:43 +02:00
Jim Meyering
c4dfd3138e misc: mention the df vs. automount change
* NEWS (Portability): Mention that df now accommodates the new
behavior of some automounters.
2009-04-28 14:32:26 +02:00
Jim Meyering
d76a1c2a2d misc: alphabetize NEWS entries 2009-04-28 14:32:26 +02:00
Tomas Smetana
dbd17157d7 df: use open(2), not stat, to trigger automounting
* src/df.c (main): When iterating over command-line arguments,
attempting to ensure each backing file system is mounted, use
open, not stat.  stat is no longer sufficient to trigger
automounting, in some cases.  Based on a suggestion from Ian Kent.
More details in http://bugzilla.redhat.com/497830
2009-04-28 14:32:17 +02:00
Ondřej Vašík
cb9fd93743 tests: ensure that cp's -a doesn't silence --preserve=context
* tests/cp/cp-a-selinux: Ensure that the -a option does not silence
error diagnostics from --preserve=context, when preserving context
is required.
2009-04-28 11:16:33 +02:00
Ondřej Vašík
8259a73a85 tests: add test for xattr diagnostics on dest. FS lacking xattr support
* tests/cp/cp-mv-enotsup-xattr: Ensure that xattr diagnostics are
displayed correctly when destination filesystem lacks xattr support.
* tests/Makefile.am (root_tests): Add new root-only test.
2009-04-28 11:16:29 +02:00
Jim Meyering
e0cf592f48 copy.c: factor out test for errno value indicating "unsupported"
* src/copy.c (errno_unsupported): New function.
(copy_attr_error, copy_internal): Use it.
2009-04-27 13:33:47 +02:00
Ondřej Vašík
1fa226772c cp -a: diagnose failure when preserving xattr/context required
* src/copy.c (copy_attr_by_fs): Always print diagnostics when preserving
xattrs is required.
(copy_attr_by_name): Likewise.
(copy_reg): Always print diagnostics when preserving SELinux
context is required.
(copy_internal): Likewise.  Also, do not ignore ENOTSUP and ENODATA
errors when preserving SELinux context is required.
* NEWS (Bug fixes): Mention it.
2009-04-27 13:33:42 +02:00
Ondřej Vašík
941bd48235 mv: ignore xattr-preservation failure when not supported by filesystem
*src/copy.c: Do not warn about xattr-preservation failure when xattrs
are not supported and preservation of xattrs is not explicitly required.
Reported by Eric Sandeen in http://bugzilla.redhat.com/496142
2009-04-27 13:26:03 +02:00
Jim Meyering
819ee4272b build: update from gnulib, for the vc-list-files fix
* gnulib: Update submodule to latest.
2009-04-25 10:29:55 +02:00
Jim Meyering
a81441557b build: adjust use of automake's new $(AM_V_GEN) variable
* src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, fs.h):
(version.c, version.h): Use $(AM_V_GEN) only as a prefix of an existing
command.  Otherwise, it provokes warnings from some "make" programs.
Suggestion from Ralf Wildenhues.
2009-04-25 09:23:48 +02:00
Ralf Wildenhues
6debf54e61 tests: fix check-AUTHORS skip logic
* src/Makefile.am (check-AUTHORS): When this test is skipped, be
sure to avoid all commands in the recipe, not just those passed
to the first shell.
2009-04-25 08:35:53 +02:00
Eric Blake
c86509d86e cfg.mk: update to latest gnulib change
* cfg.mk (bootstrap-tools): Override maint.mk default to include
bison.
* gnulib: Update to latest gnulib.
2009-04-24 20:16:27 -06:00
Jim Meyering
9e7edf0006 build: move coreutils-specific rules from maint.mk to new file
* dist-check.mk: New file: coreutils-specific rules extracted
from maint.mk, now that maint.mk has migrated to gnulib.
* Makefile.am (EXTRA_DIST): Add dist-check.mk.
* coreutils/cfg.mk: Include $(srcdir)/dist-check.mk.
* gnulib: Update submodule to latest.
2009-04-24 21:41:11 +02:00
Jim Meyering
b726914a4c tests: avoid unusual (~1-in-20) failure of a new test
* tests/misc/sort: Remove one of the generated tests.
363 remain in this file alone.
2009-04-24 21:34:59 +02:00
Jim Meyering
207daac5c1 build: use automake's new $(AM_V_GEN) and $(AM_V_at) variables
* src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, fs.h):
(version.c, version.h): Mark with $(AM_V_GEN) and $(AM_V_at),
so that the latest automake prints "GEN $@" by default.
2009-04-24 15:16:46 +02:00
Simon Josefsson
98dbd8cc53 build: use maint.mk from gnulib
* maint.mk: Remove file.  Now it's generated.
* .gitignore: Ignore it.
* bootstrap.conf (gnulib_modules): Add maintainer-makefile.
* gnulib: Update submodule to latest.
2009-04-24 07:40:14 +02:00
Jim Meyering
52c4018a9c build: make --enable-silent-rules the default
* configure.ac (AM_INIT_AUTOMAKE): Remove silent-rules.  Instead,...
(AM_SILENT_RULES): Use this, with it's undocumented [yes] argument.
Those who want verbose build output may configure with
--disable-silent-rules or use "make V=1".
2009-04-23 21:09:13 +02:00
Jim Meyering
0e414d9e4a * gnulib: Update submodule to latest. 2009-04-23 21:04:51 +02:00
Jim Meyering
25eb4c6909 sort -m: don't segfault when output file is also an input file
* src/sort.c (avoid_trashing_input): Fix an off-by-one error and
guard the use of memmove.
* NEWS (Bug fixes): Mention it.
* tests/misc/sort: Add tests to exercise the offending code.
* THANKS: Update.
Reported by Otavio Salvador in http://bugs.debian.org/525048.
2009-04-23 21:03:14 +02:00
Jim Meyering
f41f926aab tests: make the check-AUTHORS test more portable, now that it's...
run as part of "make check".
* src/Makefile.am (check-AUTHORS): Don't depend on en_US.UTF-8.
Instead, use the French UTF8 locale, if configure found one.
If not found, just skip the test.
2009-04-23 21:02:43 +02:00
Jim Meyering
cbc4d9bd13 avoid parallel "make distcheck" failure due to two run-in-src/ rules
Move the check-AUTHORS rule from "syntax-check" to "check".
* maint.mk (local-checks-available): Remove check-AUTHORS.
(check-AUTHORS): Remove rule.
* src/Makefile.am (CLEANFILES): Add $(no_install__progs),
since they too are built sometimes.
(check-AUTHORS): Split a longer-than-80 sed command.
(../AUTHORS): Remove obsolete rule.
2009-04-23 21:01:52 +02:00
Jim Meyering
c74fbaefeb cp: work around linux kernel bug: short-read != EOF on /proc
Remove the optimization that avoided up to 50% of cp's read syscalls.
Do not assume that a short read on a regular file indicates EOF.
When reading from a file in /proc on linux [at least 2.6.9 - 2.6.29]
into a 4k-byte buffer or larger, a short read does not
always indicate EOF.  For example, "cp /proc/slabinfo /tmp"
copies only 4068 of the total 7493 bytes.  This optimization
(25719a3315, Improve performance a bit
by optimizing away; 2005-11-24) appears to have been worth less than
a 2% speed-up (and usually much less), so the impact of removing it
is negligible.

* src/copy.c (copy_reg): Don't exit the loop early.
* tests/cp/proc-short-read: New test, lightly based on a suggestion
from Mike Frysinger, to exercise this fix.
* tests/Makefile.am (TESTS): Add cp/proc-short-read.
* NEWS (Improve robustness): Mention this change.
2009-04-22 21:52:11 +02:00
Jim Meyering
2ad7da7594 tests: avoid new "make distcheck" failure due to newer File::Temp
With newer perl (e.g., Fedora 10's 4:5.10.0-68.fc10), tests/CuTmpdir.pm
stopped removing its temporary directories, with diagnostics like this:
  cannot remove path when cwd is /c/coreutils/tests/misc/seq.tmp-e2up \
  for /c/coreutils/tests/misc/seq.tmp-e2up: at \
  /usr/lib/perl5/5.10.0/File/Temp.pm line 902
Chdir out of the target directory before that code runs:
* tests/CuTmpdir.pm (END): chdir '..'.
(chmod_tree): Remove explicit "chdir $dir".
2009-04-22 21:45:24 +02:00
Jim Meyering
4298108f46 doc: update README
* README: (Reporting bugs): List the bug-reporting address here, too,
not just in the following more test-oriented paragraph.
Reported by Tim Mooney.
All changes are no longer listed in version-controlled ChangeLog
files, so note that contributions are attributed in the commit logs.
Mention bootstrap.conf, now that it's the authoritative source of
minimal prerequisite program/version# pairs.
2009-04-19 23:11:16 +02:00
Aurelien Jarno
e453e720b9 tests: avoid failure of install-C test on FreeBSD UFS file system
* tests/install/install-C: Use 2755 (set-gid), not 1755 (sticky),
to test install -C with non-permission mode bits set.  At least on
FreeBSD with a UFS file system, a non-root user may not set the
sticky bit on a non-directory.
2009-04-19 22:17:08 +02:00
Jim Meyering
51a6c63496 comment touch up: insert a space between "#" and text of comment
* bootstrap: It's easier to read that way.
2009-04-19 21:49:14 +02:00
Ralf Wildenhues
2977df8e7d fix comment typos
* bootstrap: Fix comment typos.
* src/pr.c: Likewise.
2009-04-19 21:28:43 +02:00
Jim Meyering
48430d6a4a maint: bootstrap: sync a tiny change from gnulib
* bootstrap: rename variable to sync with gnulib: s/\$depth/$shallow/
2009-04-17 09:10:57 +02:00
Jim Meyering
f08504b43b * gnulib: Update submodule to latest. 2009-04-16 07:42:20 +02:00
Jim Meyering
ea6abe343d build: use '.'-relative name, gnulib_dir
* cfg.mk (gnulib_dir): Use "gnulib", not "/gnulib", now that
the former is a git submodule, and guaranteed to exist.
2009-04-16 07:03:59 +02:00
Jim Meyering
a46c077467 maint: clean up skipped syntax-check rules
* cfg.mk (local-checks-to-skip): Remove patch-check and changelog-check.
* maint.mk (patch-check): Remove rule.
(local-checks-available): Remove patch-check.
(changelog-check): Remove rule.
2009-04-15 20:18:24 +02:00
Ralf Wildenhues
4404198c12 build: avoid parallel distcheck failure
* Makefile.am (ALL_RECURSIVE_TARGETS): Initialize here, too,
to please automake.  Add install-root, check-root, distcheck-hook.
* cfg.mk (ALL_RECURSIVE_TARGETS): Add sc_tight_scope.
* maint.mk (ALL_RECURSIVE_TARGETS): Add patch-check,
check-AUTHORS, maintainer-distcheck, vc-dist, taint-distcheck,
my-distcheck, alpha, beta, major.
2009-04-11 15:20:37 +02:00
Jim Meyering
0523f45f66 doc: fix a typo: s/is a is a/is a/
* doc/coreutils.texi (Putting the tools together): Fix typo.
2009-04-10 12:50:14 +02:00
Jim Meyering
b571b61970 build: tight-scope test: don't build excluded programs
* src/Makefile.am (sc_tight_scope): Depend on $(bin_PROGRAMS),
not $(all_programs)
2009-04-10 11:35:10 +02:00
Jim Meyering
03490e3565 gnulib: update to latest: fix ls -v & sort -V
* NEWS (Bug fixes): Mention it.
2009-04-10 10:15:24 +02:00
Jim Meyering
854f76ed4f maint: remove obsolete utime module
* bootstrap.conf (obsolete_gnulib_modules): Remove utime.
2009-04-10 08:42:10 +02:00
Jim Meyering
6a51c69b05 maint: put each module name on its own line; sort
* bootstrap.conf (gnulib_modules): List them one per line.
2009-04-10 08:20:13 +02:00
Jim Meyering
0df3a91b25 tests: misc/ls-misc: avoid shadowing local decl of $e
* tests/misc/ls-misc (make_j_d): Rename latter $e to $env
2009-04-09 15:29:59 +02:00
Pádraig Brady
bf87a2c8ea id: fix infinite loop on some systems
Steven Parkes reported that `id -G $USER` went into an infinite loop
on Darwin systems for users in more than 10 groups:
http://bugs.gentoo.org/show_bug.cgi?id=264007
* gl/lib/mgetgroups.c (mgetgroups): Work around buggy getgrouplist
implementations that don't update the required size correctly,
by doubling the result buffer and retrying. Also return the
parameter updated by getgrouplist rather than its return value,
as the documentation doesn't actually state the number of groups
stored is returned by getgrouplist.
* tests/misc/id-groups: Add test to exercise this logic
* tests/Makefile.am: Reference new test
* NEWS: Mention the fix
* THANKS: Update
2009-04-09 14:07:29 +01:00
Jim Meyering
148ddb3232 maint: avoid "make syntax-check" failure
* src/install.c (main): Tweak syntax of new diagnostic.
2009-04-07 20:16:00 +02:00
Pádraig Brady
6fb27500ee install: deprecate the --preserve_context option
src/install.c: Print a warning when --preserve_context
rather than --preserve-context is used as per FIXME.
2009-04-07 19:10:16 +01:00
Pádraig Brady
0f1b8c021d maint: remove compiler warnings from randint and randread modules
* gl/lib/randint.c: Remove unused MAX macro
* gl/lib/randread.c (randread_error): Add __attribute__((__noreturn__))
2009-04-07 19:08:32 +01:00
Pádraig Brady
af5723c71e shred,sort,shuf: don't use /dev/urandom by default
Suggestion from Steven Schveighoffer at:
http://savannah.gnu.org/patch/?6797
to greatly speed up the random passes done by shred.
* gl/lib/randread.c: Default to using the internal
pseudorandom generator, rather than reading /dev/urandom
* src/shred.c (usage): remove mention of /dev/urandom
* src/shuf.c (usage); ditto
* src/sort.c (usage): ditto
* doc/coreutils.text: Document the new behaviour
for aquiring random data.
2009-04-07 19:01:46 +01:00
Pádraig Brady
9fdf5845fc maint: Clarify ambiguous refs to Linux kernels or GNU/Linux systems
* README-prereq: s_linux_GNU/Linux_ or s_linux_Linux kernel_
* README-valgrind: ditto
* src/chown-core.c: ditto
* src/dd.c: ditto
* src/df.c: ditto
* src/ls.c: ditto
* src/mv.c: ditto
* src/pwd.c: ditto
* src/remove.c: ditto
* src/shred.c: ditto
* src/stat.c: ditto
* src/su.c: ditto
* src/system.h: ditto
* src/timeout.c: ditto
* src/truncate.c: ditto
2009-04-07 18:57:53 +01:00
Pádraig Brady
e22f096d10 doc: add missing documentation for some SELinux options
* doc/coreutils.texi (ls invocation): Describe the --context (-Z) option
(install invocation): Describe the --preserve-context and -Z options
(id invocation): Describe the --context (-Z) option
(mkdir invocation): ditto
(mknod invocation): ditto
(mkfifo invocation): ditto
* TODO: remove the todo item
2009-04-07 18:53:51 +01:00
Jim Meyering
33e7070464 * doc/code-vs-command: Remove long-unused, never-distributed file. 2009-04-06 07:59:52 +02:00
Jim Meyering
1974dc34b6 gnulib: update to latest: includes Solaris 8 portability fixes 2009-04-04 22:53:56 +02:00
Jim Meyering
8e8b025c90 maint: clean up Makefile.am, rename remaining ChangeLog files
* Makefile.am (changelog_etc, syntax_check_exceptions): Define.
(EXTRA_DIST): Use.  Remove names that are now automatically
included: build-aux/git-version-gen, build-aux/vc-list-files.
* build-aux/ChangeLog-2007: Rename from */ChangeLog.
* doc/ChangeLog-2007: Likewise.
* lib/ChangeLog-2007: Likewise.
* m4/ChangeLog-2007: Likewise.
* po/ChangeLog-2007: Likewise.
2009-04-04 12:40:58 +02:00
Jim Meyering
7008e33441 tests: tweak po_check syntax check
* maint.mk (sc_po_check): Don't let dangling lib/*.[ch] links cause
spurious "grep: lib/file.h: No such file or directory" warnings.
2009-04-04 10:49:36 +02:00
Jim Meyering
100d4983e7 tests: improve ChangeLog syntax check
* maint.mk (sc_changelog): Use $(VC_LIST_EXCEPT), not find.
Don't hang when there are no ChangeLog files.
(sc_require_config_h): For the file-name-filter, use grep -l
to be slightly more efficient.
(sc_require_config_h_first, _header_without_use, sc_program_name):
Likewise.
2009-04-04 10:49:36 +02:00
Ralf Wildenhues
d75bcea4cf tests: make syntax-checks more robust
* maint.mk (_prohibit_regexp): Add ';' at end of ':'-introduced
comment so that the comment doesn't gobble up the following test
for a missing regexp definition.
(_header_without_use): Escape all '.'s in a header file name,
not just the first one.
2009-04-04 10:25:18 +02:00
Jim Meyering
eaacc89a45 * cfg.mk (old_NEWS_hash): Regenerate once more. 2009-04-03 22:05:10 +02:00
Jim Meyering
e1e5963a9d doc: adjust 7.2 "cat,cp,install,mv,split speed-up" NEWS item
* NEWS: Reword an entry from 7.2 and change "linux" to "GNU/Linux".
The latter was requested by Richard Stallman.
* cfg.mk (old_NEWS_hash): Regenerate.
2009-04-03 21:53:50 +02:00
Pádraig Brady
612b647dd1 ls: fix alignment when month names have varying widths
Reported by Samuel Thibault and Stéphane Raimbault, as the glibc fr_FR
locale has recently changed to use the official but variable width
abbreviated month names. Other glibc locales also have variable widths.
http://sourceware.org/ml/libc-locales/2008-q1/msg00035.html
http://sourceware.org/bugzilla/show_bug.cgi?id=9859
* NEWS: Mention the fix
* gl/lib/mbsalign.c: A new module to align and truncate a
string in a specified number of screen cells, while handling
multi-byte characters appropriately.
* gl/lib/mbsalign.h: Ditto
* gl/modules/mbsalign: Ditto
* bootstrap.conf: Reference the new module
* src/ls.c (abmon_init): New function, precompute the abbreviated
months aligned left in a minimum width column <= 5 screen cells.
(align_nstrftime): New function, replace the first %b in the
format specification to strftime with the precomputed month string.
Note using the cached month strings speeds up `ls -lU` by around 17%
on glibc-2.7-2 on linux at least.  Also if we implement this function
using heap storage rather than automatic storage, and use snprintf
instead of strcpy, ls will slow down by 2% and 1% respectively
(i.e. a net gain of 14% rather than 17%).
* tests/ls/abmon-align: A new test to test ls alignment for
various formats and locales
* tests/Makefile.am: Reference the new test
2009-04-03 00:34:11 +01:00
Pádraig Brady
34f0c3e522 doc: Clarify the help for version sorting in ls and sort
* src/ls.c: Update the -v help description
* src/sort.c: Update the -V help description
2009-04-02 13:53:43 +01:00
Jim Meyering
a5ba6c8ef8 doc: adjust README-prereq instructions
* README-prereq: Reverse order of -b/--track options.
 Pádraig Brady mentioned that is required with at least git-1.5.3.6.
Invoke automake's own bootstrap script.
2009-04-02 14:45:49 +02:00
C de-Avillez
2ade7643de build: require automake-1.10b or newer
* bootstrap.conf: Require at least automake-1.10b.
* README-prereq: Mention 1.10b, not 1.10a.
2009-04-02 08:56:32 +02:00
Jim Meyering
4145a1e54c tests: skip mv/i-3 if /dev/stdin is unreadable
* tests/mv/i-3: Skip if /dev/stdin is unreadable.
Reported by Sergei Steshenko.
2009-04-02 08:44:12 +02:00
Jim Meyering
1417251e29 build: set automake's silent-rules option via configure.ac
* bootstrap: Revert commit 9f39fa855, 2009-03-28,
"build: use automake's --silent-rules option when possible".
* configure.ac (AM_INIT_AUTOMAKE): Instead, set it here.
Require the just-released version of automake: 1.10b.
2009-03-31 20:57:11 +02:00
Jim Meyering
30071248c9 tests: enable automake's color-tests and parallel-tests via configure.ac
* gnulib-tests/Makefile.am (AUTOMAKE_OPTIONS): Don't define here.
* tests/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* configure.ac (AM_INIT_AUTOMAKE): Instead, add color-tests and
parallel-tests here.
2009-03-31 20:29:01 +02:00
Ralf Wildenhues
f8268d3bae build: use Automake's new parallel-tests feature
* build-aux/check.mk: Remove, not needed any more.
* tests/Makefile.am (AUTOMAKE_OPTIONS): Add parallel-tests and
color-tests.
* tests/check.mk: Do not include build-aux/check.mk any more.
(SUFFIXES, TEST_LOGS): Remove.
(TESTS_ENVIRONMENT): Use $$f rather than $$tst in $PERL invocation.
* gnulib-tests/Makefile.am: Do not include build-aux/check.mk.
(AUTOMAKE_OPTIONS): New macro, add parallel-test and color-tests.
(TEST_LOGS): Remove.
2009-03-31 20:29:01 +02:00
Jim Meyering
7a21310eb3 * README-release (savannah news): Also mention the Subject: to use. 2009-03-31 20:28:41 +02:00
Jim Meyering
278ae924be post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-03-31 14:48:50 +02:00
621 changed files with 26220 additions and 24377 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,3 @@
*.1
*.I[12]
*.[EIOX]
*.o
@@ -56,6 +55,8 @@ lib/selinux
lib/uniwidth
m4/.cvsignore
m4/.gitignore
maint.mk
man/*.1
po/*.gmo
po/*.po
po/.gitignore

4
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "gnulib"]
path = gnulib
url = git://git.sv.gnu.org/gnulib.git
path = gnulib
url = git://git.sv.gnu.org/gnulib.git

View File

@@ -1 +1 @@
7.1
8.0

View File

@@ -1,6 +1,6 @@
# Suppress valgrind diagnostics we don't care about.
# Copyright (C) 2003, 2004, 2006-2008 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2006-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -0,0 +1,6 @@
^GNUMakefile$
Makefile\.am$
\.mk$
^tests/pr/
ChangeLog.*
^man/help2man$

3
.x-sc_system_h_headers Normal file
View File

@@ -0,0 +1,3 @@
^src/libstdbuf\.c$
^src/system\.h$
^src/copy\.h$

View File

@@ -76,6 +76,7 @@ sleep: Jim Meyering, Paul Eggert
sort: Mike Haertel, Paul Eggert
split: Torbjörn Granlund, Richard M. Stallman
stat: Michael Meskes
stdbuf: Pádraig Brady
stty: David MacKenzie
su: David MacKenzie
sum: Kayvan Aghaiepour, David MacKenzie

View File

@@ -11609,7 +11609,7 @@
-----
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -4033,7 +4033,7 @@
-----
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -4015,7 +4015,7 @@
-----
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -372,7 +372,7 @@
-----
Copyright (C) 2008 Free Software Foundation, Inc.
Copyright (C) 2008-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

59
HACKING
View File

@@ -189,7 +189,7 @@ branch, and then realize that something about it is not right.
It's easy to adjust:
edit your files # this can include running "git add NEW" or "git rm BAD"
git commit --amend -e -a
git commit --amend -a
git format-patch --stdout -1 > your-branch.diff
That replaces the most recent change-set with the revised one.
@@ -213,8 +213,15 @@ Commit log requirements
=======================
Your commit log should always start with a one-line summary, the second
line should be blank, and the remaining lines are usually ChangeLog-style
entries for all affected files. Omit the leading TABs that you're used
to seeing in a "real" ChangeLog file.
entries for all affected files. However, it's fine -- even recommended --
to write a few lines of prose describing the change, when the summary
and ChangeLog entries don't give enough of the big picture. Omit the
leading TABs that you're used to seeing in a "real" ChangeLog file, but
keep the maximum line length at 72 or smaller, so that the generated
ChangeLog lines, each with its leading TAB, will not exceed 80 columns.
As for the ChangeLog-style content, please follow these guidelines:
http://www.gnu.org/software/guile/changelogs/guile-changelogs_3.html
Try to make the summary line fit one of the following forms:
@@ -222,23 +229,30 @@ Try to make the summary line fit one of the following forms:
prog1, prog2: change-description
doc: change-description
tests: change-description
build: change-description
maint: change-description
Use SPACE-only indentation in new files.
========================================
In any new file, eliminate all leading TABs (e.g., via running GNU indent
with --no-tabs) and put these lines at the end of the file:
Use SPACE-only indentation in all[*] files
==========================================
We use space-only indentation in nearly all files.
If you use Emacs and your coreutils working directory name matches,
this code enables the right mode:
;; In coreutils, indent with spaces everywhere (not TABs).
;; Exceptions: Makefile and ChangeLog modes.
(add-hook 'find-file-hook '(lambda ()
(if (and buffer-file-name
(string-match "/coreutils\\>" (buffer-file-name))
(not (string-equal mode-name "Change Log"))
(not (string-equal mode-name "Makefile")))
(setq indent-tabs-mode nil))))
[*] Makefile and ChangeLog files are exempt, of course.
[FIXME: suggest vim syntax to do same thing, if it can be done safely.
Most distros now "set nomodeline" by default for a good reason. ]
/*
* Local variables:
* indent-tabs-mode: nil
* End:
*/
Do not change TABs to spaces or vice versa in any existing file.
Send patches to the address listed in --help output
===================================================
@@ -261,6 +275,9 @@ When writing prose (documentation, comments, log entries), use an
active voice, not a passive one. I.e., say "print the frobnozzle",
not "the frobnozzle will be printed".
Please add comments per the GNU Coding Standard:
http://www.gnu.org/prep/standards/html_node/Comments.html
Minor syntactic preferences
===========================
@@ -404,10 +421,16 @@ See the manpage for git-apply for details.
Miscellaneous useful git commands
=================================
* gitk: give a graphical view of the revision graph
* gitk: give a graphical view of the revision graph of the current branch
* gitk --all: same, but display all branches
* git log: to get most of the same info in text form
* git log -p: same as above, but with diffs
* git log -p SOME_FILE: same as above, but limit to SOME_FILE
* git log -p -2 SOME_FILE: same as above, but print only two deltas
* git log -p -1: print the most recently committed change set
* git format-patch --stdout -1 > FILE: output the most recently committed
change set, in a format suitable to be submitted and/or applied via
"git am FILE".
* git reset --soft HEAD^: Commit the delta required to restore
state to the revision just before HEAD (i.e., next-to-last).
* git rebase -i master: run this from on a branch, and it gives
@@ -419,8 +442,8 @@ Miscellaneous useful git commands
its SHA1 and then tag it or cherry-pick it onto an existing branch.
For example, run this:
git fsck --lost-found HEAD && cd .git/lost-found/commit \
&& for i in *; do git show $i|grep SOME_IDENTIFYING_STRING \
&& echo $i; done
&& for i in *; do git show $i|grep SOME_IDENTIFYING_STRING \
&& echo $i; done
The "git fsck ..." command creates the .git/lost-found/... hierarchy
listing all unreachable objects. Then the for loop
print SHA1s for commits that match via log or patch.

View File

@@ -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,50 +15,74 @@
# 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-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 \
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 \
build-aux/update-copyright \
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_error_message_uppercase \
.x-sc_file_system \
.x-sc_obsolete_symbols \
.x-sc_po_check \
.x-sc_program_name \
.x-sc_prohibit_atoi_atof \
.x-sc_prohibit_stat_st_blocks \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_tab_based_indentation \
.x-sc_require_config_h \
.x-sc_require_config_h_first \
.x-sc_space_tab \
.x-sc_sun_os_names \
.x-sc_system_h_headers \
.x-sc_trailing_blank \
.x-sc_unmarked_diagnostics \
.x-sc_useless_cpp_parens
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=
@@ -74,33 +98,35 @@ rm_subst = \
BUILT_SOURCES = .version
.version:
echo $(VERSION) > $@-t && mv $@-t $@
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
# Arrange so that .tarball-version appears only in the distribution
# tarball, and never in a checked-out repository.
# The perl substitution is to change some key uses of "rm" to "/bin/rm".
# See the rm_subst comment for details.
dist-hook: gen-ChangeLog
echo $(VERSION) > $(distdir)/.tarball-version
perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
$(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
gen_start_date = 2008-02-08
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d .git; then \
$(AM_V_GEN)if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
ALL_RECURSIVE_TARGETS += distcheck-hook
distcheck-hook: check-ls-dircolors
$(MAKE) my-distcheck
$(MAKE) taint-distcheck
DISTCLEANFILES = VERSION
MAINTAINERCLEANFILES = THANKS-to-translators
THANKS-to-translators: po/LINGUAS THANKStt.in
( \
$(AM_V_GEN)( \
cat $(srcdir)/THANKStt.in; \
for lang in `cat $(srcdir)/po/LINGUAS`; do \
echo http://translationproject.org/team/$$lang.html; \
@@ -111,7 +137,7 @@ THANKS-to-translators: po/LINGUAS THANKStt.in
# remain in sync.
.PHONY: check-ls-dircolors
check-ls-dircolors:
dc=$$(sed -n '/static.*ls_codes\[/,/};'/p \
$(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p \
$(srcdir)/src/dircolors.c \
|sed -n '/^ *"/p'|tr , '\n'|sed 's/^ *//' \
|sed -n 's/^"\(..\)"/\1/p'|sort -u); \

305
NEWS
View File

@@ -1,5 +1,304 @@
GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
** Bug fixes
chcon no longer exits immediately just because SELinux is disabled.
Even then, chcon may still be useful.
[bug introduced in coreutils-8.0]
stat -f recognizes more file system types: afs, cifs, anon-inode FS,
btrfs, cgroupfs, cramfs-wend, debugfs, futexfs, hfs, inotifyfs, minux3,
nilfs, securityfs, selinux, xenfs
** New features
md5sum --check now also accepts openssl-style checksums.
So do sha1sum, sha224sum, sha384sum and sha512sum.
* Noteworthy changes in release 8.0 (2009-10-06) [beta]
** Bug fixes
cp --preserve=xattr and --archive now preserve extended attributes even
when the source file doesn't have write access.
[bug introduced in coreutils-7.1]
touch -t [[CC]YY]MMDDhhmm[.ss] now accepts a timestamp string ending in .60,
to accommodate leap seconds.
[the bug dates back to the initial implementation]
ls --color now reverts to the color of a base file type consistently
when the color of a more specific type is disabled.
[bug introduced in coreutils-5.90]
ls -LR exits with status 2, not 0, when it encounters a cycle
ls -is is now consistent with ls -lis in ignoring values returned
from a failed stat/lstat. For example ls -Lis now prints "?", not "0",
for the inode number and allocated size of a dereferenced dangling symlink.
tail --follow --pid now avoids a race condition where data written
just before the process dies might not have been output by tail.
Also, tail no longer delays at all when the specified pid is not live.
[The race was introduced in coreutils-7.5,
and the unnecessary delay was present since textutils-1.22o]
** Portability
On Solaris 9, many commands would mistakenly treat file/ the same as
file. Now, even on such a system, path resolution obeys the POSIX
rules that a trailing slash ensures that the preceeding name is a
directory or a symlink to a directory.
** Changes in behavior
id no longer prints SELinux " context=..." when the POSIXLY_CORRECT
environment variable is set.
readlink -f now ignores a trailing slash when deciding if the
last component (possibly via a dangling symlink) can be created,
since mkdir will succeed in that case.
** New features
ln now accepts the options --logical (-L) and --physical (-P),
added by POSIX 2008. The default behavior is -P on systems like
GNU/Linux where link(2) creates hard links to symlinks, and -L on
BSD systems where link(2) follows symlinks.
stat: without -f, a command-line argument of "-" now means standard input.
With --file-system (-f), an argument of "-" is now rejected.
If you really must operate on a file named "-", specify it as
"./-" or use "--" to separate options from arguments.
** Improvements
rm: rewrite to use gnulib's fts
This makes rm -rf significantly faster (400-500%) in some pathological
cases, and slightly slower (20%) in at least one pathological case.
rm -r deletes deep hierarchies more efficiently. Before, execution time
was quadratic in the depth of the hierarchy, now it is merely linear.
However, this improvement is not as pronounced as might be expected for
very deep trees, because prior to this change, for any relative name
length longer than 8KiB, rm -r would sacrifice official conformance to
avoid the disproportionate quadratic performance penalty. Leading to
another improvement:
rm -r is now slightly more standards-conformant when operating on
write-protected files with relative names longer than 8KiB.
* Noteworthy changes in release 7.6 (2009-09-11) [stable]
** Bug fixes
cp, mv now ignore failure to preserve a symlink time stamp, when it is
due to their running on a kernel older than what was implied by headers
and libraries tested at configure time.
[bug introduced in coreutils-7.5]
cp --reflink --preserve now preserves attributes when cloning a file.
[bug introduced in coreutils-7.5]
cp --preserve=xattr no longer leaks resources on each preservation failure.
[bug introduced in coreutils-7.1]
dd now exits with non-zero status when it encounters a write error while
printing a summary to stderr.
[bug introduced in coreutils-6.11]
dd cbs=N conv=unblock would fail to print a final newline when the size
of the input was not a multiple of N bytes.
[the non-conforming behavior dates back to the initial implementation]
df no longer requires that each command-line argument be readable
[bug introduced in coreutils-7.3]
ls -i now prints consistent inode numbers also for mount points.
This makes ls -i DIR less efficient on systems with dysfunctional readdir,
because ls must stat every file in order to obtain a guaranteed-valid
inode number. [bug introduced in coreutils-6.0]
tail -f (inotify-enabled) now flushes any initial output before blocking.
Before, this would print nothing and wait: stdbuf -o 4K tail -f /etc/passwd
Note that this bug affects tail -f only when its standard output is buffered,
which is relatively unusual.
[bug introduced in coreutils-7.5]
tail -f once again works with standard input. inotify-enabled tail -f
would fail when operating on a nameless stdin. I.e., tail -f < /etc/passwd
would say "tail: cannot watch `-': No such file or directory", yet the
relatively baroque tail -f /dev/stdin < /etc/passwd would work. Now, the
offending usage causes tail to revert to its conventional sleep-based
(i.e., not inotify-based) implementation.
[bug introduced in coreutils-7.5]
** Portability
ln, link: link f z/ would mistakenly succeed on Solaris 10, given an
existing file, f, and nothing named "z". ln -T f z/ has the same problem.
Each would mistakenly create "z" as a link to "f". Now, even on such a
system, each command reports the error, e.g.,
link: cannot create link `z/' to `f': Not a directory
** New features
cp --reflink accepts a new "auto" parameter which falls back to
a standard copy if creating a copy-on-write clone is not possible.
** Changes in behavior
tail -f now ignores "-" when stdin is a pipe or FIFO.
tail-with-no-args now ignores -f unconditionally when stdin is a pipe or FIFO.
Before, it would ignore -f only when no file argument was specified,
and then only when POSIXLY_CORRECT was set. Now, :|tail -f - terminates
immediately. Before, it would block indefinitely.
* Noteworthy changes in release 7.5 (2009-08-20) [stable]
** Bug fixes
dd's oflag=direct option now works even when the size of the input
is not a multiple of e.g., 512 bytes.
dd now handles signals consistently even when they're received
before data copying has started.
install runs faster again with SELinux enabled
[introduced in coreutils-7.0]
ls -1U (with two or more arguments, at least one a nonempty directory)
would print entry names *before* the name of the containing directory.
Also fixed incorrect output of ls -1RU and ls -1sU.
[introduced in coreutils-7.0]
sort now correctly ignores fields whose ending position is specified
before the start position. Previously in numeric mode the remaining
part of the line after the start position was used as the sort key.
[This bug appears to have been present in "the beginning".]
truncate -s failed to skip all whitespace in the option argument in
some locales.
** New programs
stdbuf: A new program to run a command with modified stdio buffering
for its standard streams.
** Changes in behavior
ls --color: files with multiple hard links are no longer colored differently
by default. That can be enabled by changing the LS_COLORS environment
variable. You can control that using the MULTIHARDLINK dircolors input
variable which corresponds to the 'mh' LS_COLORS item. Note these variables
were renamed from 'HARDLINK' and 'hl' which were available since
coreutils-7.1 when this feature was introduced.
** Deprecated options
nl --page-increment: deprecated in favor of --line-increment, the new option
maintains the previous semantics and the same short option, -i.
** New features
chroot now accepts the options --userspec and --groups.
cp accepts a new option, --reflink: create a lightweight copy
using copy-on-write (COW). This is currently only supported within
a btrfs file system.
cp now preserves time stamps on symbolic links, when possible
sort accepts a new option, --human-numeric-sort (-h): sort numbers
while honoring human readable suffixes like KiB and MB etc.
tail --follow now uses inotify when possible, to be more responsive
to file changes and more efficient when monitoring many files.
* Noteworthy changes in release 7.4 (2009-05-07) [stable]
** Bug fixes
date -d 'next mon', when run on a Monday, now prints the date
7 days in the future rather than the current day. Same for any other
day-of-the-week name, when run on that same day of the week.
[This bug appears to have been present in "the beginning". ]
date -d tuesday, when run on a Tuesday -- using date built from the 7.3
release tarball, not from git -- would print the date 7 days in the future.
Now, it works properly and prints the current date. That was due to
human error (including not-committed changes in a release tarball)
and the fact that there is no check to detect when the gnulib/ git
submodule is dirty.
** Build-related
make check: two tests have been corrected
** Portability
There have been some ACL-related portability fixes for *BSD,
inherited from gnulib.
* 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
@@ -37,9 +336,9 @@ GNU coreutils NEWS -*- outline -*-
** Changes in behavior
cp,mv,install,cat,split: now read and write a minimum of 32KiB
at a time. This was seen to increase throughput. Up to 2 times
when reading cached files on linux for example.
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.

20
README
View File

@@ -13,9 +13,9 @@ The programs that can be built with this package are:
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
sleep sort split stat stty su sum sync tac tail tee test timeout touch tr
true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who
whoami yes
sleep sort split stat stdbuf stty su sum sync tac tail tee test timeout
touch tr true truncate tsort tty uname unexpand uniq unlink uptime users
vdir wc who whoami yes
See the file NEWS for a list of major changes in the current release.
@@ -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,
@@ -173,6 +173,10 @@ run this command:
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.
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.
***************************************
There are many tests, but nowhere near as many as we need.
@@ -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

View File

@@ -2,42 +2,24 @@
These notes intend to help people working on the checked-out sources.
These requirements do not apply when building from a distribution tarball.
See also HACKING for more detailed coreutils contribution guidlines.
See also HACKING for more detailed coreutils contribution guidelines.
* Requirements
We've opted to keep only the highest-level sources in the GIT repository.
This eases our maintenance burden, (fewer merges etc.), but imposes more
requirements on anyone wishing to build from the just-checked-out sources.
Specific tools and versions will be checked for and listed by the
bootstrap script shown below, and will include:
- Automake <http://www.gnu.org/software/automake/>
- Autoconf <http://www.gnu.org/software/autoconf/>
- Bison <http://www.gnu.org/software/bison/>
- Gettext <http://www.gnu.org/software/gettext/>
- Git <http://git.or.cz/>
- Gperf <http://www.gnu.org/software/gperf/>
- Gzip <http://www.gnu.org/software/gzip/>
- Perl <http://www.cpan.org/>
- Rsync <http://samba.anu.edu.au/rsync/>
- Tar <http://www.gnu.org/software/tar/>
Only building the initial full source tree will be a bit painful.
Later, a plain `git pull && make' should be sufficient.
- Valgrind
Note the requirements to build the released archive are much less and
are just the requirements of the standard ./configure && make procedure.
Specific development tools and versions will be checked for and listed by
the bootstrap script. See README-prereq for specific notes on obtaining
these prerequisite tools.
Valgrind <http://valgrind.org/> is also highly recommended, if
Valgrind supports your architecture. See also README-valgrind.
- XZ utils (successor to LZMA)
This package's build procedure uses XZ to create a compressed
distribution tarball. Using this feature of Automake requires
version 1.10a or newer, as well as the xz program itself.
Make sure you have the latest version of the XZ Utils from
<http://tukaani.org/lzma/download>.
While building from a just-cloned source tree may require installing a
few prerequisites, later, a plain `git pull && make' should be sufficient.
* First GIT checkout
@@ -82,7 +64,3 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Local Variables:
indent-tabs-mode: nil
End:

View File

@@ -1,32 +1,56 @@
Detailed below are concrete examples for
getting the prerequisites for particular systems.
This gives some notes on obtaining the tools required for development.
I.E. the tools checked for by the bootstrap script and include:
- linux - fedora
- Autoconf <http://www.gnu.org/software/autoconf/>
- Automake <http://www.gnu.org/software/automake/>
- Bison <http://www.gnu.org/software/bison/>
- Gettext <http://www.gnu.org/software/gettext/>
- Git <http://git.or.cz/>
- Gperf <http://www.gnu.org/software/gperf/>
- Gzip <http://www.gnu.org/software/gzip/>
- Perl <http://www.cpan.org/>
- Rsync <http://samba.anu.edu.au/rsync/>
- Tar <http://www.gnu.org/software/tar/>
- Texinfo <http://www.gnu.org/software/texinfo/>
This shows the steps for getting the required tools to build coreutils 7.0
on a Fedora 8 system. We try to use official packages where possible.
The 3 methods described for making these required packages available, should
help clarify build requirements on any linux system at least.
Note please try to install/build official packages for your system.
If these are not available then one can make them available only to
the coreutils build using the following instructions. Even if the
official packages for your system are too old, please install them
as they may be required to build the newer versions.
1. Make sure offical distro git package is installed
# yum install git
* autoconf *
2. The distro autoconf is too old, but there is a newer one available
so we rebuild that and make it available to the full system:
# yum install emacs #autoconf build requires emacs (20MB)
# rpmbuild --rebuild http://download.fedora.redhat.com/pub/fedora/linux/development/source/SRPMS/autoconf-2.63-1.fc10.src.rpm
# rpm -Uvh /usr/src/redhat/RPMS/noarch/autoconf-2.63-1.fc8.noarch.rpm
Note Autoconf 2.61a-341 or newer is needed to build automake-1.10a in step 3.
Apply the same method to install the lzma package.
[FIXME: mention xz when it's packaged]
# Note Autoconf 2.62 or newer is needed to build automake-1.11
git clone --depth=1 git://git.sv.gnu.org/autoconf.git
git checkout v2.62
autoreconf -vi
./configure --prefix=$HOME/coreutils/deps
make install
3. The latest released automake (1.10.1) was not new enough, so we download
and build automake-1.10a from its repository and make it available
just to coreutils:
# yum install help2man #required to build automake fully
$ git clone git://git.sv.gnu.org/automake.git
$ cd automake && ./configure --prefix=$HOME/coreutils/deps
$ make install
* automake *
Now we can build coreutils as described in README-hacking
as long as $PATH starts with $HOME/coreutils/deps
# Note help2man is required to build automake fully
git clone git://git.sv.gnu.org/automake.git
cd automake
git checkout -b branch-1.11 --track origin/branch-1.11
./bootstrap
./configure --prefix=$HOME/coreutils/deps
make install
coreutils uses XZ utils (successor to LZMA) to create
a compressed distribution tarball. Using this feature of Automake
requires version 1.10a or newer, as well as the xz program itself.
* xz *
git clone git://ctrl.tukaani.org/xz.git
cd xz
./autogen.sh
./configure --prefix=$HOME/coreutils/deps
make install
Now we can build coreutils as described in README-hacking
as long as $PATH starts with $HOME/coreutils/deps/bin, which
one can set for the current shell like:
$ export PATH=$HOME/coreutils/deps/bin:$PATH

View File

@@ -7,23 +7,22 @@ Here are most of the steps we (maintainers) follow when making a release.
* Run ./configure && make maintainer-clean
* Ensure that the desired versions of autoconf, automake, bison, etc.
are in your PATH. See HACKING for the complete list.
are in your PATH. See the buildreq list in bootstrap.conf for
the complete list.
* Ensure that you're on "master" with no uncommitted diffs.
This should produce no output: git checkout master; git diff
* Make sure your local gnulib directory is up to date.
* Run bootstrap, (assuming your local copy of gnulib is in /gnulib):
./bootstrap --gnulib-srcdir=/gnulib
* Run bootstrap: ./bootstrap
FIXME: enable excluded programs like arch? to get their manual pages?
* Pre-release testing:
Ensure that make check syntax-check succeeds.
On at least one SELinux-enabled (enforcing) and one non-SELinux system,
run all tests, both root-only and regular.
Run *all* non-root tests, including expensive and very expensive ones i.e.,
run this: make check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
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
@@ -31,16 +30,19 @@ FIXME: enable excluded programs like arch? to get their manual pages?
* Run "make distcheck"
* Manually set the date, version number, and [stable/alpha/beta] on
line 3 of NEWS, then do this:
line 3 of NEWS, then do e.g.,:
v=7.1
v=8.0
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' Makefile)
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
git tag -s -m "coreutils $v" v$v HEAD
git tag -s -m "$pkg $v" v$v HEAD
* Run the following to create release tarballs. Your choice selects the
corresponding upload-to destination in the emitted gnupload command.
The different destinations are specified in cfg.mk. See the definitions
of gnu_ftp_host-{alpha,beta,stable}.
# "TYPE" must be major, beta or alpha
# "TYPE" must be stable, beta or alpha
make TYPE
* Test the tarball. copy it to a few odd-ball systems and ensure that
@@ -51,19 +53,22 @@ FIXME: enable excluded programs like arch? to get their manual pages?
Once all the builds and tests have passed,
* Run the gnupload command suggested by your "XZ_OPT=-9e make major" run above.
* Run the gnupload command that was suggested by your "make major" run above.
* Wait a few minutes (maybe up to 30?) and then use the release URLs to
download all tarball/signature pairs and use gpg --verify to ensure
that they're all valid.
* Push the new tag:
git push origin tag v<JUST_RELEASED_VERSION_NUMBER>
v=$(cat .prev-version)
git push origin tag v$v
* Send the gpg-signed announcement mail, e.g.,
To: info-gnu@gnu.org, coreutils-announce@gnu.org
Cc: coordinator@translationproject.org, bug-coreutils@gnu.org
Subject: coreutils-7.1 released [stable]
Subject: coreutils-8.0 released [beta]
* Approve the announcement here:
http://lists.gnu.org/mailman/admindb/coreutils-announce
@@ -72,24 +77,21 @@ Once all the builds and tests have passed,
From here:
https://savannah.gnu.org/projects/coreutils/
click on the "submit news", then write something like the following:
(If there is no such button, then enable "News" for the project via
the Main -> "Select Features" menu item, or via this link:
https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=gzip)
Subject: coreutils-0.0 released [beta]
The announcement is here:
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/48
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/54
Then go here to approve it:
https://savannah.gnu.org/news/approve.php?group=coreutils
* For non-alpha releases, update the on-line manual at
* After each non-alpha release, update the on-line manual accessible via
http://www.gnu.org/software/coreutils/manual/
Run `make web-manual', then copy the contents of doc/manual
into a CVS checkout of the coreutils manual repository.
Also edit coreutils.html (FIXME? why?) before doing a CVS commit.
by running this:
CVS_RSH=ssh \
cvs -d:ext:$USER@cvs.savannah.gnu.org:/web/coreutils co coreutils
Be sure to "cvs add -ko" any files that "cvs status" marks with "?".
That is necessary whenever a new texinfo node is added. Each becomes
a new file in html_node that must then be "cvs add"ed.
build-aux/gnu-web-doc-update

View File

@@ -1,7 +1,7 @@
#! /bin/bash
# Convert this package for use with valgrind.
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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:

23
THANKS
View File

@@ -66,8 +66,9 @@ Barry Kelly http://barrkel.blogspot.com/
Bauke Jan Douma bjdouma@xs4all.nl
Ben Elliston bje@air.net.au
Ben Harris bjh21@netbsd.org
Benjamin Cutler cutlerbc@simla.colostate.edu
Bengt Martensson bengt@mathematik.uni-Bremen.de
Benjamin Cutler cutlerbc@simla.colostate.edu
Benno Schulenberg bensberg@justemail.net
Bernard Giroud bernard.giroud@creditlyonnais.ch
Bernd Eckenfels ecki@debian.org
Bernd Leibing bernd.leibing@rz.uni-ulm.de
@@ -75,8 +76,10 @@ Bernd Melchers melchers@cis.fu-berlin.de
Bernhard Baehr bernhard.baehr@gmx.de
Bernhard Gabler bernhard@uni-koblenz.de
Bernhard Rosenkraenzer bero@redhat.de
Bernhard Voelker bernhard.voelker@siemens-enterprise.com
Bert Deknuydt Bert.Deknuydt@esat.kuleuven.ac.be
Bert Wesarg bert.wesarg@googlemail.com
Bill Brelsford wb@k2di.net
Bill Peters peters@gaffel.as.arizona.edu
Bjorn Helgaas helgaas@rsn.hp.com
Bob McCracken kerouac@ravenet.com
@@ -112,6 +115,7 @@ Christophe LYON christophe.lyon@st.com
Chuck Hedrick hedrick@klinzhai.rutgers.edu
Clark Morgan cmorgan@aracnet.com
Clement Wang clem.wang@overture.com
Cliff Miller cbm@whatexit.org
Colin Plumb colin@nyx.net
Colin Watson cjw44@riva.ucam.org
Collin Rogowski collin@rogowski.de
@@ -183,6 +187,7 @@ Felix Rauch Valenti frauch@cse.unsw.edu.au
Ferdinand fw@scenic.mine.nu
Fletcher Mattox fletcher@cs.utexas.edu
Florent Bayle florent@sarcelle.net
Florian Schlichting fschlich@cis.fu-berlin.de
Florin Iucha fiucha@hsys.mic.ro
Francesco Montorsi fr_m@hotmail.com
François Pinard pinard@iro.umontreal.ca
@@ -235,6 +240,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
@@ -246,6 +252,7 @@ James Antill jmanti%essex.ac.uk@seralph21.essex.ac.uk
James Lemley James.Lemley@acxiom.com
James Hunt jamesodhunt@hotmail.com
James Ralston ralston@pobox.com
James R. Van Zandt jrvz@comcast.net
James Sneeringer jvs@ocslink.com
James Tanis jtt@soscorp.com
James Youngman jay@gnu.org
@@ -275,6 +282,7 @@ Jim Dennis jimd@starshine.org
Joakim Rosqvist dvljrt@cs.umu.se
Jochen Hein jochen@jochen.org
Joe Orton joe@manyfish.co.uk
Joel E. Denny jdenny@clemson.edu
Joerg Sonnenberger joerg@britannica.bec.de
Joey Hess joeyh@debian.org
Johan Boule bohan@bohan.dyndns.org
@@ -298,6 +306,7 @@ Joshua Hudson joshudson@gmail.com
Josselin Mouette joss@debian.org
Juan F. Codagnone juam@arnet.com.ar
Juan M. Guerrero st001906@hrz1.hrz.tu-darmstadt.de
Julian Bradfield jcb@inf.ed.ac.uk
Jungshik Shin jshin@pantheon.yale.edu
Jürgen Fluk louis@dachau.marco.de
Jurriaan thunder7@xs4all.nl
@@ -327,6 +336,7 @@ Leah Q eequor@earthlink.net
Lehti Rami rammer@cs.tut.fi
Leonard N. Zubkoff lnz@dandelion.com
Leonardo Milano lmilano@udel.edu
Lluís Batlle viriketo@gmail.com
Lorne Baker lbaker@nitro.avint.net
Luke Hassell lukehassell@yahoo.com
Luke Kendall lukekendall@optushome.com.au
@@ -365,6 +375,7 @@ Marty Leisner leisner@sdsp.mc.xerox.com
Masami Takikawa takikawm@CS.ORST.EDU
Mate Wierdl mw@moni.msci.memphis.edu
Matej Vela mvela@public.srce.hr
Matias A. Fonzo selk@dragora.org
Matt Kraai kraai@ftbfs.org
Matt Perry matt@primefactor.com
Matt Pham mattvpham@gmail.com
@@ -380,6 +391,7 @@ Matthew Swift swift@alum.mit.edu
Matthew Woehlke mw_triad@users.sourceforge.net
Matthias Urlichs smurf@noris.de
Matti Aarnio matti.aarnio@zmailer.org
Mathias Brodala info@noctus.net
Mattias Wadenstein maswan@acc.umu.se
Max Chang maxchang@ucla.edu
Meelis Roos mroos@tartu.cyber.ee
@@ -395,6 +407,7 @@ Michael J. Croghan mcroghan@usatoday.com
Michael McFarland sidlon@yahoo.com
Michael McLagan mmclagan@invlogic.com
Michael Piefel piefel@informatik.hu-berlin.de
Michael Speer knomenet@gmail.com
Michael Steffens michael.steffens@s.netic.de
Michael Stone mstone@debian.org
Michael Stutz stutz@dsl.org
@@ -433,8 +446,10 @@ Olatunji Oluwabukunmi Ruwase tjruwase@stanford.edu
Olav Morkrid olav@funcom.com
Ole Laursen olau@hardworking.dk
Oliver Kiddle okiddle@yahoo.co.uk
Olivier Fourdan ofourdan@redhat.com
Ørn E. Hansen oehansen@daimi.aau.dk
Oskar Liljeblad osk@hem.passagen.se
Otavio Salvador otavio@ossystems.com.br
Pádraig Brady P@draigBrady.com
Patrick Mauritz oxygene@studentenbude.ath.cx
Paul D. Smith psmith@gnu.org
@@ -479,6 +494,7 @@ Ralph Loader loader@maths.ox.ac.uk
Raul Miller moth@magenta.com
Raúl Núñez de Arenas Coronado raul@pleyades.net
Reuben Thomas rrt@sc3d.org
Yang Ren ryang@redhat.com
Richard A Downing richard.downing@bcs.org.uk
Richard Braakman dark@xs4all.nl
Richard Dawe rich@phekda.freeserve.co.uk
@@ -509,6 +525,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
@@ -524,6 +541,8 @@ 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
@@ -550,6 +569,7 @@ Tim Waugh twaugh@redhat
Tobias Stoeckmann tobias@bugol.de
Toby Peterson toby@opendarwin.org
Todd A. Jacobs tjacobs@codegnome.org
Tom Fitzhenry tom@tom-fitzhenry.me.uk
Tom Haynes thomas@netapp.com
Tom Quinn trq@dionysos.thphys.ox.ac.uk
Tomas Pospisek tpo@sourcepole.ch
@@ -592,6 +612,7 @@ Wis Macomson wis.macomson@intel.com
Wojciech Purczynski cliph@isec.pl
Wolfram Kleff kleff@cs.uni-bonn.de
Won-kyu Park wkpark@chem.skku.ac.kr
Yanko Kaneti yaneti@declera.com
Yann Dirson dirson@debian.org
Zvi Har'El rl@math.technion.ac.il

1
TODO
View File

@@ -15,7 +15,6 @@ document the following in coreutils.texi:
mktemp
[
pinky
Also document the SELinux changes.
Suggestion from Paul Eggert:
More generally, there's not that much use for imaxtostr nowadays,

272
bootstrap
View File

@@ -34,7 +34,7 @@ bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
bt2=${bt}2
usage() {
echo >&2 "\
cat <<EOF
Usage: $0 [OPTION]...
Bootstrap this package from the checked-out sources.
@@ -56,7 +56,7 @@ For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Running without arguments will suffice in most cases.
"
EOF
}
# Configuration.
@@ -70,6 +70,9 @@ gnulib_modules=
# Any gnulib files needed that are not in modules.
gnulib_files=
# A function to be called after everything else in this script.
bootstrap_epilogue() { :; }
# The command to download all .po files for a specified domain into
# a specified directory. Fill in the first %s is the domain name, and
# the second with the destination directory. Use rsync's -L and -r
@@ -106,14 +109,14 @@ tests_base=tests
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
"
# Additional gnulib-tool options to use. Use "\newline" to break lines.
@@ -148,6 +151,45 @@ copy=false
# on which version control system (if any) is used in the source directory.
vc_ignore=auto
# find_tool ENVVAR NAMES...
# -------------------------
# Search for a required program. Use the value of ENVVAR, if set,
# otherwise find the first of the NAMES that can be run (i.e.,
# supports --version). If found, set ENVVAR to the program name,
# die otherwise.
find_tool ()
{
# Find sha1sum, named gsha1sum on MacPorts.
find_tool_envvar=$1
shift
find_tool_names=$@
eval "find_tool_res=\$$find_tool_envvar"
if test x"$find_tool_res" = x; then
for i
do
if ($i --version </dev/null) >/dev/null 2>&1; then
find_tool_res=$i
break
fi
done
else
find_tool_error_prefix="\$$find_tool_envvar: "
fi
if test x"$find_tool_res" = x; then
echo >&2 "$0: one of these is required: $find_tool_names"
exit 1
fi
($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
echo >&2 "$0: ${find_tool_error_prefix}cannot run $find_tool_res --version"
exit 1
}
eval "$find_tool_envvar=\$find_tool_res"
eval "export $find_tool_envvar"
}
# Find sha1sum, named gsha1sum on MacPorts.
find_tool SHA1SUM sha1sum gsha1sum
# Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory
# if we were invoked as "sh bootstrap".
@@ -231,11 +273,11 @@ fi
# 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
sort_ver() { # sort -V is not generally available
ver1="$1"
ver2="$2"
#split on '.' and compare each component
# split on '.' and compare each component
i=1
while : ; do
p1=$(echo "$ver1" | cut -d. -f$i)
@@ -247,11 +289,11 @@ sort_ver() { #sort -V is not generally available
echo "$2 $1"
break
elif [ ! "$p1" = "$p2" ]; then
if [ "$p1" -gt "$p2" ] 2>/dev/null; then #numeric comparision
if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
echo "$2 $1"
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then #numeric comparision
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
echo "$1 $2"
else #numeric, then lexographic comparison
else # numeric, then lexicographic comparison
lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
if [ "$lp" = "$p2" ]; then
echo "$1 $2"
@@ -272,10 +314,10 @@ get_version() {
$app --version 2>&1 |
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
t done
d
:done
q'
t done
d
:done
q'
}
check_versions() {
@@ -308,12 +350,12 @@ print_versions() {
echo "----------------------"
printf "$buildreq"
echo "----------------------"
#can't depend on column -t
# 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 "See README-prereq for notes on obtaining these prerequisite programs:" >&2
echo
print_versions
exit 1
@@ -342,7 +384,7 @@ cleanup_gnulib() {
}
git_modules_config () {
GIT_CONFIG=.gitmodules git config "$@"
test -f .gitmodules && git config --file .gitmodules "$@"
}
# Get gnulib files.
@@ -359,8 +401,8 @@ case ${GNULIB_SRCDIR--} in
trap cleanup_gnulib 1 2 13 15
git clone --help|grep depth > /dev/null && depth='--depth 2' || depth=
git clone $depth 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
@@ -371,7 +413,7 @@ case ${GNULIB_SRCDIR--} in
# Redirect the gnulib submodule to the directory on the command line
# if possible.
if test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
git_modules_config submodule.gnulib.url >/dev/null; then
git submodule init
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
@@ -419,10 +461,12 @@ update_po_files() {
new_po="$ref_po_dir/$po.po"
cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" ||
! test -f "$po_dir/$po.po" ||
! ${SHA1SUM-sha1sum} -c --status "$cksum_file" < "$new_po" > /dev/null; then
! test -f "$po_dir/$po.po" ||
! $SHA1SUM -c --status "$cksum_file" \
< "$new_po" > /dev/null; then
echo "updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
cp "$new_po" "$po_dir/$po.po" \
&& $SHA1SUM < "$new_po" > "$cksum_file"
fi
done
}
@@ -456,45 +500,45 @@ symlink_to_dir()
# FIXME: for now, this does only one level
parent=`dirname "$dst_dir"`
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
done
fi
if $copy; then
{
test ! -h "$dst" || {
echo "$0: rm -f $dst" &&
rm -f "$dst"
}
test ! -h "$dst" || {
echo "$0: rm -f $dst" &&
rm -f "$dst"
}
} &&
test -f "$dst" &&
cmp -s "$src" "$dst" || {
echo "$0: cp -fp $src $dst" &&
cp -fp "$src" "$dst"
echo "$0: cp -fp $src $dst" &&
cp -fp "$src" "$dst"
}
else
test -h "$dst" &&
src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
test "$src_i" = "$dst_i" || {
dot_dots=
case $src in
/*) ;;
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
echo >&2 "$0: invalid symlink calculation: $src -> $dst"
exit 1;;
/*/*/*/*/) dot_dots=../../../;;
/*/*/*/) dot_dots=../../;;
/*/*/) dot_dots=../;;
esac;;
esac
dot_dots=
case $src in
/*) ;;
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
echo >&2 "$0: invalid symlink calculation: $src -> $dst"
exit 1;;
/*/*/*/*/) dot_dots=../../../;;
/*/*/*/) dot_dots=../../;;
/*/*/) dot_dots=../;;
esac;;
esac
echo "$0: ln -fs $dot_dots$src $dst" &&
ln -fs "$dot_dots$src" "$dst"
echo "$0: ln -fs $dot_dots$src $dst" &&
ln -fs "$dot_dots$src" "$dst"
}
fi
}
@@ -524,29 +568,29 @@ cp_mark_as_generated()
if test -z "$c1"; then
cmp -s "$cp_src" "$cp_dst" || {
# Copy the file first to get proper permissions if it
# doesn't already exist. Then overwrite the copy.
echo "$0: cp -f $cp_src $cp_dst" &&
rm -f "$cp_dst" &&
cp "$cp_src" "$cp_dst-t" &&
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
mv -f "$cp_dst-t" "$cp_dst"
# Copy the file first to get proper permissions if it
# doesn't already exist. Then overwrite the copy.
echo "$0: cp -f $cp_src $cp_dst" &&
rm -f "$cp_dst" &&
cp "$cp_src" "$cp_dst-t" &&
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
mv -f "$cp_dst-t" "$cp_dst"
}
else
# Copy the file first to get proper permissions if it
# doesn't already exist. Then overwrite the copy.
cp "$cp_src" "$cp_dst-t" &&
(
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
echo '#line 1' &&
sed "s!$bt_regex/!!g" "$cp_src"
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
echo '#line 1' &&
sed "s!$bt_regex/!!g" "$cp_src"
) > $cp_dst-t &&
if cmp -s "$cp_dst-t" "$cp_dst"; then
rm -f "$cp_dst-t"
rm -f "$cp_dst-t"
else
echo "$0: cp $cp_src $cp_dst # with edits" &&
mv -f "$cp_dst-t" "$cp_dst"
echo "$0: cp $cp_src $cp_dst # with edits" &&
mv -f "$cp_dst-t" "$cp_dst"
fi
fi
fi
@@ -558,7 +602,7 @@ version_controlled_file() {
found=no
if test -d CVS; then
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
grep '^/[^/]*/[0-9]' > /dev/null && found=yes
grep '^/[^/]*/[0-9]' > /dev/null && found=yes
elif test -d .git; then
git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
elif test -d .svn; then
@@ -580,35 +624,35 @@ slurp() {
esac
test -d $1/$dir/$file && continue
for excluded_file in $excluded_files; do
test "$dir/$file" = "$excluded_file" && continue 2
test "$dir/$file" = "$excluded_file" && continue 2
done
if test $file = Makefile.am; then
copied=$copied${sep}$gnulib_mk; sep=$nl
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
rm -f $dir/$gnulib_mk &&
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
}
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
rm -f $dir/$gnulib_mk &&
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
}
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
version_controlled_file $dir $file; then
echo "$0: $dir/$file overrides $1/$dir/$file"
version_controlled_file $dir $file; then
echo "$0: $dir/$file overrides $1/$dir/$file"
else
copied=$copied$sep$file; sep=$nl
if test $file = gettext.m4; then
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
rm -f $dir/$file
sed '
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
AC_DEFUN([AM_INTL_SUBDIR], [
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
$a\
AC_DEFUN([gl_LOCK_EARLY], [])
' $1/$dir/$file >$dir/$file
else
cp_mark_as_generated $1/$dir/$file $dir/$file
fi
copied=$copied$sep$file; sep=$nl
if test $file = gettext.m4; then
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
rm -f $dir/$file
sed '
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
AC_DEFUN([AM_INTL_SUBDIR], [
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
$a\
AC_DEFUN([gl_LOCK_EARLY], [])
' $1/$dir/$file >$dir/$file
else
cp_mark_as_generated $1/$dir/$file $dir/$file
fi
fi || exit
done
@@ -616,18 +660,18 @@ slurp() {
test $dot_ig = x && continue
ig=$dir/$dot_ig
if test -n "$copied"; then
insert_sorted_if_absent $ig "$copied"
# If an ignored file name ends with .in.h, then also add
# the name with just ".h". Many gnulib headers are generated,
# e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
insert_sorted_if_absent $ig "$f"
insert_sorted_if_absent $ig "$copied"
# If an ignored file name ends with .in.h, then also add
# the name with just ".h". Many gnulib headers are generated,
# e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
insert_sorted_if_absent $ig "$f"
# For files like sys_stat.in.h and sys_time.in.h, record as
# ignorable the directory we might eventually create: sys/.
f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
insert_sorted_if_absent $ig "$f"
# For files like sys_stat.in.h and sys_time.in.h, record as
# ignorable the directory we might eventually create: sys/.
f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
insert_sorted_if_absent $ig "$f"
fi
done
done
@@ -686,20 +730,18 @@ find "$m4_base" "$source_base" \
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
-type l -xtype l -delete > /dev/null 2>&1
# Use automake's --silent-rules option, if possible.
automake="${AUTOMAKE-automake} --add-missing --copy --force-missing"
(${AUTOMAKE-automake} --help) 2>&1 \
| grep -e '^ *--silent-rules' > /dev/null \
&& automake="$automake --silent-rules"
# Reconfigure, getting other files.
# Skip autoheader if it's not needed.
grep '^[ ]*AC_CONFIG_HEADERS\>' configure.ac >/dev/null ||
AUTOHEADER=true
for command in \
libtool \
"${ACLOCAL-aclocal} --force -I m4" \
"${AUTOCONF-autoconf} --force" \
"${AUTOHEADER-autoheader} --force" \
"$automake"
"${AUTOMAKE-automake} --add-missing --copy --force-missing"
do
if test "$command" = libtool; then
use_libtool=0
@@ -739,7 +781,7 @@ if test $with_gettext = yes; then
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars
@@ -751,9 +793,9 @@ if test $with_gettext = yes; then
/^subdir *=.*/s/=.*/= runtime-po/
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
' <po/Makevars.template >runtime-po/Makevars
@@ -762,10 +804,6 @@ if test $with_gettext = yes; then
fi
fi
# Horrible, coreutils-specific kludges.
# Change paths in gnulib-tests/gnulib.mk from "../.." to "..".
m=gnulib-tests/gnulib.mk
sed 's,\.\./\.\.,..,g' $m > $m-t
mv -f $m-t $m
bootstrap_epilogue
echo "$0: done. Now you can run './configure'."

View File

@@ -18,103 +18,234 @@
# We don't need these modules.
avoided_gnulib_modules='
--avoid=canonicalize-lgpl
--avoid=dummy
--avoid=lock
--avoid=canonicalize-lgpl
--avoid=dummy
'
# 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
memcmp
memcpy
memmove
memset
strcspn
strtod
strtol
'
# gnulib modules used by this package.
gnulib_modules="
$avoided_gnulib_modules
$obsolete_gnulib_modules
acl alloca announce-gen argmatch
argv-iter
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
gendocs
getline getloadavg getndelim2 getopt getpagesize getpass-gnu
gettext gettime gettimeofday getugroups getusershell
git-version-gen
gitlog-to-changelog
gnu-make gnumakefile gnupload
group-member hard-locale hash hash-pjw host-os human idcache
ignore-value
inttostr inttypes isapipe
lchmod lchown lib-ignore linebuffer link-follow
long-options lstat malloc
manywarnings
mbrtowc
mbswidth
memcasecmp memcmp2 mempcpy
memrchr mgetgroups
mkancesdirs mkdir mkdir-p mkstemp mktime modechange
mountlist mpsort obstack pathmax perl physmem
posix-shell
posixtm
posixver
progname
propername
putenv
quote quotearg raise readlink areadlink-with-size
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 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 version-etc-fsf verror
warnings
wcwidth winsz-ioctl winsz-termios write-any-file
xalloc
xfreopen
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
faccessat
fchdir
fcntl
fcntl-safer
fdl
file-type
fileblocks
filemode
filenamecat
filevercmp
fnmatch-gnu
fopen-safer
fprintftime
freopen
fseeko
fsusage
fsync
ftello
ftruncate
fts
getdate
getgroups
gethrxtime
getline
getloadavg
getndelim2
getopt-gnu
getpagesize
getpass-gnu
gettext
gettime
gettimeofday
getugroups
getusershell
git-version-gen
gitlog-to-changelog
gnu-make
gnu-web-doc-update
gnumakefile
gnupload
group-member
hard-locale
hash
hash-pjw
host-os
human
idcache
ignore-value
inttostr
inttypes
isapipe
lchmod
lchown
lib-ignore
linebuffer
link
link-follow
linkat
long-options
lstat
maintainer-makefile
malloc
manywarnings
mbrtowc
mbsalign
mbswidth
memcasecmp
memchr
memcmp2
mempcpy
memrchr
mgetgroups
mkancesdirs
mkdir
mkdir-p
mkstemp
mktime
modechange
mountlist
mpsort
obstack
pathmax
perl
physmem
posix-shell
posixtm
posixver
priv-set
progname
propername
putenv
quote
quotearg
raise
randint
randperm
readlink
readtokens
readtokens0
readutmp
realloc
regex
rename
rename-dest-slash
rmdir
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-posix
strftime
strpbrk
strsignal
strtoimax
strtoumax
strverscmp
symlink
sys_stat
timespec
tzset
uname
unicodeio
unistd-safer
unlink-busy
unlocked-io
update-copyright
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
xreadlink
xstrtod
xstrtoimax
xstrtol
xstrtold
xstrtoumax
yesno
"
# Other locale categories that need message catalogs.
@@ -165,7 +296,6 @@ if test $gettext_external = 1; then
m4/glibc2.m4
m4/intdiv0.m4
m4/lcmessage.m4
m4/lock.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
@@ -177,7 +307,7 @@ gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
# Build prerequisites
buildreq="\
autoconf 2.61
automake 1.10a
automake 1.11
autopoint -
bison -
gettext -
@@ -191,4 +321,12 @@ tar -
"
# Automake requires that ChangeLog exist.
touch ChangeLog
touch ChangeLog || exit 1
bootstrap_epilogue()
{
# Change paths in gnulib-tests/gnulib.mk from "../.." to "..".
m=gnulib-tests/gnulib.mk
sed 's,\.\./\.\.,..,g' $m > $m-t
mv -f $m-t $m
}

View File

@@ -234,8 +234,7 @@
-----
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
Copyright (C) 2002-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -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

View File

@@ -27,20 +27,20 @@ use Time::Local;
use strict;
use vars qw($list_types %messages %options @batch_list $batch_cmd
$no_recurse $explain_type $find_mode $short_print
$no_cvsignore $nolinks $file $single_filename $curr_dir
@common_ignores $ignore_rx %entries %subdirs %removed);
$no_recurse $explain_type $find_mode $short_print
$no_cvsignore $nolinks $file $single_filename $curr_dir
@common_ignores $ignore_rx %entries %subdirs %removed);
use constant SUBDIR_FOUND => 1;
use constant SUBDIR_CVS => 2;
# This list comes from the CVS manual.
use constant STANDARD_IGNORES =>
('RCS', 'SCCS', 'CVS', 'CVS.adm', 'RCSLOG', 'cvslog.*', 'tags',
'TAGS', '.make.state', '.nse_depinfo', '*~', '#*', '.#*', ',*',
"_\$*", "*\$", '*.old', '*.bak', '*.BAK', '*.orig', '*.rej',
'.del-*', '*.a', '*.olb', '*.o', '*.obj', '*.so', '*.exe',
'*.Z', '*.elc', '*.ln', 'core');
('RCS', 'SCCS', 'CVS', 'CVS.adm', 'RCSLOG', 'cvslog.*', 'tags',
'TAGS', '.make.state', '.nse_depinfo', '*~', '#*', '.#*', ',*',
"_\$*", "*\$", '*.old', '*.bak', '*.BAK', '*.orig', '*.rej',
'.del-*', '*.a', '*.olb', '*.o', '*.obj', '*.so', '*.exe',
'*.Z', '*.elc', '*.ln', 'core');
# 3-letter month names in POSIX locale, for fast date decoding
my %months = (
@@ -62,20 +62,20 @@ my %months = (
sub usage ()
{
print "Usage:\n" .
" cvsu [OPTIONS] [FILE] ...\n" .
"Options:\n" .
" --local Disable recursion\n" .
" --explain Verbosely print status of files\n" .
" --find Emulate find - filenames only\n" .
" --short Don't print paths\n" .
" --ignore Don't read .cvsignore\n" .
" --messages List known file types and long messages\n" .
" --nolinks Disable recognizing hard and soft links\n" .
" --types=[^]LIST Print only file types [not] from LIST\n" .
" --batch=COMMAND Execute this command on files\n" .
" --help Print this usage information\n" .
" --version Print version number\n" .
"Abbreviations and short options are supported\n";
" cvsu [OPTIONS] [FILE] ...\n" .
"Options:\n" .
" --local Disable recursion\n" .
" --explain Verbosely print status of files\n" .
" --find Emulate find - filenames only\n" .
" --short Don't print paths\n" .
" --ignore Don't read .cvsignore\n" .
" --messages List known file types and long messages\n" .
" --nolinks Disable recognizing hard and soft links\n" .
" --types=[^]LIST Print only file types [not] from LIST\n" .
" --batch=COMMAND Execute this command on files\n" .
" --help Print this usage information\n" .
" --version Print version number\n" .
"Abbreviations and short options are supported\n";
exit 0;
}
@@ -90,11 +90,11 @@ sub version ()
sub adjust_types ()
{
if ($list_types =~ m{^\^(.*)$}) {
$list_types = "";
foreach (keys %messages) {
$list_types .= $_
if (index ($1, $_) < 0);
}
$list_types = "";
foreach (keys %messages) {
$list_types .= $_
if (index ($1, $_) < 0);
}
}
}
@@ -104,12 +104,12 @@ sub list_messages ()
my $default_mark;
print "Recognizable file types are:\n";
foreach (sort keys %messages) {
if (index($list_types, $_) >= 0) {
$default_mark = "*";
} else {
$default_mark = " ";
}
print " $default_mark $_ $messages{$_}\n";
if (index($list_types, $_) >= 0) {
$default_mark = "*";
} else {
$default_mark = " ";
}
print " $default_mark $_ $messages{$_}\n";
}
print "* indicates file types listed by default\n";
exit 0;
@@ -124,28 +124,28 @@ sub init_ignores ()
push @common_ignores, STANDARD_IGNORES;
unless (defined($HOME)) {
return;
return;
}
my $home_cvsignore = "${HOME}/.cvsignore";
if (-f "$home_cvsignore") {
unless (open (CVSIGNORE, "< $home_cvsignore")) {
error ("couldn't open $home_cvsignore: $!");
}
unless (open (CVSIGNORE, "< $home_cvsignore")) {
error ("couldn't open $home_cvsignore: $!");
}
while (<CVSIGNORE>) {
push (@common_ignores, split);
}
while (<CVSIGNORE>) {
push (@common_ignores, split);
}
close (CVSIGNORE);
close (CVSIGNORE);
}
my $CVSIGNOREENV = $ENV{"CVSIGNORE"};
unless (defined($CVSIGNOREENV)) {
return;
return;
}
my @ignores_var = split (/ /, $CVSIGNOREENV);
@@ -157,15 +157,15 @@ sub init_ignores ()
# Newline is added at the end.
sub error ($)
{
print STDERR "cvsu: ERROR: " . shift(@_) . "\n";
exit 1;
print STDERR "cvsu: ERROR: " . shift(@_) . "\n";
exit 1;
}
# execute commands from @exec_list with $exec_cmd
sub do_batch ()
{
my @cmd_list = split (' ', $batch_cmd);
system (@cmd_list, @batch_list);
my @cmd_list = split (' ', $batch_cmd);
system (@cmd_list, @batch_list);
}
# print files status
@@ -177,34 +177,34 @@ sub file_status ($)
my $pathfile;
return
if $ignore_rx ne '' && $type =~ /[?SLD]/ && $file =~ /$ignore_rx/;
if $ignore_rx ne '' && $type =~ /[?SLD]/ && $file =~ /$ignore_rx/;
return
if (index($list_types, $type) < 0);
if (index($list_types, $type) < 0);
$pathfile = $curr_dir . $file;
if (defined($batch_cmd)) {
push (@batch_list, $pathfile);
# 1000 items in the command line might be too much for HP-UX
if ($#batch_list > 1000) {
do_batch();
undef @batch_list;
}
push (@batch_list, $pathfile);
# 1000 items in the command line might be too much for HP-UX
if ($#batch_list > 1000) {
do_batch();
undef @batch_list;
}
}
if ($short_print) {
$item = $file;
$item = $file;
} else {
$item = $pathfile;
$item = $pathfile;
}
if ($find_mode) {
print "$item\n";
print "$item\n";
} else {
$type = $messages{$type}
if ($explain_type);
print "$type $item\n";
$type = $messages{$type}
if ($explain_type);
print "$type $item\n";
}
}
@@ -219,28 +219,28 @@ sub load_entries ($)
my %ent = ();
unless (open (ENTRIES, "< $entries_file")) {
error ("couldn't open $entries_file: $!");
error ("couldn't open $entries_file: $!");
}
while (<ENTRIES>) {
chomp;
$ent{$_} = 1;
chomp;
$ent{$_} = 1;
}
close (ENTRIES);
if (open (ENTRIES, "< $entries_log_file")) {
while (<ENTRIES>) {
chomp;
if ( m{^A (.+)} ) {
$ent{$1} = 1;
} elsif ( m{^R (.+)} ) {
delete $ent{$1};
} else {
# Note: "cvs commit" helps even when you are offline
error ("$entries_log_file:$.: unrecognizable line, " .
"try \"cvs commit\"");
}
}
close (ENTRIES);
while (<ENTRIES>) {
chomp;
if ( m{^A (.+)} ) {
$ent{$1} = 1;
} elsif ( m{^R (.+)} ) {
delete $ent{$1};
} else {
# Note: "cvs commit" helps even when you are offline
error ("$entries_log_file:$.: unrecognizable line, " .
"try \"cvs commit\"");
}
}
close (ENTRIES);
}
return keys %ent;
@@ -260,28 +260,28 @@ sub process_arg ($)
local $single_filename = 0;
if ( $arg eq "" or -d $arg ) {
$curr_dir = $arg;
my $real_curr_dir = $curr_dir eq "" ? "." : $curr_dir;
$curr_dir = $arg;
my $real_curr_dir = $curr_dir eq "" ? "." : $curr_dir;
error ("$real_curr_dir is not a directory")
unless ( -d $real_curr_dir );
error ("$real_curr_dir is not a directory")
unless ( -d $real_curr_dir );
# Scan present files.
file_status (".");
opendir (DIR, $real_curr_dir) ||
error ("couldn't open directory $real_curr_dir: $!");
foreach (readdir (DIR)) {
$found_files {$_} = 1;
}
closedir (DIR);
# Scan present files.
file_status (".");
opendir (DIR, $real_curr_dir) ||
error ("couldn't open directory $real_curr_dir: $!");
foreach (readdir (DIR)) {
$found_files {$_} = 1;
}
closedir (DIR);
} else {
$single_filename = basename $arg;
$curr_dir = dirname $arg;
$found_files{$single_filename} = 1 if lstat $arg;
$single_filename = basename $arg;
$curr_dir = dirname $arg;
$found_files{$single_filename} = 1 if lstat $arg;
}
$curr_dir .= "/"
unless ( $curr_dir eq "" || $curr_dir =~ m{/$} );
unless ( $curr_dir eq "" || $curr_dir =~ m{/$} );
# Scan CVS/Entries.
my %entries = ();
@@ -289,118 +289,118 @@ sub process_arg ($)
my %removed = ();
foreach ( load_entries ("${curr_dir}CVS/Entries") ) {
if ( m{^D/([^/]+)/} ) {
$subdirs{$1} = SUBDIR_FOUND if !$single_filename;
} elsif ( m{^/([^/]+)/([^/])[^/]*/([^/]*)/} ) {
if ( !$single_filename or $single_filename eq $1 ) {
$entries{$1} = $3;
$removed{$1} = 1
if $2 eq '-';
}
} elsif ( m{^D$} ) {
next;
} else {
error ("${curr_dir}CVS/Entries: unrecognizable line");
}
if ( m{^D/([^/]+)/} ) {
$subdirs{$1} = SUBDIR_FOUND if !$single_filename;
} elsif ( m{^/([^/]+)/([^/])[^/]*/([^/]*)/} ) {
if ( !$single_filename or $single_filename eq $1 ) {
$entries{$1} = $3;
$removed{$1} = 1
if $2 eq '-';
}
} elsif ( m{^D$} ) {
next;
} else {
error ("${curr_dir}CVS/Entries: unrecognizable line");
}
}
if ( $single_filename && !$entries{$single_filename} &&
!$found_files{$single_filename} ) {
error ("nothing known about $arg");
!$found_files{$single_filename} ) {
error ("nothing known about $arg");
}
# Scan .cvsignore if any
unless ($no_cvsignore) {
my (@ignore_list) = ();
my (@ignore_list) = ();
if (-f "${curr_dir}.cvsignore") {
open (CVSIGNORE, "< ${curr_dir}.cvsignore")
|| error ("couldn't open ${curr_dir}.cvsignore: $!");
while (<CVSIGNORE>) {
push (@ignore_list, split);
}
close (CVSIGNORE);
}
if (-f "${curr_dir}.cvsignore") {
open (CVSIGNORE, "< ${curr_dir}.cvsignore")
|| error ("couldn't open ${curr_dir}.cvsignore: $!");
while (<CVSIGNORE>) {
push (@ignore_list, split);
}
close (CVSIGNORE);
}
my ($iter);
foreach $iter (@ignore_list, @common_ignores) {
if ($iter eq '!') {
$ignore_rx = ''
} else {
if ($ignore_rx eq '') {
$ignore_rx = '^(';
} else {
$ignore_rx .= '|';
}
$ignore_rx .= glob_to_rx ($iter);
}
}
$ignore_rx .= ')$'
if $ignore_rx ne '';
my ($iter);
foreach $iter (@ignore_list, @common_ignores) {
if ($iter eq '!') {
$ignore_rx = ''
} else {
if ($ignore_rx eq '') {
$ignore_rx = '^(';
} else {
$ignore_rx .= '|';
}
$ignore_rx .= glob_to_rx ($iter);
}
}
$ignore_rx .= ')$'
if $ignore_rx ne '';
}
# File is missing
foreach $file (sort keys %entries) {
unless ($found_files{$file}) {
if ($removed{$file}) {
file_status("R");
} else {
file_status("U");
}
}
unless ($found_files{$file}) {
if ($removed{$file}) {
file_status("R");
} else {
file_status("U");
}
}
}
foreach $file (sort keys %found_files) {
next if ($file eq '.' || $file eq '..');
lstat ($curr_dir . $file) ||
error ("lstat() failed on $curr_dir . $file");
if (! $nolinks && -l _) {
file_status ("L");
} elsif (-d _) {
if ($file eq 'CVS') {
file_status ("C");
} elsif ($subdirs{$file}) {
$subdirs{$file} = SUBDIR_CVS;
} else {
file_status ("D"); # Unknown directory
}
} elsif (! (-f _) && ! (-l _)) {
file_status ("S"); # This must be something very special
} elsif (! $nolinks && (stat _) [3] > 1 ) {
file_status ("H"); # Hard link
} elsif (! $entries{$file}) {
file_status ("?");
} elsif ($entries{$file} =~ /^Initial |^dummy /) {
file_status ("A");
} elsif ($entries{$file} =~ /^Result of merge/) {
file_status ("G");
} elsif ($entries{$file} !~
/^(...) (...) (..) (..):(..):(..) (....)$/) {
error ("Invalid timestamp for $curr_dir$file: $entries{$file}");
} else {
my $cvtime = timegm($6, $5, $4, $3, $months{$2}, $7 - 1900);
my $mtime = (stat _) [9];
if ($cvtime == $mtime) {
file_status ("F");
} elsif ($cvtime < $mtime) {
file_status ("M");
} else {
file_status ("O");
}
}
next if ($file eq '.' || $file eq '..');
lstat ($curr_dir . $file) ||
error ("lstat() failed on $curr_dir . $file");
if (! $nolinks && -l _) {
file_status ("L");
} elsif (-d _) {
if ($file eq 'CVS') {
file_status ("C");
} elsif ($subdirs{$file}) {
$subdirs{$file} = SUBDIR_CVS;
} else {
file_status ("D"); # Unknown directory
}
} elsif (! (-f _) && ! (-l _)) {
file_status ("S"); # This must be something very special
} elsif (! $nolinks && (stat _) [3] > 1 ) {
file_status ("H"); # Hard link
} elsif (! $entries{$file}) {
file_status ("?");
} elsif ($entries{$file} =~ /^Initial |^dummy /) {
file_status ("A");
} elsif ($entries{$file} =~ /^Result of merge/) {
file_status ("G");
} elsif ($entries{$file} !~
/^(...) (...) (..) (..):(..):(..) (....)$/) {
error ("Invalid timestamp for $curr_dir$file: $entries{$file}");
} else {
my $cvtime = timegm($6, $5, $4, $3, $months{$2}, $7 - 1900);
my $mtime = (stat _) [9];
if ($cvtime == $mtime) {
file_status ("F");
} elsif ($cvtime < $mtime) {
file_status ("M");
} else {
file_status ("O");
}
}
}
# Now do directories.
unless ($no_recurse) {
my $save_curr_dir = $curr_dir;
foreach $file (sort keys %subdirs) {
if ($subdirs{$file} == SUBDIR_FOUND) {
$curr_dir = $save_curr_dir;
file_status ("X");
} elsif ($subdirs{$file} == SUBDIR_CVS) {
process_arg ($save_curr_dir . $file)
}
}
my $save_curr_dir = $curr_dir;
foreach $file (sort keys %subdirs) {
if ($subdirs{$file} == SUBDIR_FOUND) {
$curr_dir = $save_curr_dir;
file_status ("X");
} elsif ($subdirs{$file} == SUBDIR_CVS) {
process_arg ($save_curr_dir . $file)
}
}
}
}
@@ -423,13 +423,13 @@ sub glob_to_rx ($)
# Find parts in square brackets and copy them literally
# Text outside brackets is processed by glob_to_rx_simple()
while ($expr ne '') {
if ($expr =~ /^(.*?)(\[.*?\])(.*)/) {
$expr = $3;
$result .= glob_to_rx_simple ($1) . $2;
} else {
$result .= glob_to_rx_simple ($expr);
last;
}
if ($expr =~ /^(.*?)(\[.*?\])(.*)/) {
$expr = $3;
$result .= glob_to_rx_simple ($1) . $2;
} else {
$result .= glob_to_rx_simple ($expr);
last;
}
}
return $result;
}
@@ -441,21 +441,21 @@ sub Main ()
# long status messages
%messages = (
"?" => "Unlisted file",
"." => "Known directory",
"F" => "Up-to-date file",
"C" => "CVS admin directory",
"M" => "Modified file",
"S" => "Special file",
"D" => "Unlisted directory",
"L" => "Symbolic link",
"H" => "Hard link",
"U" => "Lost file",
"X" => "Lost directory",
"A" => "Newly added",
"O" => "Older copy",
"G" => "Result of merge",
"R" => "Removed file"
"?" => "Unlisted file",
"." => "Known directory",
"F" => "Up-to-date file",
"C" => "CVS admin directory",
"M" => "Modified file",
"S" => "Special file",
"D" => "Unlisted directory",
"L" => "Symbolic link",
"H" => "Hard link",
"U" => "Lost file",
"X" => "Lost directory",
"A" => "Newly added",
"O" => "Older copy",
"G" => "Result of merge",
"R" => "Removed file"
);
undef @batch_list; # List of files for batch processing
@@ -471,17 +471,17 @@ sub Main ()
my $want_ver = 0; # Print version and exit
my %options = (
"types=s" => \$list_types,
"batch=s" => \$batch_cmd,
"local" => \$no_recurse,
"explain" => \$explain_type,
"find" => \$find_mode,
"short" => \$short_print,
"ignore" => \$no_cvsignore,
"messages" => \$want_msg,
"nolinks" => \$nolinks,
"help" => \$want_help,
"version" => \$want_ver
"types=s" => \$list_types,
"batch=s" => \$batch_cmd,
"local" => \$no_recurse,
"explain" => \$explain_type,
"find" => \$find_mode,
"short" => \$short_print,
"ignore" => \$no_cvsignore,
"messages" => \$want_msg,
"nolinks" => \$nolinks,
"help" => \$want_help,
"version" => \$want_ver
);
GetOptions(%options);
@@ -493,19 +493,19 @@ sub Main ()
version() if $want_ver;
unless ($no_cvsignore) {
init_ignores();
init_ignores();
}
if ($#ARGV < 0) {
@ARGV = ("");
@ARGV = ("");
}
foreach (@ARGV) {
process_arg ($_);
process_arg ($_);
}
if ($#batch_list >= 0) {
do_batch();
do_batch();
}
}

52
cfg.mk
View File

@@ -25,27 +25,21 @@ gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
manual_title = Core GNU utilities
url_dir_list = \
ftp://$(gnu_rel_host)/gnu/coreutils
ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
# The GnuPG ID of the key used to sign the tarballs.
gpg_key_ID = B9AB9A16
# Tests not to run as part of "make distcheck".
# 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 =
local-checks-to-skip += patch-check
# Tools used to bootstrap this package, used for "announcement".
bootstrap-tools = autoconf,automake,gnulib,bison
# 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
# Now that we have better (check.mk) tests, make this the default.
# Now that we have better tests, make this the default.
export VERBOSE = yes
old_NEWS_hash = fa6cba1740b3f385520c1b54d90859ca
old_NEWS_hash = 785e51bc9af87e7eb004f9ba24a0ca27
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
dd = $(srcdir)/src/dd.c
@@ -105,6 +99,18 @@ sc_root_tests:
exit 1; } || :; \
fi
# Ensure that the syntax_check_exceptions file list in Makefile.am
# stays in sync with corresponding files in the repository.
sce = syntax_check_exceptions
sc_x_sc_dist_check:
@test "$$( ($(VC_LIST) | sed -n '/^.x-sc_/p'; \
sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/Makefile.am \
| sed 's/^ *//;/^$(sce) =/d' \
| tr -s '\012\\' ' ' | fmt -1 \
) | sort | uniq -u)" \
&& { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
headers_with_interesting_macro_defs = \
exit.h \
fcntl_.h \
@@ -154,8 +160,7 @@ sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(VC_LIST) src | \
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
$$($(VC_LIST_EXCEPT) | grep '^src/') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
fi
@@ -167,9 +172,14 @@ sc_sun_os_names:
{ 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 $@
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
sc_check-AUTHORS:
@$(MAKE) -C src $@
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
# infrastructure is in tests/Makefile.am. Make sure no old-style
@@ -195,3 +205,17 @@ sc_strftime_check:
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
fi
# Indent only with spaces.
sc_prohibit_tab_based_indentation:
@re='^ * ' \
msg='TAB in indentation; use only spaces' \
$(_prohibit_regexp)
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
sc_prohibit_emacs__indent_tabs_mode__setting:
@re='^( *[*#] *)?indent-tabs-mode:' \
msg='use of emacs indent-tabs-mode: setting' \
$(_prohibit_regexp)
include $(srcdir)/dist-check.mk

View File

@@ -24,15 +24,16 @@ AC_PREREQ([2.61])
# indicates that it is built from the 219th delta (in _some_ repository)
# following the v6.9 tag, and that 58ddd is a prefix of the commit SHA1.
AC_INIT([GNU coreutils],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[bug-coreutils@gnu.org])
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[bug-coreutils@gnu.org])
AC_CONFIG_SRCDIR([src/ls.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
AM_INIT_AUTOMAKE([1.10a dist-xz])
AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
AC_PROG_CC_STDC
AM_PROG_CC_C_O
@@ -46,7 +47,7 @@ coreutils_MACROS
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings],
[turn on lots of GCC warnings (for developers)])],
[turn on lots of GCC warnings (for developers)])],
[case $enableval in
yes|no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
@@ -59,9 +60,11 @@ if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
# Add many warnings, except some...
nw=
# This, $nw, is the list of warnings we disable.
nw="$nw -Wdeclaration-after-statement" # too useful to forbid
nw="$nw -Waggregate-return" # anachronistic
nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h)
nw="$nw -Wc++-compat" # We don't care about C++ compilers
nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
nw="$nw -Wtraditional" # Warns on #elif which we use often
@@ -79,6 +82,7 @@ if test "$gl_gcc_warnings" = yes; then
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
nw="$nw -Wswitch-enum" # Too many warnings for now
nw="$nw -Wswitch-default" # Too many warnings for now
nw="$nw -Wstack-protector" # not worth working around
# things I might fix soon:
nw="$nw -Wfloat-equal" # sort.c, seq.c
nw="$nw -Wmissing-format-attribute" # copy.c
@@ -96,6 +100,11 @@ if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
# In spite of excluding -Wlogical-op above, it is enabled, as of
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
gl_WARN_ADD([-Wno-logical-op])
gl_WARN_ADD([-fdiagnostics-show-option])
AC_SUBST([WARN_CFLAGS])
@@ -109,12 +118,10 @@ fi
AC_FUNC_FORK
optional_bin_progs=
AC_CHECK_FUNCS([uname],
gl_ADD_PROG([optional_bin_progs], [uname]))
AC_CHECK_FUNCS([chroot],
gl_ADD_PROG([optional_bin_progs], [chroot]))
gl_ADD_PROG([optional_bin_progs], [chroot]))
AC_CHECK_FUNCS([gethostid],
gl_ADD_PROG([optional_bin_progs], [hostid]))
gl_ADD_PROG([optional_bin_progs], [hostid]))
gl_WINSIZE_IN_PTEM
@@ -156,9 +163,9 @@ int main()
[# If we have tzset, assume the worst when cross-compiling.
utils_cv_localtime_cache=yes])
else
# If we lack tzset, report that localtime does not cache TZ,
# since we can't invalidate the cache if we don't have tzset.
utils_cv_localtime_cache=no
# If we lack tzset, report that localtime does not cache TZ,
# since we can't invalidate the cache if we don't have tzset.
utils_cv_localtime_cache=no
fi])dnl
AC_MSG_RESULT([$utils_cv_localtime_cache])
if test $utils_cv_localtime_cache = yes; then
@@ -185,7 +192,7 @@ AC_CACHE_CHECK([for 3-argument setpriority function],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/time.h>
#include <sys/resource.h>
#include <sys/resource.h>
]],
[[setpriority (0, 0, 0);]])],
[utils_cv_func_setpriority=yes],
@@ -313,6 +320,19 @@ if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
gl_ADD_PROG([optional_bin_progs], [df])
fi
# Limit stdbuf to ELF systems with GCC
optional_pkglib_progs=
AC_MSG_CHECKING([whether this is an ELF system])
AC_EGREP_CPP([yes], [#if __ELF__
yes
#endif], [elf_sys=yes], [elf_sys=no])
AC_MSG_RESULT([$elf_sys])
if test "$elf_sys" = "yes" && \
test "$GCC" = "yes"; then
gl_ADD_PROG([optional_bin_progs], [stdbuf])
gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so])
fi
############################################################################
mk="$srcdir/src/Makefile.am"
# Extract all literal names from the definition of $(EXTRA_PROGRAMS)
@@ -349,8 +369,8 @@ case $t in
$no_install_progs_default) ;;
*) AC_MSG_ERROR([[internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, $t,
does not match the list of default-not-installed programs
($no_install_progs_default) also recorded in $mk]],
1) ;;
($no_install_progs_default) also recorded in $mk]],
1) ;;
esac
# Given the name of a variable containing a space-separated list of
@@ -385,6 +405,8 @@ MAN=`echo "$MAN"|sed 's/\@<:@\.1//'`
OPTIONAL_BIN_PROGS=`echo "$optional_bin_progs "|sed 's/ /\$(EXEEXT) /g;s/ $//'`
AC_SUBST([OPTIONAL_BIN_PROGS])
OPTIONAL_PKGLIB_PROGS=`echo "$optional_pkglib_progs " | sed 's/ $//'`
AC_SUBST([OPTIONAL_PKGLIB_PROGS])
NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
AC_SUBST([NO_INSTALL_PROGS_DEFAULT])

133
dist-check.mk Normal file
View File

@@ -0,0 +1,133 @@
# Most of this is probably too coreutils-centric to be useful to other packages.
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 --enable-gcc-warnings --disable-nls \
&& $(MAKE) 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 "========================"

View File

@@ -2002,8 +2002,7 @@
-----
Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
Copyright (C) 2001-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -60,45 +60,45 @@ syntax_checks = \
# 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
@@ -115,7 +115,7 @@ find_upper_case_var = \
} \
END {$$m and (warn "$(ME): do not use upper case in \@var{...}\n"), exit 1}'
sc-lower-case-var:
@$(PERL) -e 1 2> /dev/null && \
$(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
$(AM_V_GEN)$(PERL) -e 1 \
&& $(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
check: check-texinfo

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
@c File mode bits
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008
@c Free Software Foundation, Inc.
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006,
@c 2008-2009 Free Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.3 or

View File

@@ -1,117 +0,0 @@
/* Iterate over arguments from argv or --files0-from=FILE
Copyright (C) 2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */
#include <config.h>
#include "argv-iter.h"
#include <stdlib.h>
#include <string.h>
struct argv_iterator
{
/* Test FP to determine whether in read-mode or argv-mode. */
/* file-mode: fp records position */
FILE *fp;
size_t item_idx;
char *tok;
size_t buf_len;
/* argv-mode: record just argv and current pointer */
char **arg_list;
char **p;
};
struct argv_iterator *
argv_iter_init_argv (char **argv)
{
struct argv_iterator *ai = malloc (sizeof *ai);
if (!ai)
return NULL;
ai->fp = NULL;
ai->arg_list = argv;
ai->p = argv;
return ai;
}
/* Initialize to read from the stream, FP.
The input is expected to contain a list of NUL-delimited tokens. */
struct argv_iterator *
argv_iter_init_stream (FILE *fp)
{
struct argv_iterator *ai = malloc (sizeof *ai);
if (!ai)
return NULL;
ai->fp = fp;
ai->tok = NULL;
ai->buf_len = 0;
ai->item_idx = 0;
ai->arg_list = NULL;
return ai;
}
char *
argv_iter (struct argv_iterator *ai, enum argv_iter_err *err)
{
if (ai->fp)
{
ssize_t len = getdelim (&ai->tok, &ai->buf_len, '\0', ai->fp);
if (len < 0)
{
*err = feof (ai->fp) ? AI_ERR_EOF : AI_ERR_READ;
return NULL;
}
*err = AI_ERR_OK;
ai->item_idx++;
return ai->tok;
}
else
{
if (*(ai->p) == NULL)
{
*err = AI_ERR_EOF;
return NULL;
}
else
{
*err = AI_ERR_OK;
return *(ai->p++);
}
}
}
size_t
argv_iter_n_args (struct argv_iterator const *ai)
{
return ai->fp ? ai->item_idx : ai->p - ai->arg_list;
}
void
argv_iter_free (struct argv_iterator *ai)
{
if (ai->fp)
free (ai->tok);
free (ai);
}
/*
* Local variables:
* indent-tabs-mode: nil
* End:
*/

View File

@@ -1,47 +0,0 @@
/* Iterate over arguments from argv or --files0-from=FILE
Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <stdbool.h>
struct argv_iterator;
enum argv_iter_err;
#undef _ATTRIBUTE_NONNULL_
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
#else
# define _ATTRIBUTE_NONNULL_(m)
#endif
enum argv_iter_err
{
AI_ERR_OK = 1,
AI_ERR_EOF,
AI_ERR_MEM,
AI_ERR_READ
};
struct argv_iterator *argv_iter_init_argv (char **argv)
_ATTRIBUTE_NONNULL_ (1);
struct argv_iterator *argv_iter_init_stream (FILE *fp)
_ATTRIBUTE_NONNULL_ (1);
char *argv_iter (struct argv_iterator *, enum argv_iter_err *)
_ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);
size_t argv_iter_n_args (struct argv_iterator const *)
_ATTRIBUTE_NONNULL_ (1);
void argv_iter_free (struct argv_iterator *)
_ATTRIBUTE_NONNULL_ (1);

231
gl/lib/mbsalign.c Normal file
View File

@@ -0,0 +1,231 @@
/* 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));
mbs_align_pad (dest, dest_end, end_spaces);
}
mbsalign_cleanup:
free (str_wc);
free (newstr);
return ret;
}

View File

@@ -1,5 +1,5 @@
/* Prototypes for openat-style fd-relative SELinux functions
Copyright (C) 2007 Free Software Foundation, Inc.
/* 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
@@ -14,10 +14,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <selinux/selinux.h>
#include <selinux/context.h>
#include <stddef.h>
int getfileconat (int fd, char const *file, security_context_t *con);
int lgetfileconat (int fd, char const *file, security_context_t *con);
int setfileconat (int fd, char const *file, security_context_t con);
int lsetfileconat (int fd, char const *file, security_context_t con);
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);

View File

@@ -76,37 +76,45 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
return -1;
return -1;
while (1)
{
GETGROUPS_T *h;
{
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);
/* getgrouplist updates max_n_groups to num required. */
ng = getgrouplist (username, gid, g, &max_n_groups);
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
{
int saved_errno = errno;
free (g);
errno = saved_errno;
return -1;
}
g = h;
/* 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 (0 <= ng)
{
*groups = g;
return ng;
}
}
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
{
int saved_errno = errno;
free (g);
errno = saved_errno;
return -1;
}
g = h;
if (0 <= ng)
{
*groups = g;
/* On success some systems just return 0 from getgrouplist,
so return max_n_groups rather than ng. */
return max_n_groups;
}
}
}
/* else no username, so fall through and use getgroups. */
#endif
max_n_groups = (username
? getugroups (0, NULL, username, gid)
: getgroups (0, NULL));
? getugroups (0, NULL, username, gid)
: getgroups (0, NULL));
/* If we failed to count groups with NULL for a buffer,
try again with a non-NULL one, just in case. */
@@ -118,8 +126,8 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
return -1;
ng = (username
? getugroups (max_n_groups, g, username, gid)
: getgroups (max_n_groups, g));
? getugroups (max_n_groups, g, username, gid)
: getgroups (max_n_groups, g));
if (ng < 0)
{

View File

@@ -1,5 +1,5 @@
/* Get a list of all group IDs associated with a specified user ID.
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

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generator, ISAAC.
Copyright (C) 1999-2006 Free Software Foundation, Inc.
Copyright (C) 1999-2006, 2009 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
@@ -43,7 +43,7 @@
/* This index operation is more efficient on many processors */
#define ind(mm, x) \
(* (uint32_t *) ((char *) (mm) \
+ ((x) & (ISAAC_WORDS - 1) * sizeof (uint32_t))))
+ ((x) & (ISAAC_WORDS - 1) * sizeof (uint32_t))))
/*
* The central step. This uses two temporaries, x and y. mm is the
@@ -191,18 +191,18 @@ isaac_init (struct isaac_state *s, uint32_t const *seed, size_t seedsize)
isaac_mix (s, seed);
/* Second and subsequent passes (extension to ISAAC) */
while (seedsize -= ISAAC_BYTES)
{
seed += ISAAC_WORDS;
for (i = 0; i < ISAAC_WORDS; i++)
s->mm[i] += seed[i];
isaac_mix (s, s->mm);
}
{
seed += ISAAC_WORDS;
for (i = 0; i < ISAAC_WORDS; i++)
s->mm[i] += seed[i];
isaac_mix (s, s->mm);
}
}
else
{
/* The no seed case (as in reference ISAAC code) */
for (i = 0; i < ISAAC_WORDS; i++)
s->mm[i] = 0;
s->mm[i] = 0;
}
/* Final pass */
@@ -252,7 +252,7 @@ isaac_seed_data (struct isaac_state *s, void const *buffer, size_t size)
{
p = (unsigned char *) s->mm + s->c;
for (i = 0; i < avail; i++)
p[i] ^= buf[i];
p[i] ^= buf[i];
buf += avail;
size -= avail;
isaac_mix (s, s->mm);

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generator, ISAAC.
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Copyright (C) 1999-2005, 2009 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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
{
@@ -132,75 +128,75 @@ randint_genmax (struct randint_source *s, randint genmax)
for (;;)
{
if (randmax < genmax)
{
/* Calculate how many input bytes will be needed, and read
the bytes. */
{
/* Calculate how many input bytes will be needed, and read
the bytes. */
size_t i = 0;
randint rmax = randmax;
unsigned char buf[sizeof randnum];
size_t i = 0;
randint rmax = randmax;
unsigned char buf[sizeof randnum];
do
{
rmax = shift_left (rmax) + UCHAR_MAX;
i++;
}
while (rmax < genmax);
do
{
rmax = shift_left (rmax) + UCHAR_MAX;
i++;
}
while (rmax < genmax);
randread (source, buf, i);
randread (source, buf, i);
/* Increase RANDMAX by appending random bytes to RANDNUM and
UCHAR_MAX to RANDMAX until RANDMAX is no less than
GENMAX. This may lose up to CHAR_BIT bits of information
if shift_right (RANDINT_MAX) < GENMAX, but it is not
worth the programming hassle of saving these bits since
GENMAX is rarely that large in practice. */
/* Increase RANDMAX by appending random bytes to RANDNUM and
UCHAR_MAX to RANDMAX until RANDMAX is no less than
GENMAX. This may lose up to CHAR_BIT bits of information
if shift_right (RANDINT_MAX) < GENMAX, but it is not
worth the programming hassle of saving these bits since
GENMAX is rarely that large in practice. */
i = 0;
i = 0;
do
{
randnum = shift_left (randnum) + buf[i];
randmax = shift_left (randmax) + UCHAR_MAX;
i++;
}
while (randmax < genmax);
}
do
{
randnum = shift_left (randnum) + buf[i];
randmax = shift_left (randmax) + UCHAR_MAX;
i++;
}
while (randmax < genmax);
}
if (randmax == genmax)
{
s->randnum = s->randmax = 0;
return randnum;
}
{
s->randnum = s->randmax = 0;
return randnum;
}
else
{
/* GENMAX < RANDMAX, so attempt to generate a random number
by taking RANDNUM modulo GENMAX+1. This will choose
fairly so long as RANDNUM falls within an integral
multiple of GENMAX+1; otherwise, LAST_USABLE_CHOICE < RANDNUM,
so discard this attempt and try again.
{
/* GENMAX < RANDMAX, so attempt to generate a random number
by taking RANDNUM modulo GENMAX+1. This will choose
fairly so long as RANDNUM falls within an integral
multiple of GENMAX+1; otherwise, LAST_USABLE_CHOICE < RANDNUM,
so discard this attempt and try again.
Since GENMAX cannot be RANDINT_MAX, CHOICES cannot be
zero and there is no need to worry about dividing by
zero. */
Since GENMAX cannot be RANDINT_MAX, CHOICES cannot be
zero and there is no need to worry about dividing by
zero. */
randint excess_choices = randmax - genmax;
randint unusable_choices = excess_choices % choices;
randint last_usable_choice = randmax - unusable_choices;
randint reduced_randnum = randnum % choices;
randint excess_choices = randmax - genmax;
randint unusable_choices = excess_choices % choices;
randint last_usable_choice = randmax - unusable_choices;
randint reduced_randnum = randnum % choices;
if (randnum <= last_usable_choice)
{
s->randnum = randnum / choices;
s->randmax = excess_choices / choices;
return reduced_randnum;
}
if (randnum <= last_usable_choice)
{
s->randnum = randnum / choices;
s->randmax = excess_choices / choices;
return reduced_randnum;
}
/* Retry, but retain the randomness from the fact that RANDNUM fell
into the range LAST_USABLE_CHOICE+1 .. RANDMAX. */
randnum = reduced_randnum;
randmax = unusable_choices - 1;
}
/* Retry, but retain the randomness from the fact that RANDNUM fell
into the range LAST_USABLE_CHOICE+1 .. RANDMAX. */
randnum = reduced_randnum;
randmax = unusable_choices - 1;
}
}
}

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Generate random permutations.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -79,21 +79,21 @@ randperm_new (struct randint_source *r, size_t h, size_t n)
default:
{
size_t i;
size_t i;
v = xnmalloc (n, sizeof *v);
for (i = 0; i < n; i++)
v[i] = i;
v = xnmalloc (n, sizeof *v);
for (i = 0; i < n; i++)
v[i] = i;
for (i = 0; i < h; i++)
{
size_t j = i + randint_choose (r, n - i);
size_t t = v[i];
v[i] = v[j];
v[j] = t;
}
for (i = 0; i < h; i++)
{
size_t j = i + randint_choose (r, n - i);
size_t t = v[i];
v[i] = v[j];
v[j] = t;
}
v = xnrealloc (v, h, sizeof *v);
v = xnrealloc (v, h, sizeof *v);
}
break;
}

View File

@@ -39,6 +39,16 @@
#include "unlocked-io.h"
#include "xalloc.h"
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __attribute__(x) /* empty */
# endif
#endif
#ifndef ATTRIBUTE_NORETURN
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif
#ifndef MIN
# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
@@ -50,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. */
@@ -62,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
@@ -96,8 +100,8 @@ struct randread_source
/* Up to a buffer's worth of pseudorandom data. */
union
{
uint32_t w[ISAAC_WORDS];
unsigned char b[ISAAC_BYTES];
uint32_t w[ISAAC_WORDS];
unsigned char b[ISAAC_BYTES];
} data;
} isaac;
} buf;
@@ -106,13 +110,13 @@ struct randread_source
/* The default error handler. */
static void
static void ATTRIBUTE_NORETURN
randread_error (void const *file_name)
{
if (file_name)
error (exit_failure, errno,
_(errno == 0 ? "%s: end of file" : "%s: read error"),
quotearg_colon (file_name));
_(errno == 0 ? "%s: end of file" : "%s: read error"),
quotearg_colon (file_name));
abort ();
}
@@ -147,26 +151,22 @@ 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));
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
else
{
s->buf.isaac.buffered = 0;
isaac_seed (&s->buf.isaac.state);
}
{
s->buf.isaac.buffered = 0;
isaac_seed (&s->buf.isaac.state);
}
return s;
}
@@ -206,7 +206,7 @@ readsource (struct randread_source *s, unsigned char *p, size_t size)
p += inbytes;
size -= inbytes;
if (size == 0)
break;
break;
errno = (ferror (s->source) ? fread_errno : 0);
s->handler (s->handler_arg);
}
@@ -224,34 +224,34 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
for (;;)
{
if (size <= inbytes)
{
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, size);
isaac->buffered = inbytes - size;
return;
}
{
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, size);
isaac->buffered = inbytes - size;
return;
}
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, inbytes);
p += inbytes;
size -= inbytes;
/* If P is aligned, write to *P directly to avoid the overhead
of copying from the buffer. */
of copying from the buffer. */
if (ALIGNED_POINTER (p, uint32_t))
{
uint32_t *wp = (uint32_t *) p;
while (ISAAC_BYTES <= size)
{
isaac_refill (&isaac->state, wp);
wp += ISAAC_WORDS;
size -= ISAAC_BYTES;
if (size == 0)
{
isaac->buffered = 0;
return;
}
}
p = (unsigned char *) wp;
}
{
uint32_t *wp = (uint32_t *) p;
while (ISAAC_BYTES <= size)
{
isaac_refill (&isaac->state, wp);
wp += ISAAC_WORDS;
size -= ISAAC_BYTES;
if (size == 0)
{
isaac->buffered = 0;
return;
}
}
p = (unsigned char *) wp;
}
isaac_refill (&isaac->state, isaac->data.w);
inbytes = ISAAC_BYTES;

View File

@@ -1,6 +1,6 @@
/* Generate buffers of random data.
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,5 +1,5 @@
/* root-dev-ino.c -- get the device and inode numbers for `/'.
Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Root device and inode number checking.
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,12 +34,12 @@ get_root_dev_ino (struct dev_ino *root_d_i);
do \
{ \
if (STREQ (Dirname, "/")) \
error (0, 0, _("it is dangerous to operate recursively on %s"), \
quote (Dirname)); \
error (0, 0, _("it is dangerous to operate recursively on %s"), \
quote (Dirname)); \
else \
error (0, 0, \
_("it is dangerous to operate recursively on %s (same as %s)"), \
quote_n (0, Dirname), quote_n (1, "/")); \
error (0, 0, \
_("it is dangerous to operate recursively on %s (same as %s)"), \
quote_n (0, Dirname), quote_n (1, "/")); \
error (0, 0, _("use --no-preserve-root to override this failsafe")); \
} \
while (0)

View File

@@ -1,88 +0,0 @@
/* openat-style fd-relative functions for SE Linux
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* written by Jim Meyering */
#include <config.h>
#include "selinux-at.h"
#include "openat.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
#include "save-cwd.h"
#include "openat-priv.h"
#define AT_FUNC_NAME getfileconat
#define AT_FUNC_F1 getfilecon
#define AT_FUNC_F2 getfilecon
#define AT_FUNC_USE_F1_COND 1
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t *con
#define AT_FUNC_POST_FILE_ARGS , con
#include "at-func.c"
#undef AT_FUNC_NAME
#undef AT_FUNC_F1
#undef AT_FUNC_F2
#undef AT_FUNC_USE_F1_COND
#undef AT_FUNC_POST_FILE_PARAM_DECLS
#undef AT_FUNC_POST_FILE_ARGS
#define AT_FUNC_NAME lgetfileconat
#define AT_FUNC_F1 lgetfilecon
#define AT_FUNC_F2 lgetfilecon
#define AT_FUNC_USE_F1_COND 1
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t *con
#define AT_FUNC_POST_FILE_ARGS , con
#include "at-func.c"
#undef AT_FUNC_NAME
#undef AT_FUNC_F1
#undef AT_FUNC_F2
#undef AT_FUNC_USE_F1_COND
#undef AT_FUNC_POST_FILE_PARAM_DECLS
#undef AT_FUNC_POST_FILE_ARGS
#define AT_FUNC_NAME setfileconat
#define AT_FUNC_F1 setfilecon
#define AT_FUNC_F2 setfilecon
#define AT_FUNC_USE_F1_COND 1
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t con
#define AT_FUNC_POST_FILE_ARGS , con
#include "at-func.c"
#undef AT_FUNC_NAME
#undef AT_FUNC_F1
#undef AT_FUNC_F2
#undef AT_FUNC_USE_F1_COND
#undef AT_FUNC_POST_FILE_PARAM_DECLS
#undef AT_FUNC_POST_FILE_ARGS
#define AT_FUNC_NAME lsetfileconat
#define AT_FUNC_F1 lsetfilecon
#define AT_FUNC_F2 lsetfilecon
#define AT_FUNC_USE_F1_COND 1
#define AT_FUNC_POST_FILE_PARAM_DECLS , security_context_t con
#define AT_FUNC_POST_FILE_ARGS , con
#include "at-func.c"
#undef AT_FUNC_NAME
#undef AT_FUNC_F1
#undef AT_FUNC_F2
#undef AT_FUNC_USE_F1_COND
#undef AT_FUNC_POST_FILE_PARAM_DECLS
#undef AT_FUNC_POST_FILE_ARGS

View File

@@ -1,7 +1,7 @@
/* tempname.c - generate the name of a temporary file.
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation,
2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -41,8 +41,7 @@
# define TMP_MAX 238328
#endif
#ifndef __GT_FILE
# define __GT_FILE 0
# define __GT_BIGFILE 1
# define __GT_FILE 1
# define __GT_DIR 2
# define __GT_NOCREATE 3
#endif
@@ -61,12 +60,9 @@
#if _LIBC
# define struct_stat64 struct stat64
# define small_open __open
# define large_open __open64
#else
# define struct_stat64 struct stat
# define small_open open
# define large_open open
# define __open open
# define __gen_tempname gen_tempname
# define __getpid getpid
# define __gettimeofday gettimeofday
@@ -96,7 +92,7 @@ direxists (const char *dir)
enough space in TMPL. */
int
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
int try_tmpdir)
int try_tmpdir)
{
const char *d;
size_t dlen, plen;
@@ -110,30 +106,30 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
{
plen = strlen (pfx);
if (plen > 5)
plen = 5;
plen = 5;
}
if (try_tmpdir)
{
d = __secure_getenv ("TMPDIR");
if (d != NULL && direxists (d))
dir = d;
dir = d;
else if (dir != NULL && direxists (dir))
/* nothing */ ;
/* nothing */ ;
else
dir = NULL;
dir = NULL;
}
if (dir == NULL)
{
if (direxists (P_tmpdir))
dir = P_tmpdir;
dir = P_tmpdir;
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
dir = "/tmp";
dir = "/tmp";
else
{
__set_errno (ENOENT);
return -1;
}
{
__set_errno (ENOENT);
return -1;
}
}
dlen = strlen (dir);
@@ -169,15 +165,14 @@ static const char letters[] =
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
at the time of the call.
at the time of the call.
__GT_FILE: create the file using open(O_CREAT|O_EXCL)
and return a read-write fd. The file is mode 0600.
__GT_BIGFILE: same as __GT_FILE but use open64().
and return a read-write fd. The file is mode 0600.
__GT_DIR: create a directory, which will be mode 0700.
We use a clever algorithm to get hard-to-predict names. */
int
gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len)
gen_tempname_len (char *tmpl, int flags, int kind, size_t x_suffix_len)
{
size_t len;
char *XXXXXX;
@@ -205,7 +200,7 @@ gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len)
len = strlen (tmpl);
if (len < x_suffix_len || ! check_x_suffix (&tmpl[len - x_suffix_len],
x_suffix_len))
x_suffix_len))
{
__set_errno (EINVAL);
return -1;
@@ -223,60 +218,58 @@ gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len)
size_t i;
for (i = 0; i < x_suffix_len; i++)
{
XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
}
{
XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
}
switch (kind)
{
case __GT_FILE:
fd = small_open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
{
case __GT_FILE:
fd = __open (tmpl,
(flags & ~0777) | O_RDWR | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR);
break;
case __GT_BIGFILE:
fd = large_open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
case __GT_DIR:
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
break;
case __GT_DIR:
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
break;
case __GT_NOCREATE:
/* This case is backward from the other three. This function
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
{
if (errno == ENOENT)
{
__set_errno (save_errno);
fd = 0;
goto done;
}
else
{
/* Give up now. */
fd = -1;
goto done;
}
}
continue;
case __GT_NOCREATE:
/* This case is backward from the other three. This function
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
{
if (errno == ENOENT)
{
__set_errno (save_errno);
fd = 0;
goto done;
}
else
{
/* Give up now. */
fd = -1;
goto done;
}
}
continue;
default:
assert (! "invalid KIND in __gen_tempname");
}
default:
assert (! "invalid KIND in __gen_tempname");
}
if (fd >= 0)
{
__set_errno (save_errno);
goto done;
}
{
__set_errno (save_errno);
goto done;
}
else if (errno != EEXIST)
{
fd = -1;
goto done;
}
{
fd = -1;
goto done;
}
}
randint_all_free (rand_src);
@@ -295,7 +288,7 @@ gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len)
}
int
__gen_tempname (char *tmpl, int kind)
__gen_tempname (char *tmpl, int flags, int kind)
{
return gen_tempname_len (tmpl, kind, 6);
return gen_tempname_len (tmpl, flags, kind, 6);
}

View File

@@ -1,6 +1,6 @@
/* Create a temporary file or directory.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,12 +30,13 @@
KIND may be one of:
GT_NOCREATE: simply verify that the name does not exist
at the time of the call.
at the time of the call.
GT_FILE: create a large file using open(O_CREAT|O_EXCL)
and return a read-write fd. The file is mode 0600.
and return a read-write fd. The file is mode 0600.
GT_DIR: create a directory, which will be mode 0700.
We use a clever algorithm to get hard-to-predict names. */
#include <stddef.h>
extern int gen_tempname (char *tmpl, int kind);
extern int gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len);
extern int gen_tempname (char *tmpl, int flags, int kind);
extern int gen_tempname_len (char *tmpl, int flags, int kind,
size_t x_suffix_len);

View File

@@ -1,5 +1,5 @@
/* a wrapper for frepoen
Copyright (C) 2008 Free Software Foundation, Inc.
Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,11 +31,11 @@ xfreopen (char const *filename, char const *mode, FILE *fp)
if (!freopen (filename, mode, fp))
{
char const *f = (filename ? filename
: (fp == stdin ? _("stdin")
: (fp == stdout ? _("stdout")
: (fp == stderr ? _("stderr")
: _("unknown stream")))));
: (fp == stdin ? _("stdin")
: (fp == stdout ? _("stdout")
: (fp == stderr ? _("stderr")
: _("unknown stream")))));
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
quote_n (0, f), quote_n (1, mode));
quote_n (0, f), quote_n (1, mode));
}
}

View File

@@ -1,5 +1,5 @@
#serial 3
dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -1,5 +1,5 @@
#serial 3
dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -1,24 +0,0 @@
Description:
iterate through argv or a --files0-from=-specified file
Files:
lib/argv-iter.c
lib/argv-iter.h
Depends-on:
getdelim
stdbool
configure.ac:
Makefile.am:
lib_SOURCES += argv-iter.c argv-iter.h
Include:
"argv-iter.h"
License
GPL
Maintainer:
Jim Meyering

View File

@@ -1,10 +0,0 @@
Files:
tests/test-argv-iter.c
Depends-on:
configure.ac:
Makefile.am:
TESTS += test-argv-iter
check_PROGRAMS += test-argv-iter

26
gl/modules/mbsalign Normal file
View 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

View File

@@ -1,33 +0,0 @@
Description:
openat-style fd-relative functions for SE Linux
Files:
lib/selinux-at.c
lib/selinux-at.h
Depends-on:
selinux-h
configure.ac:
# FIXME: put this in an .m4 file?
# For runcon.
AC_CHECK_HEADERS([selinux/flask.h])
AC_LIBOBJ([selinux-at])
gl_save_LIBS=$LIBS
LIB_SELINUX=
AC_SEARCH_LIBS([setfilecon], [selinux],
[test "$ac_cv_search_setfilecon" = "none required" ||
LIB_SELINUX=$ac_cv_search_setfilecon])
AC_SUBST(LIB_SELINUX)
LIBS=$gl_save_LIBS
Makefile.am:
Include:
selinux-at.h
License:
LGPL
Maintainer:
Jim Meyering

View File

@@ -1,120 +0,0 @@
/* Test argv iterator
Copyright (C) 2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
#define ASSERT(expr) \
do \
{ \
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
while (0)
#include "argv-iter.h"
static FILE *
write_nul_delimited_argv (char **argv)
{
FILE *fp = tmpfile ();
ASSERT (fp);
while (*argv)
{
size_t len = strlen (*argv) + 1;
ASSERT (fwrite (*argv, len, 1, fp) == 1);
argv++;
}
ASSERT (fflush (fp) == 0);
rewind (fp);
return fp;
}
int
main ()
{
/* set_program_name (argv[0]); placate overzealous "syntax-check" test. */
static char *av[][4] = {
{NULL},
{"1", NULL},
{"1", "2", NULL},
{"1", "2", "3", NULL}
};
int use_stream;
for (use_stream = 0; use_stream < 2; use_stream++)
{
size_t i;
for (i = 0; i < ARRAY_CARDINALITY (av); i++)
{
FILE *fp;
struct argv_iterator *ai;
size_t n_found = 0;
if (use_stream)
{
/* Generate an identical list to be read via FP. */
ASSERT ((fp = write_nul_delimited_argv (av[i])) != NULL);
ai = argv_iter_init_stream (fp);
}
else
{
fp = NULL;
ai = argv_iter_init_argv (av[i]);
}
ASSERT (ai);
while (1)
{
enum argv_iter_err ai_err;
char *s = argv_iter (ai, &ai_err);
ASSERT ((i == n_found) == (ai_err == AI_ERR_EOF));
ASSERT ((s == NULL) ^ (ai_err == AI_ERR_OK));
ASSERT (ai_err == AI_ERR_OK || ai_err == AI_ERR_EOF);
if (ai_err == AI_ERR_OK)
++n_found;
if (ai_err == AI_ERR_EOF)
break;
/* In stream mode, the strings are equal, but
in argv mode the actual pointers are equal. */
ASSERT (use_stream
? STREQ (s, av[i][n_found - 1])
: s == av[i][n_found - 1]);
}
ASSERT (argv_iter_n_args (ai) == i);
argv_iter_free (ai);
if (fp)
ASSERT (fclose (fp) == 0);
}
}
return 0;
}
/*
* Local variables:
* indent-tabs-mode: nil
* End:
*/

2
gnulib

Submodule gnulib updated: 5a1286a9f8...959d9cb463

View File

@@ -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

View File

@@ -8746,8 +8746,7 @@
-----
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
Software Foundation, Inc.
Copyright (C) 2000-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -1,40 +0,0 @@
Things to do to hash.c:
Always use curly braces around statements in if/else/while/do/etc.
that span more than a line -- even around multiline simple statements
or single-line simple statements preceded by a comment line.
Never have lines longer than 80 chars.
Remove ^L characters. We don't want/need such crutches.
Get a good (smart) pagination filter. I have one (a perl script)
that usually does a decent job for me -- I called it something
like stdc-print and think I sent you an early verison.
I don't like the name `cursor'. I much prefer short names
like `p' for index variables. I doubt I'll change all of them,
but thought you should know why some will probably end up changing.
#define USE_OBSTACK somewhere
Fix this comment. Depending on system and application...
Mention fragmentation.
+#if USE_OBSTACK
+ /* Whenever obstacks are used, it is possible to allocate all overflowed
+ entries into a single stack, so they all can be freed in a single
+ operation. It is not clear if the speedup is worth the trouble. */
+ struct obstack entry_stack;
+#endif
assert (bucket_limit - bucket == n_buckets) ?
remove.c: s/done/successful or ok
-----
Copyright (C) 1998 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice
and this notice are preserved.

View File

@@ -1,6 +1,6 @@
/* buffer-lcm.c - compute a good buffer size for dealing with two files
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2005, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,22 +34,22 @@ buffer_lcm (size_t a, size_t b, size_t lcm_max)
else
{
if (b)
{
/* Return lcm (A, B) if it is in range; otherwise, fall back
on A. */
{
/* Return lcm (A, B) if it is in range; otherwise, fall back
on A. */
size_t lcm, m, n, q, r;
size_t lcm, m, n, q, r;
/* N = gcd (A, B). */
for (m = a, n = b; (r = m % n) != 0; m = n, n = r)
continue;
/* N = gcd (A, B). */
for (m = a, n = b; (r = m % n) != 0; m = n, n = r)
continue;
/* LCM = lcm (A, B), if in range. */
q = a / n;
lcm = q * b;
if (lcm <= lcm_max && lcm / b == q)
return lcm;
}
/* LCM = lcm (A, B), if in range. */
q = a / n;
lcm = q * b;
if (lcm <= lcm_max && lcm / b == q)
return lcm;
}
size = a;
}

View File

@@ -2,7 +2,7 @@
This function is probably useful only for choosing whether to issue
a prompt in an implementation of POSIX-specified rm.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,13 +25,6 @@
#include <unistd.h>
#ifndef F_OK
# define F_OK 0
# define X_OK 1
# define W_OK 2
# define R_OK 4
#endif
#include "group-member.h"
#include "stat-macros.h"
@@ -57,8 +50,8 @@ euidaccess_stat (struct stat const *st, int mode)
mode &= 7;
else
mode = ((mode & R_OK ? 4 : 0)
+ (mode & W_OK ? 2 : 0)
+ (mode & X_OK ? 1 : 0));
+ (mode & W_OK ? 2 : 0)
+ (mode & X_OK ? 1 : 0));
if (mode == 0)
return true; /* The file exists. */
@@ -68,7 +61,7 @@ euidaccess_stat (struct stat const *st, int mode)
/* The super-user can read and write any file, and execute any file
that anyone can execute. */
if (euid == 0 && ((mode & X_OK) == 0
|| (st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
|| (st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
return true;
/* Convert the file's permission bits to traditional form. */
@@ -84,14 +77,14 @@ euidaccess_stat (struct stat const *st, int mode)
granted = st->st_mode;
else
granted = ( (st->st_mode & S_IRUSR ? 4 << 6 : 0)
+ (st->st_mode & S_IWUSR ? 2 << 6 : 0)
+ (st->st_mode & S_IXUSR ? 1 << 6 : 0)
+ (st->st_mode & S_IRGRP ? 4 << 3 : 0)
+ (st->st_mode & S_IWGRP ? 2 << 3 : 0)
+ (st->st_mode & S_IXGRP ? 1 << 3 : 0)
+ (st->st_mode & S_IROTH ? 4 << 0 : 0)
+ (st->st_mode & S_IWOTH ? 2 << 0 : 0)
+ (st->st_mode & S_IXOTH ? 1 << 0 : 0));
+ (st->st_mode & S_IWUSR ? 2 << 6 : 0)
+ (st->st_mode & S_IXUSR ? 1 << 6 : 0)
+ (st->st_mode & S_IRGRP ? 4 << 3 : 0)
+ (st->st_mode & S_IWGRP ? 2 << 3 : 0)
+ (st->st_mode & S_IXGRP ? 1 << 3 : 0)
+ (st->st_mode & S_IROTH ? 4 << 0 : 0)
+ (st->st_mode & S_IWOTH ? 2 << 0 : 0)
+ (st->st_mode & S_IXOTH ? 1 << 0 : 0));
if (euid == st->st_uid)
granted >>= 6;
@@ -99,7 +92,7 @@ euidaccess_stat (struct stat const *st, int mode)
{
gid_t egid = getegid ();
if (egid == st->st_gid || group_member (st->st_gid))
granted >>= 3;
granted >>= 3;
}
if ((mode & ~granted) == 0)

View File

@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 2005, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,136 +0,0 @@
/* fdopendir implementation derived from glibc.
Copyright (C) 2006 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#if _LIBC
# include <dirstream.h>
# include <not-cancel.h>
#else
# if __GNUC__ < 3
# define __builtin_expect(expr, expected_val) expr
# endif
# include "openat.h"
# define stat64 stat
# define dirent64 dirent
# define __fxstat64(V, fd, sb) fstat(fd, sb)
# define __fcntl fcntl
# define __set_errno(Val) do { errno = (Val); } while (0)
# define __libc_lock_init(NAME) ((NAME) = 0, 0)
# define close_not_cancel_no_status(fd) close (fd)
# ifdef __i386__
# define internal_function __attribute ((regparm (3), stdcall))
# else
# define internal_function
# endif
struct __dirstream
{
int fd; /* File descriptor. */
char *data; /* Directory block. */
size_t allocation; /* Space allocated for the block. */
size_t size; /* Total valid data in the block. */
size_t offset; /* Current offset into the block. */
off_t filepos; /* Position of next entry to read. */
int lock;
};
#endif
#undef _STATBUF_ST_BLKSIZE
static DIR *
internal_function
__alloc_dir (int fd, bool close_fd)
{
if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
goto lose;
size_t allocation;
#ifdef _STATBUF_ST_BLKSIZE
if (__builtin_expect ((size_t) statp->st_blksize >= sizeof (struct dirent64),
1))
allocation = statp->st_blksize;
else
#endif
allocation = (BUFSIZ < sizeof (struct dirent64)
? sizeof (struct dirent64) : BUFSIZ);
const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
if (dirp == NULL)
lose:
{
if (close_fd)
{
int save_errno = errno;
close_not_cancel_no_status (fd);
__set_errno (save_errno);
}
return NULL;
}
memset (dirp, '\0', sizeof (DIR));
dirp->data = (char *) (dirp + 1) + pad;
dirp->allocation = allocation;
dirp->fd = fd;
__libc_lock_init (dirp->lock);
return dirp;
}
DIR *
fdopendir (int fd)
{
#if 0
struct stat64 statbuf;
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
return NULL;
if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
{
__set_errno (ENOTDIR);
return NULL;
}
/* Make sure the descriptor allows for reading. */
int flags = __fcntl (fd, F_GETFL);
if (__builtin_expect (flags == -1, 0))
return NULL;
if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0))
{
__set_errno (EINVAL);
return NULL;
}
#endif
return __alloc_dir (fd, false);
}

View File

@@ -1,6 +1,6 @@
/* Locale-specific memory transformation
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@
size_t
memxfrm (char *restrict dest, size_t destsize,
char *restrict src, size_t srcsize)
char *restrict src, size_t srcsize)
{
#if HAVE_STRXFRM
@@ -59,33 +59,33 @@ memxfrm (char *restrict dest, size_t destsize,
errno = 0;
result += strxfrm (dest + di, src + si, destsize - di) + 1;
if (errno != 0)
break;
break;
if (result <= result0)
{
errno = ERANGE;
break;
}
{
errno = ERANGE;
break;
}
if (result == destsize + 1 && si + slen == srcsize)
{
/* The destination is exactly the right size, but strxfrm wants
room for a trailing null. Work around the problem with a
temporary buffer. */
size_t bufsize = destsize - di + 1;
char stackbuf[4000];
char *buf = stackbuf;
if (sizeof stackbuf < bufsize)
{
buf = malloc (bufsize);
if (! buf)
break;
}
strxfrm (buf, src + si, bufsize);
memcpy (dest + di, buf, destsize - di);
if (sizeof stackbuf < bufsize)
free (buf);
errno = 0;
}
{
/* The destination is exactly the right size, but strxfrm wants
room for a trailing null. Work around the problem with a
temporary buffer. */
size_t bufsize = destsize - di + 1;
char stackbuf[4000];
char *buf = stackbuf;
if (sizeof stackbuf < bufsize)
{
buf = malloc (bufsize);
if (! buf)
break;
}
strxfrm (buf, src + si, bufsize);
memcpy (dest + di, buf, destsize - di);
if (sizeof stackbuf < bufsize)
free (buf);
errno = 0;
}
di = (result < destsize ? result : destsize);
si += slen + 1;

View File

@@ -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;
}

View File

@@ -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

View File

@@ -1,6 +1,6 @@
/* Compare integer strings.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
/* Compare numeric strings. This is an internal include file.
Copyright (C) 1988, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
2003, 2004, 2005, 2006 Free Software Foundation, Inc.
2003, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -77,28 +77,28 @@ fraccompare (char const *a, char const *b, char decimal_point)
if (*a == decimal_point && *b == decimal_point)
{
while (*++a == *++b)
if (! ISDIGIT (*a))
return 0;
if (! ISDIGIT (*a))
return 0;
if (ISDIGIT (*a) && ISDIGIT (*b))
return *a - *b;
return *a - *b;
if (ISDIGIT (*a))
goto a_trailing_nonzero;
goto a_trailing_nonzero;
if (ISDIGIT (*b))
goto b_trailing_nonzero;
goto b_trailing_nonzero;
return 0;
}
else if (*a++ == decimal_point)
{
a_trailing_nonzero:
while (*a == NUMERIC_ZERO)
a++;
a++;
return ISDIGIT (*a);
}
else if (*b++ == decimal_point)
{
b_trailing_nonzero:
while (*b == NUMERIC_ZERO)
b++;
b++;
return - ISDIGIT (*b);
}
return 0;
@@ -113,7 +113,7 @@ fraccompare (char const *a, char const *b, char decimal_point)
static inline int
numcompare (char const *a, char const *b,
int decimal_point, int thousands_sep)
int decimal_point, int thousands_sep)
{
unsigned char tmpa = *a;
unsigned char tmpb = *b;
@@ -124,119 +124,119 @@ numcompare (char const *a, char const *b,
if (tmpa == NEGATION_SIGN)
{
do
tmpa = *++a;
tmpa = *++a;
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep);
if (tmpb != NEGATION_SIGN)
{
if (tmpa == decimal_point)
do
tmpa = *++a;
while (tmpa == NUMERIC_ZERO);
if (ISDIGIT (tmpa))
return -1;
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
tmpb = *++b;
if (tmpb == decimal_point)
do
tmpb = *++b;
while (tmpb == NUMERIC_ZERO);
return - ISDIGIT (tmpb);
}
{
if (tmpa == decimal_point)
do
tmpa = *++a;
while (tmpa == NUMERIC_ZERO);
if (ISDIGIT (tmpa))
return -1;
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
tmpb = *++b;
if (tmpb == decimal_point)
do
tmpb = *++b;
while (tmpb == NUMERIC_ZERO);
return - ISDIGIT (tmpb);
}
do
tmpb = *++b;
tmpb = *++b;
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep);
while (tmpa == tmpb && ISDIGIT (tmpa))
{
do
tmpa = *++a;
while (tmpa == thousands_sep);
do
tmpb = *++b;
while (tmpb == thousands_sep);
}
{
do
tmpa = *++a;
while (tmpa == thousands_sep);
do
tmpb = *++b;
while (tmpb == thousands_sep);
}
if ((tmpa == decimal_point && !ISDIGIT (tmpb))
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
return fraccompare (b, a, decimal_point);
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
return fraccompare (b, a, decimal_point);
tmp = tmpb - tmpa;
for (log_a = 0; ISDIGIT (tmpa); ++log_a)
do
tmpa = *++a;
while (tmpa == thousands_sep);
do
tmpa = *++a;
while (tmpa == thousands_sep);
for (log_b = 0; ISDIGIT (tmpb); ++log_b)
do
tmpb = *++b;
while (tmpb == thousands_sep);
do
tmpb = *++b;
while (tmpb == thousands_sep);
if (log_a != log_b)
return log_a < log_b ? 1 : -1;
return log_a < log_b ? 1 : -1;
if (!log_a)
return 0;
return 0;
return tmp;
}
else if (tmpb == NEGATION_SIGN)
{
do
tmpb = *++b;
tmpb = *++b;
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep);
if (tmpb == decimal_point)
do
tmpb = *++b;
while (tmpb == NUMERIC_ZERO);
do
tmpb = *++b;
while (tmpb == NUMERIC_ZERO);
if (ISDIGIT (tmpb))
return 1;
return 1;
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep)
tmpa = *++a;
tmpa = *++a;
if (tmpa == decimal_point)
do
tmpa = *++a;
while (tmpa == NUMERIC_ZERO);
do
tmpa = *++a;
while (tmpa == NUMERIC_ZERO);
return ISDIGIT (tmpa);
}
else
{
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep)
tmpa = *++a;
tmpa = *++a;
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
tmpb = *++b;
tmpb = *++b;
while (tmpa == tmpb && ISDIGIT (tmpa))
{
do
tmpa = *++a;
while (tmpa == thousands_sep);
do
tmpb = *++b;
while (tmpb == thousands_sep);
}
{
do
tmpa = *++a;
while (tmpa == thousands_sep);
do
tmpb = *++b;
while (tmpb == thousands_sep);
}
if ((tmpa == decimal_point && !ISDIGIT (tmpb))
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
return fraccompare (a, b, decimal_point);
|| (tmpb == decimal_point && !ISDIGIT (tmpa)))
return fraccompare (a, b, decimal_point);
tmp = tmpa - tmpb;
for (log_a = 0; ISDIGIT (tmpa); ++log_a)
do
tmpa = *++a;
while (tmpa == thousands_sep);
do
tmpa = *++a;
while (tmpa == thousands_sep);
for (log_b = 0; ISDIGIT (tmpb); ++log_b)
do
tmpb = *++b;
while (tmpb == thousands_sep);
do
tmpb = *++b;
while (tmpb == thousands_sep);
if (log_a != log_b)
return log_a < log_b ? -1 : 1;
return log_a < log_b ? -1 : 1;
if (!log_a)
return 0;
return 0;
return tmp;
}

View File

@@ -1,6 +1,6 @@
/* Compare numeric strings.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
int
strnumcmp (char const *a, char const *b,
int decimal_point, int thousands_sep)
int decimal_point, int thousands_sep)
{
return numcompare (a, b, decimal_point, thousands_sep);
}

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Exercise chdir-long's sample main program.
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
# Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,10 +38,10 @@ function mkdir_len
( cd $root &&
perl -e 'my $len='$n'-length "'$root'";$i=100;$d="z"x$i;
while ($i+2 < $len) {
$len -= $i + 1;
mkdir $d,0700 or die "$!\n";
chdir $d} $d="z"x($len-1);
mkdir $d or die "mkdir_len: $d: $!\n"' )
$len -= $i + 1;
mkdir $d,0700 or die "$!\n";
chdir $d} $d="z"x($len-1);
mkdir $d or die "mkdir_len: $d: $!\n"' )
}
size_list=

View File

@@ -1,6 +1,6 @@
/* xfts.c -- a wrapper for fts_open
Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,28 +35,28 @@
FTS *
xfts_open (char * const *argv, int options,
int (*compar) (const FTSENT **, const FTSENT **))
int (*compar) (const FTSENT **, const FTSENT **))
{
FTS *fts = fts_open (argv, options | FTS_CWDFD, compar);
if (fts == NULL)
{
/* This can fail in three ways: out of memory, invalid bit_flags,
and one or more of the FILES is an empty string. We could try
to decipher that errno==EINVAL means invalid bit_flags and
errno==ENOENT means there's an empty string, but that seems wrong.
Ideally, fts_open would return a proper error indicator. For now,
we'll presume that the bit_flags are valid and just check for
empty strings. */
and one or more of the FILES is an empty string. We could try
to decipher that errno==EINVAL means invalid bit_flags and
errno==ENOENT means there's an empty string, but that seems wrong.
Ideally, fts_open would return a proper error indicator. For now,
we'll presume that the bit_flags are valid and just check for
empty strings. */
bool invalid_arg = false;
for (; *argv; ++argv)
{
if (**argv == '\0')
invalid_arg = true;
}
{
if (**argv == '\0')
invalid_arg = true;
}
if (invalid_arg)
error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote (""));
error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote (""));
else
xalloc_die ();
xalloc_die ();
}
return fts;

View File

@@ -2,4 +2,4 @@
FTS *
xfts_open (char * const *, int options,
int (*) (const FTSENT **, const FTSENT **));
int (*) (const FTSENT **, const FTSENT **));

View File

@@ -1,6 +1,6 @@
/* Locale-specific memory transformation
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@
size_t
xmemxfrm (char *restrict dest, size_t destsize,
char *restrict src, size_t srcsize)
char *restrict src, size_t srcsize)
{
size_t translated_size = memxfrm (dest, destsize, src, srcsize);
@@ -54,8 +54,8 @@ xmemxfrm (char *restrict dest, size_t destsize,
error (0, errno, _("string transformation failed"));
error (0, 0, _("set LC_ALL='C' to work around the problem"));
error (exit_failure, 0,
_("the untransformed string was %s"),
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
_("the untransformed string was %s"),
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
}
return translated_size;

View File

@@ -5005,7 +5005,7 @@
-----
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006 Free Software Foundation, Inc.
2005, 2006, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -1,7 +1,7 @@
# boottime.m4 serial 4
# Determine whether this system has infrastructure for obtaining the boot time.
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008 Free Software Foundation, Inc.
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,8 +1,8 @@
#serial 24
#serial 25
# Check declarations for this package.
dnl Copyright (C) 1997-2001, 2003-2006, 2008
dnl Free Software Foundation, Inc.
dnl Copyright (C) 1997-2001, 2003-2006, 2008-2009 Free Software
dnl Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -37,13 +37,7 @@ AC_DEFUN([gl_CHECK_DECLS],
AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
AC_CHECK_DECLS_ONCE([free])
AC_CHECK_DECLS_ONCE([getenv])
AC_CHECK_DECLS_ONCE([geteuid])
AC_CHECK_DECLS_ONCE([getlogin])
AC_CHECK_DECLS_ONCE([getuid])
AC_CHECK_DECLS_ONCE([lseek])
AC_CHECK_DECLS_ONCE([malloc])
AC_CHECK_DECLS_ONCE([memchr])
AC_CHECK_DECLS_ONCE([realloc])
])

View File

@@ -1,5 +1,5 @@
# serial 1
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -1,6 +1,6 @@
# Invoke open, but return either a desired file descriptor or -1.
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,

View File

@@ -1,6 +1,6 @@
# Tests for GNU GMP (or any compatible replacement).
dnl Copyright (C) 2008 Free Software Foundation, Inc.
dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,

View File

@@ -1,5 +1,5 @@
#serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -36,8 +36,8 @@ AC_DEFUN([gl_INCLUDE_EXCLUDE_PROG],
gl_no_install_progs_default=`echo '$2'|sed 's/,/ /g'`
AC_ARG_ENABLE([install-program],
[AS_HELP_STRING([--enable-install-program=PROG_LIST],
[install the programs in PROG_LIST (comma-separated,
default: none)])],
[install the programs in PROG_LIST (comma-separated,
default: none)])],
[gl_do_install_prog=$enableval],
[gl_do_install_prog=]
)
@@ -46,8 +46,8 @@ AC_DEFUN([gl_INCLUDE_EXCLUDE_PROG],
# use --enable-no-install-program=A,B
AC_ARG_ENABLE([no-install-program],
[AS_HELP_STRING([--enable-no-install-program=PROG_LIST],
[do NOT install the programs in PROG_LIST
(comma-separated, default: $2)])],
[do NOT install the programs in PROG_LIST
(comma-separated, default: $2)])],
[gl_no_install_prog=$enableval],
[gl_no_install_prog=]
)
@@ -78,7 +78,7 @@ AC_DEFUN([gl_INCLUDE_EXCLUDE_PROG],
# Warn about a request not to install a program that is
# already on the default-no-install list.
case " $gl_no_install_progs_default " in
*" $gl_i "*) gl_msg="by default, '$gl_i' is not installed" ;;
*" $gl_i "*) gl_msg="by default, '$gl_i' is not installed" ;;
esac
fi

View File

@@ -37,9 +37,9 @@ AC_DEFUN([coreutils_MACROS],
# By default, argmatch should fail calling usage (1).
AC_DEFINE([ARGMATCH_DIE], [usage (1)],
[Define to the function xargmatch calls on failures.])
[Define to the function xargmatch calls on failures.])
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
[Define to the declaration of the xargmatch failure function.])
[Define to the declaration of the xargmatch failure function.])
# used by ls
AC_REQUIRE([gl_CLOCK_TIME])
@@ -47,11 +47,30 @@ AC_DEFUN([coreutils_MACROS],
AC_CHECK_FUNCS_ONCE([directio])
# Used by install.c.
AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
coreutils_saved_libs=$LIBS
LIBS="$LIBS $LIB_SELINUX"
AC_CHECK_FUNCS([matchpathcon_init_prefix], [],
[
case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
no:*) # SELinux disabled
;;
*:no) # SELinux disabled
;;
*)
AC_MSG_WARN([SELinux enabled, but matchpathcon_init_prefix not found])
AC_MSG_WARN([The install utility may run slowly])
esac
])
LIBS=$coreutils_saved_libs
# Used by sort.c.
AC_CHECK_FUNCS_ONCE([nl_langinfo])
# Used by tail.c.
AC_CHECK_FUNCS([inotify_init],
[AC_DEFINE([HAVE_INOTIFY], [1],
[Define to 1 if you have usable inotify support.])])
AC_CHECK_FUNCS_ONCE( \
endgrent \
endpwent \
@@ -76,24 +95,32 @@ AC_DEFUN([coreutils_MACROS],
# for dd.c and shred.c
coreutils_saved_libs=$LIBS
AC_SEARCH_LIBS([fdatasync], [rt posix4],
[test "$ac_cv_search_fdatasync" = "none required" ||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
[test "$ac_cv_search_fdatasync" = "none required" ||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
AC_SUBST([LIB_FDATASYNC])
AC_CHECK_FUNCS([fdatasync])
LIBS=$coreutils_saved_libs
# Check whether libcap is usable -- for ls --color support
LIB_CAP=
AC_ARG_ENABLE([libcap],
AC_HELP_STRING([--disable-libcap], [disable libcap support]),
AC_MSG_WARN([libcap support disabled by user]),
[AC_CHECK_LIB([cap], [cap_get_file],
AC_HELP_STRING([--disable-libcap], [disable libcap support]))
if test "X$enable_libcap" != "Xno"; then
AC_CHECK_LIB([cap], [cap_get_file],
[AC_CHECK_HEADER([sys/capability.h],
[LIB_CAP=-lcap
AC_DEFINE([HAVE_CAP], [1], [libcap usability])],
[AC_MSG_WARN([header sys/capability.h was not found, support for libcap will not be built])]
)],
[AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])])
])
[LIB_CAP=-lcap
AC_DEFINE([HAVE_CAP], [1], [libcap usability])]
)])
if test "X$LIB_CAP" = "X"; then
if test "X$enable_libcap" = "Xyes"; then
AC_MSG_ERROR([libcap library was not found or not usable])
else
AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])
fi
fi
else
AC_MSG_WARN([libcap support disabled by user])
fi
AC_SUBST([LIB_CAP])
# See if linking `seq' requires -lm.

View File

@@ -2,7 +2,7 @@
dnl Misc lib-related macros for coreutils.
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008-2009
# Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -53,8 +53,8 @@ $ac_includes_default
# NetBSD needs -lcrypt for crypt.
cu_saved_libs="$LIBS"
AC_SEARCH_LIBS([crypt], [ufc crypt],
[test "$ac_cv_search_crypt" = "none required" ||
LIB_CRYPT="$ac_cv_search_crypt"])
[test "$ac_cv_search_crypt" = "none required" ||
LIB_CRYPT="$ac_cv_search_crypt"])
LIBS="$cu_saved_libs"
AC_SUBST([LIB_CRYPT])
])

View File

@@ -1,4 +1,4 @@
dnl Copyright (C) 2006 Free Software Foundation, Inc.
dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -1,7 +1,7 @@
# stat-prog.m4 serial 6
# Record the prerequisites of src/stat.c from the coreutils package.
# Copyright (C) 2002-2004, 2006, 2008 Free Software Foundation, Inc.
# Copyright (C) 2002-2004, 2006, 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -57,30 +57,30 @@ AC_INCLUDES_DEFAULT
{ AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [$statvfs_includes])
test $ac_cv_member_struct_statvfs_f_basetype = yes ||
{ AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [$statvfs_includes])
test $ac_cv_member_struct_statvfs_f_fstypename = yes ||
{ test $ac_cv_member_struct_statfs_f_fstypename != yes &&
{ AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
test $ac_cv_member_struct_statvfs_f_fstypename = yes ||
{ test $ac_cv_member_struct_statfs_f_fstypename != yes &&
{ AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
then
AC_CHECK_MEMBERS([struct statvfs.f_namemax],,, [$statvfs_includes])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[$statvfs_includes],
[static statvfs s;
return (s.s_fsid ^ 0) == 0;])],
[$statvfs_includes],
[static statvfs s;
return (s.s_fsid ^ 0) == 0;])],
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
[Define to 1 if the f_fsid member of struct statvfs is an integer.])])
[Define to 1 if the f_fsid member of struct statvfs is an integer.])])
else
AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type],,,
[$statfs_includes])
if test $ac_cv_header_OS_h != yes; then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[$statfs_includes],
[static statfs s;
return (s.s_fsid ^ 0) == 0;])],
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
[Define to 1 if the f_fsid member of struct statfs is an integer.])])
[AC_LANG_PROGRAM(
[$statfs_includes],
[static statfs s;
return (s.s_fsid ^ 0) == 0;])],
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
[Define to 1 if the f_fsid member of struct statfs is an integer.])])
fi
fi
])

View File

@@ -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.
])

View File

@@ -1,6 +1,6 @@
# Compare numeric strings.
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,

View File

@@ -11,9 +11,9 @@
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])
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])
@@ -24,11 +24,11 @@ AC_DEFUN([gl_FUNC_XATTR],
use_xattr=0
fi
AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
[Define if you want extended attribute support.])
[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])
[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])

View File

@@ -1,5 +1,5 @@
#serial 1
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

881
maint.mk
View File

@@ -1,881 +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-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/>.
# 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) $(srcdir)/cfg.mk)
.PHONY: $(syntax-check-rules)
local-checks-available = \
patch-check $(syntax-check-rules) \
makefile-check check-AUTHORS
.PHONY: $(local-checks-available)
# Arrange to print the name of each syntax-checking rule just before running it.
$(syntax-check-rules): %: %.m
$(patsubst %, %.m, $(syntax-check-rules)):
@echo $(patsubst sc_%.m, %, $@)
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
syntax-check: $(local-check)
# @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
# By default, _prohibit_regexp does not ignore case.
export ignore_case =
_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
# There are many rules below that prohibit constructs in this package.
# If the offending construct can be matched with a grep-E-style regexp,
# use this macro. The shell variables "re" and "msg" must be defined.
define _prohibit_regexp
dummy=; : so we do not need a semicolon before each use \
test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
endef
sc_avoid_if_before_free:
@$(srcdir)/build-aux/useless-if-before-free \
$(useless_free_options) \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found useless "if" before "free" above' 1>&2; \
exit 1; } || :
sc_cast_of_argument_to_free:
@re='\<free *\( *\(' msg='don'\''t cast free argument' \
$(_prohibit_regexp)
sc_cast_of_x_alloc_return_value:
@re='\*\) *x(m|c|re)alloc\>' \
msg='don'\''t cast x*alloc return value' \
$(_prohibit_regexp)
sc_cast_of_alloca_return_value:
@re='\*\) *alloca\>' msg='don'\''t cast alloca return value' \
$(_prohibit_regexp)
sc_space_tab:
@re='[ ] ' msg='found SPACE-TAB sequence; remove the SPACE' \
$(_prohibit_regexp)
# Don't use *scanf or the old ato* functions in `real' code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
@re='\<([fs]?scanf|ato([filq]|ll)) *\(' \
msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
$(_prohibit_regexp)
# Use STREQ rather than comparing strcmp == 0, or != 0.
sc_prohibit_strcmp:
@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *==' \
$$($(VC_LIST_EXCEPT)) \
| grep -vE ':# *define STREQ\(' && \
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
1>&2; exit 1; } || :
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
@grep -nE 'error \(EXIT_SUCCESS,' \
$$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
# `FATAL:' should be fully upper-cased in error messages
# `WARNING:' should be fully upper-cased, or fully lower-cased
sc_error_message_warn_fatal:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"Warning|"Fatal|"fatal' && \
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
exit 1; } || :
# Error messages should not start with a capital letter
sc_error_message_uppercase:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"[A-Z]' \
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
{ echo '$(ME): found capitalized error message' 1>&2; \
exit 1; } || :
# Error messages should not end with a period
sc_error_message_period:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '[^."]\."' && \
{ echo '$(ME): found error message ending in period' 1>&2; \
exit 1; } || :
sc_file_system:
@re=file''system ignore_case=1 \
msg='found use of "file''system"; spell it "file system"' \
$(_prohibit_regexp)
# Don't use cpp tests of this symbol. All code assumes config.h is included.
sc_prohibit_have_config_h:
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
1>&2; exit 1; } || :
# 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
# You must include <config.h> before including any other header file.
sc_require_config_h_first:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
fail=0; \
for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \
grep '^# *include\>' $$i | sed 1q \
| grep '^# *include <config\.h>' > /dev/null \
|| { echo $$i; fail=1; }; \
done; \
test $$fail = 1 && \
{ echo '$(ME): the above files include some other header' \
'before <config.h>' 1>&2; exit 1; } || :; \
else :; \
fi
sc_prohibit_HAVE_MBRTOWC:
@re='\bHAVE_MBRTOWC\b' msg="do not use $$re; it is always defined" \
$(_prohibit_regexp)
# To use this "command" macro, you must first define two shell variables:
# h: the header, enclosed in <> or ""
# re: a regular expression that matches IFF something provided by $h is used.
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)
# Prohibit the inclusion of c-ctype.h without an actual use.
ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
sc_prohibit_c_ctype_without_use:
@h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' $(_header_without_use)
_empty =
_sp = $(_empty) $(_empty)
# The following list was generated by running:
# man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \
# | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt
_sig_functions = \
bsd_signal kill killpg pthread_kill pthread_sigmask raise sigaction \
sigaddset sigaltstack sigdelset sigemptyset sigfillset sighold sigignore \
siginterrupt sigismember signal sigpause sigpending sigprocmask sigqueue \
sigrelse sigset sigsuspend sigtimedwait sigwait sigwaitinfo
_sig_function_re = $(subst $(_sp),|,$(strip $(_sig_functions)))
# The following were extracted from "man signal.h" manually.
_sig_types_and_consts = \
MINSIGSTKSZ SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK \
SA_RESETHAND SA_RESTART SA_SIGINFO SIGEV_NONE SIGEV_SIGNAL \
SIGEV_THREAD SIGSTKSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SS_DISABLE \
SS_ONSTACK mcontext_t pid_t sig_atomic_t sigevent siginfo_t sigset_t \
sigstack sigval stack_t ucontext_t
# generated via this:
# perl -lne '/^#ifdef (SIG\w+)/ and print $1' lib/sig2str.c|sort -u|fmt -70
_sig_names = \
SIGABRT SIGALRM SIGALRM1 SIGBUS SIGCANCEL SIGCHLD SIGCLD SIGCONT \
SIGDANGER SIGDIL SIGEMT SIGFPE SIGFREEZE SIGGRANT SIGHUP SIGILL \
SIGINFO SIGINT SIGIO SIGIOT SIGKAP SIGKILL SIGKILLTHR SIGLOST SIGLWP \
SIGMIGRATE SIGMSG SIGPHONE SIGPIPE SIGPOLL SIGPRE SIGPROF SIGPWR \
SIGQUIT SIGRETRACT SIGSAK SIGSEGV SIGSOUND SIGSTKFLT SIGSTOP SIGSYS \
SIGTERM SIGTHAW SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1 \
SIGUSR2 SIGVIRT SIGVTALRM SIGWAITING SIGWINCH SIGWIND SIGWINDOW \
SIGXCPU SIGXFSZ
_sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) $(_sig_types_and_consts)))
# Prohibit the inclusion of signal.h without an actual use.
sc_prohibit_signal_without_use:
@h='<signal.h>' \
re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \
$(_header_without_use)
sc_obsolete_symbols:
@re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
$(_prohibit_regexp)
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# 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 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_the_the:
@re='\<the ''the\>' \
ignore_case=1 msg='found use of "the ''the";' \
$(_prohibit_regexp)
sc_trailing_blank:
@re='[ ]$$' \
msg='found trailing blank(s)' \
$(_prohibit_regexp)
# Match lines like the following, but where there is only one space
# between the options and the description:
# -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:
@re='either ''version [^3]' msg='GPL vN, N!=3' \
$(_prohibit_regexp)
cvs_keywords = \
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
sc_prohibit_cvs_keyword:
@re='\$$($(cvs_keywords))\$$' \
msg='do not use CVS keyword expansion' \
$(_prohibit_regexp)
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
# This is a bit of a kludge, since it prevents use of the string
# even in comments, but for now it does the job with no false positives.
sc_prohibit_stat_st_blocks:
@re='[.>]st_blocks' msg='do not use st_blocks; use ST_NBLOCKS' \
$(_prohibit_regexp)
# Make sure we don't define any S_IS* macros in src/*.c files.
# They're already defined via gnulib's sys/stat.h replacement.
sc_prohibit_S_IS_definition:
@re='^ *# *define *S_IS' \
msg='do not define S_IS* macros; include <sys/stat.h>' \
$(_prohibit_regexp)
# Each program that uses proper_name_utf8 must link with
# one of the ICONV libraries.
sc_proper_name_utf8_requires_ICONV:
@progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
if test "x$$progs" != x; then \
fail=0; \
for p in $$progs; do \
dir=$$(dirname "$$p"); \
base=$$(basename "$$p" .c); \
grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
|| { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
done; \
test $$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:
@re='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
msg='redundant "const" in declarations' \
$(_prohibit_regexp)
sc_const_long_option:
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
| grep -Ev 'const struct option|struct option const' && { \
echo 1>&2 '$(ME): add "const" to the above declarations'; \
exit 1; } || :
NEWS_hash = \
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
$(srcdir)/NEWS \
| grep -v '^Copyright .*Free Software' \
| md5sum - \
| sed 's/ .*//')
# Ensure that we don't accidentally insert an entry into an old NEWS block.
sc_immutable_NEWS:
@if test -f $(srcdir)/NEWS; then \
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
fi
# 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
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
sc_makefile_TAB_only_indentation:
@grep -nE '^ [ ]{8}' \
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
&& { echo '$(ME): found TAB-8-space indentation' 1>&2; \
exit 1; } || :
sc_m4_quote_check:
@grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
$$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \
&& { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \
exit 1; } || :
fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
apply the above patch\n'
# Verify that all source files using _() are listed in po/POTFILES.in.
po_file = po/POTFILES.in
sc_po_check:
@if test -f $(po_file); then \
grep -E -v '^(#|$$)' $(po_file) \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
case $$file in \
*.?|*.??) ;; \
*) 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 -L $(po_file) -L $(po_file) $@-1 $@-2 \
|| { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \
rm -f $@-1 $@-2; \
fi
# 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)'.
msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
sc_makefile_path_separator_check:
@grep -nE 'PATH[=].*:' \
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
&& { echo $(msg) 1>&2; exit 1; } || :
# Check that `make alpha' will not fail at the end of the process.
writable-files:
if test -d $(release_archive_dir); then :; else \
for file in $(distdir).tar.gz \
$(release_archive_dir)/$(distdir).tar.gz; do \
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.
sc_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
XZ_OPT=-9ev $(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
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.
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 "========================"
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) \
--no-print-checksums \
$(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
.PHONY: web-manual
web-manual:
@test -z "$(manual_title)" \
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
@cd '$(srcdir)/doc'; \
$(SHELL) ../build-aux/gendocs.sh -o '$(abs_builddir)/doc/manual' \
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
"$(PACKAGE_NAME) - $(manual_title)"
@echo " *** Upload the doc/manual directory to web-cvs."

1
man/.gitignore vendored
View File

@@ -72,6 +72,7 @@ sleep.1
sort.1
split.1
stat.1
stdbuf.1
stty.1
su.1
sum.1

View File

@@ -105,6 +105,7 @@ sleep.1: $(common_dep) $(srcdir)/sleep.x ../src/sleep.c
sort.1: $(common_dep) $(srcdir)/sort.x ../src/sort.c
split.1: $(common_dep) $(srcdir)/split.x ../src/split.c
stat.1: $(common_dep) $(srcdir)/stat.x ../src/stat.c
stdbuf.1: $(common_dep) $(srcdir)/stdbuf.x ../src/stdbuf.c
stty.1: $(common_dep) $(srcdir)/stty.x ../src/stty.c
su.1: $(common_dep) $(srcdir)/su.x ../src/su.c
sum.1: $(common_dep) $(srcdir)/sum.x ../src/sum.c
@@ -148,14 +149,14 @@ mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
# That is necessary to avoid failures for programs that are also shell built-in
# functions like echo, false, printf, pwd.
.x.1:
@case '$(PERL)' in \
$(AM_V_GEN)case '$(PERL)' in \
*"/missing "*) \
echo 'WARNING: cannot update man page $@ since perl is missing' \
'or inadequate' 1>&2 \
'or inadequate' 1>&2 \
;; \
*) \
rm -f $@ \
&& { echo "Updating man page $@"; \
rm -f $@ $@-t \
&& { \
rm -rf $t; \
mkdir $t; \
(cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
@@ -164,8 +165,11 @@ mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
--include=$(srcdir)/$*.x \
--output=$t/$@ $t/$*; \
} \
&& sed 's|$*\.td/||g' $t/$@ > $@ \
&& rm -rf $t ;; \
&& sed 's|$*\.td/||g' $t/$@ > $@-t \
&& rm -rf $t \
&& chmod -w $@-t \
&& mv $@-t $@ \
;; \
esac
distcheck-hook: check-x-vs-1 check-programs-vs-x
@@ -181,8 +185,8 @@ ASSORT = LC_ALL=C sort
# add them here manually.
.PHONY: check-x-vs-1
check-x-vs-1:
PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \
t=ls-files.$$$$; \
$(AM_V_GEN)PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \
t=$@-t; \
(cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
(echo $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT) \
| tr -s ' ' '\n' | sed 's/\.1$$//') \
@@ -195,7 +199,7 @@ all_programs = \
.PHONY: check-programs-vs-x
check-programs-vs-x:
status=0; \
$(AM_V_GEN)status=0; \
for p in dummy `$(all_programs)`; do \
test $$p = dummy && continue; \
test $$p = ginstall && p=install || : ; \

View File

@@ -1,4 +1,4 @@
'\" Copyright (C) 1998, 1999, 2001, 2006, 2007 Free Software Foundation, Inc.
'\" Copyright (C) 1998, 1999, 2001, 2006, 2007, 2009 Free Software Foundation, Inc.
'\"
'\" This is free software. You may redistribute copies of it under the terms
'\" of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.

View File

@@ -1,4 +1,4 @@
'\" Copyright (C) 1998, 1999, 2001, 2006 Free Software Foundation, Inc.
'\" Copyright (C) 1998, 1999, 2001, 2006, 2009 Free Software Foundation, Inc.
'\"
'\" This is free software. You may redistribute copies of it under the terms
'\" of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.

View File

@@ -2,3 +2,5 @@
comm \- compare two sorted files line by line
[DESCRIPTION]
.\" Add any additional description here
[SEE ALSO]
join(1), uniq(1)

Some files were not shown because too many files have changed in this diff Show More