Compare commits

..

922 Commits
v7.6 ... v8.12

Author SHA1 Message Date
Jim Meyering
8c6a1d1281 version 8.12
* NEWS: Record release date.
2011-04-26 16:00:50 +02:00
Jim Meyering
74e5ad9cf7 maint: tweak sc_tight_scope rule
* src/Makefile.am (sc_tight_scope): Remove useless quotes,
change 1>&2 to >&2, and combine a few short lines.
2011-04-26 09:27:49 +02:00
Jim Meyering
740516cd12 dd: work around compilation failure on AIX 5.1 and 5.2
* src/dd.c (O_NOCACHE): Undefine.  This symbol is defined
via AIX's <fcntl.h>, yet used as an enum name in dd.c.
Reported by Gary V. Vaughan in http://debbugs.gnu.org/8555
* NEWS (Portability): Mention this.
2011-04-26 09:27:44 +02:00
Jim Meyering
d891fe81f7 maint: move two small functions, so we can remove a fwd decl
* src/dd.c (cleanup, quit): Move the definition of quit to follow the
definition of process_signals, so we can remove the declaration of
the latter.
2011-04-26 09:02:44 +02:00
Jim Meyering
512825f9ba maint: change some leading 8-space sequences to TABs in a Makefile.am
src/Makefile.am (fs-magic, fs-kernel-magic): Change some leading
8-space sequences to TABs.
2011-04-25 14:43:22 +02:00
Jim Meyering
bd6cea345c stat: recognize V9FS and ECRYPTFS file systems
* src/stat.c (human_fstype): Add magic numbers for V9FS and ECRYPTFS.
2011-04-25 14:40:45 +02:00
Jim Meyering
61de57cd23 tail --follow=name no longer implies --retry
* src/tail.c (tail_forever_inotify): Just as without inotify,
tail --follow=name now terminates when the last tailed-by-name file
is unlinked or moved aside.  This bug was introduced on 2009-06-15
via commit ae494d4b, "tail: use inotify if it is available".
Reported by Tim Underwood in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286
* NEWS (Bug fixes): Mention this.
* tests/tail-2/follow-name: Test for this.
* tests/Makefile.am (TESTS): Add it.
2011-04-25 10:59:15 +02:00
Jeff Liu
32eb31999f copy: include both src and dest names in clone failure diagnostic
* src/copy.c (copy_reg): Upon btrfs clone failure, print not just
the destination file name, but also the source file name.
That may be useful upon failure of a cross-device clone attempt.
2011-04-25 10:58:57 +02:00
Jim Meyering
0e6c96e68c tests: tail-2/pipe-f2: avoid false-positive failure
Otherwise, this would fail (albeit rarely) on a "make -j24 check" run.
* tests/tail-2/pipe-f2: Increase timeout from 1 second to 10,
to avoid false positive failure.
2011-04-25 10:58:09 +02:00
Jim Meyering
768b8a0662 maint: explicitly list full-read and full-write module names
* bootstrap.conf (gnulib_modules): Include full-read and full-write
explicitly.  Before, we'd get them via safe-read, but with newer
gnulib, that is no longer enough: link failure due to undefined
references to full_write.
2011-04-25 10:57:58 +02:00
Jim Meyering
249d9a3ca4 doc: tail/inotify does use --sleep-interval=S, with --pid=P
* doc/coreutils.texi (tail invocation): Mention it.
* src/tail.c (usage): Likewise.
(tail_forever_inotify): Clarify comment.
2011-04-25 10:55:27 +02:00
Alan Curry
302cfcaeab tests: sparse-fiemap: adjust syntax to accommodate older awk
* tests/cp/sparse-fiemap: Parenthesize ternary expression used
as an argument to awk's printf.  Otherwise, gawk 3.0.1 and the
one from debian stable's original-awk would get a syntax error.
Reported by Dennis Clarke.

Copyright note: tiny change
2011-04-22 11:10:32 +02:00
Jim Meyering
8c0b1de42c tests: sparse-fiemap: with root/ext3, do not create an ext4 FS
* tests/cp/sparse-fiemap: When this test was run as root on an ext3
file system, (ext3 had known problems), it would trickily create and
mount a loopback ext4 file system and use that instead.  However, due
to a bug in 2.6.39-rc1..rc3, this loopback test (when run in another
loopback FS) exposed a bug with 1k-blocksize ext4 whereby non-NUL
data would be read from a hole.  For details, see this:
http://thread.gmane.org/gmane.comp.file-systems.ext4/24495
2011-04-21 21:01:13 +02:00
Jim Meyering
223e3832eb tests: sparse-fiemap: report more detail upon failure; ignore an FP
* tests/cp/sparse-fiemap: Fail right away with details, when cmp fails.
When extent maps are found to differ, display them and merely warn.
2011-04-21 18:39:02 +02:00
Jim Meyering
18a474d755 copy: use FIEMAP (extent_copy) only for apparently-sparse files,
to avoid the expense of extent_copy's unconditional use of
FIEMAP_FLAG_SYNC.
* src/copy.c (copy_reg): Do not attempt extent_copy on a file
that appears to have no holes.
* NEWS (Changes in behavior): Document this.  At first I labeled this
as a bug fix, but that would be inaccurate, considering there is no
documentation of FIEMAP semantics, nor even consensus among kernel
FS developers.  Here's hoping SEEK_HOLE/SEEK_DATA support will soon
make it into the linux kernel.
2011-04-20 18:48:48 +02:00
Jim Meyering
846d826096 copy: factor out a tiny sparse-testing function
* src/copy.c (HAVE_STRUCT_STAT_ST_BLOCKS): Define to 0 if undefined,
so we can use it in the return expression, here:
(is_probably_sparse): New function, factored out of...
(copy_reg): ...here.  Use the new function.
2011-04-20 18:48:48 +02:00
Jim Meyering
bef4fa1e1a copy: do not treat unwritten extents specially: avoid XFS/ext4 data loss
* src/copy.c (extent_copy): Do not treat "unwritten extents" specially.
Otherwise, with a release-candidate 2.6.39-rc3 kernel, XFS or ext4,
when using gold as your linker, and if you forget to run "make check",
you could end up installing files full of zeros instead of the expected
binaries.  For a lot of discussion, see
http://thread.gmane.org/gmane.comp.file-systems.xfs.general/37895
* tests/cp/fiemap-empty: Disable this test.
2011-04-20 18:48:38 +02:00
Jim Meyering
9bcd045f81 copy: always use FIEMAP_FLAG_SYNC, for now
* src/extent-scan.c (extent_need_sync): Always return true,
to make the sole caller always use FIEMAP_FLAG_SYNC.
This will doubtless have an undesirable performance impact,
but we'll mitigate that shortly, by using extent_copy only on
files with holes.
2011-04-20 17:11:15 +02:00
Jim Meyering
48306b83be tests: remove spurious syntax from a perl snippet
* tests/cp/sparse-fiemap: Remove spurious BEGIN {...} block.
2011-04-20 09:46:27 +02:00
Ondřej Vašík
9f688b8363 dircolors: add .ear, .war, .sar, for Java jar-like archives
* src/dircolors.hin: Add .ear, .war, .sar, for Java jar-like archives
Suggested by Ville Skyttä in https://bugzilla.redhat.com/616497.
2011-04-17 11:21:13 +02:00
Jim Meyering
5995ed0b38 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-04-13 21:32:49 +02:00
Jim Meyering
8dc5394183 version 8.11
* NEWS: Record release date.
2011-04-13 21:13:50 +02:00
Pádraig Brady
ace9ef2a94 maint: mention dd's new partial read warning in NEWS
* NEWS: Mention the new feature, from commits e1788d9e and 194c1e89
2011-04-13 15:38:36 +01:00
Pádraig Brady
403e8e3b89 tests: fix a false positive fiemap test on some file systems
* tests/filefrag-extent-compare: Don't check the length of the
last extent, as this was seen to vary on XFS, where it leaves
trailing blocks allocated for performance reasons.
* tests/cp/fiemap-empty: Though not seen as an issue in practise,
try to avoid possible issues with the allocator in file systems,
by requesting to allocate a power of 2.
2011-04-13 11:18:48 +01:00
Pádraig Brady
501ce81b6a maint: correct kernel version in test comment 2011-04-12 11:30:33 +01:00
Jim Meyering
53ee267945 maint: remove unnecessary inclusion of <stdio.h>
* src/extent-scan.c: Don't include <stdio.h>.  It was not used.
2011-04-12 12:14:26 +02:00
Jim Meyering
ce0f286cce build: update gnulib submodule to latest 2011-04-11 14:33:23 +02:00
Jim Meyering
1487204385 cfg.mk: remove useless semicolon and backslash
* cfg.mk (sc_NEWS_two_empty_lines): Remove semicolon and backslash.
2011-04-11 14:32:56 +02:00
Jim Meyering
4db3c6b5ea doc: tweak NEWS
* NEWS: Slightly obfuscate a line to avoid a false-positive
doubled-word ("is-is") match.
Fix a grammar error in news for 8.2.
* cfg.mk (old_NEWS_hash): Resync.
2011-04-11 14:32:56 +02:00
Jim Meyering
b80e2c7c25 maint: install: remove support for --preserve_context ("_", not "-")
* src/install.c: Its use has elicited a warning for two years.
Use --preserve-context instead.
* NEWS (changes in behavior): Mention this.
2011-04-11 14:32:56 +02:00
Jim Meyering
9288068ff8 maint: reorder install.c to eliminate declarations of static functions
* src/install.c: Remove static function declarations.
2011-04-11 14:32:56 +02:00
Jim Meyering
e6f4c34167 maint: rename variables for clarity...
and to avoid a false-positive "TO to" in new doubled word check.
* src/install.c (change_timestamps): Rename parameters for
readability.  Make the comment match the code.
2011-04-11 14:32:55 +02:00
Jim Meyering
b2dfc3b5e5 maint: remove doubled words in comments, e.g., s/to to/to/
* tests/ls/color-norm: s/to to/to/
* gl/lib/mbsalign.h (mbs_align_t): s/or or/or/
* src/extent-scan.c (extent_scan_read): s/the the/the/
* src/libstdbuf.c: s/the the/the/
* tests/misc/stdbuf: s/on on/on/
* ChangeLog-2005: s/for\n\tfor /for\n\t/
2011-04-11 14:32:55 +02:00
Pádraig Brady
80be785c95 maint: misc typo fixes
* src/fiemap.h: s/can not/cannot/
* NEWS: s/in/is/
* doc/coreutils.texi: Remove spurious "and".
s/effect/affect/
Use matched ``...'' quotes.
2011-04-11 11:13:14 +02:00
Pádraig Brady
324571ea4a maint: correct kernel version in NEWS
* NEWS: Adjust to match commit 1c3654cb, 2011-04-02,
"copy: require fiemap sync also for 2.6.38 kernels"
2011-04-07 00:23:00 +01:00
Pádraig Brady
18f5a8537c copy: handle mergeable extents across fiemap scans
* extent-scan.h (extent_scan_free): Init the pointer to NULL,
and reset the count to 0, so that we can realloc the buffer.
* src/extent-scan.c (extent_scan_init): Likewise.
(extent_scan_read): Loop over multiple fiemap scans, so we handle
mergeable extents that span across fiemap scan boundaries.  Once
we have enough unique extents, return so as to minimize memory use.
2011-04-06 23:15:19 +01:00
Pádraig Brady
8b2bedadb5 copy: fix an unlikely memory leak when a fiemap copy fails
* src/copy.c (extent_copy): Free the extents array when
sparse_copy() fails.
2011-04-06 23:08:54 +01:00
Jim Meyering
a71537366e tests: avoid spurious parallel failure due to temporary disk full
Running the new fiemap-empty test uses 600MB of disk space via
fallocate, and in so doing caused failure in unrelated tests that
were running in parallel on a small file system.  Rather than
simply running fallocate (which allocates the space, inducing
disk full when it fails), skip the test if there is less than
800MB of free space, as computed via stat and awk.
* tests/init.cfg (require_file_system_bytes_free_): New function.
* tests/cp/fiemap-empty: Use it.
2011-04-04 18:21:32 +02:00
Jim Meyering
4e23ca47ac tests: don't ever leave a backgrounded "sleep 10m" process
* tests/misc/help-version: Sleep only ~30s, not 10m.
The latter was a problem when somehow that sleep process would
hang around and thereby prevent (for up to 10m) a normal unmount
of the temporary partition in which I'd run the tests.
2011-04-04 18:21:32 +02:00
Jim Meyering
aec3e1e107 tests: preserve-gid: don't chown temporary PATH dir to a nameless UID
* tests/cp/preserve-gid: Simply chmod a+rx instead.
That is safer, in case the nameless UID actually has an account,
and might take advantage of root running a program in a directory
under its control
2011-04-04 18:21:32 +02:00
Jim Meyering
40f71538b6 tests: preserve-gid: remove useless use of "env"
* tests/cp/preserve-gid: Remove useless use of "env".
2011-04-04 18:21:32 +02:00
Jim Meyering
1bc76356d2 tests: convert common root-build test failure to a "skip"
* tests/mv/sticky-to-xpart: Skip rather than failing this test
when run as root and the binaries are not accessible by "nobody".
2011-04-04 18:21:31 +02:00
Jim Meyering
6227c8e8de tests: minor improvement of sc_tight_scope rule
* src/Makefile.am (sc_tight_scope): Adjust rule to use an eval-based
trap-setting for-loop rather than 4x hard-coded 128+N constants.
Also catch SIGQUIT (3).  Tweak comments.
2011-04-04 18:21:31 +02:00
Eric Blake
8d0b79afa5 docs: mention POSIX 2008
* doc/coreutils.texi (Standards conformance): Give value of
_POSIX2_VERSION matching the _POSIX_C_SOURCE of POSIX 2008.
2011-04-04 09:45:28 -06:00
Jim Meyering
03583f8d64 maint: prohibit direct use of strncmp: prefer STREQ_LEN, STRNCMP_LIT
* cfg.mk (sc_prohibit_strncmp): New rule, mostly from libvirt.
* src/system.h (STREQ_LEN, STRPREFIX, STRNCMP_LIT): Define.
* src/df.c (get_dev, get_point): Convert.
* src/extent-scan.c (extent_need_sync): Likewise.
* src/ls.c (is_colored, decode_switches): Likewise.
(parse_ls_color, (print_color_indicator): Likewise.
* src/md5sum.c (split_3): Likewise.
* src/split.c (main, emit_ancillary_info): Likewise.
* src/tr.c (look_up_char_class): Likewise.
* src/uname.c (main): Likewise.
* src/who.c (scan_entries): Likewise.
2011-04-03 21:55:27 +02:00
Jim Meyering
1c3654cb1f copy: require fiemap sync also for 2.6.38 kernels
* src/extent-scan.c (extent_need_sync): Require sync also for 2.6.38.
Without this, part of the cp/fiemap-empty test would fail both on
F15-to-be (2.6.38.1-6.fc15.x86_64) and rawhide.  For details, see
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22190
2011-04-03 12:16:27 +02:00
Jim Meyering
45b332f7ab cp: always detect copy-into-self: avoid infloop w/large PATH_MAX
When running the erroneous command, cp -rl A D D, and depending on the
structure of directories A and D and the file system type (because that
changes order of dir. entry traversal), cp would sometimes fail to
detect that D was being copied into D, and would create D/D/D/D/D/...
until it hit PATH_MAX or exhausted some resource.
I noticed this via the occasional failure of the cp/into-self test
when run using a ZFS file system.  It is occasional because the bug
is dependent on the order in which directory entries are traversed,
and that is apparently indeterminate with ZFS.
Technically, with the current recursive implementation, there is no
risk of an infinite loop, due to stack limitations, but with an
eventual fts-based implementation, it might have iterated until
disk space or inodes are exhausted.
* src/copy.c (copy_dir): Avoid copy-into-self interminable loop on
systems with large PATH_MAX.  On other systems, diagnose the copy-into-
self error consistently.  Handle the parameter,
first_dir_created_per_command_line_arg, correctly when there are two
or more sub-directories.
2011-04-02 16:14:47 +02:00
Jim Meyering
e08b3e7c08 maint: fix a comment typo
* tests/cp/fiemap-empty: Correct typo in comment.  Add "FIXME".
2011-04-02 14:22:55 +02:00
Pádraig Brady
bfdb6b585b copy: process empty extents more efficiently
* src/copy.c (extent_copy): Treat an allocated but empty extent
much like a hole.  I.E. don't read data we know is going to be NUL.
Also we convert the empty extent to a hole only when SPARSE_ALWAYS
so that the source and dest have the same allocation.  This will
be improved soon, when we use fallocate() to do the allocation.
* tests/cp/fiemap-empty: A new test for efficiency and correctness
of copying empty extents.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the change in behavior.
2011-04-01 15:04:18 +01:00
Pádraig Brady
b56b53bd70 copy: protect against overlapping extents
* src/extent-scan.c (extent_scan_read): Add a more stringent check
for OFF_T overflow, to ensure subsequent code is immune.
Detect overlapping extents and adjust, so as files always copied.
Detection using a single scan with fallback to a standard copy
was thought too expensive in memory or time.
* NEWS: Mention the fix
2011-04-01 14:42:46 +01:00
Pádraig Brady
594292a1d8 copy: link rather than copy symlinks, when --link used
This bug was introduced in commit ca9e212c, 2009-09-24,
"cp, mv: use linkat to guarantee semantics", which
inadvertently disabled the creation of hardlinks to symlinks.
However rather than implementing the intention of that commit
and relying on gnulib linkat emulation, we'll revert to the
previous emulation as that maintains ownership and timestamps.

* src/copy.c (copy_internal): Use our existing hardlink to
symlink emulation when link() might dereference the symlink.
Also ensure that we copy the timestamps of the original symlink
when we use the emulation.
* tests/cp/link-symlink: Add a test to ensure timestamps copied.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
Reported by Ruediger Meier
2011-04-01 14:17:27 +01:00
Jim Meyering
0ec711b5c4 tests: inotify-rotate: avoid race condition with overloaded disk
* tests/tail-2/inotify-rotate: Wait 50% longer for grep to succeed.
Without this change, this test would fail consistently when using
"make -j25 check" with F15 in a virtio- and spinning-rust-backed
virtual machine.
2011-03-31 18:58:38 +02:00
Pádraig Brady
f69876e558 copy: with fiemap copy, only sync when needed
* src/extent-scan.h (struct extent_scan): Add the fm_flags member to
pass to the fiemap scan.
* src/extent-scan.c (extent_need_sync): A new function used to
detect Linux kernels before 2.6.38.
(extent_scan_init): Add FIEMAP_FLAG_SYNC when needed.
* tests/cp/sparse-fiemap: Adjust comment.
* NEWS: Mention the change in behavior.
Indirectly suggested by Mike Frysinger
2011-03-31 16:46:42 +01:00
Mathieu Bridon
17a7e45927 tests: avoid unwarranted failure in mock-simulated non-SELinux env.
* tests/init.cfg (require_selinux_): Skip the test also when
/proc/filesystems does not list selinuxfs.
Add comments.
* cfg.mk (exclude_file_name_regexp--sc_file_system): Exempt
tests/init.cfg, with its use of /proc/filesystems.
Based on the patch by Mathieu Bridon in http://debbugs.gnu.org/8359.
More discussion in http://bugzilla.redhat.com/573111
2011-03-28 12:00:12 +02:00
Jim Meyering
fde07ff436 maint: correct formatting style in a header
* src/find-mount-point.h: Move "*" to where it belongs.
Move "const", too.
* src/find-mount-point.c: Move "const" to conform.
* src/Makefile.am (sc_tight_scope): Allow `*'s before the function name.
Use perl's -l option and drop the \n after (and quotes around) $1.
2011-03-28 11:51:35 +02:00
Pádraig Brady
99679fff62 df: fix alignment of columns
* src/df.c (alloc_table_row): A new function to allocate storage
for a row of strings.
(print_table): A new function to interate over all stored strings in
the table, and apply alignment honoring the max width of each column.
(get_header): Renamed from print_header, and adjusted accordingly.
(get_dev): Renamed from show_dev.  Also we no longer wrap longer
device names over two lines, which can be an unexpected issue for
scripts parsing the output from df.
(get_disk): s/show_/get_/
(get_point): Likewise.
(get_entry): Likewise.
(get_all_entries): Likewise.
* NEWS: Mention the change.
2011-03-23 16:44:49 +00:00
Jim Meyering
437fcf713c build: update gnulib submodule to latest 2011-03-22 07:13:59 +01:00
Jim Meyering
b3f6b33e4b tests: exercise tests new "==" operator
* tests/misc/test: Exercise the new operator.
* NEWS (Changes in behavior): Mention it.
2011-03-22 07:13:59 +01:00
David A. Wheeler
3f31ec950b test: accept "==" as a synonym for "="
Make GNU coreutils' test recognize "==" as a synonym for "=".
This is already the case in GNU coreutils' expr, bash, ksh,
busybox ash, FreeBSD-current /bin/sh and /bin/test, and
OpenBSD's /bin/sh.

Before, env test a '==' a would fail with this diagnostic:
"test: ==: binary operator expected".  Now, it succeeds.
* src/test.c: Accept "==" as a synonym for "=".
* doc/coreutils.texi (String tests): Document it.
Reported as http://debbugs.gnu.org/8263
Also see http://austingroupbugs.net/view.php?id=375
2011-03-22 07:12:01 +01:00
Jim Meyering
2a3a094e0d tests: fix a bug in the cp/preserve-gid test
* tests/cp/preserve-gid: Ensure that every process under test uses
the cp binary we've just built.  Before this fix, with a restrictive
umask or build-dir permissions, the UID-changing tests would end up
using whatever cp happened to be available through $PATH
Analysis by arbogast.cedric@gmail.com in http://debbugs.gnu.org/8292.
2011-03-21 07:37:20 +01:00
Paul Eggert
c20d0e17c3 bootstrap: do not exclude m4/message.m4
* bootstrap.conf (excluded_files): Don't exclude m4/lcmessage.m4,
as it's needed with the latest gnulib.
2011-03-20 12:25:26 -07:00
Jim Meyering
8e5292dfb8 maint: remove a name from THANKS.in that is derived from git log
The names in THANKS are generated from two sources: the hard-coded
list, THANKS.in, and the names of committers from the git log.
When a contributor on the hard-coded list commits a change,
we remove their now-redundant name from THANKS.in.
* THANKS.in: Remove a now-duplicate name.
2011-03-20 16:05:23 +01:00
Pádraig Brady
7a804b9af4 tests: fix the sparse-fiemap test
* tests/filefrag-extent-compare: Merge adjacent extents in
each list before processing, so we correctly account for
split extents in either list.
* tests/cp/sparse-fiemap: Remove the explicit syncing,
which was only changing the way extents were arranged,
and thus working around the extent comparison issue
that was seen on ext4 loop back.
2011-03-19 23:58:49 +00:00
Jim Meyering
4f591fdd0b sort: avoid memory pressure of 130MB/thread when reading from pipe
* src/sort.c (INPUT_FILE_SIZE_GUESS): Decrease initial allocation
factor used to size buffer used when reading a non-regular file.
For motivation, see discussion here:
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/878/focus=887
2011-03-16 16:30:02 +01:00
Jim Meyering
8e4e1d484f maint: stop using .x-sc_* files to list syntax-check exemptions
Instead, use the brand new mechanism with which you merely use a
variable (derived from the rule name) defined in cfg.mk to an ERE
matching the exempted file names.
* gnulib: Update to latest, to get maint.mk that implements this.
* Makefile.am (syntax_check_exceptions): Remove variable.
(EXTRA_DIST): Remove use of the variable.
* cfg.mk (sc_x_sc_dist_check): Remove rule, no longer useful.
(exclude_file_name_regexp--sc_space_tab): Define variable.
(exclude_file_name_regexp--sc_bindtextdomain): Likewise.
(exclude_file_name_regexp--sc_unmarked_diagnostics): Likewise.
(exclude_file_name_regexp--sc_error_message_uppercase): Likewise.
(exclude_file_name_regexp--sc_trailing_blank): Likewise.
(exclude_file_name_regexp--sc_system_h_headers): Likewise.
(exclude_file_name_regexp--sc_require_config_h_first): Likewise.
(exclude_file_name_regexp--sc_require_config_h): Likewise.
(exclude_file_name_regexp--sc_po_check): Likewise.
(exclude_file_name_regexp--sc_prohibit_always-defined_macros): Likewise.
(exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF): Likewise.
(exclude_file_name_regexp--sc_program_name): Likewise.
(exclude_file_name_regexp--sc_file_system): Likewise.
(exclude_file_name_regexp--sc_prohibit_always_true_header_tests):
Likewise.
(exclude_file_name_regexp--sc_prohibit_fail_0): Likewise.
(exclude_file_name_regexp--sc_prohibit_atoi_atof): Likewise.
(exclude_file_name_regexp--sc_prohibit_tab_based_indentation): Likewise.
(exclude_file_name_regexp--sc_prohibit_stat_st_blocks): Likewise.
* configure.ac [whether localtime caches TZ]: Use return 0/1, not
exit (0/1) to avoid triggering a sc_prohibit_magic_number_exit failure.
* .x-sc_GPL_version: Remove file.
* .x-sc_bindtextdomain: Likewise.
* .x-sc_error_message_uppercase: Likewise.
* .x-sc_file_system: Likewise.
* .x-sc_obsolete_symbols: Likewise.
* .x-sc_po_check: Likewise.
* .x-sc_program_name: Likewise.
* .x-sc_prohibit_always-defined_macros: Likewise.
* .x-sc_prohibit_always_true_header_tests: Likewise.
* .x-sc_prohibit_atoi_atof: Likewise.
* .x-sc_prohibit_empty_lines_at_EOF: Likewise.
* .x-sc_prohibit_fail_0: Likewise.
* .x-sc_prohibit_magic_number_exit: Likewise.
* .x-sc_prohibit_stat_st_blocks: Likewise.
* .x-sc_prohibit_strcmp: Likewise.
* .x-sc_prohibit_tab_based_indentation: Likewise.
* .x-sc_require_config_h: Likewise.
* .x-sc_require_config_h_first: Likewise.
* .x-sc_space_tab (config): Likewise.
* .x-sc_sun_os_names: Likewise.
* .x-sc_system_h_headers: Likewise.
* .x-sc_trailing_blank: Likewise.
* .x-sc_unmarked_diagnostics: Likewise.
* .x-sc_useless_cpp_parens: Likewise.
2011-03-16 12:22:22 +01:00
Pádraig Brady
0ddfd54b08 maint: use wcswidth from gnulib
* gl/lib/mbsalign.c (rpl_wcswidth): Remove this in favor
of the equivalent wcswidth replacement in gnulib.
* bootstrap.conf: Depend on the wcswidth module.
Suggested by Bruno Haible.
2011-03-13 23:55:17 +00:00
Jim Meyering
56e8714e2b touch: update to latest gnulib to fix Solaris 10 touch segfault
* gnulib: Update to latest, to address http://debbugs.gnu.org/8230.
When built on Solaris 9 and run on Solaris 10, touch would segfault.
Reported by Ben Walton.
* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.
* NEWS (Bug fixes): Mention this.
2011-03-13 18:41:44 +01:00
Jim Meyering
e0245ae0ae sort: spawn fewer threads for small inputs
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): Do not spawn a new thread
for every 4 lines.  Increase this from 4 to 128K.  128K lines seems
appropriate for a 5-year-old dual-core laptop, but it is too low for
some common combinations of short lines and/or newer systems.
* NEWS (Bug fixes): Mention it.
2011-03-13 18:13:17 +01:00
Pádraig Brady
3ed0384c41 copy: merge similar extents before processing
* src/extent-scan.c (extent_scan_read):  Merge adjacent extents
that vary only in size, so that we may process them more efficiently.
This will be especially useful when we introduce fallocate()
so that we don't reproduce fragmentation in the destination.
2011-03-11 00:50:10 +00:00
Paul Eggert
194c1e89a4 dd: avoid or diagnose some problems with short reads
* src/dd.c (warn_partial_read): New static var.
(iread): Diagnose partial reads if needed.
(iwrite): Don't diagnose them here; not needed any more.
(scanargs): Determine whether partial reads should be diagnosted.
2011-03-05 16:06:34 -08:00
Pádraig Brady
5bf48c1186 maint: fix dd nocache test to be independent of current stdin
* tests/dd/nocache: Don't assume stdin is a pipe
2011-03-05 09:53:00 +00:00
Pádraig Brady
5f3115535b dd: add a flag to discard cached data
* src/dd.c (FFS_MASK): A new macro (Find First Set) refactored
from the following enum as it's now used twice.
(usage): Mention the new 'nocache' flag.
(cache_round): A new function to help ignore requests
to drop cache, that are less than page_size.
(invalidate_cache): A new function to call posix_fadvise()
with the appropriate offset and length.  Note we don't
use fdadvise() so we can detect errors when count=0.
(dd_copy): Call invalidate_cache() for the portions read.
(iwrite): Likewise for the portions written.
(main): Call invalidate_cache for page_size slop or
for full file when count=0.
* cfg.mk (sc_dd_O_FLAGS): Adjust to pass.
* doc/coreutils.texi (dd invocation): Describe the 'nocache' flag,
and give some examples of how it can be used.
* tests/dd/nocache: A new test.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
2011-03-05 02:33:53 +00:00
Pádraig Brady
433a7c614f doc: clarify that dd bs= can immediately output short reads
* doc/coreutils.texi (dd invocation): Clarify that bs= can
cause parital reads to be immediately written to output.
* src/dd.c (usage): Hint that bs= can cause partial writes.
See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8171
2011-03-05 02:21:45 +00:00
Pádraig Brady
7525860fb9 doc: group dd conv= options that are actually flags
* src/dd.c (usage): Move 'sync' up with other data transformation
options.  Having it alongside 'fsync' and 'fdatasync' is
particularly confusing.  Also the double line description of
the 'sync' option, serves as a visual break from the "flag"
type options that follow.
* doc/coreutils.texi (dd invocation):  Apply the same grouping
as above, by splitting the "conv=" table in two.
2011-03-05 02:01:16 +00:00
Pádraig Brady
e1788d9ed9 dd: warn when we disable oflag=direct not at EOF
An alternative to this is to auto enable iflag=fullblock
when oflag=direct and bs= is specified.
It was thought better though, to warn about the specific issue,
and give full control of dd's options to the user.

* src/dd.c (iwrite): Warn, when we write after having
disabled O_DIRECT.
See https://bugzilla.redhat.com/show_bug.cgi?id=614605
2011-03-05 01:48:55 +00:00
Jim Meyering
caaf2899f6 du: don't infloop for --files0-from=DIR
* src/du.c (main): Fail on AI_ERR_READ error, rather than merely
diagnosing and continuing.  Based on a patch by Stefan Vargyas.
Also move the handling of AI_ERR_EOF into the case stmt.
Do not report ferror/fclose(stdin) failure when we've
already diagnosed e.g., failure to read the DIR, above.
Bug introduced by 2008-11-24 commit 031e2fb5, "du: read and
process --files0-from= input a name at a time,".
* src/wc.c: Handle read failure as with du: do not exit
immediately, but rather go on to print any total and to clean-up.
As above, move the handling of AI_ERR_EOF into the case stmt.
* tests/du/files0-from-dir: New file, to test both du and wc.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2011-03-03 09:05:44 +01:00
Jim Meyering
7cfd12c78e wc: avoid NULL dereference on out-of-memory error
* src/wc.c (main): Diagnose failed argv_iter_init_* failure,
rather than falling through and dereferencing NULL.
Bug introduced by 2008-11-25 commit c2e56e0d,
"wc: read and process --files0-from= input a name at a time,".
* NEWS (Bug fixes): Mention it.
2011-03-03 09:01:17 +01:00
Pádraig Brady
a132e03507 tests: without filefrag, only skip part of sparse-fiemap
* tests/cp/sparse-fiemap: Move the PERL check to the top,
since we don't test anything without it.  In the loop,
don't use skip_test_ as it exits the test completely.
2011-02-25 07:30:09 +00:00
Gilles Espinasse
269665866d maint: replace spaces with tab in tests/Makefile.am
* tests/Makefile.am: Replace spaces with tabs for consistency
2011-02-19 23:09:09 +00:00
Jim Meyering
2895f44e89 stdbuf: avoid even the appearance of a possible use-after-free
There was an execution path by which "libstdbuf" could be used after
being freed, but that would happen only if there were no libstdbuf.so
alongside the stdbuf program and there had been an installation error
leading to absence of the file, PKGLIBDIR/libstdbuf.so.
* src/stdbuf.c (set_LD_PRELOAD): Rearrange loop to make it perfectly
clear that there is no possibility of use-after-free.
Steve Grubb reported this possible use-after-free of "libstdbuf".
2011-02-18 23:31:29 +01:00
Gilles Espinasse
e6067bcb04 tests: correct racy sparse-to-pipe test
* tests/cp/sparse-to-pipe: Wait for backgrounded "cat" to complete
before comparing the results.
2011-02-18 13:52:21 +01:00
Paul Eggert
43066fe2ca uptime: omit unnecessary #if
* src/uptime.c (print_uptime): Omit unnecessary "#if defined
HAVE_GETLOADAVG || defined C_GETLOADAVG".  This #if is always
true, and removing it will help us simplify the gnulib getloadavg
module.
2011-02-14 21:05:55 -08:00
Pádraig Brady
0f56019db8 tests: support more file systems in the cp fiemap tests
* tests/cp/sparse-fiemap: Check for fiemap support against a file
rather than a directory to enable tests on BTRFS for example.
Explicity disable the test on ext3 or file systems where we
can't determine the type.
* tests/cp/fiemap-perf: Likewise.  Also disable the test on older
BTRFS (like in Fedora 14), where extents are returned for holes.
* tests/init.cfg: Comment that BTRFS only supports fiemap
for regular files.
2011-02-15 00:02:29 +00:00
Pádraig Brady
275c831a3c copy: adjust fiemap handling of sparse files
Don't depend on heuristics to detect sparse files
if fiemap is available.  Also don't scan for new
holes unless --sparse=always has been specified.

* src/copy.c (extent_copy): Pass the user specified
sparse mode, and handle as described above.
2011-02-11 00:13:31 +00:00
Pádraig Brady
6f95025c9d copy: suppress redundant lseeks when using fiemap
* src/copy.c (extent_copy): Suppress redundant lseek()s in both
the source and dest files, when there is no hole between extents.
2011-02-11 00:13:31 +00:00
Jim Meyering
15571e0c8f tests: fix bug in preceding check.mk change
* tests/check.mk (.built-programs): Run cd'd submake in a subshell
so the redirected output ends up in the current directory, not ../src.
2011-02-10 10:01:23 +01:00
Jim Meyering
c91b2a3c3b tests: print "python missing:..." diagnostic where more will see it
* tests/init.cfg (fiemap_capable_): Print with warn_, so that the
diagnostic shows up alongside the corresponding SKIP message.
2011-02-10 08:57:12 +01:00
Jim Meyering
ee6c466ba8 tests: avoid gross inefficiency in "make test"
Do not run a sub-make to set up the environment for each
and every test script.  Instead, run it just once and store
the result in a file.
* tests/check.mk (built_programs): Remove definition.
(.built-programs): New rule to create the temporary file.
(CLEANFILES): Arrange to remove it.
(TESTS_ENVIRONMENT): Simply cat .built-programs, rather than
running the sub-make.
* .gitignore: Ignore it.
2011-02-10 08:50:14 +01:00
Pádraig Brady
5c3fd50a75 test: improve the cp fiemap tests
* tests/cp/fiemap-2: Enable the fiemap check for files, which
will enable the test for files on ext3.
* tests/cp/fiemap-perf: Comment why we're not enabling for ext3.
* tests/cp/sparse-fiemap: Ditto.  Also sync the files before
doing a fiemap which was needed for ext4 loop back at least.
Add a comment that FIEMAP_FLAG_SYNC is ineffective, thus
requiring the explicit syncs.
* tests/fiemap-capable: A new python script to determine
if a specified path supports fiemap.
* tests/init.cfg (fiemap_capable_): Use the new python script.
* tests/Makefile.am (EXTRA_DIST): Include the new python script.
2011-02-08 22:46:25 +00:00
Jim Meyering
480c0dc9e7 tests: randread-tests: use macro.h not "#define ASSERT..."
* gl/modules/randread-tests (Files): Add tests/macros.h
* gl/tests/test-rand-isaac.c: Remove now-unneeded #include directives.
(ASSERT): Remove definition.
Instead, include "macros.h".
Prompted by suggestions from Bruno Haible.
2011-02-08 08:30:19 +01:00
Jim Meyering
beaf631292 maint: move di-set and ino-map modules from ./gl to gnulib
* gl/lib/di-set.c: Remove file.
* gl/lib/di-set.h: Likewise.
* gl/lib/ino-map.c: Likewise.
* gl/lib/ino-map.h: Likewise.
* gl/modules/di-set: Likewise.
* gl/modules/di-set-tests: Likewise.
* gl/modules/ino-map: Likewise.
* gl/modules/ino-map-tests: Likewise.
* gl/tests/test-di-set.c: Likewise.
* gl/tests/test-ino-map.c: Likewise.
* gnulib: Update to latest, now that these two modules are there.
2011-02-07 16:24:14 +01:00
Jim Meyering
b9fc790ddc di-set: provide a lookup method
This is required for patch, and hence is about to move to gnulib.
* gl/lib/di-set.c (di_set_lookup): New function.
* gl/lib/di-set.h: Declare it.
* gl/tests/test-di-set.c (main): Exercise it.

The bug was introduced on 2004-12-04 via commit 7380cf79.
2011-02-07 15:50:44 +01:00
Jim Meyering
2e636af1ef cut: don't segfault for large unbounded range
* src/cut.c (set_fields): When computing the maximum range endpoint,
take into consideration the start of any unbounded range, like "999-".
* NEWS (Bug fixes): Mention it.
* tests/misc/cut (big-unbounded-b,c,f): Add tests.
Reported by Paul Marinescu in http://debbugs.gnu.org/7993
The bug was introduced on 2004-12-04 via commit 7380cf79.
2011-02-07 09:25:51 +01:00
Jim Meyering
9f61806875 copy: don't let a failed lseek go undiagnosed
Upon failed lseek, sparse_copy_finalize would mistakenly return true.
Admittedly, that is very unlikely, since that particular lseek
is attempted only if the preceding call to sparse_copy induced
a hole at EOF (via lseek on the destination FD).  However, now
that sparse_copy has an output parameter, N_READ, there is no
longer any reason to call lseek (fd, 0, SEEK_CUR), so...
* src/copy.c (sparse_copy_finalize): Remove the function.
(copy_reg): Call ftruncate with n_read, rather than
sparse_copy_finalize with its now-unnecessary lseek.
Lasse Collin spotted the bug in sparse_copy_finalize.
2011-02-05 22:40:57 +01:00
Jim Meyering
661413d8c3 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-02-04 18:19:36 +01:00
Jim Meyering
ca637bff0e version 8.10
* NEWS: Record release date.
2011-02-04 18:08:12 +01:00
Jim Meyering
d5fa424a9c cp: avoid spurious failure on any non-linux kernel
* src/extent-scan.c (extent_scan_read) [!linux]: Always set
scan->initial_scan_failed so caller knows not to report the failure.
2011-02-04 15:01:39 +01:00
Jim Meyering
ee74c7d36d tests: skip mv/i-3 on FreeBSD to avoid spurious failure
* tests/mv/i-3: Skip when uname -s reports FreeBSD.
2011-02-04 14:59:03 +01:00
Pádraig Brady
d846bc8bab sort: fix --debug key highlighting when key start after key end
This case was overlooked in commit bdde34f9, 2010-08-05,
"sort: tune and refactor --debug code, and fix minor underlining bug"

* src/sort.c (debug_key):  Don't adjust the key end when
it's before the key start.
* tests/misc/sort-debug-keys: Add a test case.
2011-02-03 10:19:34 +00:00
Jim Meyering
4e9ab7d3d8 tests: correct part of fiemap-perf
* tests/cp/fiemap-perf: Correct erroneous added test.
Since nonexistent names were used, the final test ended up
being "test =", which would always "succeed".
2011-02-02 12:02:22 +01:00
Jim Meyering
78ee2953bf build: update gnulib submodule to latest 2011-02-02 09:40:55 +01:00
Pádraig Brady
84e5274f7e cp: fix the buffer size used when writing zeros
* src/copy.c (write_zeros): This bug caused 4 or 8 bytes to
be written at a time which is very inefficient.  One could
trigger the issue with `cp --sparse=never sparse non-sparse`
on a file system that supports fiemap.
2011-01-31 23:21:04 +00:00
Jim Meyering
f8f57dd76b cp: always initialize extent_copy's output parameter
* src/copy.c (extent_copy): Otherwise it would be used uninitialized.
2011-01-31 20:55:34 +01:00
Jim Meyering
43d739e99c tests: exercise a rarely-used corner of copy.c
* tests/cp/sparse-to-pipe: New test.
* tests/Makefile.am (TESTS): Add it.
2011-01-31 18:26:06 +01:00
Jim Meyering
cc0645fc64 cp: fix copying a sparse file to a pipe
The recent FIEMAP-related changes made it so the unusual case of
copying a sparse file to a non-regular destination (e.g., a pipe)
would erroneously write one byte too many to that destination.
That happened because extent_copy assumed that it could use lseek
to obtain the number of bytes written to the output file descriptor.
That was valid only for regular files.
* src/copy.c (sparse_copy): Add a parameter, to be used by extent_copy,
but not by reg_copy.  Adjust callers.
(extent_copy): Maintain new local, dest_pos, using new arg, n_read.
Don't call lseek on dest_fd; use new var, dest_pos, instead.
(copy_reg): Add unused arg.
2011-01-31 18:26:06 +01:00
Jim Meyering
96a93f9480 tests: gfs2 also supports FIEMAP
* tests/init.cfg (fiemap_capable_): Add gfs2.
Clarify comment.
2011-01-31 15:20:29 +01:00
Jim Meyering
aeed6c1d89 maint: remove unused inclusion of "fiemap.h"
* src/copy.c: Don't include "fiemap.h".
2011-01-31 15:17:12 +01:00
Jim Meyering
3aae01fa9b tests: factor fiemap-related predicate into init.cfg
* tests/init.cfg (fiemap_capable_): New function.
* tests/cp/fiemap-perf: Use it.
* tests/cp/sparse-fiemap: Likewise.
* tests/cp/fiemap-2: Likewise.
2011-01-31 14:44:15 +01:00
Jim Meyering
31dc21f693 maint: update copyright year lists in new files
* src/extent-scan.h: Update copyright year list.
* src/extent-scan.c: Likewise.
* tests/cp/sparse-fiemap: Likewise.
2011-01-31 13:42:49 +01:00
Jim Meyering
08b7bce540 tests: modernize sparse-fiemap test
* tests/cp/sparse-fiemap: Use print_ver_, not open-coded VERBOSE test.
2011-01-31 13:40:26 +01:00
Jim Meyering
040b00ef19 tests: remove duplicate fiemap-perf test
* tests/cp/fiemap-perf: Copy block-comparing code from sparse-fiemap.
* tests/cp/sparse-fiemap: The same test was here, alongside a much
more involved test.  Remove it, now that it is in its own file.
2011-01-31 13:35:55 +01:00
Jim Meyering
5b11cd0179 doc: NEWS: mention cp's improvement
* NEWS (New Features): cp now copies sparse files efficiently.
2011-01-30 21:30:35 +01:00
Jim Meyering
199355e234 build: update gnulib submodule to latest 2011-01-30 20:44:12 +01:00
Jim Meyering
fc3c8e3cdd copy, tee: assume EINTR is always defined: remove #ifdefs
Don't use "#ifdef EINTR".  dd.c has been doing that since 2004.
* src/copy.c (sparse_copy): Remove #ifdef...#endif around EINTR use.
* src/tee.c (tee_files): Remove #ifdef...#endif around EINTR use.
If we need it, add something like this in system.h:
/* When EINTR is not defined, define it to an improbable value
   so that each use does not have to be #ifdef'd.  */
 #ifndef EINTR
 # define EINTR 999988
 #endif
2011-01-30 20:44:12 +01:00
Jim Meyering
54602c76a0 tests: cp/fiemap: exercise previously-failing parts
* tests/cp/fiemap-2: New test.
* tests/Makefile.am (TESTS): Add it.
2011-01-30 20:44:12 +01:00
Jim Meyering
0f91b6174e copy: make extent_copy use sparse_copy, rather than its own code
* src/copy.c (extent_copy): Before this change, extent_copy would fail
to create holes, thus breaking --sparse=auto and --sparse=always.
I.e., copying a large enough file of all zeros, cp --sparse=always
should introduce a hole, but with extent_copy, it would not.
2011-01-30 20:44:12 +01:00
Jim Meyering
8da69cbf30 copy: remove obsolete comment
* src/copy.c (sparse_copy): Remove now-obsolete comment about
how we used to work around lack of ftruncate.  Combine nested
if conditions into one.
2011-01-30 20:44:12 +01:00
Jim Meyering
82c7f192bd copy: factor sparse-copying code into its own function, because
we're going to have to use it from within extent_copy, too.
* src/copy.c (sparse_copy): New function, factored out of...
(copy_reg): ...here.
Remove now-unused locals.
2011-01-30 20:44:12 +01:00
Jim Meyering
f5743a6f20 fiemap copy: avoid leak-on-error
* src/copy.c (extent_copy): Don't leak an extent_scan buffer on
failed lseek, read, or write.
2011-01-30 20:44:12 +01:00
Jim Meyering
3953f7523e fiemap copy: avoid a performance hit due to very small buffer
* src/copy.c (extent_copy): Don't let what should have been a
temporary reduction of buf_size (to handle a short ext_len) become
permanent and thus impact the performance of all further iterations.
2011-01-30 20:44:12 +01:00
Jim Meyering
cfbeeafd4a fiemap copy: simplify post-loop logic; improve comments
* src/copy.c (extent_copy): Avoid duplication in post-loop
extend-to-desired-length code.
2011-01-30 20:44:11 +01:00
Jim Meyering
f4473df430 fiemap copy: rename some locals
(extent_copy): Rename locals: s/*ext_logical/*ext_start/
2011-01-30 20:44:11 +01:00
Jim Meyering
72b86ad4e8 tests: ensure that FIEMAP-enabled cp copies a sparse file efficiently
* tests/cp/fiemap-perf: New file.
* tests/Makefile.am (TESTS): Add it.
2011-01-30 20:44:11 +01:00
Jim Meyering
790a4654ae copy: don't allocate a separate buffer just for extent-based copy
* src/copy.c (copy_reg): Move use of extent_scan to just *after*
we allocate the main copying buffer, so we can...
(extent_scan): Take a new parameter, BUF, and use that rather
than allocating a private buffer.  Update caller.
2011-01-30 20:44:11 +01:00
Jim Meyering
ce3c73dddd copy: tweak variable name; improve a comment
* src/copy.c (copy_reg): Rename a variable to make more sense from
caller's perspective: s/require_normal_copy/normal_copy_required/.
This is an output-only variable, and the original name could make
it look like an input (or i&o) variable.
2011-01-30 20:44:11 +01:00
Jim Meyering
0497a86f70 copy: call extent_copy also when make_holes is false, ...
so that we benefit from using extents also when reading a sparse
input file with --sparse=never.
* src/copy.c (copy_reg): Remove erroneous test of "make_holes"
so that we call extent_copy also when make_holes is false.
Otherwise, what's the point of that parameter?
2011-01-30 20:44:11 +01:00
Jim Meyering
8ecb0c76c3 copy: remove else-after-goto and adjust indentation
* src/copy.c (copy_reg): Remove useless else-after-goto.
2011-01-30 20:44:11 +01:00
Jim Meyering
50040d07e1 extent-scan: adjust naming and formatting
* src/extent-scan.h [struct extent_scan]: Rename member:
s/hit_last_extent/hit_final_extent/.  "final" is clearer,
since "last" can be interpreted as "preceding".
Rename extent-scan functions to start with extent_scan_.
* src/Makefile.am (copy_sources): Also distribute extent-scan.h.
* src/extent-scan.c: Don't include error.h or quote.h.  Neither is used.
* src/copy.c: shorten a comment to fit in 80 columns
* src/extent-scan.c, src/extent-scan.h: Correct formatting.
2011-01-30 20:44:11 +01:00
Jim Meyering
0b9f65dc01 fiemap copy: don't let write failure go unreported; adjust style, etc.
* src/copy.c (write_zeros): Add comments.
(extent_copy): Move decls of "ok" and "i" down to scope where used.
Adjust comments.
Rename local: s/holes_len/hole_size/
Print a diagnostic upon failure to write zeros.
2011-01-30 20:44:11 +01:00
jeff.liu
2db1433eab fiemap copy: add extent-scan.[ch], avoid a double-free and reorganize
Changes:
========
1. fix write_zeros() per Jim's comments.
2. remove char const *fname from struct extent_scan.
3. change the signature of open_extent_scan() from
"void open_extent_scan(struct extent_scan **scan)" to
"void open_extent_scan(struct extent_scan *scan)" to avoid having
to malloc the extent_scan variable; instead save it on the stack.
4. move close_extent_scan() from a function defined in extent-scan.c
to extent-scan.h as a macro definition, but it does nothing for now,
since initial extent scan defined at stack.
5. add a macro "free_extents_info()" defined at extent-scan.h to
release the memory allocated to extent info which should be called
combine with get_extents_info(), it just one line, so IMHO, define
it as macro should be ok.

* src/extent-scan.c: New file; functions to read "extents".
* src/extent-scan.h: Header file of extent-scan.c.
* src/Makefile.am: Reference it and link it to copy_source.
* src/copy.c: Use the new functions and avoid double-free.
2011-01-30 20:44:11 +01:00
Jim Meyering
f3e78eeff2 build: distribute new test script, filefrag-extent-compare
* tests/Makefile.am (EXTRA_DIST): Add filefrag-extent-compare.
2011-01-30 20:44:11 +01:00
Jim Meyering
a50ca679a1 build: distribute new file, fiemap.h
* src/Makefile.am (noinst_HEADERS): Add fiemap.h.
2011-01-30 20:44:11 +01:00
Jie Liu
d232c1cc20 copy.c: add FIEMAP_FLAG_SYNC to fiemap ioctl
* src/copy.c (fiemap_copy): Force kernel to sync the source
file before mapping.
2011-01-30 20:44:11 +01:00
Jim Meyering
6c81b97a58 fiemap.h: include <stdint.h>, not <linux/types.h>
* src/fiemap.h: Include stdint.h, not linux/types.h,
now that this file uses only portable type names.
2011-01-30 20:44:11 +01:00
Paul Eggert
a40a8fe1e5 copy.c: ensure proper alignment of fiemap buffer
* src/copy.c (fiemap_copy): Ensure that our fiemap buffer
is large enough and well-aligned.
Replace "0LL" with equivalent "0" as 3rd argument to lseek.
2011-01-30 20:44:11 +01:00
Jim Meyering
3058ffa501 copy.c: adjust comments, tweak semantics
* src/copy.c (fiemap_copy): Rename from fiemap_copy_ok.
Add/improve comments.
Remove local, "fail".
(fiemap_copy): Do not require caller to set
"normal_copy_required" before calling fiemap_copy.
Report ioctl failure if it's the 2nd or subsequent call.
2011-01-30 20:44:11 +01:00
Jim Meyering
d6fad2aa33 tests: relax the root-tests cross-check
* cfg.mk (sc_root_tests): Allow spaces before "require_root_",
now that tests/cp/sparse-fiemap has a conditional use.
2011-01-30 20:44:11 +01:00
Jim Meyering
5106653c26 tests: accommodate varying filefrag -v "flags" output
* tests/cp/sparse-fiemap: Accommodate values other than "eof"
in the "flags" column of filefrag -v output
2011-01-30 20:44:10 +01:00
Jim Meyering
dc05bc7ee2 tests: exercise more of the new FIEMAP copying code
* tests/cp/sparse-fiemap: Ensure that a file with many extents
(more than fit in copy.c's internal buffer) is copied properly.
Don't require root access if current partition is btrfs or xfs.
Use init.sh, not test-lib.sh.
* tests/filefrag-extent-compare: New file.
2011-01-30 20:44:10 +01:00
Jie Liu
f1a6f220f5 tests: add a new test for FIEMAP-copy
* tests/cp/sparse-fiemap: Add a new test for FIEMAP-copy against a
loopbacked ext4 partition.
* tests/Makefile.am (sparse-fiemap): Reference the new test.
2011-01-30 20:44:10 +01:00
Jie Liu
dff2b95e4f cp: copy sparse files efficiently using the FIEMAP ioctl
* src/fiemap.h: Add fiemap.h for fiemap ioctl(2) support.  Copied
from linux's include/linux/fiemap.h, with minor formatting changes.
* src/copy.c (copy_reg): Now, when `cp' is invoked with --sparse=[WHEN],
we will try to do FIEMAP-copy if the underlying file system
supports it, and fall back to a normal copy if it fails.
2011-01-30 20:44:10 +01:00
Pádraig Brady
38cdb01a32 doc: add alternatives for field processing not supported by cut
* doc/coreutils.texi (cut invocation): Remove the tr -s '[:blank:]'
example, as it doesn't handle leading and trailing blanks.  Add `awk`
examples for common field processing operations often asked about.
Also document a `join` hack, to achieve the same thing.  Note the
join options are ordered so as to be compatible with other systems.
2011-01-29 23:48:36 +00:00
Pádraig Brady
877ca5bf85 join: don't report disorder against an empty file
This allows one to use join as a field extractor like:
  join -a1 -o 1.3,1.1 - /dev/null

* src/join.c (join): Don't flag unpairable lines when
one of the files is empty.
* tests/misc/join: Add a new test for empty input, and adjust
a previous test that was only checking against empty input.
* doc/coreutils.texi (join invocation): Document the change.
* NEWS: Likewise.
2011-01-29 23:39:16 +00:00
Pádraig Brady
32626bde6d join: ensure --header skips the order check with empty files
* src/join.c: Skip the header even if one of the files is empty.
* tests/misc/join: Add a test case.
* NEWS: Mention the fix
2011-01-29 23:33:25 +00:00
Pádraig Brady
d4db0cb182 join: add -o 'auto' to output a constant number of fields per line
Lines with a different number of fields than the first line,
will be truncated or padded.

* src/join.c (prfields): A new function refactored from prjoin(),
to output all but the join field.
(prjoin): Don't swap line1 and line2 when line1 is blank
so that the padding is applied to the right place.
(main): Handle the -o 'auto' option.
* tests/misc/join: Add 6 new cases to test the auto format.
* NEWS: Mention the change in behavior.
Suggestion from Assaf Gordon
2011-01-29 23:08:31 +00:00
Jim Meyering
68a734d66b tests: remove obsolete uses of "$$" in temporary file names
Those were useful when tests might have been run in the same
directory and in parallel.  Now, each test is run in a newly-
created empty directory.
* tests/cp/backup-1: Remove obsolete uses of "$$".
* tests/cp/same-file: Likewise.
* tests/dd/misc: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/touch/fail-diag: Likewise.
2011-01-28 23:19:45 +01:00
Jim Meyering
034e496e98 tests: don't hide all trace of the vc_exe_in_TESTS test
There was a non-negligible delay after running a single test.
Now, you'll know why when you see this test's name.
* tests/check.mk (vc_exe_in_TESTS): Don't @-hide commands.
Use $(AM_V_GEN) instead.
2011-01-26 08:38:56 +01:00
Andreas Schwab
d255e40c37 tests: minor correction
* tests/du/move-dir-while-traversing: Ignoring SIGTSTP is enough;
don't also attempt to ignore SIGSTOP, it cannot be handled or ignored.
Spotted by Andreas Schwab.
2011-01-25 18:29:10 +01:00
Jim Meyering
56699864f6 tests: avoid FP failure due to suspension
* tests/du/move-dir-while-traversing: Prohibit suspension,
to avoid false-positive failure.
2011-01-25 12:41:47 +01:00
Jim Meyering
5c501f6fba tests: avoid rare FP failure in new du test
* tests/du/move-dir-while-traversing: Create an even larger tree
to avoid a false-positive failure due to du terminating before
the rename is triggered.
2011-01-25 12:41:42 +01:00
Jim Meyering
15ea577af7 split: avoid a new, spurious warning from gcc-4.6.0
* src/split.c (lines_rr) [IF_LINT]: Initialize files, now that
rawhide's gcc-4.6.0 would otherwise warn about use-uninitialized.
2011-01-24 10:02:22 +01:00
Jim Meyering
8264fc615a tail: avoid new diagnostic when applying -f to a pipe on linux-2.3.38
* src/tail.c (fremote): Do not print a diagnostic when
fstatfs (pipe_FD, &buf) fails, as it now does on linux-2.3.38.
This avoids the spurious failure of tests/misc/tail's f-pipe-1
test, when running in input-from-pipe mode.
2011-01-24 10:02:19 +01:00
Jim Meyering
4afbba7bac doc: fix wording in warning about potential conflict with built-in
* doc/coreutils.texi (mayConflictWithShellBuiltIn): Fix wording.
2011-01-21 22:25:11 +01:00
Paul Eggert
4f92531819 manual: document floating point better
* doc/coreutils.texi (Floating point): New section.
(od invocation, tail invocation, sort invocation, printf invocation):
(sleep invocation, seq invocation): Refer and defer to it.  See
<http://lists.gnu.org/archive/html/bug-coreutils/2011-01/msg00031.html>.
2011-01-21 10:59:52 -08:00
Jim Meyering
e0c6272ac3 build: update gnulib submodule to latest
The previous gnulib submodule reference was *still* to a
non-public commit.  My submodule had a stray commit, so
the reference was always to a local merge commit.
Reported by Rob Vermaas.
2011-01-20 10:50:24 +01:00
Jim Meyering
6344402389 build: update gnulib submodule to latest
The previous gnulib submodule reference was to a non-public commit.
Reported by Rob Vermaas.
2011-01-20 10:07:08 +01:00
Jim Meyering
948828b208 maint: use slightly more efficient process in README-release
* README-release: Run cheaper root-only tests first.
Use half of processing units (not just 1) for the expensive tests.
2011-01-19 08:35:36 +01:00
Jim Meyering
7e72d4fe9d tests: avoid FP failure in new du test
* tests/du/move-dir-while-traversing: Create a larger tree to
avoid a false-positive failure due to du terminating before
the rename is triggered.
2011-01-18 22:32:33 +01:00
Jim Meyering
5c75d1da85 build: update gnulib submodule to latest 2011-01-18 21:07:57 +01:00
Jim Meyering
34ece0b0a1 doc: update NEWS
* NEWS: Note when the uniq bug was introduced.
It was mine, commit 1d9b3de9, "uniq: remove redundant test".
2011-01-18 09:45:00 +01:00
Jim Meyering
0f9cf6b545 doc: show how to shred more efficiently
* doc/coreutils.texi (shred invocation): Give an example showing how
to invoke shred in single-pass mode, and warn that -n0 --zero may
be inadequate.
2011-01-17 19:16:43 +01:00
Jim Meyering
bdaef0686f uniq: replace a wasteful loop with simple calculation
* src/uniq.c (find_field): Remove the byte-skipping loop altogether.
Instead, perform the simple calculation.  This results in a 10%
performance improvement for large byte offsets.
2011-01-17 19:07:58 +01:00
Jim Meyering
1f0653066c tests: add a test for today's uniq bug
* tests/misc/uniq-perf: New file.
* tests/Makefile.am (TESTS): Add it.
2011-01-17 19:07:58 +01:00
Sami Kerola
aa9f02bc30 uniq: don't continue field processing after end of line
* NEWS (Bug fixes): Mention it.
* src/uniq.c (find_field): Stop processing loop when end of line
is reached.  Before this fix, 'uniq -f 10000000000 /etc/passwd'
would run for a very long time.
2011-01-17 19:07:58 +01:00
Ondřej Vašík
442b068ac1 doc: specify how tr, echo, printf treat octal numbers
* doc/coreutils.texi (tr's Character sets): Document how a 9-bit
octal value is interpreted.  tr does not ignore the ninth bit.
(echo invocation, printf invocation): Document that any ninth
bit in \OOO is ignored. (http://debbugs.gnu.org/7574)
2011-01-15 11:49:31 +01:00
Pádraig Brady
eab97b3075 maint: refactor to use read-file from gnulib
* bootstrap.conf: Add the read-file module
* src/ptx.c: Replace the original code which would
needlessly read SIZE_MAX bytes of files larger than this.
* src/shuf.c: Replace the original code.
2011-01-14 18:06:41 +00:00
Pádraig Brady
e1aaf8903d maint: trivial system header file cleanups
* src/system.h: Note where it should be included, and
make ordering check portable to GLIBC > 2
* src/copy.c: Move <sys/ioctl.h> along with other system headers
as is done elsewhere.
* src/install.c: Move <sys/wait.h> along with other system headers
as is done elsewhere.
* src/ptx.c: Include <regex.h> rather than "regex.h" as
is done elsewhere.  Note <regex.h> is kept after "system.h"
as per commit dba300a0.
2011-01-13 17:28:36 +00:00
Jim Meyering
d95e3c8ceb doc: clean up HACKING guidelines
* HACKING: Remove mention of "indent-tabs-mode: nil", since
we've remove all of those directives.  No longer needed.
Remove dated (pre-emacs-23) reference regarding WhiteSpace mode.
2011-01-12 21:21:26 +01:00
Paul Eggert
11d864b36d gnulib: Also use dtoastr and ldtoastr modules.
This adjusts to the recent splitting of the ftoastr module into 3
<http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00199.html>.
* bootstrap.conf (gnulib_modules): Add dtoastr, ldtoastr,
as coreutils needs all 3 modules now.
2011-01-11 18:10:03 -08:00
Paul Eggert
3292610bce build: update gnulib submodule to latest 2011-01-11 18:09:42 -08:00
Nadav Har'El
731f957965 rm: ignore errno related to invalid file names
* src/remove.c (nonexistent_file_errno): Also skip EINVAL and
EILSEQ, for at least smbfs rejection of '*' in file names.
* NEWS: Mention the fix.
2011-01-11 11:48:53 -07:00
Jim Meyering
db1034ddaf build: update gnulib submodule to latest 2011-01-10 07:59:00 +01:00
Jim Meyering
1c5987d2ef du: don't abort when a subdir is renamed during traversal
* NEWS (Bug fixes): Mention it.
* src/du.c (prev_level): Move declaration "up" to file-scope global.
(du_files): Reset prev_level to 0 upon abnormal fts_read termination.
Reported by Johathan Nieder in http://bugs.debian.org/609049
Also, improve a diagnostic.
* tests/du/move-dir-while-traversing: Test for the above.
* tests/Makefile.am (TESTS): Add it.
2011-01-10 07:49:55 +01:00
Pádraig Brady
d5d283dbc9 maint: suppress some clang scan-build warnings
* src/pr.c (char_to_clump): Remove a dead store.
* src/remove.c (fts_skip_tree): Likewise.
* src/sort.c (key_warnings): Likewise.
(sort): Suppress an uninitialized pointer warning.
2011-01-07 11:20:48 +00:00
Pádraig Brady
f331653fe8 maint: replace uses of ignore_ptr with ignore_value
* gnulib: Update for enhanced ignore_value()
* src/chcon.c (process_file): Don't use the deprecated ignore_ptr.
* src/chmod.c (process_file): Likewise.
* src/chown-core.c (change_file_owner): Likewise.
2011-01-07 02:09:32 +00:00
Jim Meyering
d6df8901bc post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-01-04 12:56:30 +01:00
Jim Meyering
b44b8f2b7d version 8.9
* NEWS: Record release date.
2011-01-04 12:18:32 +01:00
Jim Meyering
e43b19c4c8 build: update gnulib to latest; portability fixes 2011-01-04 12:17:21 +01:00
Jim Meyering
9d6231ef2a maint: update all copyright year number ranges
Run "make update-copyright".
2011-01-01 22:16:47 +01:00
Jim Meyering
257909013e build: update gnulib for version-etc copyright year update
* tests/sample-test: Update copyright to 2011, to appease syntax-check.
2011-01-01 22:16:35 +01:00
Jim Meyering
9a008a9e24 maint: generate much of the THANKS file
Before this change, we had a tendency to manually list each
contributor's name in THANKS.  Now, each commit "Author" is
included in the generated THANKS file automatically, and most
of the old THANKS file is now a template, THANKS.in.
We'll still have to manually list the names of people who report
problems without a usable patch.

* THANKS.in: New file, derived from THANKS, but removing names of
those who are listed as git log 'Author:'s.
* THANKS: Remove file.
* thanks-gen: New file.
* Makefile.am (THANKS): New rule.
(EXTRA_DIST): Add .mailmap, THANKS.in and thanks-gen.
* .gitignore: Add THANKS and THANKS-to-translators.
* .mailmap: Unify on single address and name-spelling per contributor.
2011-01-01 10:56:49 +01:00
Eric Blake
6b3f52e94f maint: update to latest gnulib, for testsuite improvement
* gnulib: Update to latest for init.sh fix.
* bootstrap: Resync from gnulib.
* tests/init.sh: Likewise.
2010-12-31 09:50:46 -07:00
Eric Blake
278491d2cc maint: allow gettext 0.17 again
Commit 041c9c47 traded the 'gettext' module for the lighter 'gettext-h'
module, so as to not require the latest gettext release (we only need
the latest release if we ship gettext as a dependent library, but
coreutils has long preferred to use it as an external library).
But that commit overlooked two places necessary to allow the use of
gettext 0.17.

This does not force you to downgrade (using gettext 0.18.1.1 is still
just fine), nor does it affect tarballs (once a tarball is built
with a given gettext version, it can be built on other machines
regardless of what gettext version is present).

* bootstrap.conf (buildreq): Relax prerequisite.
* configure.ac (AM_GNU_GETTEXT_VERSION): Likewise.
2010-12-30 15:10:09 -07:00
Pádraig Brady
44dbcae6b9 split: fix the suffix length calculation
* src/split.c (set_suffix_length): Only auto-calculate
the suffix length when the number of files is specified.
* tests/misc/split-a: Add a case to trigger the bug,
and exercise the suffix length auto-calculation.
* NEWS: Mention the fix.
Reported by Dmitry V. Levin and Sergey Vlasov at
https://bugzilla.altlinux.org/show_bug.cgi?id=24841
2010-12-30 16:26:20 +00:00
Paul Eggert
b0097f3d21 coreutils: keep lines within 80-column limits
* cfg.mk (LINE_LEN_MAX, FILTER_LONG_LINES): New macros.
(sc_long_lines): New rule.
* HACKING: Use shorter URLs to the same material.
* doc/Makefile.am, doc/coreutils.texi, m4/boottime.m4:
* man/help2man, man/stdbuf.x, src/Makefile.am, src/cat.c, src/copy.c:
* src/cp.c, src/dd.c, src/df.c, src/du.c, src/groups.c, src/install.c:
* src/ls.c, src/md5sum.c, src/mv.c, src/od.c, src/pinky.c, src/ptx.c:
* src/readlink.c, src/remove.c, src/rmdir.c, src/setuidgid.c:
* src/sort.c, src/tail.c, src/touch.c, tests/Coreutils.pm:
* tests/cp/existing-perm-race, tests/cp/perm, tests/cp/preserve-gid:
* tests/du/2g, tests/du/long-from-unreadable, tests/init.sh:
* tests/install/basic-1, tests/ls/nameless-uid:
* tests/ls/readdir-mountpoint-inode, tests/misc/chroot-credentials:
* tests/misc/cut, tests/misc/date, tests/misc/join, tests/misc/md5sum:
* tests/misc/sha1sum, tests/misc/sha224sum, tests/misc/sort:
* tests/misc/sort-continue, tests/misc/sort-files0-from:
* tests/misc/sort-rand, tests/misc/stdbuf, tests/misc/tr:
* tests/misc/uniq, tests/mv/atomic, tests/mv/part-fail:
* tests/mv/part-symlink, tests/mv/sticky-to-xpart, tests/pr/pr-tests:
* tests/rm/fail-2eperm, tests/rm/interactive-always:
Reformat to fit within 80 columns.
* doc/Makefile.am (BAD_POSIX_PERL): New macro.
* doc/coreutils.texi: Reword slightly, to make menus and
index lines shorter.
* src/md5sum.c: Redo --help output so that it fits within 79
columns, since that's a bit more portable and all the other --help
strings fit in 79 columns.
2010-12-28 12:30:42 -08:00
Jim Meyering
01211e9af7 maint: avoid syntax-check failure due to unused #include
* src/getlimits.c: Don't include "c-ctype.h"; no longer used.
2010-12-24 14:59:06 +01:00
Paul Eggert
bc4e77927c csplit: diagnose file counter wraparound
* src/csplit.c (create_output_file): Detect overflow when the
file counter wraps around, and exit with a diagnostic.  Formerly
the code silently wrapped around and wrote to the wrong file,
losing output data.
2010-12-23 00:07:59 -08:00
Paul Eggert
1d0a120377 sort: minor performance tweak with num_processors
* src/sort.c (main): Don't invoke num_processors twice.
2010-12-22 23:30:35 -08:00
Paul Eggert
83e0138480 getlimits: port to hosts with very wide int, or non-ASCII
* src/getlimits.c (decimal_ascii_add): Remove, replacing with ...
(decimal_absval_add_one): New function, with different signature,
which does not assume ASCII.  All callers changed.
(print_int): Remove assumptions that integers fit in 206 bits, and
that characters are ASCII.  These assumptions are portable in
practice but are easy to remove here.
2010-12-22 23:11:40 -08:00
Jim Meyering
8f90efd006 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-12-22 18:19:37 +01:00
Jim Meyering
518b92a5e3 version 8.8
* NEWS: Record release date.
2010-12-22 17:43:50 +01:00
Jim Meyering
b795e60844 csplit: update gnulib for Solaris 8,9 snprintf fix 2010-12-22 14:33:11 +01:00
Jim Meyering
887d530e62 maint: correct test-related comments
* tests/mv/i-3: Adjust comment to match just-changed code.
Spotted by Pádraig Brady.
* tests/init.cfg (retry_delay_): Correct spelling of function name
in usage example.
2010-12-22 11:52:11 +01:00
Jim Meyering
51f60a6237 tests: adjust preceding change to handle general WERROR_CFLAGS values
* gnulib-tests/Makefile.am (test_xvasprintf_CFLAGS):
(test_lock_CFLAGS, test_tls_CFLAGS): Avoid a syntax error when
$(WERROR_CFLAGS) expands to more than one token.
2010-12-22 11:10:23 +01:00
Paul Eggert
056caf4857 tests: do not assume compiler knows -Wxxx flags
* gnulib-tests/Makefile.am (test_xvasprintf_CFLAGS):
(test_lock_CFLAGS, test_tls_CFLAGS): Do not append GCC-specific
flags like -Wno-format-security unless the GCC-specific flag
-Werror is also specified.  This avoids a "make check" failure on
Solaris when using Sun C 5.8.
2010-12-22 01:48:54 -08:00
Jim Meyering
a300cfd43c tests: mv/i-3: avoid false-positive failure on a slow/busy system
* tests/mv/i-3: Quadruple the timeout duration.
Without this, I saw an expired timeout on a heavily-loaded system.
2010-12-22 10:29:30 +01:00
Jim Meyering
7ca55ef3d1 tests: avoid new false-positive failure on at least FreeBSD 8.1
* tests/mv/trailing-slash: Accommodate different diagnostic
on FreeBSD 8.1.
2010-12-21 09:30:55 +01:00
Paul Eggert
960fc61624 who: omit useless definitions of MAXHOSTNAMELEN
This prevents a compilation failure on Solaris 8, GCC 4.4.2, with
"configure --enable-gcc-warnings".
* src/who.c (MAXHOSTNAMELEN): Remove; no longer needed.
* src/pinky.c: Likewise.
2010-12-20 17:43:05 -08:00
Pádraig Brady
41159f9604 maint: fix a typo in sort --parallel help message
Also fix up Chen Guo's contacts
* src/sort.c (usage): Add a missing "of"
* THANKS: Add Chen Guo
* .mailmap: Add Chen Guo's UCLA address
2010-12-20 10:56:04 +00:00
Jim Meyering
4a423bedea build: update gnulib: ACL-vs-Solaris 8 portability etc. 2010-12-20 10:55:39 +01:00
Paul Eggert
5947491895 tests: sync init.sh from gnulib
* tests/init.sh (setup_): Initialize fail=0 before invoking mktempd_.
Ensure that IFS is defined initially.
(mktempd_): Remove fail=0 initialization; no longer needed.
2010-12-18 20:03:21 -08:00
Pádraig Brady
0eaa993ae6 wc: fix a possible hang with --files0-from
* src/wc.c (main): exit when we get a read error on
the --files0-from file, rather than retrying and
spinning the CPU
2010-12-19 00:40:27 +00:00
Pádraig Brady
e66948c3b5 cp: ensure backups are created when -T specified
* src/cp.c (do_copy): When -T is specified, initialize
the NEW_DST and SB variables, which are checked when
running: cp -T --force --backup file file
* tests/cp/backup-1: Add the -T case
2010-12-19 00:36:29 +00:00
Pádraig Brady
0e181024c0 sort: use at most 8 threads by default
* src/sort.c (main): If --parallel isn't specified,
restrict the number of threads to 8 by default.
If the --parallel option is specified, then
allow any number of threads to be set, independent
of the number of processors on the system.
* doc/coreutils.texi (sort invocation): Document the changes
to determining the number of threads to use.
Mention the memory overhead when using multiple threads.
* tests/misc/sort-spinlock-abuse: Allow single core
systems that support pthreads.
* tests/misc/sort-stale-thread-mem: Likewise.
* tests/misc/sort-unique-segv: Likewise.
* NEWS: Mention the change in behaviour.
2010-12-19 00:33:45 +00:00
Jim Meyering
eea8e7530b doc: split: add examples showing how to use the new option
* doc/coreutils.texi (split invocation): Add examples.
2010-12-18 08:04:46 +01:00
Jim Meyering
6d488ca041 tests: avoid spurious du/bigtime failure
* tests/du/bigtime: Map nonzero block count to 0.
Reported by Assaf Gordon.
* THANKS: Update.
2010-12-18 08:04:46 +01:00
Paul Eggert
c67a96c4c1 tests: set fail=0 by default
* tests/init.sh (setup_): Set fail=0.  This was the intent as per
<http://lists.gnu.org/archive/html/bug-coreutils/2010-12/msg00058.html>
but the assignment in mktempd_ is ineffective, since mktempd_
is used inside `` and its assignments are in a subshell.
2010-12-17 22:40:20 -08:00
Jim Meyering
561f8be2c9 build: update gnulib submodule to latest 2010-12-17 08:19:26 +01:00
Paul Eggert
8e81a99c26 sort: do not generate thousands of subprocesses for 16-way merge
Without this change, tests/misc/sort-compress-hang would consume
more than 10,000 process slots on my RHEL 5.5 x86-64 server,
making it likely for other applications to fail due to lack of
process slots.  With this change, the same benchmark causes 'sort'
to consume at most 19 process slots.  The change also improved
wall-clock time by 2% and user+system time by 14% on that benchmark.
* NEWS: Document this.
* src/sort.c (MAX_PROCS_BEFORE_REAP): Remove.
(reap_exited): Renamed from reap_some; this is a more accurate name,
since "some" incorrectly implies that it reaps at least one process.
All uses changed.
(reap_some): New function: it *does* reap at least one process.
(pipe_fork): Do not allow more than NMERGE + 2 subprocesses.
(mergefps, sort): Omit check for exited processes: no longer needed,
and anyway the code consumed too much CPU per line when 2 < nprocs.
2010-12-16 22:32:06 -08:00
Paul Eggert
1b31ce6982 sort: fix hang with sort --compress
* NEWS: Document this.
* src/sort.c (UNCOMPRESSED, UNREAPED, REAPED): New constants.
(struct tempnode): New member 'state', to hold these constants.
The pid member is now undefined if state == UNCOMPRESSED.
(struct sortfile): Replace member 'pid' with member 'temp'.
(uintptr): Remove.
(proctab_hasher, proctab_comparator, register_proc, delete_proc):
Proctab entries are now struct tempnode *, not pid_t, to handle
the case where multiple tempnode objects correspond to the same
pid.  This avoids a race condition that can cause a hang.
(register_proc): Arg is now struct tempnode *, not pid_t.  All
callers changed.
(delete_proc): Set tempnode state to REAPED.
(create_temp_file): No need to set pid member here; it's now
done when the pid is known.
(maybe_create_temp, create_temp): Remove PPID arg.  Return struct
tempnode *, not char *.  All callers changed.
(maybe_create_temp): Set node state to UNCOMPRESSED or UNREAPED.
No need to set node->pid to 0.
(open_temp): Replace NAME and PID args with a single TEMP arg.
All callers changed.  Wait only for unreaped children.
(zaptemp): Wait for decompressor to finish before removing its
temporary-file input.  This avoids .nfsXXXX hassles with NFS
and fixes a race (leading to a hang) regardless of NFS.
(open_input_files): Adjust to new way of dealing with temp files
and their subprocesses.
* tests/Makefile.am (TESTS): Add misc/sort-compress-hang.
* tests/misc/sort-compress-hang: New file.
2010-12-16 13:55:31 -08:00
Paul Eggert
f3c584d1e0 sort: don't dump core when merging from input twice
* NEWS: Document this.
* src/sort.c (avoid_trashing_input): The previous fix to this
function didn't fix all the problems with this code.  Replace it
with something simpler: just copy the input file.  This doesn't
change the number of files, so return void instead of the updated
file count.  Caller changed.
* tests/misc/sort-merge-fdlimit: Test for the bug.
2010-12-16 00:04:32 -08:00
Jim Meyering
33a5de5a0e doc: tail: semi-deprecate --sleep-interval and --max-unchanged-stats
Those options are useful only on systems that lack inotify support
and in the unusual event that a system with inotify support must
resort to polling.
* src/tail.c (usage): Note that the --max-unchanged-stats=N and
--sleep-interval=N options are rarely useful on systems with
inotify support.
* doc/coreutils.texi (tail invocation): Likewise.
2010-12-14 20:13:05 +01:00
Paul Eggert
14ad7a2550 sort: fix very-unlikely buffer overrun when merging to input file
* src/sort.c (avoid_trashing_input): Fix a typo that could cause a
buffer overrun in theory.  In practice this is extremely unlikely,
as it requires running out of file descriptors in a small merge,
presumably because some other process is hogging all the OS's file
descriptors.
2010-12-14 11:10:45 -08:00
Paul Eggert
8f40ed634c sort: document --compress reaper fixes
* NEWS: Document the --compress reaper fixes installed yesterday.
2010-12-14 10:22:04 -08:00
Paul Eggert
dcb3f60d0a tests: default to /tmp as the temporary directory
* tests/check.mk (TESTS_ENVIRONMENT): Default TMPDIR to /tmp,
rather than to the working directory; this is more common in
practice, which makes the tests more real-worldish; and it is
often faster.  Also, it avoids some problems with NFS cleanups.
* tests/misc/sort-compress: Remove unnecessary code setting TMPDIR.
* tests/misc/sort-compress-proc: Likewise.  Do the final sleep
only if TMPDIR is relative, which should be rarely given the
change to TESTS_ENVIRONMENT.
2010-12-14 10:08:04 -08:00
Paul Eggert
0da4d84300 sort: fix some --compress reaper bugs
* src/sort.c (uintptr): New type.
(enum procstate, struct procnode, update_proc): Remove.
(proctab_hasher, proctab_comparator, register_proc, wait_proc):
(reap_some): The proctab is now simply a hash of process-IDs
rather than of pointers to objects with reference counts and
states; this is smaller and faster and easier to understand.
(nprocs): Now pid_t, not size_t, since one cannot have more than
PID_MAX children.
(reap): If the argument is -1, wait; if 0 (a new value), do not.
Delete pid from proctab as needed.  Ignore children that are not
in proctab, as they are from the program that exec'ed us and are
irrelevant to our success or failure.
(delete_proc, reap_all): New functions.
(open_temp): Register the child.
(sort): Clean up all children afterwards; without this patch,
'sort' sometimes missed failures in children due to race conditions.
* tests/Makefile.am (TESTS): Add misc/sort-compress-proc.
* tests/misc/sort-compress-proc: New file, to test for the
bugs fixed above.
2010-12-13 23:23:47 -08:00
Paul Eggert
6d36bd4c64 tests: typo fix
* tests/misc/sort-stale-thread-mem: Fix typo in comment.
2010-12-13 10:02:43 -08:00
Jim Meyering
0c70708db7 tests: tweak basic-1 to use warn_ rather than literal "exit 77"
* tests/install/basic-1 (just_built_dd): Use warn_, rather than
cat and exit 77.
2010-12-13 08:29:42 +01:00
Jim Meyering
8351407f87 tests: mark new test as very expensive
* tests/misc/sort-stale-thread-mem: Don't initialize fail=0 here;
that is done in init.sh.  This avoids a syntax-check failure.
Invoke "Exit $fail" at end, too.
Mark as a very expensive test.
2010-12-13 08:28:19 +01:00
Paul Eggert
b212633c41 tests: test for access to stale thread memory
* tests/misc/sort-stale-thread-mem: New tests.
* tests/Makefile.am (TESTS): Add it.
2010-12-12 13:38:49 -08:00
Jim Meyering
45ff91af2e tests: avoid FP failure when run under valgrind
* tests/misc/printenv: Filter out LD_PRELOAD, as the comment
said, not LD_LIBRARY.
2010-12-11 18:44:57 +01:00
Jim Meyering
ad61335bf8 sort: avoid segfault when using two or more threads
This change does not fix the actual bug.  That was done by commit
c9db0ac6, "sort: preallocate merge tree nodes to heap".  The fix
was to store each "node" structure on the heap, not on the stack.
Otherwise, a node from one thread's stack could be used in another
thread after the first thread had expired (via pthread_join).
This bug was very hard to trigger when using spinlocks, but
easier once we began using mutexes.
* NEWS (Bug fixes): Mention it.
For details, see http://debbugs.gnu.org/7597.
2010-12-11 11:52:24 +01:00
Jim Meyering
9a9d69e9e4 sort: syntax cleanup
* src/sort.c (xfopen, debug_key, sortlines, sort, main): Adjust
formatting: fix misplaced braces, use consistent spacing,
split a 2-stmt line.
2010-12-11 11:29:38 +01:00
Paul Eggert
27e997d0eb sort: integer overflow checks in thread counts, etc.
* src/sort.c (specify_nthreads, merge_tree_init, init_node):
(queue_init, sortlines, struct thread_args, sort, main):
Use size_t, not unsigned long int, for thread counts, since thread
counts are now used to compute sizes.
(specify_nthreads): Check for size_t overflow.
(merge_tree_init, sort): Shorten name of local variable, for
readability.
(merge_tree_init): Move constants next to each other in product,
so that the constant folding is easier to see.
(init_node): Now static.  Add 'restrict' only where it might
be helpful for compiler optimization.
(queue_init): 2nd arg is now nthreads, not "reserve", which is
a bit harder to follow.  All uses changed.
(struct thread_args): Rename lo_child to is_lo_child, so that
it's obvious to the reader when we're talking about this boolean
as opposed to the new lo_child member of the other structure.
All uses changed.
(sort): Remove unused local variable end_node.
(main): Don't allow large thread counts to cause undefined behavior
later, due to integer overflow.
2010-12-11 00:29:13 -08:00
Chen Guo
c9db0ac6de sort: preallocate merge tree nodes to heap.
* src/sort.c: (merge_tree_init) New function. Allocates memory for
merge tree nodes.
(merge_tree_destory) New function.
(init_node) New function.
(sortlines) Refactor node creation code to init_node. Remove now
superfluous arguments. All callers changed.
(sort) Initialize/destory merge tree. Refactor root node creation
to merge_tree_init.
2010-12-11 00:29:13 -08:00
Paul Eggert
d1f7003556 sort: comment fix
* src/sort.c: Comment fix re spin locks.
2010-12-11 00:29:13 -08:00
Chen Guo
621876ff44 sort: use mutexes, not spinlocks (avoid busy loop on blocked output)
Running a command like this on a multi-core system
  sort < big-file | less
would peg all processors at near 100% utilization.
* src/sort.c: (struct merge_node) Change member lock to mutex.
All uses changed.
* tests/Makefile.am (XFAIL_TESTS): Remove definition, now that
this test passes once again.  I.e., the sort-spinlock-abuse test
no longer fails.
* NEWS (Bug reports): Mention this.
Reported by DJ Lucas in http://debbugs.gnu.org/7489.
2010-12-11 00:29:13 -08:00
Pádraig Brady
195c455d0a split: fix a case where --elide-empty causes invalid chunking
When -n l/N is used and long lines are present that both
span partitions and multiple buffers, one would get
inconsistent chunk sizes.

* src/split.c (main): Add a new undocumented ---io-blksize option
to support full testing with varied buffer sizes.
(cwrite): Refactor most handling of --elide-empty to here.
(bytes_split): Remove handling of --elide-empty.
(lines_chunk_split): Likewise.  The specific issue here
was the first handling of elide_empty_files interfered
with the replenishing of the input buffer.
* test/misc/split-lchunk: Add -e and the new ---io-blksize
combinations to the test.
2010-12-08 23:36:17 +00:00
Jim Meyering
a1629ba1ec tests: remove useless definition of $SORT in sort-compress
* tests/misc/sort-compress (SORT): Remove unused definition.
2010-12-05 17:07:35 +01:00
Jim Meyering
231d8719f1 tests: make it harder to lose a race in spinlock-abuse
* tests/misc/sort-spinlock-abuse: On a busy system, with only 12
pauses of length 0.1 seconds, the buggy (busy-spinlock blocked)
sort would fail to accumulate 1 second of CPU time, and hence
would mistakenly pass.  Increase from 12 to 50.
2010-12-04 11:52:21 +01:00
Paul Eggert
cd00fa6ee1 sort: merge_queue -> queue
* src/sort.c (struct thread_args, sortlines_thread, sortlines, sort):
Rename "merge_queue" to "queue", for consistency with other functions
that just use the name "queue" for these things.
2010-12-03 23:43:31 -08:00
Paul Eggert
fb282c7b30 sort: clarify queue_check_insert
* src/sort.c (queue_check_insert): Clarify body a bit, and remove
no-longer-needed comment.
2010-12-03 23:43:31 -08:00
Paul Eggert
fb41e82c77 sort: fix problems with merge node dest pointer
* src/sort.c (mergelines_node): Return void, not size_t.  All
callers changed.  Change *node->dest here, not in caller.
Do not change node->dest: it's not needed and could cause problems
on (mostly theoretical) hosts that do not allow adding integers to
null pointers.
(queue_check_insert_parent): Omit MERGED parameter; no longer needed.
All callers changed.
2010-12-03 23:43:31 -08:00
Paul Eggert
f2d977aff1 sort: simplify write_unique
* src/sort.c (write_unique): Simplify slightly so that there is
just one call to write_line, not two.
2010-12-03 23:43:31 -08:00
Paul Eggert
6f4279421d sort: put queue arg first
* src/sort.c (queue_check_insert, queue_check_insert_parent): Make
the queue arg first, for consistency with other functions such as
queue_insert that put the queue arg first.  Rename from
check_insert and update_parent, respectively.  All callers
changed.
2010-12-03 23:43:30 -08:00
Paul Eggert
f35f4b3396 sort: tune struct_merge_node slightly
* src/sort.c (struct merge_node): 'lock' is now the actual lock,
not a pointer to the lock; there's no need for indirection here.
Make 'level' unsigned int instead of size_t, since it is a
bit-shift count; also, move it next to a bool so that it's more
likely to take less space.  All uses changed.
(sortlines, sort): Spell out initialization instead of using an
initializer.  This makes the initializer a bit easier to understand,
and avoids unnecessary stores into the spin lock.
2010-12-03 23:43:30 -08:00
Paul Eggert
eb989f4b75 sort: Clarify comments
* src/sort.c: Improve comments a bit.
2010-12-03 23:43:30 -08:00
Paul Eggert
b6ef652e50 tests: cleanup rm -rf fails under NFS
This problem was observed on RHEL 5.5 x86-64 when running as a
client of a NetApp FAS2050.
* tests/cp/cp-mv-backup: Don't leave a file descriptor open to
a file in a directory that will be cleaned up with "rm -rf".
Under NFS, when the rm unlinks that file, it is instead renamed
to .nfsXXXX and then rm cannot remove the parent directory,
and the test fails.
* tests/cp/same-file: Likewise.
2010-12-03 11:09:27 -08:00
Paul Eggert
b5a25a996d cp: fix bug with fine-grained src to nearby coarse-grained dest
The actual fix is in gnulib's lib/utimecmp.c.
* NEWS: Document fix.
2010-12-03 09:56:32 -08:00
Paul Eggert
038fcfcf1b build: update gnulib submodule to latest 2010-12-03 09:53:02 -08:00
Paul Eggert
0ec869e8be sort: fix bug on 64-bit hosts with at least 32768 processors
* src/sort.c (MAX_MERGE): Avoid integer overflow when on a machine
with (say) 32-bit int and 64-bit size_t and when level == 15.
Without this fix, on such a machine with 32768 or more processors,
the level computation could overflow on large input, and this
would result in division by zero.
2010-12-01 21:51:15 -08:00
Jim Meyering
a5207bb139 tests: add test for parallel sort -u segfault bug
* tests/misc/sort-unique-segv: New file.
* tests/Makefile.am (TESTS): Add it.
2010-12-01 08:15:42 +01:00
Paul Eggert
3afda5f007 sort -u: fix a thread-race pointer corruption bug
* src/sort.c (write_unique): Save the entire "struct line", not
just a pointer to one.  Otherwise, with a multi-thread run,
sometimes, with some inputs, fillbuf would would win a race
and clobber a "saved->text" pointer in one thread just before
it was dereferenced in a comparison in another thread.
* NEWS (Bug fixes): Mention it.
2010-12-01 07:13:06 +01:00
Jim Meyering
43d1112d01 tests: don't let the OMP_NUM_THREADS envvar affect sort tests
* tests/envvar-check (vars): Add OMP_NUM_THREADS.
2010-11-27 16:32:10 +01:00
Jim Meyering
fbb47bf424 tests: test for parallel sort spinlock abuse
* tests/misc/sort-spinlock-abuse: New file.
* tests/Makefile.am (TESTS): Add it.
(XFAIL_TESTS): Mark this as an expected-to-fail (for now) test.
2010-11-27 16:32:06 +01:00
Pádraig Brady
b8cd747cc8 tsort: suppress a valgrind memory leak warning
* src/tsort.c (tsort): Unconditionally invoking the free()
doesn't increase scalability, so do it only with -Dlint
2010-11-27 03:27:49 +00:00
Pádraig Brady
67f7ed3e3a maint: update the valgrind support script
* README-valgrind: Include the "noinst" programs in
those wrapped by valgrind.  Update $PATH in check.mk
rather than Makefile.am.  Make wrapper scripts
work when suppressions not setup.  Keep lines < 80 chars.
2010-11-24 13:39:47 +00:00
Paul Eggert
013d95af11 cp: give a better diagnostic for nonexistent dest/
This patch was written by Jim Meyering and myself.
* src/copy.c (copy_reg): Turn EISDIR to ENOTDIR to improve the
quality of diagnostics for commands like "cp a nosuch/".  Reported
by Марк Коренберг and Alan Curry in the thread starting at:
http://lists.gnu.org/archive/html/bug-coreutils/2010-11/msg00178.html
* THANKS: Update.
* tests/mv/trailing-slash: Add a test.
2010-11-22 00:04:50 -08:00
Chen Guo
be107398e5 split: add --number to generate a particular number of files
* src/split.c (usage, long_options, main): New options --number,
--unbuffered, --elide-empty-files.
(set_suffix_length): New function to auto increase suffix length
to handle a specified number of files.
(create): New function.  Refactored from cwrite() and ofile_open().
(bytes_split): Add max_files argument to support byte chunking.
(lines_chunk_split): New function.  Split file into chunks of lines.
(bytes_chunk_extract): New function.  Extract a chunk of file.
(of_info): New struct.  Used by functions lines_rr and ofile_open
to keep track of file descriptors associated with output files.
(ofile_open): New function.  Shuffle file descriptors when there
are more output files than available file descriptors.
(lines_rr): New function to distribute lines round-robin to files.
(chunk_parse): New function.  Parses K/N syntax.
* tests/misc/split-bchunk: New test for byte chunking.
* tests/misc/split-lchunk: New test for line delimited chunking.
* tests/misc/split-rchunk: New test for round-robin chunking.
* tests/Makefile.am: Reference new tests.
* tests/misc/split-fail: Add failure scenarios for new options.
* tests/misc/split-l: Fix a typo. s/ln/split/.
* doc/coreutils.texi (split invocation): Document --number.
* NEWS: Mention the new feature.
* .mailmap: Map new email address for shortlog.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-11-22 01:45:15 +00:00
Jim Meyering
dadca988af build: update gnulib to fix a syntax error in a test 2010-11-19 14:29:32 +01:00
Jim Meyering
c2bdd17856 maint: avoid NEWS-related syntax-check failure
* NEWS: Add 2nd blank line to separate latest changes from
those of 8.7, to avoid syntax-check failure.
2010-11-18 21:16:27 +01:00
Paul Eggert
a71c22fdf0 od: fix bugs in displaying floating-point values
* NEWS: Describe patch.
* bootstrap.conf (gnulib_modules): Add ftoastr.
* src/od.c: Include ftoastr.h, not float.h.
(FLT_DIG, DBL_DIG): Remove.  No need to verify LDBL_DIG.
(FMT_BYTES_ALLOCATED): No need to worry about floating point now,
since this format is no longer used for floating point.
(PRINT_FIELDS): New macro, with most of the guts of the old PRINT_TYPE.
(PRINT_TYPE): Rewrite to use PRINT_FIELDS.
(PRINT_FLOATTYPE): New macro.  This uses the new functions from
ftoastr.
(print_float, print_double, print_long_double): Reimplement
using PRINT_FLOATTYPE.
(decode_one_format): Calculate field widths based on ftoastr-supplied
macros.
* tests/Makefile.am (TESTS): Add misc/od-float.
* tests/misc/od-float: New file.
2010-11-18 09:51:04 -08:00
Paul Eggert
cf90729e09 build: update gnulib submodule to latest 2010-11-18 09:33:49 -08:00
Jim Meyering
c1b41c5c3b maint: syntax-check: prevent new $VERBOSE/--version tests
* cfg.mk (sc_prohibit_verbose_version): New rule.
2010-11-18 06:29:54 +01:00
Jim Meyering
ae5cfc9f12 tests: convert tests/misc/selinux manually 2010-11-17 21:46:57 +01:00
Jim Meyering
8f9be76b0d tests: convert the multi-prog $VERBOSE/--version uses
E.g.,

-test "$VERBOSE" = yes && { env -- pwd --version; readlink --version; }
+print_ver_ pwd readlink

-test "$VERBOSE" = yes && { stdbuf --version; mv --version; }
+print_ver_ stdbuf mv

Use this command:
git grep -l 'VERBOSE.*--version'|xargs perl -ni \
  -e '/^test "\$VERBOSE" = yes && { .*--version/ or print,next;' \
  -e 's/env -- //g;' \
  -e 's/test "\$VERBOSE" = yes && { /print_ver_ /;' \
  -e ' s/(\w+) --version;/$1/g; s/ *}$//; print'
2010-11-17 21:46:25 +01:00
Jim Meyering
a8c8484ee1 tests: convert "... env -- prog --version" uses
E.g.,

-test "$VERBOSE" = yes && env -- pwd --version
+print_ver_ pwd

git grep -l 'VERBOSE.*--version'|xargs perl -pi -e \
  's/test "\$VERBOSE" = yes && env -- (\w+) --version/print_ver_ $1/'
2010-11-17 21:46:22 +01:00
Jim Meyering
293c37b906 tests: substitute the single-program $VERBOSE/--version uses
Automatically make all of the changes like this:

  -test "$VERBOSE" = yes && chgrp --version
  +print_ver_ chgrp

git grep -l 'VERBOSE.*--version'|xargs perl -pi -e \
  's/test "\$VERBOSE" = yes && (\w+) --version/print_ver_ $1/'
2010-11-17 21:45:51 +01:00
Jim Meyering
5c0275e953 tests: factor out VERBOSE-only --version-printing code
* tests/init.cfg (print_ver_): New function.
2010-11-17 21:34:54 +01:00
Jim Meyering
11d3389f5a tests: remove test-lib.sh; now all tests use gnulib's init.sh
* tests/test-lib.sh: Remove file.  No longer used.
* tests/Makefile.am (EXTRA_DIST): Remove it here, too.
* tests/sample-test: Correct a comment.
2010-11-17 20:48:57 +01:00
Jim Meyering
fbcc100f5b tests: convert remaining uses of test-lib.sh to init.sh
RHS='. "\${srcdir=.}/init.sh"; path_prepend_ ../src'
git grep -l test-lib.sh \
  | xargs perl -pi -e 's,^\. \$srcdir/test-lib\.sh$,'"$RHS",
2010-11-17 20:48:57 +01:00
Jim Meyering
ff7f0ff85c tests: convert 'if test "$VERBOSE" = yes; then' to test ... && 2010-11-17 20:48:57 +01:00
Jim Meyering
f38becab02 tests: convert first batch of tests from test-lib.sh to init.sh
Initially, I did this,
git grep -l srcdir/test-lib.sh|xargs perl -p0i -e '~180-byte script'
but that line would have been much longer than the maximum permitted
by coreutils' commit hook, and wasn't readable besides, so here's a
more readable version:

lhs=$(printf '%s\\n' \
'if test "$VERBOSE" = yes; then' \
'  set -x' \
'  touch --version' \
'fi' \
'' \
'. $srcdir/test-lib.sh' \
  | sed 's/\$/\\\$/g;s/touch/(\\w+)/')

rhs=$(printf '%s\\n' \
'. "${srcdir=.}/init.sh"; path_prepend_ ../src' \
'test "$VERBOSE" = yes && FIXME --version' \
  | sed 's/\$/\\\$/g;s/FIXME/\$1/')

git grep -l srcdir/test-lib.sh|xargs perl -p0i -e "s,$lhs,$rhs,"
2010-11-17 20:48:57 +01:00
Jim Meyering
30b74dfff1 tests: move a comment so automated conversion works 2010-11-17 20:48:57 +01:00
Jim Meyering
01a27b9054 maint: add a NEWS-checking syntax-check rule
* cfg.mk (sc_NEWS_two_empty_lines): New syntax-check rule.
2010-11-17 20:48:56 +01:00
Pádraig Brady
79adacc431 build: add patch as a bootstrap dependency
* bootstrap.conf (buildreq): require `patch` as it's used
by gnulib-tool to apply local diffs to gnulib modules
2010-11-16 07:39:06 +00:00
Pádraig Brady
9ad13ad14a split: fail immediately if impossible to create a large file
* src/split.c (main): Error if -[bC] value > OFF_T_MAX
* tests/misc/split-fail: Adjust for the new lower limits
2010-11-16 00:50:09 +00:00
Pádraig Brady
c8d570c2b3 truncate: fix a very unlikely case for undiagnosed errors
src/truncate.c (main): Use a bool to store if an error occurred,
rather than an int, to protect against overflow.
(do_ftruncate): Likewise.   Also change 0/false to mean failure
rather than success.
2010-11-16 00:47:36 +00:00
Pádraig Brady
0d1ba34494 maint: fix a new -Wpointer-sign gcc warning
* src/csplit.c (max_out): Fix a new warning introduced with
commit 6568b173, 2010-11-10, "csplit: do not rely on..."
2010-11-16 00:38:12 +00:00
Pádraig Brady
f9cfda6ad2 build: enable the -Wpointer-sign gcc warning
... when configured with the --enable-gcc-warnings option.
This follows on from commit 34ef0a01, 2010-10-14,
"sort: fix unportable cast of unsigned char * -> char *"

* configure.ac: -Wall implicitly enables this warning
so remove the explicit disabling.
2010-11-16 00:05:41 +00:00
Pádraig Brady
b19733bb42 maint: add a missed fadvise-tests module
* gl/modules/fadvise-tests: Add the module previously missed
in commit 63b5e816, 2010-07-14, "fadvise: new module ...".
* gl/tests/test-fadvise.c: Add a comment as to why we don't
check return values.
2010-11-15 14:56:24 +00:00
Paul Eggert
f70c7b785b doc: tweak NEWS and coreutils.texi
* doc/coreutils.texi (stat invocation): Add sentence-ending period.
* NEWS: Correct stat change description: s/floating point //.
* cfg.mk (old_NEWS_hash): Update, to match this NEWS change.
2010-11-13 22:02:29 +01:00
Jim Meyering
ee6f187b18 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-11-13 17:37:18 +01:00
Jim Meyering
e143ba52c4 version 8.7
* NEWS: Record release date.
2010-11-13 17:21:08 +01:00
Jim Meyering
d2e0f3602e build: update gnulib...
...to fix the failing update-copyright test,
and for the openat portability fix.
2010-11-13 15:45:56 +01:00
Jim Meyering
2d5b3329a2 build: update gnulib for linux 2.6.9 nanosleep workaround
Also, do the following to avoid "make syntax-check" failure
induced by new rules.
* .x-sc_bindtextdomain: Exempt files with an #ifdef'd "main".
* Makefile.am: Add this file.
2010-11-13 11:41:02 +01:00
Jim Meyering
ff5fc553f9 maint: remove fstimeprec (variable precision time stamp) support
The implementation of variable-precision time stamps relied
on heuristics that made the output subtly nondeterministic,
or at least hard to reproduce:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/21531/focus=21538
So, for now at least, we're removing that feature.
* bootstrap.conf (gnulib_modules): Remove fstimeprec.
* gl/lib/fstimeprec.c, gl/lib/fstimeprec.h: Remove files.
* gl/modules/fstimeprec, gl/modules/fstimeprec-tests: Likewise.
* gl/tests/test-fstimeprec.c: Remove file.
2010-11-13 11:41:02 +01:00
Jim Meyering
4a8e9bf14c stat: do not provide variable precision time stamps
* src/stat.c: Don't include fstimeprec.c.
(out_epoch_sec): Don't call fstimeprec.
* NEWS: Update description.
* doc/coreutils.texi: Likewise.
2010-11-13 11:40:52 +01:00
Paul Eggert
6568b173db csplit: do not rely on undefined behavior in printf formats
* doc/coreutils.texi (csplit invocation): Say that %d and %i are
aliases for %u.
* src/csplit.c (FLAG_THOUSANDS, FLAG_ALTERNATIVE): New constants.
(get_format_flags): Now take char const * and int * and return
size_t.  It now stores info about the flags instead of merely
scanning them.  Also, it handles '0' correctly.  Drop support for
the undocumented '+' and ' ' flags since the value is unsigned.
Add support for the (undocumented) "'" flag.  All uses changed.
(get_format_width, get_format_prec): Remove.
(check_format_conv_type): Renamed from get_format_conv_type, with
a different signature.  It now converts the format to one that is
compatible with unsigned int, and checks flags.  All uses changed.
(max_out): Have snprintf compute the number of bytes needed rather
than attempting to do it ourselves (which doesn't work portably
with outlandish formats such as %4294967296d).
(check_format_conv_type, main): Check for overflow in size
calculations.  Don't assume size_t fits in unsigned int.
* tests/misc/csplit: Check for proper handling of flags, with
%0#6.3x.  Coreutils 8.6 mishandles this somewhat-weird example.
2010-11-11 08:16:24 +01:00
Pádraig Brady
0339eb4598 csplit: fix a memory leak per input buffer
* src/csplit.c (free_buffer): Also free the line offsets buffers
(remove_line): Also free the containing structure
* tests/misc/csplit-heap: A new test to trigger with leaks of
this magnitude.
* tests/Makefile.am: Reference the new test
* NEWS: Mention the fix
Reported by David Hofstee
2010-11-11 01:40:12 +00:00
Jim Meyering
7727908335 tests: fix comments and --version invocation in new test
* tests/misc/csplit-1000: Fix comments and --version invocation.
2010-11-10 22:08:05 +01:00
Jim Meyering
0cfd4f2161 csplit: avoid buffer overrun when writing more than 999 files
Without this fix, seq 1000 | csplit - /./ '{*}' would write
the NUL-terminated file name, xx1000, into a buffer of size 6.
* src/csplit.c (main): Use properly sized file name buffer.
* NEWS (Bug fixes): Mention it.
* tests/misc/csplit-1000: New test to trigger the bug.
* tests/Makefile.am (TESTS): Add misc/csplit-1000.
2010-11-10 14:28:03 +01:00
Pádraig Brady
425503c807 tests: avoid portability problem with dash vs. symlinked ttys
* tests/mv/i-3: Adjust so that the symlink is resolved
before redirecting to the background command, as otherwise
the stdin descriptor passed to the command will fail the
isatty() or ttyname() test.
2010-11-09 12:43:20 +00:00
Pádraig Brady
4a14a80bd1 tests: avoid portability problem with dash vs. local v=$splittable_val
* tests/init.cfg (retry_delay_): Adjust awk script to print a single
floating point value, rather than many.
2010-11-08 11:26:08 +01:00
Jim Meyering
dd45755406 tests: don't disqualify FreeBSD 8.1's /bin/sh just yet,
because dash-0.5.6-2.fc14.x86_64 would also be disqualified.
This reverts part of yesterday's commit 6c058b2d, "tests: avoid
failure due to bug in FreeBSD 8.1's /bin/sh".  Note that the offending
aspect of those shells is not officially a bug, since "local" is not
specified by POSIX.  However, it is very unintuitive that prepending
"local" to an existing, standards-compliant assignment would evoke
such a fundamental change in semantics.
* tests/init.sh: Remove snippet requiring sane "local" support.
Upstream dash bug report:
http://thread.gmane.org/gmane.comp.shells.dash/419
2010-11-07 21:08:37 +01:00
Paul Eggert
ca9aa75960 stat: do not rely on undefined behavior in printf formats
* src/stat.c (digits, printf_flags): New static vars.
(make_format): New function.
(out_string, out_int, out_uint, out_uint_o, out_uint_x):
(out_minus_zero): Use it to avoid undefined behavior when invoking
printf.
(print_it): Check for invalid conversion specifications such as
%..X and %1-X, which would otherwise rely on undefined behavior
when invoking printf.
* tests/misc/stat-nanoseconds: Check that the "I" printf flag
doesn't mess up in the C locale, as it formerly did on non-GNU
hosts.
2010-11-06 18:09:44 -07:00
Jim Meyering
6c058b2dab tests: avoid failure due to bug in FreeBSD 8.1's /bin/sh
* tests/init.sh: Arrange not to accept FreeBSD 8.1's /bin/sh, since
it fails this test: /bin/sh -c 'f(){ local s=$IFS; test -n "$s"; }; f'
* tests/init.cfg (sanitize_path_): Stop-gap measure to work around
a bug in FreeBSD 8.1's /bin/sh.  We'll un-do this change once all
300+ tests use init.sh.
2010-11-06 15:24:53 +01:00
Jim Meyering
3261914da1 build: update gnulib to latest for strtod and icc fixes 2010-11-06 15:24:53 +01:00
Paul Eggert
c7375c236c stat: use e.g. %.3X instead of %X.%3:X for sub-second precision
* NEWS: Document this.
* doc/coreutils.texi (stat invocation): Likewise.
* gl/lib/fstimeprec.c, gl/lib/fstimeprec.h, gl/modules/fstimeprec:
* gl/modules/fstimeprec-tests, gl/tests/test-fstimeprec.c:
New files.
* bootstrap.conf (gnulib_modules): Add fstimeprec.
* src/stat.c: Include fstimeprec.h.  Don't include xstrtol.h.
(decimal_point, decimal_point_len): New static vars.
(main): Initialize them.
(epoch_sec, out_ns): Remove.
(out_int, out_uint): Now returns whatever printf returned.
(out_minus_zero, out_epoch_secs): New functions.
(print_stat): Use out_epoch_sec instead of out_ns and epoch_sec.
(print_stat, print_it, usage): Remove the %:X-style formats.
* tests/misc/stat-nanoseconds: Set TZ=UTC0 to avoid problems
with weird time zones.  Use a time stamp near the Epoch so that we
don't have to worry about leap seconds.  Redo test cases to match
new behavior.
* tests/touch/60-seconds: Change %Y.%:Y to %.9Y, to adjust to
new behavior.
2010-11-06 15:24:49 +01:00
Eric Blake
312549b627 cp: NEWS entry for previous fix
Resolves bug#7324

* NEWS: Document the extent of the Solaris crash.
2010-11-04 10:51:01 -06:00
Eric Blake
7b4e77352d cp, mv, touch: fix file time manipulation on Solaris 10
* gnulib: Update to latest, for futimens fix.
* .gitignore: Ignore another recent gnulib-generated file.
2010-11-04 08:34:07 -06:00
Jim Meyering
1369fe9284 build: update gnulib to latest 2010-11-03 13:11:21 +01:00
Jim Meyering
db42ae787d stat: revert %X-%Y-%Z change; use e.g., %:X to print fractional seconds
This reverts part of the recent commit 9069af45,
"stat: print timestamps to full resolution", which made %X, %Y, %Z
print floating point numbers.  We prefer to retain portability of
%X, %Y and %Z uses, while still providing access to full-resolution
time stamps via modified format strings.  Also make the new
%W consistent.
* src/stat.c: Include "xstrtol.h".
(print_it): Accept a new %...:[XYZ] format directive,
e.g., %:X, to print the nanoseconds portion of the corresponding time.
For example, %3.3:Y prints the zero-padded, truncated, milliseconds
part of the time of last modification.
(print_it): Update print_func signature to match.
(neg_to_zero): New helper function.
(epoch_time): Remove function; replace with...
(epoch_sec): New function; use timetostr.
(out_ns): New function.  Use "09" only when no other modifier
is specified.
(print_statfs): Change type of "m" to unsigned int,
now that it must accommodate values larger than 255.
(print_stat): Likewise.
Map :X to a code of 'X' + 256.  Likewise for Y, Z and W.
(usage): Update.
* tests/touch/60-seconds: Use %Y.%:Y in place of %Y.
* tests/misc/stat-nanoseconds: New file.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Changes in behavior): Mention this.
With improvements by Pádraig Brady.
Thanks to Andreas Schwab for raising the issue.
2010-11-03 13:10:50 +01:00
Nix
272f8bf0ac tests: fix a false positive for 32 bit on 64 bit hosts
* tests/ls/stat-free-symlinks: strace currently outputs an
informational message about arch difference to stdout.
Therefore we need to strip that before comparison.
2010-11-01 16:02:39 +00:00
Patrick W. Plusnick II
30e207fa46 maint: remove an unnecessary FIXME comment
* src/seq.c (terminator): This does not need to be specifiable
via an option.  Remove the FIXME comment.
2010-10-28 15:22:08 +02:00
Pádraig Brady
883ac22239 cp: make --attributes-only override --reflink completely
* doc/coreutils.texi (cp invocation): Change the description slightly
so as users might not immediately discount using this option.
Mention that --reflink is overridden by the other linking options and
--attributes-only, and give an example where this might be useful.
* src/copy.c (copy_internal): Bypass the reflink if
--attributes-only is specifed.
* tests/cp/reflink-perm: Ensure both --reflink modes are
overridden by --attributes-only.
* NEWS: Mention the change in behavior.
Reported by Jim Meyering.
2010-10-27 11:18:51 +01:00
Jim Meyering
0d792d061e tests: mention that btrfs also causes failure of misc/ls-time
* tests/misc/ls-time: Mention that this test also fails on btrfs,
at least until http://bugzilla.redhat.com/591068 is addressed.
2010-10-26 18:14:50 +02:00
Eric Blake
3e1905baf4 maint: update THANKS
* THANKS: Update.
2010-10-25 11:51:45 -06:00
Tobias Quathamer
7930367a34 date: correct typos in date --help
* src/date.c (usage): Use "e.g." correctly.
2010-10-25 11:45:27 -06:00
Pádraig Brady
c84ddbaa33 tail: support rechecking currently missing remote dirs
src/tail.c (main): As an optimization, don't bother checking
for stdin or remote files, when ---disable-inotify is specified.
To improve the fix in commit 61b77891, set the disable_inotify
flag when we fall back to polling, so that we recheck remote files.
NEWS: Mention the fix
2010-10-25 15:41:53 +01:00
Paul Eggert
7d93a082b6 du: don't print junk when diagnosing out-of-range time stamps
* src/du.c (show_date): Fix call to fputs with a buffer that
contains some uninitialized data.
* tests/Makefile.am (TESTS): Add du/big-timestamp.
* tests/du/bigtime: New file, which checks for the bug.
2010-10-23 17:24:38 -07:00
Rodrigo Campos
d5d82ecf3b doc: add a cross reference from cat's man page to "tac"
* man/cat.x: See also "tac".
2010-10-20 08:35:50 +02:00
Jim Meyering
10a0bdfa98 tests: trigger and test for md5sum's new diagnostics
* tests/misc/md5sum: Test for new diagnostics.
2010-10-19 09:35:44 +02:00
Benno Schulenberg
407806b27f md5sum: print a summary warning for improperly formatted lines
And remove the now-superfluous totals from the other two warnings,
so the plurals will also work in other languages than English.

* src/md5sum.c (digest_check): Change as above.
* tests/misc/md5sum (check-quiet2): Adjust accordingly.
2010-10-19 09:32:38 +02:00
Jim Meyering
3c7112104d build: enable -Werror for gnulib-tests, too
* gnulib: Update to latest for warning-free tests.
* gnulib-tests/Makefile.am (AM_CFLAGS): Uncomment $(WERROR_CFLAGS),
now that these tests are warning-free.
2010-10-18 07:28:36 +02:00
Jim Meyering
840e8c9cfb maint: update bootstrap from gnulib
* bootstrap: Update from gnulib.
2010-10-17 15:56:01 +02:00
Jim Meyering
b1b23d894b .gitignore: anchor patterns
* .gitignore: Anchor most patterns.  Remove .tarball-version.
* doc/.gitignore: Anchor all patterns.
Remove getdate.texi and get_date.texi.
2010-10-17 15:55:13 +02:00
Jim Meyering
766ec503f7 tests: sort-float: avoid spurious test failure on ppc/ppc64
* tests/misc/sort-float: On systems with DBL_MIN < LDBL_MIN,
this test would fail because the expected output was not sorted.
Detect that case, and if needed, reverse those two values.
2010-10-17 09:18:57 +02:00
Andreas Schwab
9c589e694f fold: fix fadvise hint
* src/fold.c (fold_file): Apply fadvise to istream, not stdin.
This bug would have inhibited the fadvise optimization when not
reading from standard input.
2010-10-16 13:32:04 +02:00
Jim Meyering
6728401351 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-10-15 17:06:56 +02:00
Jim Meyering
7612e5c5c6 version 8.6
* NEWS: Record release date.
2010-10-15 16:50:15 +02:00
Jim Meyering
ff8d38e100 build: update gnulib for vasnprintf fix 2010-10-15 07:49:54 +02:00
Paul Eggert
6b9ab1831f bug#7213: [PATCH] sort: fix buffer overrun on 32-bit hosts when warning re obsolete keys
* src/sort.c (key_warnings): Local buffer should be of size
INT_BUFSIZE_BOUND (uintmax_t), not INT_BUFSIZE_BOUND (sword).
This bug was discovered by running 'make check' on a 32-bit
Solaris 8 sparc host, using Sun cc.  I saw several other instances
of invoking umaxtostr on a buffer declared to be of size
INT_BUFSIZE_BOUND (VAR), and these instances should at some point
be replaced by INT_BUFSIZE_BOUND (uintmax_t) too, as that's a
less error-prone style.
2010-10-14 11:39:14 +02:00
Paul Eggert
7324fba675 tests: work around portability and clock-skew problems
* tests/misc/ls-misc (push_ls_colors): Don't assume LS_COLORS
is set.  This part of the fix is by Jim Meyering.
(sl-dangle2, sl-dangle3, sl-dangle4, sl-dangle5): Don't assume
that newly-created files will have time stamps in the past.  They
might not, due to clock skew, if the file systems are remote.
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/21322/focus=21346
2010-10-14 09:23:51 +02:00
Paul Eggert
c586bff1c0 install: avoid warning with Solaris 10 cc
* src/install.c (extra_mode): Don't assign ~S_IRWXUGO & ~S_IFMT
to a mode_t variable, as the number might be too big to fit.
Solaris 10 cc warns about this, and the C standard says it
has undefined behavior.
2010-10-13 22:41:21 -07:00
Paul Eggert
4015f93d30 mbsalign: avoid warning with Solaris 10 cc
* gl/lib/mbsalign.c: Include <stdint.h> for SIZE_MAX.
Use SIZE_MAX rather than (size_t) -1, to avoid warning for
"size_t x = -1" on Solaris 10 cc.
* gl/modules/mbsalign (Depends-on): Add stdint.
2010-10-13 22:41:17 -07:00
Paul Eggert
34ef0a01f0 sort: fix unportable cast of unsigned char * -> char *
* src/sort.c (fold_toupper): Change this back from char to
unsigned char, fixing a portability issue introduced in commit
59e2e55d0f dated February 26, as the
C Standard doesn't let you convert from unsigned char * to char *
without a cast, and the (in theory more portable) style here is to
convert char values, not pointer values.
(getmonth): Convert char to unsigned char when needed for
comparison.
2010-10-13 22:41:13 -07:00
Jim Meyering
71a3fd73a1 build: prepare to enable -Werror also for gnulib-tests/
* configure.ac (GNULIB_WARN_CFLAGS): Define new variable, for use
in gnulib-tests.
* gnulib-tests/Makefile.am: Disable specific -W___ options,
but only for a few specific offending tests:
(test_xvasprintf_CFLAGS): Define.
(test_lock_CFLAGS, test_tls_CFLAGS): Define.
2010-10-13 11:20:18 +02:00
Paul Eggert
9300fffcb5 tests: fix rand-isaac test
* gl/tests/test-rand-isaac.c (main): Fix swapped arguments to strtol.
2010-10-13 09:03:41 +02:00
Pádraig Brady
61b77891c2 tail: fix checking of currently unavailable directories
* src/tail.c (tail_forever_inotify): Handle the case where
tail --follow=name with inotify, is not able to add a watch on
a specified directory.  This may happen due to inotify resource
limits or if the directory is currently missing or inaccessible.
In all these cases, revert to polling which will try to reopen
the file later.  Note inotify returns ENOSPC when it runs out
of resources, and instead we report a particular error message,
lest users think one of their file systems is full.
(main): Document another caveat with using inotify, where we
currently don't recheck directories recreated after the
initial watch is setup.
* tests/tail-2/F-vs-rename: Fix the endless loop triggered by
the above issue.
* tests/tail-2/inotify-hash-abuse: Likewise.
* tests/tail-2/wait: Don't fail in the resource exhaustion case.
* tests/tail-2/F-vs-missing: A new test for this failure mode
which was until now just triggered on older buggy linux kernels
which returned ENOSPC constantly from inotify_add_watch().
* NEWS: Mention the fix.
2010-10-12 11:41:17 +01:00
Jim Meyering
9f4744534f build: update gnulib to latest; to fix failing Solaris 5.11 test 2010-10-11 22:41:12 +02:00
Jim Meyering
938435ee30 maint: add new file: .mailmap
* .mailmap: Map git author names and email addresses to
canonical/preferred form.  This file is used e.g., by "git shortlog".
2010-10-11 19:50:44 +02:00
Jim Meyering
9af44d937e build: update gnulib, to fix OpenBSD test failures 2010-10-08 22:15:15 +02:00
Jim Meyering
fdfc5cf0c1 build: update gnulib to latest; for parse-datetime.y fix 2010-10-08 08:15:34 +02:00
Jim Meyering
ab9d2d2d46 build: update gnulib to latest, to avoid FreeBSD compilation failure:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/23501
2010-10-08 08:15:34 +02:00
Pádraig Brady
758916b49e split: fix reporting of read errors
The bug was introduced with commit 23f6d41f, 19-02-2003.

* src/split.c (bytes_split, lines_split, line_bytes_split):
Correctly check the return from full_read().
* tests/misc/split-fail: Ensure split fails when
it can't read its input.
* NEWS: Mention the fix.
2010-10-07 20:08:16 +01:00
Jim Meyering
6483f0e1bd build: update gnulib to latest, for memmem/strstr fix 2010-10-06 09:31:21 +02:00
Jim Meyering
61d1c5cb3c maint: describe coreutils' policy on copyright year number ranges
* README: Mention coreutils' long-standing policy on use of M-N
ranges in copyright year lists.  Requested by Richard Stallman.
2010-10-06 00:38:25 +02:00
Eric Blake
2f41f563d1 build: complete the rename of get_date
* gnulib: Update to latest.
* src/date.c (includes, batch_convert, main): Track rename.
* src/touch.c (includes, get_reldate): Likewise.
* doc/coreutils.texi (Top, Date input formats): Likewise.
* bootstrap.conf (gnulib_modules): Likewise.
* doc/Makefile.am (EXTRA_DIST): Likewise.
* doc/.gitignore: Likewise.
* bootstrap: Synchronize from upstream.
2010-10-05 12:12:30 -06:00
Eric Blake
b7459696dc stat: drop %C support when printing file system details
* src/stat.c (print_statfs, usage): Drop %C, since it applies to
files, not file systems.
(out_file_context): Match style of other out_* functions.
(print_stat): Update caller.
* doc/coreutils.texi (stat invocation): Document %C.
* NEWS: Document the change.
2010-10-05 09:07:58 -06:00
Eric Blake
4c286d341a build: fix build on Solaris 10
* gnulib: Update to latest, for reduced -lgen scope.
* bootstrap: Synchronize from upstream.
Reported by Clemens Brogi, as bug #7142.
2010-10-05 08:38:22 -06:00
Pádraig Brady
77063bf819 stat: adjust the printing of SELinux context
* src/stat.c (default_format): Don't print SELinux context
when in file system (-f) mode, as the context is associated
with the file, not the file system.
Fix logic inversion, so that in terse mode, %C is included
only when is_selinux_enabled and not vice versa.
2010-10-05 11:00:10 +01:00
Pádraig Brady
6ad89f2233 tests: refactor the stat-birthtime test to use retry_delay_
* tests/misc/stat-birthtime: This recently added test
fits the pattern of requiring a delay to pass, so get
it to use retry_delay_()
2010-10-04 16:54:22 +01:00
Jim Meyering
2006aeba9d maint: add a release prerequisite: check the NixOS/Hydra autobuilder
* README-release: Add a note to check the autobuilder.
2010-10-03 20:48:53 +02:00
Jim Meyering
c333ff1b0c build: update gnulib submodule to latest 2010-10-03 20:42:41 +02:00
Jim Meyering
5862b677f1 maint: suppress a bogus used-uninitialized warning in tr.c
* src/tr.c (string2_extend): Insert an abort call to tell
gcc that char_to_repeat is not used uninitialized.
2010-10-03 20:42:41 +02:00
Eric Blake
d4f304d721 tests: output --version of program under test
This touches all new tests added since commit b062bbd9, when
init.cfg was added.  Older tests still exist that could use
conversion, but we can address those later.

* tests/sample-test: Restore hint for --version output.
* tests/misc/stat-birthtime: Include --version if verbose.
* tests/misc/tr-case-class: Likewise.
* tests/misc/stat-mount: Likewise.
* tests/misc/sort-unique: Likewise.
* tests/misc/sort-benchmark-random: Likewise.
Suggested by Jim Meyering.
2010-10-01 15:43:23 -06:00
Eric Blake
7a5ecae996 stat: print SELinux context when available
* src/stat.c (default_format): Include context when present.
* NEWS: Update blurb explaining the replacement for -Z.
2010-10-01 15:27:27 -06:00
Eric Blake
2c14ec962a stat: optimize and translate default format strings
Yes, this patch intentionally leaks the results of default_format(),
since it is called only twice, and since the results are in scope
until main() exits.  Not worth the extra code to pacify valgrind.

* src/stat.c (main): Hoist default format computation out of loop.
(do_statfs, do_stat): Move default format generation...
(default_format): ...into new function.  Allocate the result in
pieces, rather than repeating mostly-similar chunks.  Allow
translation of verbose format.  Pass a second format to do_stat,
for the one aspect of the default format that is conditional on
file type.
* NEWS: Document the translation aspect.
2010-10-01 15:24:39 -06:00
Eric Blake
9069af45e6 stat: print timestamps to full resolution
* src/stat.c (epoch_time): New function.
(print_stat): Use it for %[WXYZ].
* NEWS: Document this.
* tests/touch/60-seconds: Adjust test to match.
* tests/misc/stat-birthtime: Likewise.
2010-10-01 10:43:41 -06:00
Eric Blake
abe5c1f9bc stat: support printing birthtime
* src/stat.c (print_stat): New %w and %W formats.
(do_stat): Include %w in default format.
(usage): Document new specifiers.
* doc/coreutils.texi (stat invocation): Likewise.
* NEWS: Likewise.
2010-10-01 10:43:25 -06:00
Eric Blake
1129cb58ba maint: update sample test template
* tests/sample-test: Recommend modern idiom.
2010-10-01 10:20:39 -06:00
Pádraig Brady
288bfea72c maint: ensure the mbsalign module is C89 compatible
This module may be moved to gnulib at some stage,
so keep it C89 compatible.

* gl/lib/mbsalign.c (mbsalign): Declare variables at start of scope
(ambsalign): Likewise
* gl/lib/mbsalign.h: Remove trailing comma from enum
Reported by Andrei Suhan
2010-10-01 16:30:31 +01:00
Eric Blake
6067d05228 maint: update gnulib
* gnulib: Update to latest.
* doc/coreutils.texi (date): Reflect new module name.
* doc/Makefile.am (EXTRA_DIST): Likewise.
* doc/.gitignore: Likewise.
2010-09-30 15:57:19 -06:00
Eric Blake
68062ca607 maint: update gnulib
* gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Reflect new module name.
* bootstrap: Resync from upstream.
2010-09-30 15:29:07 -06:00
Jim Meyering
65b50c6cdd maint: mention the du-exclude--vs--cycle-dir fix
* NEWS (Bug fixes): Mention the du-exclude--vs--cycle-dir fix.
Reported by Graham Cobb in http://bugs.debian.org/598438,
that bug was fixed by the 2010-07-24 commit, 77428214f,
"du: tune, and fix some -L bugs with dangling or cyclic symlinks"
2010-09-30 14:24:42 +02:00
Jim Meyering
724e993104 build: update gnulib submodule to latest 2010-09-29 16:27:15 +02:00
Pádraig Brady
3f48829c29 tr: fix various issues with case conversion
This valid translation spec aborted:
  LC_ALL=en_US.iso-8859-1 tr '[:upper:]- ' '[:lower:]_'
This invalid translation spec aborted:
  LC_ALL=en_US.iso-8859-1 tr '[:upper:] '  '[:lower:]'
This was caused by commit 6efd1046, 05-01-2008,
"Avoid tr case-conversion failure in some locales"

This misaligned conversion spec was allowed:
  LC_ALL=C tr 'A-Y[:lower:]' 'a-z[:upper:]'
This was caused by commit af5d0c36, 21-10-2007,
"tr: do not reject an unmatched [:lower:] or [:upper:] in SET1"

This misaligned spec was allowed by extending the class:
  LC_ALL=C tr '[:upper:] ' '[:lower:]'

* src/tr.c (validate_case_classes): A new function to check
alignment of case conversion classes.  Also it adjusts the
length of the sets so that locales with different numbers of
upper and lower case characters, don't cause issues.
(string2_extend): Disallow extending the case conversion
class as in the above example.  That is locale dependent
and most likely not what the user wants.
(validate): Do the simple test for "restricted" char classes
earlier, so we don't redundantly do more expensive validation.
(main): Remove the case class validation, and simplify.
* tests/misc/tr-case-class: A new test to test the various
alignment and locale issues, associated with case conversion.
* tests/misc/tr: Move case conversion tests to new tr-case-class.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fixes.
2010-09-29 11:05:12 +01:00
Paul Eggert
704eedab03 build: update gnulib submodule to latest 2010-09-20 16:28:00 -07:00
Paul Eggert
9065006ccb sort: destroy spin locks portably
* src/sort.c (sortlines, sort): Use pthread_spin_destroy when a
spin lock is no longer used.  This isn't needed on GNU/Linux or
Solaris, but POSIX says it may free up resources on some platforms.
2010-09-20 15:45:49 -07:00
Pádraig Brady
4727aab1b1 tests: fix a printf portability issue
* tests/misc/sort-debug-keys: Don't depend on
printf supporting \xhh format, which isn't supported
by dash for example.  Also change from double quoted
strings to single quoted, when we don't need any
variable interpolation.
2010-09-20 15:23:20 +01:00
Pádraig Brady
f57cb371fa tests: fix an erroneous stat failure with bind mounts
* tests/misc/stat-mount: Don't try to correlate the
mount points output by df and stat, as they're similar,
but sometimes different in the presence of bind mounts.
* doc/coretuils.texi (stat invocation): Clarify the
bind mount difference between stat and df.
2010-09-20 15:07:02 +01:00
Jim Meyering
0a238bcb87 build: update gnulib submodule to latest 2010-09-18 22:35:04 +02:00
Jim Meyering
390133df25 tests: sync tests/init.sh from gnulib
* tests/init.sh: Update from gnulib.
2010-09-18 21:32:18 +02:00
Jim Meyering
c12d83920f build: use gnulib's new termios module
With it, we can remove the two sole tests of HAVE_TERMIOS_H.
* bootstrap.conf (gnulib_modules): Add termios.
* src/ls.c: Don't test HAVE_TERMIOS_H.
* src/stty.c: Likewise.
* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Remove configure-time
test for termios.h.
2010-09-18 21:32:18 +02:00
Jim Meyering
edc69f9158 maint: don't use obsolete gnulib modules
* bootstrap.conf (gnulib_modules): Use calloc-gnu, malloc-gnu
and realloc-gnu modules, rather than calloc, malloc and realloc.
The shorter-named modules are now deprecated.
(obsolete_gnulib_modules): Remove.
(gnulib_modules): Remove raise, strbprk; they're obsolete, too.
Move strtod, strtol here, from obsolete_gnulib_modules.
2010-09-18 21:22:36 +02:00
Eric Blake
2dd21704d6 maint: update to latest gnulib
* gnulib: Update to latest.
* src/copy.c (copy_reg): Use fdutimens instead of gl_futimens.
* src/touch.c (touch): Adjust parameter order.
* tests/init.sh: Resync from upstream.
2010-09-17 15:57:49 -06:00
Eric Blake
95732b834e rm: remove no-op -d option
* src/rm.c (long_opts, main): Resolve a fixme.
* NEWS: Document the change.
Based on a report by William Plusnick.
2010-09-17 08:44:31 -06:00
Eric Blake
3bb942c426 maint: update to latest gnulib
* gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Add fdutimensat.
* src/touch.c (touch): Use fdutimensat instead of gl_futimens.
2010-09-17 08:42:52 -06:00
Dmitry V. Levin
42681e9e4d dircolors: add rxvt-unicode-256color terminal type
rxvt-unicode introduced new terminal type:
http://cvs.schmorp.de/rxvt-unicode/src/rxvt.h?r1=1.398&r2=1.399

* src/dircolors.hin: Add rxvt-unicode-256color terminal type.
Reported by Alexey I. Froloff in <http://bugzilla.altlinux.org/24052>.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2010-09-13 16:53:33 -06:00
Pádraig Brady
ea1b8bafc0 tests: work around a failure with dash 0.5.4
* tests/misc/env: Check that the shell can support
the operation, before filtering through `env`.
Note dash 0.5.5 is unaffected by this issue.
2010-09-07 17:33:16 +01:00
Pádraig Brady
c52d220c30 tests: make various timeouts more robust
* tests/init.cfg (retry_delay_): Describe
the backoff method used.
* tests/ls/readdir-mountpoint-inode: Add a timeout
to the stat call to eliminate the chance of hangups.
* tests/mv/i-3: Change the timeout required to pass
from 1 second to a range of .1s - 3.1s.
* tests/rm/dangling-symlink: Likewise.
2010-09-07 14:02:56 +01:00
Pádraig Brady
437671accc tests: exclude some tests when running on NFS
All tests currently pass on NFS on Linux kernel 2.6.22 at least,
but some fail on 2.6.9, so we exclude those here.

* tests/init.cfg (is_local_dir_): A new function
returning if the specified directory is on a local file system.
(require_local_dir_): A new function to skip tests
if the current directory is not on a local file system.
* tests/cp/existing-perm-race: Skip if non local.
* tests/cp/file-perm-race: Likewise.
* tests/cp/parent-perm: Likewise.
* tests/cp/parent-perm-race: Likewise.
* tests/cp/preserve-2: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/du/basic: Use refactored function.
* tests/install/basic-1: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/dd/skip-seek-past-dev: Likewise.
* tests/du/slink: Likewise.  Remove redundant test
for NFS file system.
* tests/misc/join: s/local/locale/.
2010-09-07 10:49:55 +01:00
Jim Meyering
0e295c88bc build: update gnulib submodule to latest 2010-09-04 18:17:57 +02:00
Jim Meyering
041c9c472a build: use gettext-h, not gettext
* bootstrap.conf (gnulib_modules): Use gettext-h, not gettext.
The latter is overkill for a package that uses
AM_GNU_GETTEXT([external]...
2010-09-04 14:24:57 +02:00
Jim Meyering
fc9d948d7e tac: suppress technically unneeded "free"
* src/tac.c (main): Guard final free with #ifdef lint.
Suggested by Paul Eggert.
2010-09-01 17:17:31 +02:00
Pádraig Brady
126d59542f join: improve performance when operating on whole lines
Following on from commit f86bb696, 01-02-2010,
"join: make -t '' operate on the whole line".
Bypassing the delimiter search in this case,
gives about an 8% performance boost.

* src/join (xfields): Don't bother looking for '\n'
in the data, which we know won't be present.
2010-09-01 16:12:45 +01:00
Jim Meyering
777024889c tac: avoid double free
* src/tac.c (main): Reading a line longer than 16KiB would cause
tac to realloc its primary buffer.  Then, just before exit, tac
would mistakenly free the original (now free'd) buffer.
This bug was introduced by commit be6c13e7, "maint: always free a
buffer, to avoid even semblance of a leak".
* NEWS (Bug fixes): Mention it.
* tests/misc/tac (double-free): New test, to exercise this.
Reported by Salvo Tomaselli in <http://bugs.debian.org/594666>.
2010-08-28 19:28:20 +02:00
Pádraig Brady
c984948ff5 doc: clarify that stat -f implies -L (follows symlinks)
* doc/coreutils.texi (stat invocation). Since there is
no lstatfs, document that -L is implicit with -f.
2010-08-27 22:28:44 +01:00
Aaron Burgemeister
ddf6fb8686 stat: add %m to output the mount point for a file
* src/find-mount-point.c: A new file refactoring
find_mount_point() out from df.c
* src/find-mount-point.h: Likewise.
* src/df.c: Use the new find-mount-point module.
* src/stat.c (print_stat): Handle the new %m format.
(find_bind_mount): A new function to
return the bind mount for a file if any.
(out_mount_mount): Print the bind mount for a file, or else
the standard mount point given by the find-mount-point module.
(usage): Document the %m format directive.
* src/Makefile.am: Reference the refactored find-mount-point.c
* po/POTFILES.in: Add find_mount_point.c to the translation list
* doc/coreutils.texi (stat invocation): Document %m,
and how it may differ from the mount point that df outputs.
* test/misc/stat-mount: A new test to correlate mount points
output from df and stat.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature
* THANKS: Add the author

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-08-27 22:16:10 +01:00
Eric Blake
872f6bb2ba maint: update to latest gnulib
* gnulib: Update to latest, to avoid warnings with latest autoconf.git.
2010-08-26 16:28:31 -06:00
Eric Blake
8ce8ac9de2 maint: avoid a hung 'make syntax-check' in VPATH build
* cfg.mk (sc_system_h_headers): Look for files in correct location.
2010-08-26 16:28:31 -06:00
Pádraig Brady
0380e4c98e df: always print the device name for bind mounted files
* src/df (show_point): Remove the optimization for comparing
the specified path with the device name, as this produces
inconsistent results in the presence of bind mounts.  For bind
mounts, the device name is populated with the bind mount target.
* NEWS: Mention the change in behavior.
2010-08-25 23:02:55 +01:00
Pádraig Brady
2ed90c4c9d stat: fix a small memory leak with %N
* src/stat.c (print_stat): Free the buffer returned
from areadlink_with_size().
2010-08-23 07:15:24 +01:00
Pádraig Brady
6d78c2df58 maint: exclude tests from the set_program_name syntax-check
* .x-sc_program_name: Exclude all current and future
c files in gl/tests from this check
* gl/tests/test-di-set.c: Remove the hack to work around
the set_program_name syntax-check
* gl/tests/test-ino-map.c: Likewise
* gl/tests/test-rand-isaac.c: Likewise
2010-08-15 01:15:51 +01:00
Ralf Wildenhues
4e01bd1dab doc: avoid a warning from newer texinfo
* doc/coreutils.texi (sort invocation): Use @pxref inside parentheses.
2010-08-15 01:11:35 +01:00
Bruno Haible
9e900e81db doc: improve the info on md5sum security weaknesses
* doc/coreutils.texi (md5sum invocation): Mention currently known
security problems. Don't recommend SHA-1 as alternative.
* man/md5sum.x (BUGS): Warn about the vulnerabilities and
reference the SHA-2 based alternatives.
Reported by Simon Josefsson
2010-08-15 01:02:44 +01:00
Paul Eggert
b5f9a6a176 * tests/misc/sort (use-nl): Fix comment to match the test case. 2010-08-13 15:57:52 -07:00
Paul Eggert
9899e6cd85 sort, who: prefer free+malloc to realloc when contents are irrelevant
This change was prompted by the previous one: I audited the code
looking for similar examples.  Too bad valgrind doesn't catch this.
* src/sort.c (check, mergefps): xrealloc -> free + xmalloc
* src/who.c (print_user): Likewise.
2010-08-10 20:25:56 -07:00
Paul Eggert
2050a5913b sort: free/xmalloc rather than xrealloc
* src/sort.c (compare_random): Use free/xmalloc rather than
xrealloc, since the old buffer contents need not be preserved.
Also, don't fail if the guessed-sized malloc fails.  Suggested by
Bruno Haible.
2010-08-10 13:49:57 -07:00
Eric Blake
7861d74ba8 build: update to latest gnulib
Fixes bug 6053 for NFS on HP-UX not recognizing ACL operations.

* gnulib: Update to latest version.
2010-08-10 09:44:28 -06:00
Jim Meyering
ec0d6ddb81 sort: avoid gcc warning: explicitly ignore strtold result
* src/sort.c: Include "ignore-value.h".
(debug_key): Use ignore_value.
2010-08-10 08:11:15 -07:00
Eric Blake
4e6bac4ca3 tests: silence 'make syntax-check'
* gl/tests/test-rand-isaac.c (main): Avoid warnings from
syntax-check.
2010-08-09 14:56:02 -06:00
Mike Frysinger
fbebc507da dircolors: add screen.rxvt & terminator to TERM list
Resolves bug#6793.
* src/dircolors.hin: Add screen.rxvt & terminator.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-08-09 11:32:04 -06:00
Dan Hipschman
24f1af88c7 ls: fix a test failure that should have been skipped
* tests/ls/readdir-mountpoint-inode: Check to see if skip_test_ is
called in a helper function via $() instead of mistakenly failing.
* THANKS: Update.
2010-08-09 08:52:12 -06:00
Paul Eggert
ad31a59a37 sort: speed up -R with long lines in hard locales
* src/sort.c (compare_random): Guess that the output will be
3X the input.  This avoids the overhead of calling strxfrm
twice on typical implementations.  Suggested by Bruno Haible.
2010-08-08 23:15:09 -07:00
Paul Eggert
b877ea4b3e sort: support all combinations of -d, -f, -i, -R, and -V
* NEWS: Document this.
* src/sort.c (getmonth): Omit LEN arg, as MONTH is now null-terminated.
(compare_random): Don't null-terminate keys, as caller now does that.
(compare_version): Remove.
(debug_key): Null-terminate string for getmonth.
(keycompare): Support combining -R with any of -d, -f, -i, -V.
Also, support combining -V with any of -d, -i.
(check_ordering_compatibility): Allow newly-supported combinations.
* tests/misc/sort (02q, 02r, 02s): New tests, for new combinations.
(incompat2): Now test -nR, since -fR are now compatible.
2010-08-06 21:30:50 -07:00
Paul Eggert
bdde34f958 sort: tune and refactor --debug code, and fix minor underlining bug
Formerly, the 'compare' function and some of its subroutines had a
debugging flag, which caused them to output underlines.  This
change refactors the code so that debugging output is
more-separated from the actual sorting.  In the process, the
change fixes a minor error in the debugging output.  The change
shortens the source code and executable size a tad, and improves
CPU performance by 2.4% on my platform with a simple benchmark (C
locale, line sorting, no debug).

* src/sort.c (long_double, strtold): Move back to prelude, since
they're now used by multiple functions again.
(unit_order): Move to file scope, since it's now used by two functions.
(find_unit_order, human_numcompare, numcompare, general_numcompare):
Remove endptr parameter.  All callers changed.
(human_numcompare): Args are now const pointers.
(getmonth): Endptr is now non-const.
(key_numeric): Move up, since it's needed earlier.
(debug_key): Take a line and a key as argument, instead of having
the caller figure out where the field is.
(debug_line): New function.
(keycompare, compare): Omit debug parameter; debug output now done
elsewhere.  All callers changed.
(write_line): Renamed from write_bytes; all callers changed.
Use debug_line (not 'compare') to output debug info.
Use a slightly faster check for whether output file is stdout.
(check): Don't do debugging output; it's not that useful here,
and it confuses the code.
(main): Check for incompatibility between -c and --debug.
Use standard diagnostic for incompatible options.
* tests/misc/sort-debug-keys: Fix test case: "--Mi-1" is not
a number, so its first character should not be underlined when
debugging a numeric sort.
2010-08-05 13:28:54 -07:00
Paul Eggert
2b49b140cc sort: -R now uses less memory on long lines with internal NULs
* lib/Makefile.am (libcoreutils_a_SOURCES): Remove xmemxfrm.c,
xmemxfrm.h.
* lib/memxfrm.c, lib/memxfrm.h, lib/xmemxfrm.c, lib/xmemxfrm.h: Remove.
* m4/memxfrm.m4: Likewise.
* m4/prereq.m4 (gl_PREREQ): Remove gl_MEMXFRM.
* po/POTFILES.in: Remove lib/xmemxfrm.c.
* src/sort.c: Don't include xmemxfrm.h.
(cmp_hashes): Remove.
(xstrxfrm): New function.
(compare_random): If a line contains NULs, don't create a big
buffer that contains the strxfrm output of each string in the line.
Instead, accumulate checksums and differences as we go, so that
at any one time we have to store at most the output of a single
strxfrm call when processing the line.  This removes the need for
an memxfrm function.
2010-08-04 16:10:59 -07:00
Paul Eggert
db48b36241 init.sh: work around trap limitation of some shells
* tests/init.sh (setup_): Move exit trap outside of shell function.
This patch is imported from gnulib.
2010-08-03 13:01:42 -07:00
Paul Eggert
a2cebacf97 sort: fix bug in --debug when \0 is followed by \t
* src/sort.c (debug_width): New function, which does not stop
counting tabs at \0, and also invokes mbsnwidth.  Stamp out strnlen!
(count_tabs): Remove.
(debug_key): Use debug_width instead of mbsnwidth and count_tabs.
* tests/misc/sort-debug-keys: Check that \0 and \t intermix.
2010-08-03 10:25:47 -07:00
Paul Eggert
94615d2acf sort: revert recent -h changes and use a more-conservative approach
* NEWS: Document changes to sort -h, which are now minor with
respect to the pre-July-30th version.
* doc/coreutils.texi (sort invocation): Likewise.  The
documentation now describes how -h comparison is done rather than
being vague with border cases.
* src/sort.c (long_double, strtold): Move back to general_numcompare.
(LD, compute_human): Remove.
(find_unit_order): Remove THOU_SEP parameter, since thousands
separators are now allowed by all callers.  Revert to previous
behavior of sorting by suffix, and returning the order rather than
2 * order + binary, since we no longer care whether binary powers
are being used.  However, treat all zeros the same, instead of
sorting 0M before 0G; this is more consistent with the desired
behavior of sorting -1G before -1M.
* tests/misc/sort (h1, h3, h6): Adjust to match mostly-reverted
behavior.  However, check that all zeros sort together.
* tests/misc/sort-debug-keys: Omit a "_", since the trailing "i"
in "1234Gi" is no longer part of the key.
2010-08-02 19:21:02 -07:00
Paul Eggert
abd040180e sort: -h now handles comparisons such as 6000K vs 5M and 5MiB vs 5MB
* NEWS: Document changes to sort -h.
* doc/coreutils.texi (sort invocation): Likewise.
* src/sort.c (long_double, strtold): Move to prelude, since they're
now used by multiple functions.
(LD): New macro.
(struct keyfield.iec_present): Remove this member.  All uses removed.
(check_mixed_SI_IEC): Remove.  This code was busted in the presence
of multiple threads, as it had a race condition.
(find_unit_order): Remove arg KEY; add arg THOU_SEP; arg ENDPTR is
now char ** rather than char const **.  Return an integer that
distinguishes decimal from binary powers.  Parse the number
consistently with the intersection of strtold and strnumcmp.
Set *ENDPTR unconditionally.
(compute_human): New static function.
(human_numcompare): Remove arg KEY.  Remove 'const' from other args.
Use strnumcmp if possible, but fall back on floating point if not.
(numcompare, general_numcompare): Arg EA is now char ** rather
than char const **.
(numcompare): Adjust to new find_unit_order signature and behavior.
(keycompare): Adjus to new human_numcompare signature.
* tests/misc/sort (h1, h3, h4, h6): Adjust to new behavior.
* tests/misc/sort-debug-keys: Likewise.
2010-07-30 01:53:46 -06:00
Paul Eggert
1bf73ebb97 sort: fix --debug display with very large offsets
* src/sort.c (mark_key): Don't assume offset <= INT_MAX.
Make the code a bit clearer when width != 0.
2010-07-27 11:01:48 -07:00
Paul Eggert
c8d3838681 sort: fix bug with EOF at buffer refill
* src/sort.c (fillbuf): Don't append eol unless the line is nonempty.
This fixes a bug that was partly but not completely fixed by
the aadc67dfdb commit (dated July 15).
* tests/misc/sort (realloc-buf-2): New test, which catches this
bug on 64-bit hosts.
2010-07-26 20:51:19 -07:00
Paul Eggert
247e239698 sort: omit some "inline"s
* src/sort.c (mergelines, queue_destroy, queue_init, queue_insert):
(queue_pop, write_unique, mergelines_node, check_insert):
(update_parent): No longer inline; these uses of "inline"
seemed unlikely to help performance much.
2010-07-26 18:38:36 -07:00
Paul Eggert
802542ff92 sort: don't assume ASCII when parsing K, M, G suffixes
* src/sort.c (find_unit_order): Don't assume ASCII.
2010-07-26 12:12:50 -07:00
Paul R. Eggert
074566823e sort: make struct heap private
* gl/lib/heap.c (struct heap): Move this here...
* gl/lib/heap.h (struct heap): ... from here, as outside code no
longer needs to access any of these members.
2010-07-25 21:18:35 -07:00
Paul R. Eggert
de949fc12d sort: omit unnecessary mutex unlock+lock; simplify heap access
* src/sort.c (queue_pop): Omit unnecessary unlock+lock after
pthread_cond_wait returns.  Don't access "count" member of the
heap; any efficiency gains should be quite minor, the access
complicates this code, and "count" should be private anyway.
2010-07-25 20:55:21 -07:00
Paul R. Eggert
1563ffd2b1 sort: omit 'restrict' in doubtful cases
* src/sort.c (lock_node, unlock_node, queue_destroy, queue_init):
(queue_pop):
Omit 'restrict'; it shouldn't help here, as these functions have just
one pointer parameter and don't access static storage.
(queue_insert, check_insert, update_parent): Omit 'restrict', as
the pointer types differ, and are not char * or unsigned char *,
and therefore can't alias.
(write_unique): Omit 'restrict', as the pointer types are all
read-only.
(merge_loop, sortlines): Omit 'restrict', as any performance
advantages are extremely unlikely and it's not worth cluttering
the code for that.
(struct thread_args): Omit 'restrict': this seems to be incorrect.
It's unlikely for 'restrict' to be correct inside a typedef.
2010-07-25 20:25:55 -07:00
Paul R. Eggert
001700f4a0 sort: omit unnecessary casts
* src/sort.c (inittables, general_numcompare, compare_nodes):
(queue_init, queue_pop): Omit casts that are not needed, typically
because they are between void * and some other pointer type.
2010-07-25 19:59:11 -07:00
Paul R. Eggert
48faad3748 sort: use more-consistent style with const
* src/sort.c (proctab_hasher, proctab_comparator, stream_open, xfopen):
(open_temp, zaptemp, struct_month_cmp, begfield, limfield):
(find_unit_order, human_numcompare, numcompare, general_numcompare):
(count_tabs, keycompare, compare, compare_nodes, lock_node):
(unlock_node, queue_destroy, queue_init, queue_insert, queue_pop):
(write_unique, mergelines_node, check_insert, update_parent):
(merge_loop, sortlines, struct thread_args, set_ordering):
Prefer the style "T const" to "const T".
* gl/lib/heap.h (struct heap, heap_alloc): Likewise.
* gl/lib/heap.c (heap_default_compare, heapify_down, heapify_up):
(heap_alloc): Likewise.
2010-07-25 19:25:09 -07:00
Paul Eggert
01ca128807 du: add NEWS entry for recent du -L fixes 2010-07-25 10:53:42 -07:00
Paul R. Eggert
77428214f1 du: tune, and fix some -L bugs with dangling or cyclic symlinks
* src/du.c (process_file): Avoid recalculation of hashes
and of file-exclusion for directories.  Do not descend into
the same directory more than once, unless -l is given; this is faster.
Calculate stat buffer lazily, since it
need not be computed at all for excluded files.
Count space if FTS_ERR, since stat buffer is always valid then.
No need for 'print' local variable.
(main): Use FTS_NOSTAT.  Use FTS_TIGHT_CYCLE_CHECK only when not
hashing everything, since process_file finds cycles on its own
when hashing everything.
* tests/du/deref: Add test cases for -L bugs.
2010-07-24 00:20:07 -07:00
Paul R. Eggert
9a3c600f11 tests/misc/sort-merge-fdlimit: don't assume -R opens /dev/urandom
* tests/misc/sort-merge-fdlimit: This test was written assuming that
-R typically opens /dev/urandom, but that's no longer the case.
Redo test to specify a random source; this resurrects the point of
checking for file descriptor exhaustion.  Also try plain -R, since
that implementation may change in the future too.
2010-07-23 23:44:25 -07:00
Paul R. Eggert
df906d2e75 randread: run 2x faster on 64-bit hosts, don't assume no padding bits
* gl/lib/rand-isaac.c: 	Remove the I/O; this belongs elsewhere.
Add support for ISAAC64.  Port to hosts with padding bits.
Add self to author list.  Include <limits.h>, for CHAR_BIT.
Don't include string.h, sys/time.h, unistd.h.
(min, just): New functions.
(IF32): New macros.
(ind, ISAAC_STEP, isaac_refill, mix, isaac_init, isaac_seed):
Add support for ISAAC64.  Port to hosts with padding bits.
(ind): Now an inline function rather than a macro; no need for it
to be a macro with modern compilers.
(ISAAC_STEP): Renamed from isaac_step, since it's not function-like.
Don't bother to pass args that are always the same.  All uses changed.
(ISAAC_STEP, ISAAC_SEED): Move to inside the only function body
that can use it.
(ISAAC_MIX): Renamed from isaac_mix, since it's now a macro and is
no longer function-like.  Don't bother saving and restoring state;
no longer needed now that we're not a function.  All uses changed.
(isaac_seed_start, isaac_seed_data, isaac_seed_finish): Remove.
(isaac_seed): Take just the one arg; the caller now sets s->m.
* gl/lib/rand-isaac.h: Use _GL_RAND_ISAAC_H to protect, instead
of RAND_ISAAC_H.  Try out " #" rather than "# " for indenting.
(ISAAC_BITS_LOG, ISAAC_BITS): New macros.
(ISAAC_WORDS_LOG): Renamed from ISAAC_LOG.
(isaac_word): New type.  All uses of uint32_t changed to isaac_word,
to support ISAAC64.
(struct isaac_state): Rename member MM to M, and make it public.
(isaac_seed, isaac_refill): Adjust to new API.
* gl/lib/randread.c: Include sys/time.h.
(get_nonce): New function, containing the nonce stuff that used
to be in rand-isaac.c but better belongs here.
(randread_new): Use it.
* gl/modules/randread (Depends-on): Add inline.
* gl/modules/randread-tests: New file.
* gl/tests/test-rand-isaac.c: New file.
2010-07-23 15:08:36 -07:00
Pádraig Brady
47076e3c7c provide POSIX_FADV_SEQUENTIAL hint to appropriate utils
Following on from commit dae35bac, 01-03-2010,
"sort: inform the system about our input access pattern"
apply the same hint to all appropriate utils.
This currently gives around a 5% speedup for reading
large files from fast flash devices on GNU/Linux.

* src/base64.c: Call fadvise (..., FADVISE_SEQUENTIAL);
* src/cat.c: Likewise.
* src/cksum.c: Likewise.
* src/comm.c: Likewise.
* src/cut.c: Likewise.
* src/expand.c: Likewise.
* src/fmt.c: Likewise.
* src/fold.c: Likewise.
* src/join.c: Likewise.
* src/md5sum.c: Likewise.
* src/nl.c: Likewise.
* src/paste.c: Likewise.
* src/pr.c: Likewise.
* src/ptx.c: Likewise.
* src/shuf.c: Likewise.
* src/sum.c: Likewise.
* src/tee.c: Likewise.
* src/tr.c: Likewise.
* src/tsort.c: Likewise.
* src/unexpand.c: Likewise.
* src/uniq.c: Likewise.
* src/wc.c: Likewise, unless we don't actually read().
2010-07-22 01:04:47 +01:00
Pádraig Brady
63b5e81648 fadvise: new module providing a simpler interface to posix_fadvise
* bootstrap.conf: Include the new module
* gl/lib/fadvise.c: Provide a simpler interface to posix_fadvise.
(fadvise): Provide hint to the whole file associated with a stream.
(fdadvise): Provide hint to the specific portion of a file
associated with a file descriptor.
* gl/lib/fadvise.h: Redefine POSIX_FADV_* to FADVISE_* enums.
* gl/modules/fadvise: New file.
* m4/jm-macros.m4: Remove the no longer needed posix_fadvise check.
* .x-sc_program_name: Exclude test-fadvise.c from this check.
* gl/tests/test-fadvise (main): New test program.
* gl/modules/fadvise-testss: A new index to reference the tests.
* src/sort.c (stream_open): Use the new interface.
* src/dd.c (iwrite): Likewise.
2010-07-22 01:03:48 +01:00
Mike Frysinger
c88cfffb6c build: support fully excluding stdbuf from the build
* configure.ac (optional_pkglib_progs): Only update
after the main programs have been selected, so that
libstdbuf.so can be excluded if stdbuf also is.
2010-07-22 00:34:04 +01:00
Paul R. Eggert
c1d8e6e458 randread: use /dev/urandom to seed, not just getpid etc
* gl/lib/rand-isaac.c (isaac_seed_start): New arg SEEDED.
(isaac_seed): New args FD and BYTES_BOUND.  Read from FD if possible.
Don't bother with low-quality sources if FD has enough bytes.
* gl/lib/rand-isaac.h: New size_t arg for isaac_seed.
* gl/lib/randread.c: Include fcntl.h, unistd.h.
(NAME_OF_NONCE_DEVICE): New #define.
(nonce_device): New static var.
(randread_new): Use nonce device if available.
2010-07-20 09:51:12 -07:00
Paul R. Eggert
e5444fa2a7 sort: -R no longer disables multithreading
* src/sort.c (random_md5_state): New static var.
(random_md5_state_init): New function, to initialize random_md5_state.
(random_state, randread_source): Remove.
(cmp_hashes): Use random_md5_state rather than random_state.
Break ties using memcmp, not by getting more randomness.
If MD5 collisions turn into a problem in practice, we should
simply use a better checksum.
(main): If -R is given, call random_md5_state_init rather than
going single-threaded.
2010-07-19 10:48:00 -07:00
Paul R. Eggert
e7523efb7d randread: don't require -lrt
Programs like 'sort' were linking to -lrt in order to get
clock_gettime, but this was misguided: it wasted considerable
resources while gaining at most 10 bits of entropy.  Almost nobody
needs the entropy, and there are better ways to get much better
entropy for people who do need it.
* gl/lib/rand-isaac.c (isaac_seed): Include <sys/time.h> not
"gethrxtime.h".
(isaac_seed): Use gettimeofday rather than gethrxtime.
* gl/modules/randread (Depends-on): Depend on gettimeofday
and not gethrxtime.
* src/Makefile.am (mktemp_LDADD, shred_LDADD, shuf_LDADD, sort_LDADD):
(tac_LDADD): Omit $(LIB_GETHRXTIME); no longer needed.
2010-07-16 15:49:05 -07:00
Paul R. Eggert
78e6fb0489 sort: add a test case for the sort -u bug
* tests/Makefile.am (TESTS): Add misc/sort-unique.
* tests/misc/sort-unique: New file.
2010-07-15 18:13:55 -07:00
Paul R. Eggert
c580983f70 sort: fix a bug with sort -u and xmemcoll0, and tune keycompare
* src/sort.c (keycompare): Use xmemcoll0, as it avoids
a couple of stores.
(write_bytes): Leave the buffer the way we found it,
as it might be used again for a later comparison,
if -u is used.
2010-07-15 16:24:38 -07:00
Pádraig Brady
aadc67dfdb sort: fix a bug when sorting unterminated lines
* src/sort.c (fillbuf): The previous commit incorrectly
terminated the buffer when the last line of input
didn't contain a terminating character.
2010-07-15 12:09:33 +01:00
Chen Guo
b084d6bcb5 sort: speed up default full line sorting
Don't write NUL after the comparison buffers on each compare,
which increases performance by about 3% for short lines
on a pentium-m with gcc-4.4.1

* src/sort.c: (fillbuf): Delimit input items with NUL.
(write_bytes): Restore the item delimiter char which was
replaced with NUL in fillbuf().
2010-07-15 01:10:12 +01:00
Jim Meyering
c5e350ec56 heap_alloc: avoid integer overflow
* gl/lib/heap.c (heap_alloc): Use xnmalloc rather than xmalloc,
to avoid pathological overflow.
2010-07-14 11:05:50 -05:00
Paul R. Eggert
66af887e57 maint: omit $(POW_LIB) when linking, as this is no longer needed
* src/Makefile.am (printf_LDADD, seq_LDADD, sleep_LDADD, sort_LDADD):
(tail_LDADD, uptime_LDADD): Omit $(POW_LIB), as it's no longer
needed due to recent gnulib changes, where the strtod module no
longer uses the pow function.  strtold needs pow only because it's
sometimes aliased to strtod.  See
http://lists.gnu.org/archive/html/bug-gnulib/2010-07/msg00076.html
2010-07-14 15:45:08 +01:00
Pádraig Brady
4fe3860ebc build: update gnulib submodule to latest; update bootstrap, too
* gnulib: Update for xmemcoll0 and fix for systems without pthreads
* bootstrap: Update for translation project sync fix
2010-07-14 12:16:48 +01:00
Pádraig Brady
4332538dbb maint: reorganize latest NEWS
* NEWS: Add another blank line before the previous version.
(Bug fixes): Move to the start.
(Changes in behavior): Add the item about the du mem usage change
from the "New features" section.
2010-07-13 19:05:31 +01:00
Pádraig Brady
f8574063d5 maint: heap.c: simplify dynamic allocations
* gl/lib/heap.c (heap_alloc): Use the fact that the xalloc
routines will not return NULL.  Also remove the redundant
temporary variables.
(heap_insert): From Jim Meyering, use x2nrealloc() which
is simpler while handling overflow and increasing the
size more efficiently.  This reallocation is currently
unused by coreutils in any case as it preallocates enough.
2010-07-13 16:51:38 +01:00
Chen Guo
9face836f3 sort: parallelize internal sort
This patch is by Gene Auyeung, Chris Dickens, Chen Guo, and Mike
Nichols, based off of a patch by Paul Eggert, Glen Lenker, et. al.,
with a basic heap implementation based off of the GDSL heap,
originally by Nicolas Darnis.

The number of sorts done in parallel is limited to the number
of available processors by default, or can be further restricted
with the --parallel option.

On a dual-die, 8 core Intel Xeon, results show sorting with
8 threads is almost 4 times faster than using a single thread.
Timings when sorting a 96MB file:
THREADS     TIME (s)
1            5.10
2            2.87
4            1.75
8            1.31

Single threaded sorting has also been improved,
especially for cheaper comparison operations:
COMMAND             BEFORE (s)  AFTER (s)
sort                 8.822       8.716
sort -g             10.336      10.222
sort -n              3.077       2.961
LANG=C sort          2.169       2.066

* bootstrap.conf: Add heap, pthread.
* coreutils.texi (sort): Describe the new --parallel option.
* gl/lib/heap.c: New file. Very basic heap implementation.
* gl/lib/heap.h: New file.
* gl/modules/heap: New file.
* src/Makefile.am: Add LIB_PTHREAD.
* src/sort.c: Include heap.h, nproc.h, pthread.h.
(MAX_MERGE): New macro.
(SUBTHREAD_LINES_HEURISTIC, PARALLEL_OPTION): New constants.
(MERGE_END, MERGE_ROOT): New constants.
(struct merge_node): New struct.
(struct merge_node_queue): New struct.
(sortlines temp): Remove declaration.
(usage, long_options, main): New option, --parallel.
(specify_nthreads): New function.
(mergelines): New signature, to emphasize the fact that the HI area
must be part of the destination.  All callers changed.
(sequential_sort): New function, renamed from sortlines. Merge in
the functionality of sortlines_temp.
(compare_nodes): New function.
(lock_node, unlock_node): New functions.
(queue_destroy): New function.
(queue_init): New function.
(queue_insert): New function.
(queue_pop): New function.
(write_unique): New function.
(mergelines_node): New function.
(check_insert): New function.
(update_parent): New function.
(merge_loop): New function.
(sortlines): Rewrite to support and use parallelism, with a new
signature. All callers changed.
(struct thread_args): New struct.
(sortlines_thread): New function.
(sortlines_temp): Remove.
(sort): New argument NTHREADS. All uses changed. Output moved to
mergelines_node.
(main): disable threading if we are sorting at random.
* tests/Makefile.am (TESTS): Add misc/sort-benchmark-random.
* tests/misc/sort-benchmark-random: New file.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-07-13 01:44:46 +01:00
Jim Meyering
f6e8c18f8d di-set, ino-map: adjust a type, improve readability
* gl/lib/ino-map.c (ino_hash): Declare "i" as unsigned int.
Use an intermediate variable for the for-loop upper bound,
so it's a little more readable.  Adjust comment.
* gl/lib/di-set.c (di_ent_hash): Likewise.
2010-07-13 02:20:10 +02:00
Paul R. Eggert
335b59b962 dd: also spell out size on memory exhaustion
* src/dd.c (dd_copy): Use requested blocksize (not adjusted) in
diagnostic, to forestall user complaints that the numbers don't
match exactly.  Report both exact and human-readable sizes, using
a message format that is consistent with both "BBBB bytes (N XB)
copied" in dd.c and "memory exhausted" in lib/xmalloc.c.
2010-07-12 17:13:13 -07:00
Paul Eggert
e5ca54448e chcon, chmod, chown, du: don't translate "%s"
* src/chcon.c (process_file): Replace _("%s") with "%s".
* src/chmod.c (process_file): Likewise.
* src/chown-core.c (change_file_owner): Likewise.
* src/du.c (process_file): Likewise.
2010-07-09 13:56:05 -07:00
Paul Eggert
db4df7dda6 du: avoid spurious warnings with 64-bit gcc -W
Problem reported by Jim Meyering in:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6524#74
* gl/lib/di-set.c (di_ent_hash): Rework so that the compiler does
not incorrectly warn about shifting by 64-bits in unreachable code.
* gl/lib/ino-map.c (ino_hash): Likewise.
2010-07-06 16:16:50 -07:00
Paul Eggert
fb1a26c3f6 du: Hash with a mechanism that's simpler and takes less memory.
* gl/lib/dev-map.c, gl/lib/dev-map.h, gl/modules/dev-map: Remove.
* gl/lib/ino-map.c, gl/lib/ino-map.h, gl/modules/ino-map: New files.
* gl/modules/dev-map-tests, gl/tests/test-dev-map.c: Remove.
* gl/modules/ino-map-tests, gl/tests/test-ino-map.c: New files.
* gl/lib/di-set.h (struct di_set): Renamed from struct di_set_state,
and now private.  All uses changed.
(_ATTRIBUTE_NONNULL_): Don't assume C99.
(di_set_alloc): Renamed from di_set_init, with no size arg.
Now allocates the object rather than initializing it.
For now, this no longer takes an initial size; we can put this
back later if it is needed.
* gl/lib/di-set.c: Include hash.h, ino-map.h, and limits.h instead of
stdio.h, assert.h, stdint.h, sys/types.h (di-set.h includes that
now), sys/stat.h, and verify.h.
(N_DEV_BITS_4, N_INO_BITS_4, N_DEV_BITS_8, N_INO_BITS_8): Remove.
(struct dev_ino_4, struct dev_ino_8, struct dev_ino_full): Remove.
(enum di_mode): Remove.
(hashint): New typedef.
(HASHINT_MAX, LARGE_INO_MIN): New macros.
(struct di_ent): Now maps a dev_t to a inode set, instead of
containing a union.
(struct dev_map_ent): Remove.
(struct di_set): New type.
(is_encoded_ptr, decode_ptr, di_ent_create): Remove.
(di_ent_hash, di_ent_compare, di_ent_free, di_set_alloc, di_set_free):
(di_set_insert): Adjust to new representation.
(di_ino_hash, map_device, map_inode_number): New functions.
* gl/modules/di-set (Depends-on): Replace dev-map with ino-map.
Remove 'verify'.
* gl/tests/test-di-set.c: Adjust to the above changes to API.
* src/du.c (INITIAL_DI_SET_SIZE): Remove.
(hash_ins, main): Adjust to new di-set API.
2010-07-06 14:58:48 -07:00
Jim Meyering
d5427265e3 stat: getfilecon failure now evokes nonzero exit status
Add comments and adjust interfaces to allow low-level failure
to propagate out to callers.
* src/stat.c (out_file_context): Return bool, not void,
so we can tell callers about failure.
(print_statfs, print_stat, print_it): Propagate failure to caller.
(do_statfs): Propagate print_it failure to caller.
(do_stat): Likewise.
I nearly forgot to update do_stat to propagate print_it failure,
and it compiled just fine in spite of that.  To prevent possibility
of a repeat, I've marked each function that returns non-void with
ATTRIBUTE_WARN_UNUSED_RESULT.
2010-07-05 17:39:51 +02:00
Jim Meyering
61aae73f54 system.h: define ATTRIBUTE_WARN_UNUSED_RESULT
* src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define.
2010-07-05 17:39:46 +02:00
Pádraig Brady
09fcf494a1 tests: make tests requiring a delay to pass, more robust
* tests/init.cfg: Introduce a retry_delay_() function to
repeatedly call a test function that requires a delay.
This delay can now be shorter for the common case on fast
systems, but will double until a configurable limit it reached
before failing on slower systems.
* tests/dd/reblock: Use retry_delay_.
* tests/misc/cat-buf: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/tail-2/F-vs-rename: Likewise.
* tests/tail-2/flush-initial: Likewise.
* tests/tail-2/tail-n0f: Likewise.
* tests/tail-2/wait: Likewise.
* test/dd/misc: Comment that delay is needed to trigger failure.
2010-07-05 15:06:07 +01:00
Paul Eggert
1d95457b3e doc: Add advice about ChangeLogs and synchronizing submodules
* README-hacking: Update accordingly.
2010-07-04 15:44:48 -07:00
Jim Meyering
98d48bb0e9 du: increase the initial dev-inode set size
* src/du.c (INITIAL_DI_SET_SIZE): Increase to the prime just under
1024.  This gives a speed-up of about 2% when processing a tree
containing 100,000 files, each with a link count greater than 1,
all pointing to files in some other tree.
2010-07-04 11:15:48 +02:00
Jim Meyering
4cb8268024 du: use less than half as much memory when tracking hard links
When processing a hard-linked file, du must keep track of the file's
device and inode numbers in order to avoid counting its storage
more than once.  When du would process many hard linked files --
as are created by some backup tools -- the amount of memory required
for the supporting data structure could become prohibitively large.
This patch takes advantage of the fact that the amount of information
in the numbers of the typical dev,inode pair is far less than even
32 bits, and hence usually fits in the space of a pointer, be it
32 or 64 bits wide.  A typical du traversal examines files on no
more than a handful of distinct devices, so the device number can
be encoded in just a few bits.  Similarly, few inode numbers use
all of the high bits in an ino_t.  Before, we would represent the
dev,inode pair using a naive struct, and allocate space for each.
Thus, an entry in the hash table consisted of a pointer (to that
struct) and a "next" pointer.  With this change, we encode the
dev,inode information and put those bits in place of the pointer,
and thus do away with the need to allocate additional space for
each dev,inode pair.

* src/du.c: Include "di-set.h".
Don't include "hash.h"; it's no longer used.
(INITIAL_DI_SET_SIZE): Define.
(di_set): New global, to replace "htab".
(entry_hash, entry_compare, hash_init): Remove functions.
(hash_ins): Use di-set functions, rather than ones from the hash module.
(main): Likewise.
* bootstrap.conf (gnulib_modules): Add the new di-set module.
* NEWS (New features): Mention it.
2010-07-04 08:40:40 +02:00
Jim Meyering
f42496b72b di-set: manipulate sets of dev/inode pairs efficiently
* gl/lib/di-set.c: Implementation.
* gl/lib/di-set.h: Declarations.
* gl/modules/di-set: Define module.
* gl/modules/di-set-tests: Define test module.
* gl/tests/test-di-set.c: Likewise.
2010-07-04 08:40:40 +02:00
Jim Meyering
6357909ee6 dev-map: map device number to small non-negative
* gl/lib/dev-map.c: New file.
* gl/lib/dev-map.h: Declarations.
* gl/modules/dev-map: Define primary modules.
* gl/modules/dev-map-tests: Define test module.
* gl/tests/test-dev-map.c: Test it.
2010-07-04 08:40:40 +02:00
Paul Eggert
efe53cc72b du: don't miscount duplicate directories or link-count-1 files
* NEWS: Mention this.
* src/du.c (hash_all): New static var.
(process_file): Use it.
(main): Set it.
* tests/du/hard-link: Add a couple of test cases to help make
sure this bug stays squashed.
* tests/du/files0-from: Adjust existing tests to reflect
change in semantics with duplicate arguments.
2010-07-03 10:28:08 +02:00
Jim Meyering
d27d6d371f build: update gnulib submodule to latest; update bootstrap, too
* gnulib: Update to latest, for hash.c improvement.
* bootstrap: Update from gnulib, too.
2010-07-02 08:38:15 +02:00
Pádraig Brady
1af81dfb4d cp: add an option to only copy the file attributes
* src/copy.c (copy_attr): A new function which merges copy_attr_by_fd
and copy_attr_by_name.  Also display all errors when --attributes-only
* src/copy.c (copy_reg): Skip copying the file contents if specified.
Refactor the SELinux error handling code a little and display all
SELinux errors when only copying attributes.
* src/copy.h (struct cp_options): Add a data_copy_required boolean
* src/cp.c (main): Default to copying data but don't if specified
* src/install.c: Default to copying data
* src/mv.c: Likewise
tests/cp/reflink-perm: Add a test to check that --attributes-only
does not copy data
* tests/cp/acl: Likewise. Also refactor to remove redundant
acl manipulation
* doc/coreutils.texi (cp invocation): Describe the new option
* NEWS: Mention the new feature
2010-07-01 14:33:27 +01:00
Pádraig Brady
8aa15b2be2 ls: use the POSIX date style when the locale does not specify one
Previously we defaulted to "long-iso" format in locales without
specific format translations, like the en_* locales for example.
This reverts part of commit 6837183d, 08-11-2005, "ls ... acts like
--time-style='posix-long-iso' if the locale settings are messed up"
* src/ls.c (decode_switches): Only use the ISO format when specified.
* NEWS: Mention the change in behavior.
Reported by Daniel Qarras at http://bugzilla.redhat.com/525134
2010-07-01 13:12:52 +01:00
Jim Meyering
7336920dd0 tests: fail rather than infloop in tail's inotify-rotate test
* tests/tail-2/inotify-rotate: Switch to new init.sh-based framework.
(grep_timeout): New function.
Use it in place of open-coded loops that might infloop.
This was prompted by my encountering an inexplicable, and so far
unreproducible, infloop in the code that was waiting for "b" to
appear in "out".
2010-06-30 18:12:12 +02:00
Jim Meyering
b062bbd947 tests: move most helper functions from test-lib.sh to new init.cfg
From there, they will be used by both test-lib.sh (as we phase it out)
and the newer init.sh, to which all tests will migrate.
* tests/test-lib.sh: Move most functions from here, ...
* tests/init.cfg: ...to here.  New file.
* tests/Makefile.am (EXTRA_DIST): Add init.cfg.
2010-06-30 18:11:50 +02:00
Jim Meyering
cfee734a41 tests: sync tests/init.sh from gnulib
* tests/init.sh: Update from gnulib.
2010-06-30 18:11:50 +02:00
Jim Meyering
5b3adc0d42 doc: df, du, ls: improve --blocksize description in --help
* src/du.c (usage): Print better --blocksize description.
Prompted by Samuel Thibault in <http://bugs.debian.org/353100>.
* src/df.c (usage): Likewise.
* src/ls.c (usage): Likewise.
2010-06-29 07:06:31 +02:00
Pádraig Brady
91b7b7cf7e doc: reference POS syntax in --help for sort --key
* src/sort.c (usage): Reference the additional description
of the POS syntax.
2010-06-29 01:20:23 +01:00
Benno Schulenberg
825a92240e ln: print a clearer error message when linking fails 2010-06-27 08:47:24 +02:00
Jim Meyering
13f323786c stat: remove support for deprecated --context (-Z) option
* src/stat.c (main): Remove support for the --context (-Z) option.
In upstream releases this option has always been a no-op.  It was
first ignored for compatibility, and since the June 2008 commit,
574f7614 (coreutils-7.0), its use has evoked a warning.
* NEWS (Changes in behavior): Mention it.
2010-06-22 11:42:34 +02:00
Jim Meyering
1419af8243 doc: fix comm's --help output so we generate a better man page
* src/comm.c (usage): Don't align example comments in --help output,
since the extra space (sequence of two spaces) there would be
interpreted by help2man and induce an unwanted line break
in the resulting man page.  Reported by Jari Aalto.
2010-06-21 08:55:22 +02:00
Eric Blake
9f75771efb maint: ignore another gnulib generated file
* .gnulib: Exclude lib/c++defs.h.
2010-06-14 15:49:46 -06:00
Eric Blake
879e8261bb cat: improve documentation
* src/cat.c (usage): Clarify that -b overrides -n.
* doc/coreutils.texi (cat invocation): Likewise.
* THANKS: Update.
Suggested by Chas. Owens, in bug 6383.
2010-06-14 15:42:24 -06:00
Jim Meyering
ceb84598d8 doc: dd: discourage use of very large block sizes
* doc/coreutils.texi (dd invocation): Warn against using a very large
block size.  Suggested by Imre Péntek.
2010-06-14 22:36:28 +02:00
Jim Meyering
280b15249c dd: print a better diagnostic for an invalid block size
* src/dd.c (dd_copy): Give a better diagnostic than
"dd: memory exhausted" for an over-large bs= block size setting.
Same for ibs= and obs=.  Reported by Imre Péntek in
http://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/591969
2010-06-14 22:34:42 +02:00
Jim Meyering
d9ddd4c503 build: update gnulib submodule to latest 2010-06-11 11:32:31 +02:00
Jim Meyering
155c8148ae build: don't let a large sparse temporary file cause "make dist" to fail
* bootstrap.conf (bootstrap_epilogue): Replace the offending grep
command from po/Makefile.in.in's $(DOMAIN).pot-update rule.
2010-06-11 08:01:18 +02:00
Jim Meyering
ea615bf8cd ls: avoid just-introduced buffer overrun
* src/ls.c (gobble_file): Revert part of my preceding change,
to avoid clobbering stack.
2010-06-10 17:53:46 +02:00
Jim Meyering
9e7edd8467 maint: adjust INT_BUFSIZE_BOUND usage for maintainability
* src/tail.c (xlseek): Give INT_BUFSIZE_BOUND a variable name,
not a type name.
* src/ls.c (gobble_file, format_user_or_group_width): Likewise.
* src/head.c (elide_tail_bytes_pipe): Likewise.
(elide_tail_lines_seekable, main): Likewise.
[This change is not complete -- there are doubtless other uses
that can be updated in the same way.]
2010-06-08 13:16:26 +02:00
Jim Meyering
ad89ea6a0d sort: avoid unnecessary use of sprintf
sprintf is relatively heavy-weight.
* src/sort.c (key_warnings): Use umaxtostr and stpcpy rather
than sprintf.
Also, replace each INT_BUFSIZE_BOUND "type_name" argument
with the equivalent variable name.  More maintainable that way.
2010-06-08 13:16:26 +02:00
Eric Blake
04bed02096 dirname: tweak summary wording
* doc/coreutils.texi (dirname invocation): Reword to be more
precise.
* src/dirname.c (usage): Likewise.
* THANKS: Update.
Reported by Filipus Klutiero, bug 6175.
2010-06-08 04:28:19 -06:00
Jim Meyering
dfad4755ca doc: mention the new coreutils@ mailing lists
* README-package-renamed-to-coreutils: Mention the new mailing list
and a mirror.
2010-06-02 17:41:52 +02:00
Jim Meyering
d5a5d83094 touch: remove support for --file=REF_FILE option
* src/touch.c (main): Remove support for the deprecated, long-named
--file option, which is an alternate name for --reference (-r).
That option was undocumented with the arrival of --reference, in
the 1995-10-29 commit, 8b92864e1d.  Since the 2009-02-09 commit,
ed85df444a, use of --file has elicited a warning.  Not only was
this code due for removal, but the long-name-use-detecting code
was buggy in that it would use a stale or uninitialized "long_idx",
as reported by Robin H. Johnson in http://bugs.gentoo.org/322421.
* NEWS (Changes in behavior): Mention it.
2010-06-02 17:14:10 +02:00
Jim Meyering
c0cfa0defe maint: make spacing around "=" consistent, even in IF_LINT
E.g.,
  -  size_t desired_width IF_LINT (= 0);
  +  size_t desired_width IF_LINT ( = 0);
Use this command:
  g grep -l IF_LINT | grep '\.[ch]$' \
    | xargs perl -pi -e 's/(IF_LINT \()= /$1 = /'
2010-05-31 11:02:21 +02:00
Jim Meyering
da7a704cd3 maint: replace each "for (;;)" with "while (true)"
Run this command:
  git ls-files | grep '\.[ch]$' \
    | xargs perl -pi -e 's/for \(;;\)/while (true)/g'
...except for randint.c, which does not include stdbool.h.
In that case, use "while (1)".
* gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops.
* src/cat.c (simple_cat, cat): Use "while (true)" for infloops.
* gl/lib/randread.c (readsource, readisaac): Likewise.
* src/copy.c (copy_reg): Likewise.
* src/csplit.c (record_line_starts, process_regexp): Likewise.
* src/cut.c (set_fields): Likewise.
* src/dd.c (iread, parse_symbols): Likewise.
* src/df.c (find_mount_point, main): Likewise.
* src/du.c (main): Likewise.
* src/expand.c (expand): Likewise.
* src/factor.c (factor_using_division, do_stdin): Likewise.
* src/fmt.c (get_space): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/od.c (main): Likewise.
* src/pr.c (main, read_line): Likewise.
* src/shred.c (dopass, genpattern): Likewise.
* src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise.
* src/split.c (bytes_split, lines_split): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/test.c (and, or): Likewise.
* src/tr.c (squeeze_filter, main): Likewise.
* src/tsort.c (search_item): Likewise.
* src/unexpand.c (unexpand): Likewise.
* src/uniq.c (main): Likewise.
* src/yes.c (main): Likewise.
2010-05-31 11:02:21 +02:00
Jim Meyering
5591f19e9c maint: correct indentation of case_GETOPT_* macro uses
* src/base64.c (main): Correct indentation of syntactically
questionable case_GETOPT_HELP_CHAR and case_GETOPT_VERSION_CHAR macros.
* src/who.c (main): Likewise.
2010-05-31 11:02:21 +02:00
Jim Meyering
78c1111c00 stat: use gnulib's alignof module
* src/stat.c (alignof): Remove definition.
Instead, include "alignof.h", and sort the #include directives.
And get its definition from the gnulib module by that name:
* bootstrap.conf (gnulib_modules): Add alignof.
2010-05-31 11:02:21 +02:00
Jim Meyering
f385d97a41 tests: remove unnecessary single quotes in perl hash use: ->{'SYM'}
Run this command:
  git grep -l "limits->{'" \
    | xargs perl -pi -e "s/limits->{'(.*?)'}/limits->{\$1}/g"
* cfg.mk (sc_prohibit_perl_hash_quotes): New rule to match.
* tests/misc/join: Remove quotes.
* tests/misc/sort: Likewise.
* tests/misc/sort-merge: Likewise.
* tests/misc/test: Likewise.
* tests/misc/unexpand: Likewise.
* tests/misc/uniq: Likewise.
2010-05-31 10:59:11 +02:00
Pádraig Brady
200501052e truncate: improve handling of non regular files
Previously we copied `dd` and suppressed error messages
when truncating neither regular files or shared mem objects.
This was valid for `dd`, as truncation is ancillary to copying
it may also do, but for `truncate` we should display all errors.
Also we used the st_size from non regular files which is undefined,
so we display an error when the user tries this.

* src/truncate (do_truncate):  Error when referencing the size
of non regular files or non shared memory objects.  Display all
errors returned by ftruncate().
(main): Error when referencing the size of non regular files or
non shared memory objects.  Don't suppress error messages for
any file types that can't be opened for writing.
* tests/misc/truncate-dir-fail: Check that referencing the
size of a directory is not supported.
* tests/misc/truncate-fifo: Ensure the test doesn't hang
by using the `timeout` command.  Don't test the return from
running ftruncate on the fifo as it's system dependent as
to whether this fails or not.
NEWS: Mention the change in behavior.
Reported by Jim Meyering.
2010-05-29 10:45:13 +01:00
Pádraig Brady
81b7585ad1 truncate: support sizes relative to an existing file
* doc/coreutils.texi (truncate invocation): Mention that --reference
bases the --size rather than just setting it.
* src/truncate.c (usage): Likewise. Also remove the clause
describing --size and --reference as being mutually exclusive.
(do_truncate): Add an extra parameter to hold the size
of a referenced file, and use it if positive.
(main): Pass the size of a referenced file to do_truncate().
* tests/misc/truncate-parameters: Adjust for the new combinations.
* NEWS: Mention the change
Suggested by Richard W.M. Jones
2010-05-28 14:23:04 +01:00
Jim Meyering
d4201905ab tests: update help-version to work with parted, too
* tests/misc/help-version: Add init code for GNU Parted.
2010-05-26 11:33:53 +02:00
Jim Meyering
5d59808a65 maint: don't emit an extra newline in each of two diagnostics
* src/shuf.c (main): Remove a stray newline in a diagnostic.
* src/od.c (main): Likewise.
Detected via these:
  git grep -A1 'error *(.*,$' | grep -C1 '\\n"[,)]'
  git grep 'error *(.*;$' | grep '\\n"[,)]'
2010-05-25 18:05:29 +02:00
Jim Meyering
55db9a39a8 maint: remove unneeded double quotes on RHS of shell assignments
Run this command:
  git grep -l 'LC_[A-Z]*="' \
    | xargs perl -pi -e 's/(LC_[A-Z]*)="(.*?)"/$1=$2/'
* src/Makefile.am: Write LC_ALL=$$locale, not LC_ALL="$$locale".
* src/date.c (main): Similar, in a comment.
* tests/misc/sort-month: Write LC_ALL=$LOC, not LC_ALL="$LOC".
2010-05-25 12:32:03 +02:00
Pádraig Brady
6bc44b5feb maint: remove a redundant sort parameter from a test
* tests/misc/sort-month: Remove the -b option which
is redundant and ignored.
2010-05-24 13:00:35 +01:00
Pádraig Brady
63761c027c sort: adjust the leading blanks --debug warning
* src/sort.c (key_warnings): Always warn about significant leading
blanks when character offsets are specified, unless they key is
possibly a line offset, i.e. of the form -k1.x,1.y.  Also suppress
this warning if the user could be sorting right aligned indexes.
2010-05-24 12:12:24 +01:00
Jim Meyering
fdff32e183 maint: make copyright comment consistent with all others
* tests/misc/mktemp: Change punctuation to make copyright
paragraph consistent with all of the others.
2010-05-23 18:10:41 +02:00
Jim Meyering
28488c1214 tests: fix cp-a-selinux to skip cleanly upon mkfs failure
* tests/cp/cp-a-selinux: Initialize skip, to avoid a syntax error
in subsequent "test".
Remove redirect-to-/dev/null, now that output is always to a log file.
2010-05-21 20:21:18 +02:00
Jon Ringuette
2b8ecfa6f1 du: recognize -d N as equivalent to --max-depth=N
* NEWS (New features): Mention it.
* src/du.c (DEBUG_OPT): Remove.  Use long-named ---debug instead.
Commented out.
(MAX_DEPTH_OPTION): Remove.  Use 'd' instead.
(main): Insert literal "d:"; remove DEBUG_OPT.
* doc/coreutils.texi (du invocation): Add -d to indices.
* tests/du/max-depth: Exercise -d, too.
2010-05-19 07:28:16 +02:00
Jim Meyering
1be4f180f5 tests: exercise du's --max-depth option
* tests/Makefile.am (TESTS): Add du/max-depth.
* tests/du/max-depth: New file.
2010-05-19 07:28:16 +02:00
Pádraig Brady
9f1d4e3e6f tests: fix sort-debug-keys when fr_FR.utf8 not available
* tests/misc/sort-debug-keys: Correctly check for the absence
of the French UTF8 locale.
2010-05-18 23:44:34 +01:00
Jim Meyering
5e82d241d0 maint: fix the fs-magic-compare rule
* src/Makefile.am (fs-def): Sort definitions.
This is required by fs-magic-compare's use of join.
2010-05-17 16:10:24 +02:00
Jim Meyering
1173dcd632 tests: update init.sh from gnulib
* tests/init.sh: Update from gnulib.
2010-05-17 09:12:22 +02:00
Jim Meyering
fe953ad710 build: avoid a new -Wformat-induced warning
* src/sort.c (mark_key): Add a cast-to-int of a printf field width,
to placate -Wformat.
2010-05-17 09:09:28 +02:00
Pádraig Brady
9464ce2107 doc: fix sort info about version sort skipping blanks
* doc/coreutils.text (sort invocation): leading blanks are
significant for 'V'.
2010-05-16 01:28:32 +01:00
Pádraig Brady
03f6f32c41 sort: --debug: output data independent warnings and info
* src/sort.c (usage): Mention --debug can output warnings to stderr.
Also split the translatable string to aid translation.
(default_key_compare): A new function refactored from main(),
and now also called from the new key_warnings() function.
(key_to_opts): A new function refactored from incompatible_options(),
and now also called from the new key_warnings() function.
(key_numeric): A new function refactored to test if key is numeric.
(key_warnings): A new function to output warnings to stderr,
about questionable use of various options.  Currently it warns
about zero length keys and ineffective global options.
(incompatible_options): Refactor out key_to_opts()
(main): Use key_init() to initialize gkey.  Refactor out
default_key_compare().  Call key_warnings() in debug mode.
* doc/coreutils.texi (sort invocation): Mention that warnings
are output by --debug.
* tests/misc/sort-debug-warn: A new test for debug warnings.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature
2010-05-16 01:08:33 +01:00
Pádraig Brady
144d6e5f53 tests: fix sort-debug-keys when fr_FR.utf8 not available
* tests/misc/sort-debug-keys: Don't verify (or even run)
the fr_FR tests when that locale is not available on the system.
2010-05-12 14:53:45 +01:00
Pádraig Brady
4f5732e27a sort: add a --debug option to highlight key extents
* src/sort (usage): Add description for --debug.
(write_bytes): Pass a line structure so it can subsequently
be passed to compare to highlight the keys when in debug mode.
Also transform TAB and NUL characters written to stdout so
that the highlighting in debug mode aligns correctly.
(human_numcompare): Pass an "endptr" so we can record the extent
of the number matched.
(general_numcompare): Likewise.
(find_unit_order): Likewise.
(getmonth): Likewise.
(numcompare): Likewise.  Note we reuse find_unit_order() for this,
which is a good enough approximation, and means we don't need to
change the strnumcmp() interface.
(check_mixed_SI_IEC): Return whether iec_present, so that can be
used to set the "endptr" in find_unit_order.  Also make the key
parameter optional, which will be the case from numcompare().
(count_tabs): A new function to determine how much to adjust
the mbswidth() values by (TABs don't have a width).
(mark_key): A new function to output the key highlighting to stdout.
(debug_key): A new function to determine the offset and width
of the key highlighting.
(key_compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called.  For each key type, set
the length (lena) and whether leading blanks are auto skipped (skipb)
which are then used by debug_key() to highlight the portion of the
key used in the comparison.
(compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called.  Call debug_key() to
highlight the last resort comparison.
(check): Output highlighting for disorder line to stdout.
(main): Process the --debug option and make it mutually exlusive
with the -o option as I don't see it useful there, even potentially
harmful if someone left a --debug in by mistake when updating a file.
Also restricting debug output to stdout, simplifies the logic
for dealing with temporary files.
* doc/coreutils.texi (sort invocation): Describe the --debug option,
and reference it from the --key description.
* tests/misc/sort-debug-keys: A new test for highlighting keys.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
2010-05-12 13:30:37 +01:00
Jim Meyering
7e978a7b2d build: record the gettext-0.18 requirement also in configure.ac
* configure.ac: Require gettext-0.18 here, too.
2010-05-11 10:31:21 +02:00
Jim Meyering
844b2570b3 build: update gnulib submodule to latest
* tests/init.sh: Update from gnulib, to fix typo.
2010-05-11 09:51:16 +02:00
Jim Meyering
0c22e84156 build: record that when building from git, gettext-0.18 is required
* bootstrap.conf (buildreq): Require gettext-0.18.
2010-05-10 12:39:37 +02:00
Jim Meyering
d21812670b tests: avoid a new syntax-check failure
* .x-sc_prohibit_fail_0: Exempt tests/init.sh.
2010-05-10 11:47:27 +02:00
Jim Meyering
88e2f6c860 tests: provide a definition of gl_trap_ in cfg.mk
* cfg.mk (gl_trap_): Define here, now that it's gone from maint.mk.
* gnulib: Update to latest.
2010-05-10 11:45:40 +02:00
Jim Meyering
e080c8a1b0 tests: begin using init.sh
* tests/init.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it here.
2010-05-10 11:33:31 +02:00
Jim Meyering
722173444a tests: update help-version
* tests/misc/help-version: Use init.sh, rather than test-lib.sh.
Add idutils' setup.
2010-05-09 21:22:21 +02:00
Jim Meyering
74f07c98d4 tests: move sc_prohibit_always-defined_macros to gnulib's maint.mk
* cfg.mk (sc_prohibit_always-defined_macros): Remove it from here.
* gnulib: Update to latest, for a maint.mk that includes that rule.
2010-05-09 18:54:33 +02:00
Jim Meyering
0f741381c4 tests: rename a syntax-check
* cfg.mk (sc_prohibit_always-defined_macros): Rename from
sc_always_defined_macros.
* .x-sc_prohibit_always-defined_macros: New file, renamed from...
* .x-sc_always_defined_macros: ...removed.
* Makefile.am (syntax_check_exceptions): Rename here, too.
2010-05-09 18:47:34 +02:00
Jim Meyering
6ac165922c tests: loosen/tighten the always_defined_macros check
* cfg.mk (.re-defmac): Generate better regexps: allow white space
before the '#', and append a word-boundary requirement.
Without the latter, #define NULL_DEV ... would evoke a false-positive.
2010-05-09 18:29:22 +02:00
Jim Meyering
cab2119542 tests: improve the always_defined_macros check
* cfg.mk (sc_always_defined_macros): Adjust its helpers not to depend
on the existence of ./lib.  Instead, extract symbols directly from
gnulib/lib/*.in.h files.
2010-05-09 12:08:21 +02:00
Jim Meyering
9e42ecceff doc: factor hard-coded project-specific bits from README-release, ...
using the new --mail-headers option to gnulib's announce-gen, and
the updated maint.mk rules to connect the pieces.
* README-release: Remove hard-coded To:, Cc: etc. parts, now
that they're emitted automatically into the announcement template.
* cfg.mk (announcement_Cc_): Override the default.
* gnulib: Update to latest, to get newer announce-gen and maint.mk.
2010-05-03 22:21:31 +02:00
Jim Meyering
ca41dcff1d doc: update release procedure
* README-release: Rearrange slightly: post the announcement to
Savannah first, so you can include a link to that post in the email.
2010-05-03 20:37:13 +02:00
Jim Meyering
7d501cdd9c maint: factor trap-related code out of two syntax-check rules
* cfg.mk (gl_trap_): Define, using a loop and eval'd trap,
rather than repeated "trap" uses.  Also handle "13", SIGPIPE.
(sc_always_defined_macros): Use it.
(sc_system_h_headers): Likewise.
2010-05-03 15:49:38 +02:00
Jim Meyering
ecf6d16dc7 maint: extend the always_defined_macros syntax-check
* cfg.mk (gl_generated_headers_): Define.
(headers_with_interesting_macro_defs): Remove headers covered
by the above.
(.re-defmac): Extract symbol names from many more files.
(sc_always_defined_macros): Use VC_LIST_EXCEPT, not VC_LIST, so
that we can use the usual exception mechanism.
Test for $(gnulib_dir), not system.h.
* .x-sc_always_defined_macros: New file.  Exempt src/seq.c.
* Makefile.am (syntax_check_exceptions): Add it here.
2010-05-03 13:24:04 +02:00
Jim Meyering
c0e784b923 maint: remove now-redundant definitions provided by signal.h
* src/dd.c (SA_NODEFER, SA_RESETHAND): Remove definitions,
now that gnulib guarantees they are defined in <signal.h>.
* src/ls.c (SA_RESTART): Likewise.
2010-05-03 12:26:20 +02:00
Jim Meyering
a9c542e416 maint: remove now-redundant definitions provided by sys/wait.h
* src/timeout.c (WIFSIGNALED, WTERMSIG): Remove definitions,
now that gnulib guarantees they are defined in <sys/wait.h>.
* src/operand2sig.c: Likewise.
* src/kill.c: Likewise.
2010-05-03 12:26:00 +02:00
Paul Eggert
d861519d2a sort: use long doubles only when effective
* src/sort.c (general_numcompare): Don't use long double if strtold
is not available, as it may introduce needless overhead.
2010-05-01 23:25:39 +01:00
Jim Meyering
5e9a7ae46b build: update gnulib submodule to latest; bootstrap, too 2010-04-30 18:27:19 +02:00
Pádraig Brady
8b5087d4e6 sort: use long doubles for general numeric mode
* src/sort.c (general_numcompare): Use long doubles unconditionally,
and strtold when available, to convert numbers with greater range and
precision.  Performance was seen to be on par with standard doubles.
* doc/coreutils.texi (sort invocation): Amend the -g description to
mention long double rather than double, and strtold rather than strtod.
* src/getlimits.c (main): Output floating point limits for use in tests.
* tests/misc/sort-float: A new test to ensure sort is using long
doubles when possible, and that locale specific floats are handled.
* tests/Makefile.am: Reference the new test.
* tests/test-lib.sh (getlimits_): Normalize indenting.
* NEWS: Mention the new behaviour.
Reported by Nelson Beebe.
2010-04-29 18:55:57 +01:00
Jim Meyering
7905d6d34d build: remove now-duplicate use of AC_SYS_LARGEFILE
* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Don't require AC_SYS_LARGEFILE,
now that gnulib does it.
2010-04-29 16:41:22 +02:00
Jim Meyering
518a8664a2 build: remove now-useless configure-time header checks
* m4/jm-macros.m4 (gl_CHECK_ALL_HEADERS): Don't test for headers
that gnulib now provides: sys/ioctl.h, sys/time.h, sys/wait.h.
2010-04-29 16:41:22 +02:00
Jim Meyering
83e4f0ca02 doc: tweak factor-describing wording
* doc/coreutils.texi (factor invocation): Don't say that "factoring
large prime numbers is hard".  A pedant might ding you, since it's
trivial to factor a number that is known to be prime.  Instead, say
that "factoring large numbers... is hard".  Reported by Andreas Eder.
2010-04-25 10:35:51 +02:00
Jim Meyering
2191fe8f8d maint: remove now-unnecessary #if HAVE_header_H tests.
* .x-sc_prohibit_always_true_header_tests: New file.
* Makefile.am (syntax_check_exceptions): Add it.
* src/cat.c: Remove #if HAVE_SYS_IOCTL_H test.
* src/copy.c: Likewise.
* src/ls.c: Likewise.
* src/stty.c: Likewise.
* src/install.c: Remove #if HAVE_SYS_WAIT_H test.
* src/kill.c: Likewise.
* src/operand2sig.c: Likewise.
* src/timeout.c: Likewise.
* src/pathchk.c: Remove #if HAVE_WCHAR_H test.
* src/stat.c: Remove #if HAVE_NETINET_IN_H test.
2010-04-24 17:44:58 +02:00
Jim Meyering
a4ab8d9c55 build: enable gnulib modules for more replacement headers
* bootstrap.conf (gnulib_modules): Add the following:
netinet_in, sys_ioctl, sys_wait, so that we can eliminate
the #if HAVE_<header>_H tests guarding their header inclusions.
2010-04-24 17:16:56 +02:00
Jim Meyering
301c74865e tests: clean up also upon SIGQUIT
* tests/test-lib.sh: Also trap on SIGQUIT.
Spotted by Dmitry V. Levin.
2010-04-24 15:50:41 +02:00
Jim Meyering
765d67410c post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-04-23 18:36:32 +02:00
Jim Meyering
1d10eb8b1e version 8.5
* NEWS: Record release date.
2010-04-23 17:18:16 +02:00
Dmitry V. Levin
c0a121c9bc tests: fix exit status of signal handlers in shell scripts
The value of `$?' on entrance to signal handlers in shell scripts
cannot be relied upon, so set the exit code explicitly.

* cfg.mk (sc_always_defined_macros, sc_system_h_headers): Set
the exit code in signal handler explicitly to 128 + SIG<SIGNAL>.
* src/Makefile.am (sc_tight_scope): Likewise.
* tests/test-lib.sh: Likewise.
2010-04-23 15:44:19 +02:00
Eric Blake
c9e4ea6ee2 base64: always treat input in binary mode
Necessary for cygwin.  Technically, this patch is not correct,
in that it clobbers O_APPEND, but it is no different than any
other use of xfreopen to force binary mode, so all such uses
should be fixed at once in a later patch.

* src/base64.c (main): Open input in binary mode.
* THANKS: Update.
Reported by Yutaka Amanai.
2010-04-22 08:42:54 -06:00
Jim Meyering
819265b8be build: update gnulib submodule to latest 2010-04-21 20:05:52 +02:00
Eric Blake
a9b904a282 docs: document transformation of obsolete sort syntax
* doc/coreutils.texi (sort invocation): Mention the conversion.
2010-04-21 07:59:03 -06:00
Pádraig Brady
7dc398a30f maint: update a couple of NEWS items for the pending release
* NEWS: Mention that cp and mv from the previous release did
not support preserving extended attributes (fixed in e489fd04).
Improve the grammar for the "cp capabilities" item.
2010-04-21 07:55:38 +01:00
Pádraig Brady
8fc12909f6 sort: fix parsing of end field in obsolescent key formats
This regression was introduced in commit 224a69b5, 2009-02-24,
"sort: Fix two bugs with determining the end of field".
The specific regression being that we include 1 field too many when
an end field is specified using obsolescent key syntax (+POS -POS).

* src/sort.c (struct keyfield): Clarify the description of the eword
member, as suggested by Alan Curry.
(main): When processing obsolescent format key specifications,
normalize eword to a zero based count when no specific end char is given
for an end field. This matches what's done when keys are specified with -k.
* tests/misc/sort: Add a few more tests for the obsolescent key formats,
with test 07i being the particular failure addressed by this change.
* THANKS: Add Alan Curry who precisely identified the issue.
* NEWS: Mention the fix.
Reported by Santiago Rodríguez
2010-04-20 22:37:18 +01:00
Pádraig Brady
1777d0dfe3 cp: preserve "capabilities" when also preserving file ownership
* src/copy.c (copy_reg): Copy xattrs _after_ setting file ownership
so that capabilities are not cleared when setting ownership.
* tests/cp/capability: A new root test.
* tests/Makefile.am (root_tests): Reference the new test.
* NEWS: Mention the fix.
2010-04-16 23:02:02 +01:00
Jim Meyering
56fce1aed7 * HACKING (Add tests): Change example name, "newtest" to "new-test".
Not that anyone would confuse with something newt-related, but just
because it is more readable that way.

doc: tweak HACKING
2010-04-16 08:42:47 +02:00
Jim Meyering
36cc6ac787 doc: tweak HACKING
* HACKING (Curly braces): Tweak a sentence.  Filter a few
paragraphs through "fmt".
2010-04-16 08:21:32 +02:00
Pádraig Brady
62dd4b63c5 maint: fix build on platforms that replace strsignal
* src/Makefile.am (kill_LDADD): Add $(LIBTHREAD) so that
we link with the appropriate libraries to provide Thread Local Storage
on platforms that replace strsignal (like AIX for example).

Tested-by: Daniel Richard G. <danielg@teragram.com>
2010-04-16 00:55:43 +01:00
Pádraig Brady
3a1595a3fb tests: avoid spurious failure of ls/color-norm test
* tests/ls/color-norm: Use the "time" output by `ls -l`
to check normal style.  Previously we used the size from `ls -s`,
but the size of "empty" files can vary depending on whether
SELinux is enabled for example.
2010-04-16 00:26:21 +01:00
Jim Meyering
f8291d0ec4 doc: document our code formatting policy regarding curly braces
* HACKING (Curly braces: use judiciously): New section.
2010-04-15 18:52:41 +02:00
Jim Meyering
05bee6f116 tests: avoid spurious failure of root-only ls/capability test
* tests/ls/capability: Adjust this test not to expect the no-op escape
sequence that was removed from all other tests by 2010-01-30 commit
5d43617e, "ls --color: don't emit a final no-op escape sequence".
2010-04-14 15:48:31 +02:00
Pádraig Brady
584e38d8b3 cp: treat selinux warnings consistently
* src/copy.c (copy_reg): Suppress SELinux ENOTSUP warnings consistently
between the destination being present or not.  Previously we did
not suppress ENOTSUP messages when the destination was present.
(copy_internal): Use the same ENOTSUP supression method as
copy_reg() even though the issue was not seen in this case.
* tests/cp/cp-a-selinux: Add a test case for the issue and
group the other test cases in the file more coherently.
* tests/cp/cp-mv-enotsup-xattr: Do the same check for xattr
warnings, even though they did not have the issue.
2010-04-13 13:09:50 +01:00
Pádraig Brady
c420cfef77 doc: clarify when cp and mv output xattr warnings
The 2010-03-26 commit, 4c38625e, "doc: fix info on cp --preserve..."
was not entirely correct as cp --preserve=all does produce some
xattr warnings.

* src/copy.h: Update and clarify the comments for reduce_diagnostics
and require_preserve_{xattr,context}.
* doc/coreutils.texi (cp invocation): Update the -a and
--preserve=xattr,context options to say when and which
xattr warnings are output.
(mv invocation): Mention that some warnings are output
when preserving xattrs.
2010-04-12 10:06:11 +01:00
Pádraig Brady
be9a42e7ac doc: mention that "capabilities" are preserved by cp/mv
* doc/coreutils.texi (cp invocation): Mention that
"capabilities" are preserved when implemented using
extended attributes.
(mv invocation): Mention ACLs etc. are maintained
due to xattrs being copied.
2010-04-11 16:37:40 +01:00
Jie Liu
20a5a60c61 build: tell ./bootstrap to check for xz up-front
* bootstrap.conf (buildreq): Add xz to the list.
2010-04-11 17:09:35 +02:00
Jim Meyering
0ba945b050 tests: more syntax-checks
* gnulib: update to latest
* cfg.mk (sc_prohibit_empty_lines_at_EOF): Remove, now that it's
in gnulib's maint.mk.
(_hv_file): Override the default.
2010-04-11 11:29:00 +02:00
Jim Meyering
8c4b6ba09b maint: new syntax-check rule: prohibit empty lines at EOF
* cfg.mk (detect_empty_lines_at_EOF_): Define.
(sc_prohibit_empty_lines_at_EOF): New rule.
* .x-sc_prohibit_empty_lines_at_EOF: New file.  Exempt pr test inputs.
* Makefile.am (syntax_check_exceptions): Add it.
Pádraig Brady suggested to parse the output of tail -n1.
2010-04-10 20:26:39 +02:00
Mike Frysinger
ac6feeb9f2 dircolors: add rxvt-256color and rxvt-unicode256
* src/dircolors.hin: Add them.
2010-04-09 16:28:46 +02:00
Jim Meyering
ef5758c328 maint: ftruncate is always available, even without gnulib
Now that even MinGW provides ftruncate, we know that all
reasonable portability targets provide this function.
Remove the workaround code.  We nearly removed the gnulib
module three years ago:
  http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/9203
and it is now officially "obsolete".
* bootstrap.conf (gnulib_modules): Remove ftruncate.
* src/copy.c (copy_reg): Remove use of HAVE_FTRUNCATE and its
no-longer-used workaround code.
* src/truncate.c: Remove a comment about handling missing ftruncate.
2010-04-09 10:50:43 +02:00
James Youngman
0a9302e7f7 doc: make wc --help say how it defines a 'word'
* src/wc.c (usage): Add wc's definition of "word".
2010-04-08 23:53:12 +02:00
Jim Meyering
9e66806e28 doc: adjust a header in announcement email template
* README-release: Use Mail-Followup-To: rather than Reply-To:.
The former works more reliably, at least with Gnus.
2010-04-08 08:45:23 +02:00
Jim Meyering
f6b2f46714 tests: add a PATH-sanity-check to help-version
* tests/misc/help-version: Sync from gzip's version.
* tests/check.mk (TESTS_ENVIRONMENT): Export VERSION, as required
for new help-version test.
2010-04-07 11:47:28 +02:00
Jim Meyering
f267926f2d maint: fix a masked syntax-check violation
* m4/jm-macros.m4 (ARGMATCH_DIE): Use usage(EXIT_FAILURE), not usage(1).
* .x-sc_prohibit_magic_number_exit: Remove *.m4 exemption that was
masking the above.
2010-04-06 16:02:27 +02:00
Jim Meyering
6f6f599867 build: update gnulib submodule to latest 2010-04-06 16:02:19 +02:00
Jim Meyering
2dc09bf809 build: update gnulib submodule to latest 2010-04-05 09:03:23 +02:00
Marc Kleine-Budde
98dacf492e tail: include sys/vfs.h (if possible) when sys/statfs.h is absent
* src/tail.c [HAVE_INOTIFY && !HAVE_SYS_STATFS_H]: Include <sys/vfs.h>.
2010-04-04 09:15:07 +02:00
Jim Meyering
b48a444e35 build: update gnulib submodule to latest
* cfg.mk: Update to use new _sc_search_regexp interface.  Run this:
perl -pi -e 's/\b_prohibit_regexp\b/_sc_search_regexp/;'
  -e 's/\bmsg=/halt=/; s/\bre=/prohibit=/;' cfg.mk
and then adjust backslashes so they still line up.
2010-04-02 20:31:14 +02:00
Jim Meyering
6416762b73 doc: synchronize parts of README-release from grep's version
* README-release (FIXME): Add Reply-To, use coreutils@gnu.org
for announcements.  Update savannah-verbatim-announcement procedure.
2010-03-31 08:58:40 +02:00
Jim Meyering
a8fc4edca5 build: update gnulib submodule to latest 2010-03-29 08:28:51 +02:00
Jim Meyering
3f7091359a tests: disable new texinfo-acronym syntax-check from gnulib
* cfg.mk (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it.
2010-03-29 08:28:51 +02:00
Bruno Haible
0f5dc96354 build: update after change in gnulib's lib-ignore module
* src/Makefile.am (AM_LDFLAGS): Define.  Use gnulib's new
$(IGNORE_UNUSED_LIBRARIES_CFLAGS).
2010-03-29 08:28:51 +02:00
Jim Meyering
5ef03d6c5b tests: avoid spurious sc_prohibit_test_minus_ao syntax-check failures
* tests/misc/ls-time: Change comments and diagnostics.
* tests/misc/xattr: Likewise.
2010-03-29 08:28:51 +02:00
Jim Meyering
8915368ee3 tests: fix typos in envvar-check script
* tests/envvar-check: Fix variable name typos.
Probably harmless, since no selected shell would fail to unset.
2010-03-26 16:49:48 +01:00
Pádraig Brady
b4f9559537 nice,chroot: use more standard option parsing
Related to the 2010-03-25 commit, 88d4b346,
"timeout: use more standard option parsing".
* src/nice.c (main): Don't use parse_long_options()
which is a helper for commands that don't have any
long options specific to them.
* src/chroot.c (main): Likewise.
* tests/misc/nice-fail: Remove a case that now
passes due to us accepting multiple instances of the
--help and --version options.
* tests/misc/chroot-fail: Likewise.
2010-03-26 14:31:16 +00:00
Kim Hansen
88d4b3461e timeout: use more standard option parsing
* src/timeout.c (main): Don't use parse_long_options()
which is a helper for commands that don't have any
long options specific to them.
* tests/misc/timeout-parameters: Remove a case that now
passes due to us accepting multiple instances of the
--help and --version options.
* THANKS: Add the author.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-03-26 14:27:54 +00:00
Pádraig Brady
4c38625ef3 doc: fix info on cp --preserve=all, which does _not_ give xattr warnings
The info docs have been inaccurate since 2009-04-17, commit 941bd482,
"mv: ignore xattr-preservation failure when not supported by filesystem"
* doc/coreutils.texi (cp invocation): Say that cp --preserve=all
does _not_ output errors when failing to copy xattrs.
2010-03-26 14:19:37 +00:00
Jim Meyering
946359f101 cfg.mk: remove comments with sed rather than cpp -fpreprocessed
* cfg.mk (_sed_remove_comments): Define, starting with gettext's
moopp sed code, but factoring it to be more understandable.
(sc_space_before_open_paren): Adapt.
Prompted by Bruno Haible's suggestion to use gettext's moopp code.
2010-03-21 12:23:16 +01:00
Jim Meyering
9f793def3c cfg.mk: fix copy-paste-o in a diagnostic
* cfg.mk (sc_space_before_open_paren): Mention cpp -fpreprocessed,
not cppi, when cpp -fpreprocessed doesn't work.
Spotted by Eric Blake.
2010-03-20 13:45:56 +01:00
Jim Meyering
628a5e16dd maint: enforce one small aspect of formatting style: space-before-"("
* cfg.mk (sc_space_before_open_paren): New rule.
2010-03-20 12:14:46 +01:00
Jim Meyering
773d15a702 maint: code formatting nit
* src/system.h (ST_NBLOCKS): Add space before paren.
2010-03-20 12:11:50 +01:00
Pádraig Brady
c872a1d8a5 maint: mbsalign: fix an edge case where we truncate too much
* gl/lib/mbsalign.c (mbsalign): Ensure the temporary destination buffer
is big enough, as it may need to be bigger than the source buffer
in the presence of single byte non printable chars.
* gl/tests/test-mbsalign.c (main): Add a test to trigger the issue.
2010-03-19 21:40:05 +00:00
Pádraig Brady
dfe0d336a0 maint: update the mbsalign module
* gl/lib/mbsalign.c (mbsalign):  Support the MBA_UNIBYTE_FALLBACK
flag which reverts to unibyte mode if one can't allocate memory
or if there are invalid multibyte characters present.
Note memory is no longer dynamically allocated in unibyte mode so
one can assume that mbsalign() will not return an error if this
flag is present.  Don't calculate twice, the number of spaces,
when centering.  Suppress a signed/unsigned comparison warning.
(ambsalign): A new wrapper function to dynamically allocate
the minimum memory required to hold the aligned string.
* gl/lib/mbsalign.h: Add the MBA_UNIBYTE_FALLBACK flag and
also document others that may be implemented in future.
(ambsalign): A prototype for the new wrapper.
* gl/tests/test-mbsalign.c (main): New test program.
* gl/modules/mbsalign-tests: A new index to reference the tests.
* .x-sc_program_name: Exclude test-mbsalign.c from this check.
2010-03-19 19:23:45 +00:00
Paolo Bonzini
3dcbcf98f4 tests: change help-version to per-program functions
* help-version: Change each *_args variable to a *_setup function.
2010-03-19 13:13:08 +01:00
Jim Meyering
dd9df4ab02 doc: tweak README-prereq again
* README-prereq: Change one more: s/coreutils/This package/
2010-03-19 11:34:15 +01:00
Jim Meyering
54158a45fa doc: make README-prereq more generic
* README-prereq: Adjust wording and reduce number of mentions of
"coreutils", so it's easier to reuse in another package: grep.
2010-03-19 10:14:46 +01:00
Eric Blake
da2f637888 rm: tweak wording about loss of data warning
* src/rm.c (usage): Update wording to make two points more
apparent: undelete is not trivial, and partial recovery should be
a consideration factor in deciding whether rm is secure enough.
Initially suggested by Reuben Thomas.
2010-03-18 15:41:59 -06:00
Ralf Wildenhues
cab29edcf1 revert "maint: mark makefile "dist-hook" target as PHONY"
* src/Makefile.am (dist-hook): Do not mark this target
as PHONY, explicitly.  Automake does it for us.
2010-03-18 21:08:07 +01:00
Eric Blake
b44d4b6b0e doc: improve ls --help's description of --escape (-b)
* src/ls.c (usage): Be more precise about how --escape (-b) works:
say "C-style escapes", not "octal escapes".  Reported by Jacky Fong.
2010-03-18 17:41:12 +01:00
Jim Meyering
d75820e516 maint: mark makefile "dist-hook" target as PHONY
* src/Makefile.am (dist-hook): Mark target as PHONY.
2010-03-18 08:32:26 +01:00
Jim Meyering
46e0137277 maint: add a space before open-paren, where lacking
* src/copy.c (copy_reg): Likewise.
* src/cut.c (main): Likewise.
* src/dd.c (main): Likewise.
* src/getlimits.c (print_int): Likewise.
* src/join.c (join): Likewise.
* src/pwd.c (logical_getcwd): Likewise.
* src/sort.c (specify_nmerge, mergefps, avoid_trashing_input): Likewise.
(merge): Likewise.
* src/uptime.c (usage): Likewise.
2010-03-17 18:28:28 +01:00
Pádraig Brady
c403c31e88 timeout: add the --kill-after option
Based on a report from Kim Hansen who wanted to
send a KILL signal to the monitored command
when `timeout` itself received a termination signal.
Rather than changing such a signal into a KILL,
we provide the more general mechanism of sending
the KILL after the specified grace period.

* src/timeout.c (cleanup): If a non zero kill delay
is specified, (re)set the alarm to that delay, after
which a KILL signal will be sent to the process group.
(usage): Mention the new option.  Separate the description
of DURATION since it's now specified in 2 places.
Clarify that the duration is an integer.
(parse_duration): A new function refactored from main(),
since this logic is now called for two parameters.
(main): Parse the -k option.
* doc/coreutils.texi (timeout invocation): Describe the
new --kill-after option and use @display rather than
@table to show the duration suffixes.  Clarify that
a duration of 0 disables the associated timeout.
* tests/misc/timeout-parameters: Check invalid --kill-after.
* tests/misc/timeout: Check a valid --kill-after works.
* NEWS: Mention the new feature.
2010-03-16 23:10:15 +00:00
Jim Meyering
4edb86215d build: update gnulib submodule to latest
The latest from gnulib once again passes all tests.
2010-03-13 14:21:16 +01:00
Jim Meyering
64bc4f20e8 revert to previous working version of gnulib
This reverts commit 0c31cdc2d1.
2010-03-13 10:31:15 +01:00
Thien-Thi Nguyen
141645d9c6 doc: use mktemp, not tempfile, in a shred usage example
* doc/coreutils.texi (shred invocation):
Use mktemp(1) instead of Debian-specific tempfile(1).
2010-03-13 08:37:01 +01:00
Jim Meyering
0c31cdc2d1 build: update gnulib submodule to latest 2010-03-12 08:39:11 +01:00
Eric Blake
4323ed2bde maint: drop *.lzma suport
* .gitignore: Remove *.lzma lines.
2010-03-11 11:55:45 -07:00
Eric Blake
c971ed9377 maint: ignore *.xz files
* .gitignore: Ignore *.xz created by 'make dist', now that we
no longer produce *.lzma.
2010-03-10 16:29:44 -07:00
Jim Meyering
998fe29301 remove: without -f, avoid unnecessary-expense/issues with euidaccess
* src/remove.c (write_protected_non_symlink): If faccessat fails,
return 1 or -1 directly, rather than falling back on euidaccess*.
2010-03-10 11:05:18 +01:00
Pádraig Brady
612c2c95c3 doc: Add an example for cutting fields separated by runs of blanks
* doc/coreutils.texi (cut invocation): Show how tr can be used
to process the input for cut in this case.
Suggestion from Dan Jacobson.
2010-03-09 00:32:07 +00:00
Pádraig Brady
a7b4fa01dd maint: rename the si_present variable in sort to iec_present
* src/sort.c: The units containing 'i' are actually IEC not SI.
2010-03-04 10:54:21 +00:00
Joey Degges
dae35bac98 sort: inform the system about our input access pattern
Tell the system that we'll access input sequentially,
so that we more efficiently process uncached files in a few cases:

Reading from faster flash devices. E.g. 21 MB/s key:
  NORMAL     31.6s (26.8 user)
  SEQUENTIAL 27.7s
  WILLNEED   27.7s

Processing in parallel with readahead when using a small 1M buffer:
  NORMAL     24.7s (21.1 user)
  SEQUENTIAL 22.7s
  WILLNEED   25.6s

A small benefit when merging:
  NORMAL     25.0s (16.9 user)
  SEQUENTIAL 24.6s (16.6 user)
  WILLNEED   38.4s (13.1 user)

Note WILLNEED is presented above for comparison to show it
has some unwanted characteristics due to its synchronous
prepopulation of the cache. It has a good benefit on a
mechanical disk @ 80MB/s and a multicore system with
competing processes:
  NORMAL     14.73s
  SEQUENTIAL 10.95s
  WILLNEED   05.22s
However the scheduling differences causing this result
are probably best explicitly managed using `nice` etc.

* m4/jm-macros.m4 (coreutils_MACROS): check for posix_fadvise().
* src/sort.c (fadvise_input): A new function to apply
the POSIX_FADV_SEQUENTIAL hint to an input stream.
(stream_open): Call the above function for all input streams.
2010-03-04 10:42:00 +00:00
Jim Meyering
168a6b6a0f tests: don't let the LANGUAGE envvar perturb tests
* tests/envvar-check (vars): Add LANGUAGE to the list of envvars
to unset.  At least in glibc (as an extension to POSIX), its value
actually trumps LC_ALL:

  $ LC_ALL=es_ES LANGUAGE=fr_FR.UTF-8 /bin/cat no-such
  /bin/cat: no-such: Aucun fichier ou dossier de ce type

but only when the default locale is not C:

  $ LC_ALL=C LANGUAGE=fr_FR.UTF-8 /bin/cat no-such
  /bin/cat: no-such: No such file or directory

Prompted by a report from Mads Kiilerich.
2010-03-04 10:46:11 +01:00
Pádraig Brady
59e2e55d0f sort: fix issues with month sorting in some locales
* src/sort.c (char fold_toupper[]): Change to unsigned
so as the correct comparisons are made in getmonth().
This fixes unibyte locales where abbreviated months
have characters that are > 0x7F, but it also works for
multibyte locales with the caveat that multibyte characters
are matched case sensitively.
With this change, the following example sorts correctly:
  $ echo -e "1 márta\n2 Feabhra" | LANG=ga_IE.utf8 sort -k2,2M
  2 Feabhra
  1 márta
* src/sort.c (inittables): Since we ignore blanks around months
in the input, don't include them when they're present in the locale.
With this change, the following example sorts correctly:
  $ echo -e "1 2月\n2 1月" | LANG=ja_JP.utf8 sort -k2,2M
  2 1月
  1 2月
* tests/misc/sort-month: A new test to exercise the above cases.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
2010-03-01 10:58:02 +00:00
Eric Blake
2590389aab bootstrap: resynchronize from gnulib
* gnulib: Update to latest.
* bootstrap: Copy from gnulib/build-aux/bootstrap.
* README-hacking: Describe how to use GNULIB_SRCDIR.
2010-02-25 09:29:46 -07:00
Eric Blake
9a6c97eb29 expr: clarify error message
* src/expr.c (eval4, eval3): Clarify that expr expects integers,
and not the broader category of numbers.
* tests/misc/expr: Update test accordingly.
Suggested by Dan Jacobson.
2010-02-25 08:54:49 -07:00
Pádraig Brady
0b5bd805bd maint: clean up the output from syntax-check rules
* cfg.mk (sc_tight_scope): Pass the -s (silent) flag to `make`
so that it doesn't report about calling sub makes.
(sc_check-AUTHORS): Likewise.
(sc_strftime_check): Don't display stderr from `info`.
* src/Makefile.am (sc_tight_scope): Don't annotate with "GEN".
(sc_check-AUTHORS): Likewise.
2010-02-19 11:41:19 +00:00
Moritz Orbach
f5268e2749 ls: fix a regression by honoring NORMAL attributes again
Output the NORMAL attribute before non file name text.
This attribute will continue into file names that would
not otherwise be colored unless FILE is also set.
The regression was introduced with commit 483297d5, 28-02-2009,
"ls --color no longer outputs unnecessary escape sequences".

* src/ls.c (set_normal_color): A new function to output the
NORMAL attribute sequence if it's enabled.
(print_current_files): Output NORMAL before printing long format info.
(print_file_name_and_frills): Output NORMAL before printing file name.
(print_color_indicator): Reset the attributes before a file name with
attributes so that NORMAL attributes will not combine with them.
(print_name_with_quoting): Ensure attributes are reset after printing
the file name if NORMAL attributes were output.
* tests/ls/color-norm: A new test for NORMAL and FILE combinations.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
Reported in https://savannah.gnu.org/bugs/?26512
2010-02-17 23:25:12 +00:00
Pádraig Brady
cba49d57da maint: fix the man page correlation tests
These checks were not being run as distcheck-hook targets
are only supported in the top-level Makefile.  Instead
these tests are now run during a syntax-check.

* cfg.mk (sc_man_file_correlation):  A new syntax check to
call the 2 existing tests to check the correlation between
the programs and man/*.[1x].
* man/Makefile.am (sc_man_file_correlation): Call the 2 existing
man page correlation tests.
(check-x-vs-1): Remove the "GEN" annotation as it's a bit verbose.
(check-programs-vs-x): Likewise.
* src/Makefile.am (all_programs.list): Exclude libstdbuf.so
from the list of programs.  This issue was not noticed as
the checks were not actually being run.
2010-02-16 15:19:40 +00:00
Pádraig Brady
a2f81776ad tests: fix an unlikely race in tail-2/inotify-hash-abuse2
* tests/tail-2/inotify-hash-abuse2: Explicitly kill the process
by using cleanup_() rather than using a timeout which may trigger
a failure on very slow systems (< 20 iterations of the loop per second).
2010-02-16 00:51:38 +00:00
Pádraig Brady
11d84c10ce doc: fix inconsistent capitalization in --help output
* src/base64.c (usage): Don't capitalize the first character
in an --option description.
* src/stdbuf.c (usage): Likewise.
* src/truncate.c (usage): Likewise.
* cfg.mk (sc_option_desc_uppercase): A new syntax check to
stop this happening in future.
* man/Makefile.am (sc_option_desc_uppercase): Ensure all
man pages are generated, then search for erroneous uppercase chars.
* src/Makefile.am (all_programs): Ensure all
commands are built so that all man pages can be generated.
2010-02-15 23:42:49 +00:00
Jim Meyering
58c98f2342 remove.c: remove three unnecessary #include directives
* src/remove.c: Don't include hash.h, hash-pjw.h or obstack.h.
They have been unused since the fts rewrite.
2010-02-15 19:26:30 +01:00
Eric Blake
7ae60bf26f build: ignore another gnulib artifact
* .gitignore: Add lib/warn-on-use.h.
2010-02-15 06:56:11 -07:00
Eric Blake
d4de2dc83a dirname: improve man page description
* doc/coreutils.texi (dirname invocation): Properly cover behavior
on directory.
* man/dirname.x: Likewise.
* THANKS: Update.
Reported by Emmanuel Lacour.
2010-02-15 06:56:07 -07:00
Pádraig Brady
45b46f4951 doc: remove extraneous periods from --help output
* src/join.c (usage): Mention "fields" rather than repeating "line"
so that it's more obvious that the fields are still parsed, and
thus -o is still honored for headers.  Also remove an extraneous
'.' reported by Stéphane Raimbault.
* src/base64.c (usage): Remove extraneous blank line and order
the options alphabetically.  Also remove an extraneous '.'
* src/chown.c (usage): Remove extraneous '.'
* src/cp.c (usage): Likewise.
* src/mktemp.c (usage): Likewise.
* src/pr.c (usage): Likewise.
* src/stat.c (usage): Likewise.
* src/uniq.c (usage): Likewise.
2010-02-11 08:01:15 +00:00
Jim Meyering
9f650d0870 doc: add a TODO item
* TODO: Consider adding a col implementation.
2010-02-10 07:25:58 +01:00
Jim Meyering
ed509250a2 copy.c: improve a comment
* src/copy.c (copy_reg): The comment about POSIXLY_CORRECT refers
only to cp, not to any other application that uses copy.c.
2010-02-07 21:02:18 +01:00
James R. Van Zandt
543696a9af doc: add a cross reference from tac's man page to "rev"
* man/tac.x: See also "rev".
2010-02-07 17:18:34 +01:00
Jim Meyering
86573d33a7 tests: include help-version test settings used by gzip and grep
* tests/misc/help-version: ...the better to keep this file in sync.
2010-02-07 17:18:02 +01:00
Jim Meyering
cea6d15720 doc: rewrite part of README-release
* README-release (Pre-release testing): Reorganize.
2010-02-07 09:10:53 +01:00
Jim Meyering
69cc8d5cb7 sync with gnulib
* gl/lib/regcomp.c.diff: Update to apply to changed version in gnulib.
* gnulib: Update submodule to latest.
2010-02-05 10:30:31 +01:00
Pádraig Brady
dd2253f49d tests: fix various timeout races
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/277485

* tests/misc/timeout: Set all expected timeouts to 1s and all
unexpected timeouts to 10s. In this way, tests normally proceed
quickly but may delay up to 10s before reporting failures.
* tests/ls/infloop: Likewise.
* tests/tail-2/pid: Likewise.
* tests/tail-2/pipe-f: Likewise.
* tests/tail-2/wait: Likewise.
* tests/dd/skip-seek-past-dev: Likewise.
2010-02-02 15:16:40 +00:00
Ondřej Vašík
f53a0e1062 tests: cp-a-selinux: skip the test if mounting a loop device fails
* tests/cp/cp-a-selinux: Skip the test (instead of fail) if we
fail to mount a loop device (e.g., none available).
2010-02-01 16:46:34 +01:00
Pádraig Brady
628b1d5e7e maint: fix a typo in NEWS
* NEWS: s/contains/contain/
2010-02-01 15:40:44 +00:00
Pádraig Brady
f86bb6967d join: make -t '' operate on the whole line
Previously passing an empty parameter to -t would
raise an error, but now it means to treat each line
as a single field for matching.  This matches the
default operation of `sort` which is usually used
in conjunction with join.

* src/join.c (main): Set the field delimiter to '\n' if
an empty parameter is passed to -t.
(usage): Mention the operation of -t ''.
* tests/misc/join: Add 2 new tests, for the existing -t '\0'
and the new -t '' functionality.
* doc/coreutils.texi (join invocation): Mention that
join -t '' always operates on the whole line, while
join -t '\0' usually does.
* NEWS: Mention the change in behavior.
2010-02-01 15:36:56 +00:00
Assaf Gordon
819aa9eba7 join: add --header option to always output the first line
This essentially allows one to use --check-order with headings.
Note join without --check-order will already handle the common case
where headings do match in each file, however using --check-order will fail
often when the header sorts after the first line of data.

Note also that this will join header lines from each file even if
they don't match, with headings from the first file being used.

* NEWS: Mention the new option.
* doc/coreutils.texi (join invocation): Describe the new option.
* src/join.c (usage): Likewise.
(join): Join the header lines unconditionally.
* tests/misc/join: Add 5 new tests.
2010-02-01 13:57:42 +00:00
Pádraig Brady
86914603b5 maint: fix an inconsequential memory leak in join
* src/join.c (join): Refactor the code that checks for misorder
at the tail of the files.  The most significant change here is
that freeline() is called thus silencing a valgrind warning about
a definite but inconsequential memory leak.
(freeline): Make more general by doing nothing when passed NULL,
and setting freed pointers to NULL.
2010-02-01 13:52:58 +00:00
Pádraig Brady
6e8f368e07 maint: use $(CONFIG_INCLUDE) rather than the hardcoding lib/config.h
* tests/check.mk (TESTS_ENVIRONMENT): Use the generated CONFIG_INCLUDE
variable.  Note $(abs_builddir)/$(CONFIG_HEADER) also currently works,
but $(CONFIG_HEADER) is deprecated and may not be generated in future.
$(CONFIG_INCLUDE) was made available by gnulib in commit, 22970f8a,
"syntax-check: detect incorrect boolean macro values in config.h"
2010-02-01 13:32:46 +00:00
Jim Meyering
5d43617e8a ls --color: don't emit a final no-op escape sequence
* src/ls.c (main): With --color, avoid emitting the final color-
resetting escape sequence when it would be a no-op.
* tests/ls/color-clear-to-eol: Adjust expected output accordingly.
* tests/ls/color-dtype-dir: Likewise.
* tests/ls/multihardlink: Likewise.
* tests/ls/stat-free-symlinks: Likewise.
* tests/misc/ls-misc: Likewise.
* NEWS (Changes in behavior): Mention it.
C de-Avillez rebased and adapted four of the new sl-dangle*
tests in tests/misc/ls-misc.
Reported by Jim Avera in
http://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/494663
2010-02-01 08:26:12 +01:00
Jim Meyering
5d4952059f maint: move vulnerable-Makefile.in-check to gnulib
* cfg.mk (sc_vulnerable_makefile_CVE-2009-4029): Move rule to...
* gnulib: Update to latest, to get updated "maint.mk".
2010-01-28 09:38:31 +01:00
Jim Meyering
c7ecdb0fcb maint: add a syntax-check rule to check for vulnerable Makefile.in
* cfg.mk (sc_vulnerable_makefile_CVE-2009-4029): New rule.
2010-01-27 22:41:33 +01:00
Kamil Dudka
aad0bde0b5 who --mesg (-T) can use a more accurate test for TTY writability
Enabled when coreutils is configured with --with-tty-group.
Based on a patch written by Piotr Gackiewicz.  Details at
http://bugzilla.redhat.com/454261

* src/who.c (is_tty_writable): A new function returning true if a TTY
device is writable by the group.  Additionally it checks the group to be
the same as TTY_GROUP_NAME when compiled with --with-tty-group.
* m4/jm-macros.m4: Introduce a new configure option --with-tty-group.
* NEWS: Mention the change.
2010-01-25 11:43:49 +01:00
Jim Meyering
0caead1ea0 tests: fix a syntax-check rule to pass in non-srcdir build
* cfg.mk (sc_x_sc_dist_check): This coreutils-specific syntax-check
rule would fail in a non-srcdir build, since in that case, each name
from $(VC_LIST) starts with "$(srcdir)/".  Fix that.
* gnulib: Update to latest, to pull in a required maint.mk change.
2010-01-24 14:51:31 +01:00
Pádraig Brady
9c566ad04a tests: make cp-mv-enotsup-xattr independent of the host file system
* tests/cp-mv-enotsup-xattr: Create a file system from which to copy
the xattrs so that the test is not skipped if the host file system
does not have user_xattr support.  Also don't erroneously fail when
built without xattr support.
2010-01-23 23:44:51 +00:00
Pádraig Brady
3e8586bc54 doc: add nproc to the texinfo overview menu
* doc/coreutils.texi: Add nproc to the System context
command list in the overview menu.
2010-01-23 23:06:59 +00:00
Pádraig Brady
014fead953 maint: ensure test independence from config macro format
* tests/cp/acl: Support USE_ACL not being defined.
* tests/mv/acl: Likewise. Also fix typo in skip message.
* tests/cp/preserve-slink-time: Support HAVE_UTIMENSAT being 0.
* tests/touch/no-dereference: Likewise.
* tests/ls/capability: Normalize so 1 is not required to be last char.
2010-01-23 22:53:52 +00:00
Eric Blake
e489fd04d6 build: fix failure from bogus USE_XATTR definition
* m4/xattr.m4 (gl_FUNC_ADDR): Fix regression introduced in commit
6beca4248.
* THANKS: Update.
Reported by Adam Sampson.
2010-01-19 06:41:57 -07:00
Jim Meyering
31423c76e8 libstdbuf: plug a very unlikely leak
* src/libstdbuf.c (apply_mode): Don't leak "buf" upon setvbuf failure.
2010-01-18 12:03:18 +01:00
Jim Meyering
cd349fdca2 pr: avoid two over-allocations
* src/pr.c (init_store_cols): Allocate N*sizeof(*VAR) bytes,
not N*sizeof(int*).  The latter would mistakenly allocate double
the required space on a system with 8-byte pointers.
2010-01-18 12:03:06 +01:00
Jim Meyering
eccf54368f maint: add missing "post-release push" step to release procedure
* README-release: Push the automated release and post-release
NEWS-updating commits.
Pádraig Brady reported that I'd pushed the tag without also
pushing the followup commit.
2010-01-14 06:39:11 -07:00
Jim Meyering
7ba0e90c55 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-01-13 22:14:16 +01:00
Jim Meyering
954ef23ed9 version 8.4
* NEWS: Record release date.
2010-01-13 21:57:54 +01:00
Pádraig Brady
e55d882811 tests: avoid spurious failures on older shells
* tests/tail-2/inotify-hash-abuse: Use kill rather than wait
to determine if the tail process is still running.
* tests/tail-2/inotify-hash-abuse2: Ditto.
2010-01-13 13:42:49 +01:00
Jim Meyering
f28c7d959b tests: work around spurious test failure with OpenBSD4.5's /bin/sh
* tests/ls/infloop: OpenBSD4.5's /bin/sh would mistakenly include
"set -x"-output in an application's stderr stream when stderr is
redirected before stdout.  This was causing one spurious test failure.
The work-around: redirect stdout first.
Reported by Nelson Beebe.
2010-01-13 10:55:55 +01:00
Jim Meyering
3b498ba141 tests: don't silently skip the sort-version tests
* tests/misc/sort-version: Don't use <<- and indented here-doc contents.
s/<<-/<</ and unindent the here-document contents.  Otherwise,
bash would ignore the indented delimiter and use EOF, thus silently
skipping this test.  OpenBSD5.4's shell reported the failure:
  $ printf 'cat<<-x\n foo\n x\n'|sh
  sh: <stdin>[4]: here document `x' unclosed
  [Exit 1]
by contrast, bash warns but still exits successfully:
  $ printf 'cat<<-x\n foo\n x\n'|bash && echo you lose
  bash: line 3: warning: here-document at line 1 delimited by \
    end-of-file (wanted `x')
   foo
   x
  you lose
2010-01-13 10:21:02 +01:00
Eric Blake
39243f0ea8 tests: avoid spurious failure on old kernel
* tests/touch/no-dereference: Skip test if utimensat doesn't
support symlinks.
Reported by Bernhard Voelker.
2010-01-12 06:00:05 -07:00
Pádraig Brady
a4da48c4f5 maint: update info about getting the prerequisite automake
* README-prereq: Now that we require automake-1.11.1
update the instructions from getting it from the git repo
2010-01-12 10:32:08 +00:00
Pádraig Brady
d89755469b maint: remove an already handled item from TODO
* TODO: The question regarding printf octal escapes is answered in
commit 4bcefa62, 2003-04-21, "Fix printf POSIX compatibility bug ..."
2010-01-12 10:29:36 +00:00
Pádraig Brady
b81cdbf31e maint: fix tests on solaris by using /usr/xpg4/bin
* tests/check.mk: Prepend /usr/xpg4/bin to the $PATH if present.
Using the more standard utilities allows tests such as misc/printenv,
which uses the -E option to grep, to complete.
2010-01-12 10:26:27 +00:00
Jim Meyering
0a6bbb5947 build: update gnulib, to get fixed getlogin-related tests 2010-01-12 09:56:07 +01:00
Jim Meyering
6beca4248f build: fix build failure due to missing libxattr
Configure is supposed to detect insufficient XATTR support.
However, if a system has the required headers, but no library,
the configure script would mistakenly enable USE_XATTR.
* m4/xattr.m4 (gl_FUNC_XATTR): If the attr_copy_file function
is not found, don't set USE_XATTR.
Nelson Beebe reported a link failure on RHEL 5.3.
Also, do not let the combination of --disable-xattr and
a stray LIB_XATTR environment setting perturb the build.
* NEWS (Build-related): Mention it.
2010-01-12 08:06:47 +01:00
Jim Meyering
37b8bfda56 doc: mention the wchar.h vs. glibc build problem
* NEWS (Build-related): Mention the wchar.h issue.
2010-01-12 06:52:14 +01:00
Pádraig Brady
21a6a7f64c nproc: return a possibly more accurate total CPU count
* gnulib: Update, for num_processors() improvement.
* NEWS: Mention the fix.
2010-01-12 06:46:51 +01:00
Kamil Dudka
6454dd0f2f ls: reorder includes to work around broken <sys/capability.h>
* src/ls.c: Include <sys/capability.h> later, to avoid build
failure with a header from libcap-2.16-1 or earlier.
See http://bugzilla.redhat.com/483548 for details.
2010-01-12 06:31:20 +01:00
Eric Blake
d0f18197fc maint: move coreutils specific rule into cfg.mk
* gnulib: Update, for maint.mk improvement.
* cfg.mk (_makefile_at_at_check_excpetions): New rule, needed
for latest change to maint.mk.
2010-01-08 12:00:51 -07:00
Jim Meyering
21f4da0fb9 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-01-07 18:25:36 +01:00
Jim Meyering
201ba1a203 version 8.3
* NEWS: Record release date.
2010-01-07 18:13:26 +01:00
Jim Meyering
e06e7a8331 maint: change an email address in THANKS
* THANKS: Adjust Denis' address.
2010-01-07 07:17:06 +01:00
Eric Blake
67d3e26350 pr: ensure the page header line is of the required format
Before this change, with too long a file name, the name would
abut the date field on the left and possibly also the "Page N"
field on the right, rather than leaving a one-space separator
in each case.  Fixes a regression introduced on Mar 6 2009,
by commit a4053c5291

* src/pr.c (print_header): Ensure that there is at least one
space before and after the file name part of the header line.
* NEWS: Mention it.
* tests/pr/W20l24f-ll: s/xPage/ x Page/.
* THANKS: Update.
Reported by Denis McKeon, in https://savannah.gnu.org/bugs/?28492.
2010-01-06 21:07:23 -07:00
Eric Blake
72a0a8264d maint: apply correct license to auxiliary files
* gnulib: Update, for maint.mk improvements.
* HACKING: Use GFDL 1.3, not 1.2.
* NEWS: Likewise.
* README: Likewise.
* cfg.mk (old_NEWS_hash): Update accordingly.
* .gitignore: Ignore file created by 'make update-NEWS-hash'.
2010-01-06 21:05:52 -07:00
Jim Meyering
f52d939014 build: require newer versions of automake and autoconf
* configure.ac: Require autoconf-2.62 and automake-1.11.1 or newer.
* bootstrap.conf (buildreq): Require automake-1.11.1 or newer,
to ensure people use a version with the fix for CVE-2009-4029.
Note that the coreutils-8.2 tarball included a fixed Makefile.in.
Require autoconf-2.62, per automake.
2010-01-06 15:40:41 +01:00
Eric Blake
7a1f69aae0 cp, touch: avoid problem with new glibc
* gnulib: Update, for utimens fix.
* NEWS: Mention the fix.
Reported by Guillaume Ayoub in http://bugs.debian.org/563726.
See also http://bugzilla.redhat.com/552320.

Signed-off-by: Eric Blake <ebb9@byu.net>
2010-01-06 06:42:16 -07:00
Philip Rowlands
bbdc929602 doc: fix typo in NEWS
* NEWS: Fix typo: s/repeated/repeatedly/
2010-01-05 14:11:56 +01:00
Jim Meyering
4db2f5c6bc build: update gnulib submodule to latest 2010-01-05 09:08:07 +01:00
Jim Meyering
be6c13e7e0 maint: always free a buffer, to avoid even semblance of a leak
* src/tac.c (main): Free the input buffer in most cases.
2010-01-05 09:08:03 +01:00
Jim Meyering
dc0f5eb6a0 maint: use more readable operator: "||" rather than "|"
* src/cp.c (make_dir_parents_private): Use "||" rather than "|",
so that clang understands there is no undefined pointer dereference.
2010-01-04 16:46:44 +01:00
Jim Meyering
0faf3bf874 maint: record update-copyright options for this package
* cfg.mk: Next time, just run "make update-copyright".
2010-01-03 18:56:22 +01:00
Eric Blake
b7f2b51c42 ls: fix color of broken symlinks colored as target
* src/ls.c (print_color_indicator): When using 'LINK target' in
dircolors, treat broken symlink as C_ORPHAN.
* tests/misc/ls-misc (sl-dangle2, sl-dangle3, sl-dangle4)
(sl-dangle5): Test for it, and add more coverage.
* NEWS: Document it.
* THANKS: Update.
Reported by Chris Jones.
2010-01-01 13:41:46 -07:00
Jim Meyering
84db964925 df: use fputs in place of printf in a few more places
* src/df.c (print_header): Use fputs rather than printf in more places.
Suggested by Eric Blake.
2010-01-01 16:56:03 +01:00
Jim Meyering
49c5b690cb build: update gnulib submodule to latest 2010-01-01 14:06:48 +01:00
Jim Meyering
157c2bc55e maint: add a few copyrights; remove obsolete README file
* tests/README: Remove long-obsolete file.
* tests/Makefile.am (EXTRA_DIST): Remove README.
* tests/misc/truncate-dir-fail: Add copyright comment.
* tests/misc/selinux: Likewise.
* tests/misc/chcon: Likewise.
* tests/misc/chcon-fail: Likewise.
* tests/sample-test: Use only 2010 in this list.
2010-01-01 14:06:48 +01:00
Jim Meyering
1aa17dc89b maint: update all FSF copyright year lists to include 2010
Use this command:
git ls-files | grep -v COPYING \
  | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \
      build-aux/update-copyright
2010-01-01 14:06:47 +01:00
Stéphane Raimbault
6c8d432b1f pr --help: add missing space between short and long options usage message
* src/pr.c (usage): Add missing space.
2010-01-01 14:06:47 +01:00
Stéphane Raimbault
f1ab2e0227 pr --help: improve a line-break
* src/pr.c (usage): Move the newline character a bit farther.
2010-01-01 14:06:47 +01:00
Stéphane Raimbault
4668ae8f06 df: add comments to help translators align column headers
* src/df.c (print_header): Add a comment telling translators to
retain the message length, and another to align header translations.
2010-01-01 14:06:46 +01:00
Jim Meyering
b0782cb9ea maint: newer gnulib; don't hard-code my GPG key ID
* cfg.mk (gpg_key_ID): Remove definition, now that maint.mk automates it.
* gnulib: Update to latest.
2009-12-31 16:44:50 +01:00
Jim Meyering
f428e548e5 doc: update tail's documentation to allow for new -F semantics
* src/tail.c (usage): Reword tail -F description, so that it no
longer mentions details specific to the non-inotify implementation.
Also, join diagnostic strings (while staying under the 509-byte limit)
to ease formatting of translations.  The latter was prompted by
a report from Stéphane Raimbault.
* doc/coreutils.texi (tail invocation): Update description here, too.
2009-12-31 09:42:52 +01:00
Eric Blake
7e0c2b9a59 touch: work around ntfs-3g bug
* gnulib: Update, for utimensat fix.
* NEWS: Improve wording about touch fixes.
* THANKS: Update.
Reported by Stuart Citrin.
2009-12-30 20:33:39 -07:00
Jim Meyering
7f9e164d27 build: update gnulib submodule to latest 2009-12-30 11:24:16 +01:00
Jim Meyering
d3a4bc86cd doc: mention two tail -F bug fixes in NEWS
* NEWS (Bug fixes): Two tail -F fixes.
2009-12-30 11:22:55 +01:00
Jim Meyering
fe062d563a tail: test for a bug in inotify-enabled tail -F
tail -F a b would stop tracking additions to b after "mv a b".
* tests/tail-2/F-vs-rename: New file.
* tests/Makefile.am (TESTS): Add it.
2009-12-30 11:22:55 +01:00
Giuseppe Scrivano
2ead2365e0 tail -F: don't stop following the target of a rename
This fixes a bug whereby tail -F would fail to track changes
to a file that was a target of a rename, and when the source of
the rename was another tailed file.

* src/tail.c (tail_forever_inotify): Ensure the wd is not already
present in the hash table before trying to add it.  When a new watch
descriptor is added to the `wd_to_name' hash table, check that it is
not already present.  If it is present then remove the previous element.
2009-12-30 11:22:55 +01:00
Pádraig Brady
2024418dc4 maint: improve the info about $PATH in README-prereq
* README-prereq: It wasn't obvious that the $PATH should
be set before building any of the prerequisite packages,
so move that information up.
2009-12-30 02:09:43 +00:00
Jim Meyering
fd93fc3ef4 tail: add another test to exercise abort-inducing flaw in tail -F
* tests/tail-2/inotify-hash-abuse2: New test, based on a reproducer
by Rob Wortman.
* tests/Makefile.am (TESTS): Add it.
2009-12-29 17:01:54 +01:00
Jim Meyering
bd26efaaa3 tail: add a test to exercise abort-inducing flaw in tail -F
* tests/tail-2/inotify-hash-abuse: New file, derived from
a report by Rob Wortman.
* tests/Makefile.am (TESTS): Add it.
Improved by: Pádraig Brady.
2009-12-29 17:01:54 +01:00
Giuseppe Scrivano
07f15147eb tail: remove `fdspec' from the hash table before changing its key
* src/tail.c (tail_forever_inotify): Avoid modifying fdspec->wd while
it is in the wd_to_name hash table.  Once it is removed, it can be
added using the new `wd' as key for the hash table.  This fixes the
abort-inducing bug reported by Rob Wortman in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/19372
2009-12-29 17:01:01 +01:00
Jim Meyering
ed86ca7c5e maint: quiet "make" in doc/
* doc/Makefile.am (constants.texi): Add a use of AM_V_GEN.
2009-12-29 14:31:56 +01:00
Jim Meyering
4b2b2711d9 tail: rename an internal variable
* src/tail.c (tail_forever_inotify): s/wd_table/wd_to_name/
2009-12-29 14:26:05 +01:00
Jim Meyering
66b15949df tail: avoid read-beyond-end-of-buffer error
* src/tail.c (tail_forever_inotify): Do not use f[i] in a context
where i may be larger than the largest valid index.  In the final
"if" clause in which we'd remove an inotify watch, we might have
used f[n_files].  Use fspec instead, since it is guaranteed to
be defined.
2009-12-29 14:24:01 +01:00
Eric Blake
3d09e31e07 maint: ignore more built files
Recent gnulib changes added new built files.

* .gitignore: Add arg-nonnull.h, link-warning.h,
unused-parameter.h.
2009-12-26 11:11:24 -07:00
Eric Blake
67bfde6668 tac: supply link dependency
* src/Makefile.am (tac_LDADD): Add LIB_GETHRXTIME.
* THANKS: Update.
Reported by Robert Schwebel.
2009-12-26 10:40:17 -07:00
Jim Meyering
a0d5d53a30 build: update gnulib submodule to latest 2009-12-26 09:09:51 +01:00
Jim Meyering
8506d9adb6 tail: shrink internal struct by 8 bytes
* tail.c (struct File_spec): Rearrange struct members to decrease
size by 8 bytes to 76,96 on i686,x86_64 respectively.
2009-12-26 09:09:36 +01:00
Jim Meyering
c85ad43ef4 maint: tail: avoid in-function #if directives
* src/tail.c (fremote): Add a comment.
Move definition "up" to precede first use, so we can
remove its prototype and the #if..#endif around each use.
(any_remote_file): Rename from any_remote_files.
2009-12-25 12:05:30 +01:00
Pádraig Brady
8d2ecd4a3e tail: fix --follow to not use inotify on remote files
* src/tail.c (struct File_spec): Add a flag to record if file is remote.
(recheck): If we're using inotify then check if the file has gone remote
and if so, drop it with a warning.
(any_remote_files): A new function to check for any open remote files.
(tailable_stdin): A new function to refactor the check for whether
a tailable file was specified through stdin.
(fremote): A new function to check if a file descriptor
refers to a remote file.
(tail_forever_inotify): Add some comments.
(tail_file): Record if a file is remote when initially opened.
(main): Disable inotify if any remote files specified.
Also document the caveat about remounted files not
being noticed by inotify.
* NEWS: Mention the fix.
2009-12-25 00:56:41 +00:00
Pádraig Brady
11dc0016bb wc: line-buffer the printed counts
* src/wc.c (main): Set stdout to line buffered mode
to ensure parallel running instances don't intersperse
their output.  This adds 6.5% to the run time in the worst case
of many zero length files, but has neglible impact for
standard sized files.
* tests/misc/wc-parallel: New test for atomic output.
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix
This is similar to commit 710fe413, 20-10-2009,
"md5sum, sha*sum, sum: line-buffer the printed checksums"
2009-12-23 13:45:34 +00:00
Pádraig Brady
53db8d6479 stat: Recognize k-afs, gfs, ocfs2 file system types
* src/stat.c (human_fstype): Add k-afs, gfs/gfs2 and ocfs2.
* NEWS: Update the stat -f entry.
2009-12-22 16:55:04 +00:00
Pádraig Brady
4b449caf2d stat: add support for more file system types
* src/stat.c (human_fstype): Add the following FS types:
fuseblk, rpc_pipefs.  Also fix a typo of minux3 to minix3,
and mention the fs-magic-compare make target to help update the list.
* NEWS: Mention the fix.
2009-12-22 11:17:01 +00:00
Jim Meyering
d98b1b35a6 build: correct coreutils-specific distcheck rules
* dist-check.mk (built_programs): Use $(bin_PROGRAMS), not $(PROGRAMS).
Otherwise, my-instcheck would fail due to non-installation of e.g.,
the noinst_PROGRAMS, setuidgid and getlimits.
(taint-distcheck): Correct the grep command that checks for libtool
traces in configure.
2009-12-20 10:57:45 +01:00
Eric Blake
01e4f003a0 touch: fix ctime regression in 'touch -a'
Regression introduced in coreutils 8.1 due to a bug in the Linux
kernel implementation of utimensat with mtime of UTIME_OMIT.

* gnulib: Update to latest, to pick up utimensat fix.
* NEWS: Mention the change.
* THANKS: Update.
Reported by John Stanley.
2009-12-19 17:32:45 -07:00
Pádraig Brady
54dcfab190 maint: don't include the strverscmp gnulib module
* bootstrap.conf (gnulib_modules): Remove the strverscmp module
which is not used since commit e505736f, on 03-10-2008,
"ls and sort: use filevercmp instead of strverscmp"
2009-12-19 01:34:59 +00:00
Pádraig Brady
3593cf50b2 doc: enhance and reference info about version comparison
* doc/coreutils.texi (sort invocation): Reference the additional
info about filevercmp rather than the unused strverscmp.
(Details about version sort): Add some examples that are not
handled well by fileversmp.
* src/ls.c: Change a comment referencing the now unused strverscmp.
2009-12-19 01:21:28 +00:00
Pádraig Brady
d64c186d8e rm: fix --one-file-system regression due to fts conversion
* src/remove.c (rm_fts): Fix incorrect comparison of
device and inode numbers.
* tests/rm/one-file-system2: Add a separate test so
that it can be run as a normal user (It doesn't need to mount).
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix.
Reported by Jan Larres.
2009-12-19 01:14:07 +00:00
Jim Meyering
bfcfc0ce72 maint: improve dist-check.mk rules
* dist-check.mk (null_AM_MAKEFLAGS): Remove LIBTOOL.  Adding it was
erroneous, since it is required when building from a distribution
tarball of a libtool-using project.  Reported by Ralf Wildenhues.
(my-distcheck): Reorganize to use a subshell and set -e, so that
failures propagate "out".  Without this change, setting LIBTOOL=false
would cause a failure that would then be ignored, probably due to a
problem in $(install-transform-check).
2009-12-14 11:33:03 +01:00
Thiago Farina
bf01ac3004 base64: use *_OPTION_DESCRIPTION macros instead of hard-coded strings
* src/base64 (usage): Use HELP_OPTION_DESCRIPTION and
VERSION_OPTION_DESCRIPTION macros, not literal strings.
2009-12-14 08:35:17 +01:00
Jim Meyering
5519ba24b5 tests: unpack xz-compressed tarballs when possible, not always *.gz
* dist-check.mk: Unpack compressed tarball using xz when possible,
since that's faster.
2009-12-13 17:55:31 +01:00
Jim Meyering
e4c4d77f84 maint: make dist-check.mk more easily shared
* dist-check.mk (built_programs): More generic, but still assumes src/.
Don't set GZIP in environment when untarring.
(my-distcheck): Use $(DIST_ARCHIVES), rather than assuming that
there is always a .tar.gz file.
2009-12-13 17:55:24 +01:00
Jim Meyering
c149538652 nohup: if fd_repoen fails (redirecting stdin), report it
* src/nohup.c (main): Don't ignore fd_reopen failure.
2009-12-13 12:23:41 +01:00
Jim Meyering
6ee02e3d83 tests: make the taint-distcheck rule easier to share with other projects
* dist-check.mk (taint-distcheck): Skip this test in a project
that uses libtool.
2009-12-13 11:22:39 +01:00
Jim Meyering
207a978e64 stat: recognize "sockfs" file system type, ...
... now that its magic number appears in <linux/magic.h>.
* src/stat.c (human_fstype) [S_MAGIC_SOCKFS]: Add case.
2009-12-13 11:00:41 +01:00
Jim Meyering
0291966175 maint: move definitions from maint.mk to dist-check.mk
* dist-check.mk (null_AM_MAKEFLAGS): Define here, not in maint.mk.
(built_programs): Likewise.
(my-distcheck): Move comments to...
(coreutils-path-check): ...the code they refer to.
Remove obsolete comments.
(null_AM_MAKEFLAGS): Add gperf, even though it's not used here.
* gnulib: Update to latest, for fixed maint.mk.
2009-12-13 10:51:36 +01:00
Jim Meyering
d9ba885974 tests: tail-without-inotify: avoid spurious test failure
* tests/tail-2/wait: Account for the possibility that the kernel
lacks inotify support.  Reported by Chris Clayton.
2009-12-12 17:40:42 +01:00
Jim Meyering
96047b77ec factor: add a missing va_end
* src/factor.c (debug): Add missing va_end.
2009-12-12 08:10:07 +01:00
Jim Meyering
5a514de955 build: update gnulib submodule to latest; adapt a patch
* gl/lib/tempname.c.diff: Adjust patch to apply to gnulib, now that
most TABs in indentation have been converted to spaces by running
this command: f=tempname.c.diff; patch-xform $f > k && mv k $f
2009-12-11 19:30:59 +01:00
Jim Meyering
a0000ba4ae post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-12-11 14:43:13 +01:00
Jim Meyering
70d023b076 version 8.2
* NEWS: Record release date.
2009-12-11 14:00:40 +01:00
Jim Meyering
ca39c9c308 tests: use a slightly better CU_TEST_NAME setting
* tests/check.mk (CU_TEST_NAME): Better test names.
2009-12-11 13:59:57 +01:00
Jim Meyering
fc4d3f63b0 tail: don't call fstat on an uninitialized FD
This bug showed up via valgrind as a "Conditional jump or move
depends on uninitialized value(s)" error.
* src/tail.c (ignore_fifo_and_pipe): New function.
(main): Use it only when tailing forever.
The code to compute n_viable and mark some F[i] as ignored would call
isapipe on an uninitialized file descriptor.  But n_viable and those
.ignored marks are useful/used only when tailing forever.  This bug
was introduced via commit f0ff8c73 (7.6), "tail: make the new
piped-stdin test as portable as the old one".
* NEWS (Bug fixes): Mention it.
2009-12-11 12:15:13 +01:00
Jim Meyering
3df2108b0d doc: NEWS: mention that gnulib's mgetgroups fix affects id
* NEWS (Bug fixes): Mention the "id" bug fix inherited via this gnulib
change: "mgetgroups: do not write bytes beyond end of malloc'd buffer"
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=51d5e813e9ee6cf23
2009-12-11 08:51:28 +01:00
Jim Meyering
829c418d67 build: update gnulib submodule to latest 2009-12-10 16:50:27 +01:00
Jim Meyering
06e9880c8e tests: avoid spurious failure when run via valgrind
* tests/misc/printenv: Ignore LD_PRELOAD differences.
2009-12-10 16:50:05 +01:00
Jim Meyering
bb4cb10e89 doc: NEWS: the "make distcheck" vulnerability dates back to 5.0
* NEWS (Bug fixes): Correct the introduced-in version number.
This was introduced on 2003-04-02 by commit 722a49ea.
2009-12-09 13:58:12 +01:00
Jim Meyering
23c0cecaa8 doc: NEWS: mention the "make distcheck" vulnerability
* NEWS (Bug fixes): Mention implications of the "make distcheck" change.
This was introduced on 2008-07-22 by commit 9bb0d576, "tests: ensure
"make check" w/tainted build dir no longer impacts $HOME".
2009-12-09 13:09:33 +01:00
Jim Meyering
19b460b239 tests: don't let "umask 077" cause root-only cp/preserve-gid failure
* tests/cp/preserve-gid: Use working_umask_or_skip_ to set umask to 022.
2009-12-09 08:45:30 +01:00
Jim Meyering
0f8bb24ca8 build: update gnulib submodule to latest 2009-12-08 21:34:00 +01:00
Pádraig Brady
321d2901de maint: remove an erroneous comment
* tests/misc/timeout: Remove an erroneous comment
introduced through copy and paste.
2009-12-08 15:33:18 +00:00
Pádraig Brady
f5a97b8269 sort: fix failure if sort's parent has ignored SIGCHLD
* src/sort.c (main): Reset the SIGCHLD handler to the default
as otherwise wait() could return an error.
* tests/misc/sort-compress: Set the CHLD handler in a subshell
to SIG_IGN to ensure the sort command resets it to SIG_DFL.
* NEWS: Mention the fix.
2009-12-08 15:29:27 +00:00
Pádraig Brady
73d4626134 timeout: fix failure if timeout's parent has ignored SIGCHLD
* src/timeout.c (main): Reset the SIGCHLD handler to the default
as otherwise wait() could return -1 and set errno to ECHILD.
This condition was ignored until commit 0b1dcf33, on 31-08-2009,
"timeout: defensive handling of all wait() errors"
but subsequently timeout would run the command correctly
but then fail with an error message.
* tests/misc/timeout: In a subshell set the CHLD handler to
SIG_IGN to ensure the timeout command resets it to SIG_DFL.
* NEWS: Mention the fix.
2009-12-08 15:17:01 +00:00
Pádraig Brady
7ac41f9950 tests: fix stty-row-col failure on small fixed terminals
* tests/misc/stty-row-col: Linux virtual consoles at least,
issue an error if you try to increase their size, so skip the
test if we can't increase the dimensions of the tty by 1 cell.
Reported by Matthew Burgess.
2009-12-08 15:08:44 +00:00
Pádraig Brady
dcff25a925 tests: fix stty failure with serial control settings
* tests/misc/stty: Don't check the serial control settings as
these are ignored by various Linux kernels.
Reported by Matthew Burgess.
2009-12-08 15:06:01 +00:00
Jim Meyering
7a2b0b8f66 build: update gnulib submodule to latest 2009-12-07 18:56:07 +01:00
Jim Meyering
ae034822c5 build: distcheck: do not leave a $TMPDIR/coreutils directory behind
* dist-check.mk (tmpdir): Rename from TMPDIR.  Use ./tests/torture
unconditionally, rather than $TMPDIR-with-default-to-/tmp.
Otherwise, running "make distcheck" could leave an empty /tmp/coreutils
directory behind.
(tp): Simplify, now that it's always in the build-dir.
(taint-distcheck): Set HOME earlier, in case $(MAKE) misbehaves.
(my-instcheck, coreutils-path-check): Add diagnostics, so it's easier
to diagnose when each runs.
(coreutils-path-check): Run configure with --quiet, to reduce output.
Inspired by Ralf Wildenhues' report of /tmp/coreutils being left behind.
2009-12-07 18:54:26 +01:00
Jim Meyering
d8cadda3b9 tests: readdir-mountpoint-inode avoid false-positive w/virtualbox
* tests/ls/readdir-mountpoint-inode: With some systems, stat can
succeed on a mount point and report that the inode number is 0.
Since ls displays "?" for those, that would otherwise show up as a
difference.  Skip such mount points.  Reported by Sergei Steshenko
in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/19142
2009-12-06 08:48:51 +01:00
Pádraig Brady
afd087d414 tests: don't run tail-2/inotify-race by default
* tests/tail-2/inotify-race: Note the caveats of the test.
I.E. the intermittent skips and the gdb hang reported
by Alan Curry.  Add extra info to the log on why the test
is skipped as it may be due to multiple reasons.  Mark
the test as very expensive so that it's not normally run.
2009-12-06 00:42:42 +00:00
Eric Blake
9b4b38f56e id: handle systems without getgroups support
If getgroups failed with ENOSYS, mgetgroups would unnecessarily
fail, and that provoked id into freeing an uninitialized pointer.
Meanwhile, we were not using xalloc_die properly.  Both issues
are better solved in gnulib, by introducing xgetgroups; this
patch uses the new interface.

Regression introduced by commit 6a31fd8d7.

* gnulib: Update, for mgetgroups improvments.
* src/id.c (print_full_info): Adjust caller to die on allocation
failure, and no longer worry about ENOSYS.
* src/group-list.c (print_group_list): Likewise.
* src/setuidgid.c (main): Likewise.
* NEWS: Mention the fix.
* THANKS: Update.
Reported by Scott Harrison.
2009-12-04 19:18:06 -07:00
Jim Meyering
5224fbd6f9 tests: fix a bug in sanitize_path_ that inhibited verbose output
* tests/test-lib.sh (sanitize_path_): Use "set -- ...", not "set - ...",
since the latter turns off the -x setting we rely on for VERBOSE=yes
output.
2009-12-03 17:04:16 +01:00
Eric Blake
d16a8f6c7f sort: fix link failure on Solaris
Commit f9d0bb8481 made sort depend on xnanosleep.

* src/Makefile.am (sort_LDADD): Add LIB_NANOSLEEP.
2009-12-01 13:07:48 -07:00
Jim Meyering
0dc1f4c6f3 rm: fix empty-name bug introduced with conversion to use fts
While "rm ''" would properly fail, "rm F1 '' F2" would fail
to remove F1 and F2, due to the empty string argument.
This bug was introduced on 2009-07-12, via commit 4f73ecaf,
"rm: rewrite to use fts".
* gnulib: Update to latest, for fixed fts.c.
* NEWS (Bug fixes): Describe it.
* tests/rm/empty-name: Adjust for changed diagnostic.
(mk_file): Define, copied from misc/ls-misc.
(empty-name-2): New test, for today's fix.
* lib/xfts.c (xfts_open): Reflect the change in fts_open, now that
it no longer fails immediately when one argument is the empty string.
Assert that the bit flags were not the cause of failure.
* po/POTFILES.in: Remove xfts.c.
* THANKS: Update.
Reported by Ladislav Hagara.
2009-12-01 14:38:39 +01:00
Pádraig Brady
cb775df09e bootstrap: fix handling of various perl --version formats
* bootstrap (get_version): Don't use perl's $] special
variable, as that requires updating all bootstrap.conf files to
use perl's x.yyyzzz version format.  Instead make the regular
expression more general to support version formats from older
perl-5.005_002 (5.5.2) and perl-5.11 which has other numbers
in the version line.
2009-11-30 14:04:43 +01:00
Jim Meyering
b92e0455e1 bootstrap: update from gnulib, for perl-5.11.x support
* bootstrap (get_version): Handle perl separately,
since perl-5.11's --version output is different.
2009-11-29 14:04:09 +01:00
Jim Meyering
3910144405 build: update gnulib submodule to latest 2009-11-29 10:56:57 +01:00
Jim Meyering
4bb812ad49 maint: chown.c: remove a comment
* src/chown.c: Remove old spec-like comment.
2009-11-28 06:48:03 +01:00
Eric Blake
b498c58013 tests: fix link failure on cygwin
Counterpart to commit 8fe40b84bd, since test-link.c uses rename,
and we override gnulib with a rename() replacement that can xalloc_die.

* gl/modules/link-tests.diff: New file.
2009-11-24 06:36:13 -07:00
Eric Blake
f9d0bb8481 build: fix link failure on cygwin
Cygwin 1.5 has a broken sleep, and the gnulib tests dragged in
rpl_sleep which then caused a link failure because it wasn't in
libcoreutils.a.  We could solve it by using the gnulib sleep module.
However, sleep and usleep may interact poorly with SIGALRM, and they
have less granularity; so it is better to adopt a policy that if we
must sleep, prefer xnanosleep.

* src/sort.c (pipe_fork): Use xnanosleep, to avoid the need for
rpl_sleep on cygwin, and to reduce granularity.
(MAX_FORK_TRIES_COMPRESS, MAX_FORK_TRIES_DECOMPRESS): Increase,
to account for reduction in granularity.
* src/tail.c (tail_file): Use xnanosleep in debug code.
* cfg.mk (sc_prohibit_sleep): New rule.
2009-11-24 06:36:07 -07:00
Jim Meyering
ab6b27eba7 tests: avoid test failures when PATH contains an unsearchable directory
* tests/test-lib.sh (sanitize_path_): New function.
Always call it.
2009-11-23 17:49:39 +01:00
Dmitry V. Levin
9cf9f8e1e0 tests: do not fail on read-only root file system
* tests/touch/not-owner: Handle the case when the root file system is
mounted read-only.
Reported by Solar Designer.
2009-11-22 16:40:18 +01:00
Jim Meyering
ad1f07b3c4 maint: cfg.mk: remove factored-out ftp host/dir definitions
* cfg.mk (gnu_ftp_host-alpha, gnu_ftp_host-beta gnu_ftp_host-stable):
(gnu_rel_host, url_dir_list): Remove definitions.  The defaults,
now provided by maint.mk, are the same.
* gnulib: Update for latest, including those maint.mk additions.
2009-11-20 16:39:24 +01:00
Jim Meyering
ddea7b1078 maint: correct comments in test scripts
* tests/misc/pwd-long: Fix spelling of cygwin1.dll in comment.
* tests/rm/fail-eperm: Likewise.
Reported by Eric Blake.
2009-11-20 12:58:51 +01:00
Jim Meyering
5eb8d60e6d maint: don't list "warnings" module explicitly
* bootstrap.conf (gnulib_modules): Remove "warnings", now that
it's pulled in automatically via "manywarnings".
2009-11-20 08:17:24 +01:00
Jim Meyering
395b1c9375 maint: move xfreopen module to gnulib
* gl/lib/xfreopen.c: Remove file.
* gl/lib/xfreopen.h: Likewise.
* gl/modules/xfreopen: Likewise.
2009-11-20 07:37:56 +01:00
Jim Meyering
2f2112335c build: update gnulib submodule to latest 2009-11-20 07:37:56 +01:00
Jim Meyering
30eb606ed5 tests: avoid spurious failures due to insecure directory in PATH
These tests perform no PATH search, and used to simply delete PATH from
the environment.  However, that is not portable, as seen on Cygwin,
where cygwin.dll must be resolvable via PATH when starting a sub-shell.
With commit 0cc04241, we took the alternate approach of untainting the
incoming $ENV{PATH}, but that fails when it contains an other-writable
directory.  Instead, now we hard code it to '/bin:/usr/bin'.

* tests/misc/pwd-long: Hard code $ENV{PATH} to a safe value.
* tests/rm/fail-eperm: Likewise.
Reported by Gilles Espinasse, Andreas Schwab, and Bauke Jan Douma.
2009-11-19 11:12:29 +01:00
Jim Meyering
f18eef3284 build: "make stable" emitted an invalid gnupload command
* cfg.mk (gnu_ftp_host-stable): Rename from gnu_ftp_host-major.
* README-release: Change another s/major/stable/.
2009-11-18 21:04:52 +01:00
Jim Meyering
e246d654f3 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-11-18 19:56:25 +01:00
Jim Meyering
447d245551 version 8.1
* NEWS: Record release date.
2009-11-18 19:38:50 +01:00
Jim Meyering
fee722471c build: update gnulib for Solaris utimens workaround 2009-11-18 15:58:20 +01:00
Jim Meyering
630f4ba107 build: update gnulib submodule to latest 2009-11-18 07:33:02 +01:00
Jim Meyering
2fccfaab19 maint: remove local gnulib-related patches
* gl/lib/printf-args.c.diff: Remove file.  No longer needed.
* gl/lib/vasnprintf.c.diff: Likewise.
2009-11-17 21:44:37 +01:00
Jim Meyering
2b18a4c138 build: update gnulib for Solaris 10 unsetenv work-around 2009-11-17 21:44:30 +01:00
Jim Meyering
6609ccbf87 doc: mention the du/fts vs. NFSv4 mount-point work-around
* NEWS (Changes in behavior): Mention it.
2009-11-17 08:56:12 +01:00
Jim Meyering
d863533752 build: update from gnulib for (un)setenv fixes 2009-11-17 08:48:15 +01:00
Jim Meyering
bf5af9aef8 build: update gnulib submodule to latest 2009-11-16 11:37:09 +01:00
Jim Meyering
161e5120d4 true, false: perform initialization only when argc == 2
* src/true.c (main): There is no reason to examine argv[0],
call atexit, etc., in the usual case in which we're about to exit.
This has the side effect of making it so that these programs
no longer segfault when subjected to execve abuse.
Before this change, these commands would make "true" segfault:
  printf '%s\n' '#include <unistd.h>' 'int main(int c, char**v)' \
    '{ execve (v[1], 0, 0); }' > k.c && gcc k.c && ./a.out $PWD/true
Now it succeeds.  Reported by Tetsuo Handa and Bart Van Assche
via Ondřej Vašík in http://bugzilla.redhat.com/537684.
2009-11-16 09:30:50 +01:00
Jim Meyering
3b997a9bcb tail -F can fail to track a file after it's been rotated
Tailing forever and by-name (--follow=name, -F), tail would
sometimes fail to follow a file that had been removed via rename.
If you can't apply this patch and have tail 7.6 or newer, you can
work around the bug via the undocumented --disable-inotify option.
* src/tail.c (tail_forever_inotify): When tailing by name (-F),
do not un-watch a file upon receipt of the IN_MOVE_SELF event.
Reported by Arjan Opmeer in http://bugs.debian.org/548439.
* NEWS (Bug fixes): Mention it.
Also see http://marc.info/?l=coreutils-bug&m=125829031916515
* tests/Makefile.am (TESTS): Add tail-2/inotify-rotate.
* tests/tail-2/inotify-rotate: New test.
2009-11-16 09:30:43 +01:00
Jim Meyering
00f0cabaec tests: help-version: exit nonzero when $built_programs is empty
* tests/misc/help-version: Use "Exit 1", rather than "Exit $fail"
with fail defined to 0 when $built_programs is empty.
2009-11-14 15:01:44 +01:00
Jim Meyering
5cf6fb3b12 build: do use AM_GNU_GETTEXT's "need-formatstring-macros" option
* configure.ac: Revert commit 49741b61 and add a comment.
Reported by Eric Blake.
2009-11-14 15:01:44 +01:00
Pádraig Brady
9ed5048148 tests: avoid a spurious failure on a loaded system
* tests/misc/timeout-parameters: This test could fail due to
the 1-second timeout expiring before a command of "no_such"
could be exec'd and fail.  Increase to 10 seconds.
2009-11-14 13:53:17 +00:00
Jim Meyering
c3744b25f2 build: require gettext-0.17
* configure.ac: Require gettext-0.17; it was released two years ago.
2009-11-13 17:54:07 +01:00
Jim Meyering
49741b61b7 build: correct gettext configure-time support
* configure.ac: Use AM_GNU_GETTEXT([external], [need-ngettext]),
rather than AM_GNU_GETTEXT([external], [need-formatstring-macros]).
Reported by Martin Jacobs in
http://thread.gmane.org/gmane.comp.parsers.bison.bugs/3181
* THANKS: Add his name.
2009-11-13 17:54:07 +01:00
Jim Meyering
9a91b2a928 build: update gnulib to latest, for fixed test-getgroups.c 2009-11-13 16:39:11 +01:00
Jim Meyering
4c9e7e01fa tests: avoid a spurious timeout on a heavily-loaded system
* tests/misc/timeout-parameters: This test would fail due to
the 1-second timeout expiring before a command of "." could
be exec'd and fail.  Increase to 10 seconds.
2009-11-13 16:38:20 +01:00
Eric Blake
6a31fd8d73 build: update gnulib, for getgroups improvements
A replacement getgroups is now guaranteed to exist, but it may
fail with ENOSYS.  mgetgroups is moved to gnulib, and now takes
gid_t instead of GETGROUPS_T (but setgroups still needs GETGROUPS_T).

* gnulib: Update to latest.
* gl/modules/mgetgroups: Delete, moved to gnulib.
* gl/m4/mgetgroups.m4: Likewise.
* gl/lib/mgetgroups.h: Likewise.
* gl/lib/mgetgroups.c: Likewise.
* src/group-list.c (print_group_list): Adjust callers.
* src/id.c (print_full_info): Likewise.
2009-11-13 07:50:20 -07:00
Jim Meyering
719a95aa9d build: bootstrap: add a comment; generalize autoheader check
* bootstrap: Sync from gnulib and diff.
2009-11-12 09:51:54 +01:00
Jim Meyering
1313107c5c build: update gnulib to latest; more *BSD and Solaris work-arounds 2009-11-12 07:53:42 +01:00
Jim Meyering
cf1bc9810d bootstrap: use git_modules_config in one more place
* bootstrap: Make bootstrap's --gnulib-srcdir more useful (for testing).
2009-11-11 19:07:37 +01:00
Eric Blake
622cf39be6 doc: fix typo
* doc/coreutils.texi (mktemp invocation): Quote shell variable.
2009-11-10 05:56:22 -07:00
Jim Meyering
3aff3ed137 build: update gnulib submodule to latest for its FreeBSD fixes 2009-11-09 11:00:42 +01:00
Pádraig Brady
10d97b3191 ls: fix capability coloring
Capability checking was incorrectly done on just the base name
rather than on the whole path.  Consequently there could be both
false positives and negatives when coloring files with capabilities.
Also capability checking was not done at all in certain cases for
non executable files.  Note passing absolute rather than relative
names to cap_get_file() reduces the has_capability() overhead
from around 33% to 30%.  I.E. ls --color is now around 3% faster.

* src/ls.c (struct fileinfo): Add a has_capability member.
(print_color_indicator): Refactor to pass just a fileinfo pointer
and a flag to say if we're dealing with a symlink target.
(print_name_with_quoting): Likewise.
(gobble_file): Set has_capability in the fileinfo struct.  Also do
a capability check even if executable coloring is disabled.
Ditto for SETUID and SETUID coloring.
Comment on how expensive has_capability() is.
(print_long_format): Adjust to refactored print_name_with_quoting.
(quote_name): Likewise.
(print_file_name_and_frills): Likewise.
* tests/ls/capability: Test the various false positive and negatives.
* THANKS: Add reporter (Ivan Labath).
* NEWS: Mention the fix.
2009-11-09 08:16:20 +00:00
Eric Blake
56b85e035b build: consistently use freopen-safer
cat, head, ptx, shuf, tac, tail, tee, tr, and uniq used freopen
on stdout, and were potentially vulnerable.  dircolors, du, and
tsort only used it on stdin, which is unaffected by freopen_safer,
but this covers all uses for consistency.

* cfg.mk (sc_require_stdio_safer): New rule.
* gl/modules/xfreopen (Depends-on): Add freopen-safer.
* gl/lib/xfreopen.c (includes): Use stdio--.h.
* src/ptx.c (includes): Likewise.
* src/shuf.c (includes): Likewise.
* src/uniq.c (includes): Likewise.
* src/dircolors.c (includes): Likewise.
* src/du.c (includes): Likewise.
* src/tsort.c (includes): Likewise.
2009-11-07 10:10:28 -07:00
Eric Blake
c768e2231b mktemp: fix bug with -q and closed stdout
If stdin or stdout is closed, then freopen(,stderr) can violate
the premise that STDERR_FILENO==fileno(stderr), which in turn
breaks mktemp -q.

* bootstrap.conf (gnulib_modules): Add freopen-safer.
* src/mktemp.c (includes): Use stdio--.h.
* tests/misc/close-stdout: Enhance test to catch bug.
2009-11-07 10:10:25 -07:00
Jim Meyering
9a8d8f46a5 maint: make du's cycle-detection code consistent
* src/du.c (process_file): Revert the du.c-changing part of
commit 8ba5d1a7. Use cycle_warning_required instead.
2009-11-07 08:43:05 +01:00
Jim Meyering
d9dbbb9a45 chcon, chgrp, chmod and chown now diagnose a directory cycle
* lib/xfts.c (cycle_warning_required): New function.
* lib/xfts.h: Declare it.
* src/chown-core.c (change_file_owner): Diagnose a cycle.
* src/chmod.c (process_file): Likewise.
* src/chcon.c (process_file): Likewise.
* NEWS (Bug fixes): Mention this.
2009-11-07 08:43:00 +01:00
Giuseppe Scrivano
74cf4cb26d nproc: A new program to count the available processors
* AUTHORS: Add my name.
* NEWS: Mention it.
* README: Likewise.
* bootstrap.conf (gnulib_modules): Add nproc.
* doc/coreutils.texi (nproc invocation): Add nproc info.
* man/Makefile.am (nproc.1): Add dependency.
* man/nproc.x: New template.
* man/.gitignore: Ignore generated man page.
* po/POTFILES.in: Add src/nproc.c.
* src/.gitignore: Exclude nproc.
* src/Makefile.am (EXTRA_PROGRAMS): Add nproc.
* src/nproc.c: New file.
* tests/Makefile.am (TESTS): Add misc/nproc-{avail,positive}.
* tests/misc/nproc-avail: New file.
* tests/misc/nproc-positive: New file.
2009-11-06 16:54:12 +00:00
Jim Meyering
41456fac8a build: move do-release-commit-and-tag to gnulib
* bootstrap.conf (gnulib_modules): Add do-release-commit-and-tag.
* build-aux/do-release-commit-and-tag: Remove file.  Now it's in gnulib.
* gnulib: Update submodule to the latest, to get the just-moved script.
2009-11-06 11:20:16 +01:00
Eric Blake
dde83c27b4 mktemp: use more robust means to avoid double-close of stdout
Reverts earlier patch - fflush() can succeed but fclose() fail for
some cases of write failures, and we want to catch those.

* src/mktemp.c (stdout_closed): New variable.
(maybe_close_stdout): New function, borrowed from dd.c.
(main): Track whether stdout has been closed.
2009-11-05 13:12:35 -07:00
Eric Blake
20e5a0d562 mktemp: enhance test to catch just-fixed typo behavior
Penance for botching the conflict resolution while rebasing my series.

* tests/misc/mktemp (check_tmp): Test for the bug when wrong parameter
is used.
2009-11-05 13:12:33 -07:00
Jim Meyering
22e4276ed1 mktemp: don't try to close stdout twice
* src/mktemp.c (main): Rather than calling close_stream (which would
make atexit-called close_stdout try to close it a second time),
check for write failure via ferror and fflush.
2009-11-05 16:32:52 +01:00
Jim Meyering
25d2460ae3 mktemp: don't use suff_len in place of #-of-`X's variable
* src/mktemp.c (mkstemp_len, mkdtemp_len): Pass x_len as final
argument, and not suff_len.
2009-11-05 16:23:59 +01:00
Eric Blake
31a9937081 mktemp: add suffix handling
Now that mkstemps is supported, we might as well use it.

* src/mktemp.c (TMPDIR_OPTION): New enum value.
(longopts): Add new option.
(usage): Document it.
(count_trailing_X_s): Rename...
(count_consecutive_X_s): ...to this, and add parameter.
(mkstemp_len, mkdtemp_len): Add parameter.
(main): Implement new option.
(AUTHORS): Add myself.
* AUTHORS (mktemp): Likewise.
* tests/misc/mktemp: Test new option.
* doc/coreutils.texi (mktemp invocation): Document it.
* NEWS: Likewise.
Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548316.
2009-11-05 07:10:40 -07:00
Eric Blake
d431c61873 build: reflect gnulib changes to tempname
In glibc 2.11 and gnulib, gen_tempname added a parameter
suffixlen (unfortunately, it is typed as int rather than
size_t, for historical compatibility to a poor choice by BSD).

* gnulib: Import latest changes.
* gl/lib/tempname.h.diff: Accommodate new suffixlen parameter.
* gl/lib/tempname.c.diff (check_x_suffix): Allow for X in suffix
beyond x_suffix_len.
(gen_tempname_len): Add suffixlen parameter.
(__gen_tempname): Update caller.
* src/mktemp.c (mkstemp_len, mkdtemp_len): Update callers.
2009-11-05 07:00:52 -07:00
Eric Blake
5f29d118df build: override gnulib tempname via diff
Diffs are more robust than wholesale replacement, because bootstrap
will inform us of any incompatible changes made in upstream gnulib.

* gl/lib/tempname.h: Change...
* gl/lib/tempname.h.diff: ...to diff.
* gl/lib/tempname.c: Change...
* gl/lib/tempname.c.diff: ...to diff.
2009-11-05 06:59:21 -07:00
Eric Blake
0c5ae3a8ac mktemp: rearrange --help output
* src/mktemp.c (usage): Align indentation and sort by long
options.  Describe valid templates.
Suggested by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548316.
2009-11-05 06:59:03 -07:00
Eric Blake
e89a5e9b13 tests: enhance mktemp test
* tests/misc/mktemp: Add more coverage.
2009-11-05 06:54:56 -07:00
Eric Blake
bcca26e838 doc: document mktemp
* doc/coreutils.texi (mktemp invocation): New node.
* TODO: Delete completed task.
2009-11-05 06:54:50 -07:00
Eric Blake
41b3a8ed8b mktemp: don't leave file behind on write failure
* src/mktemp.c (main): Remove just-created file if stdout had
problems.
* bootstrap.conf (gnulib_modules): Add remove.
* tests/misc/close-stdout: Test it.
* NEWS: Document it.
2009-11-05 06:53:21 -07:00
Jim Meyering
cd65f11c4f du: cleanup: remove dead-code vestige of already-removed option
* src/du.c (MEGABYTES_LONG_OPTION, main): Remove vestiges
of already-removed long option, --megabytes.
2009-11-05 08:37:12 +01:00
Jim Meyering
8ba5d1a70c du now diagnoses cycles, rather than ignoring them
* src/du.c (symlink_deref_bits): New global, decl moved from ...
(main): ...here.
(process_file): When fts detects a directory cycle that can't
be due to symlinks, report it and arrange to exit nonzero.
* NEWS (Bug fixes): Mention it.
2009-11-05 08:32:31 +01:00
Jim Meyering
38cb824673 maint: factor out cycle warning, now that du will use it, too
* src/system.h (emit_cycle_warning): Define.  Factored out of...
* src/remove.c (rm_fts): ...here.  Use the new macro.
2009-11-05 08:32:31 +01:00
Jim Meyering
d4b96c26ce tests: rm: add test for today's change in behavior
* tests/Makefile.am (root_tests): Add rm/read-only to the list.
* tests/rm/read-only: New file.
2009-11-03 14:48:10 +01:00
Jim Meyering
7bf2e3db23 rm -f: ignore EROFS when it's really ENOENT
rm -f must not print a diagnostic for a nonexistent file.  However,
most linux-based kernel unlinkat functions set errno to EROFS when
the named file (regardless of whether it exists) would lie on a
read-only file system.  remove.c now performs an extra fstatat call
in that case, to determine whether the file exists.
* src/remove.c (excise): Map EROFS to ENOENT, if a file is nonexistent.
Reported by Steven Drake in <http://savannah.gnu.org/bugs/?27923>.
* NEWS (Changes in behavior): Mention it.
2009-11-03 14:14:00 +01:00
Jim Meyering
87bf834dd3 tests: inotify-race: don't let malfunctioning gdb hang the test
* tests/tail-2/inotify-race: Apply timeout to each gdb invocation.
2009-11-03 14:14:00 +01:00
Eric Blake
8fe40b84bd build: avoid some warnings
* gl/lib/mbsalign.c (mbsalign): Mark unused parameter.
* bootstrap.conf (gnulib_modules): Remove obsolete
rename-dest-slash.
* gnulib-tests/Makefile.am (AM_CFLAGS): Reduce set of warnings for
gnulib tests.
* gl/modules/rename-tests.diff (Makefile.am): New file, to add
LIBINTL to LDADD, since we avoid canonicalize-lgpl module.
* gl/lib/regcomp.c.diff (regerror, calc_next)
(build_collating_symbol, parse_bracket_element, build_equiv_class)
(free_tree): Mark unused parameters.
* gl/lib/regex_internal.h.diff (re_string_elem_size_at): New file,
to mark unused parameters.
* gl/lib/printf-args.c.diff (PRINTF_FETCHARGS): New file, to avoid
type mismatch.
* gl/lib/vasnprintf.c (VASNPRINTF): New file, to avoid shadowing
local variable name.
* .gitignore: Ignore temporary build artifacts.
2009-11-02 06:34:24 -07:00
Eric Blake
565e5f6827 build: update gnulib submodule to latest, for fewer compiler warnings 2009-11-02 06:26:55 -07:00
Jim Meyering
6eb457eaba admin: automate one more part of the release process
This script automates the process of updating NEWS, performs
the resulting final commit (thus with a consistent log message),
and applies a signed tag (v$VERSION) to the result.
* build-aux/do-release-commit-and-tag: New script.
* README-release: Document it.
2009-10-31 11:08:03 +01:00
Jim Meyering
a276ba2dd4 admin: fix typo in release procedure
* README-release: s/gzip/coreutils/
2009-10-31 08:49:46 +01:00
Jim Meyering
71c2f88155 tests: prohibit fail=0 initialization
* cfg.mk (sc_prohibit_fail_0): New rule.
* .x-sc_prohibit_fail_0: New file.
* Makefile.am (syntax_check_exceptions): Distribute the new file.
2009-10-30 12:50:31 +01:00
Jim Meyering
3c88587b2e tests: factor 350 fail=0 initializations into test-lib.sh
Run this command to remove the factored-out "fail=0" lines.
perl -ni -e '/^fail=0$/ or print' $(g grep -l '^fail=0$')
* tests/test-lib.sh: Initialize fail=0 here, not in 300+ scripts.
* tests/...: nearly all bourne shell scripts
Suggested by Eric Blake.
2009-10-30 12:50:12 +01:00
Jim Meyering
12a0a583f6 tests: remove the less-regular fail=0 assignments manually
* tests/tail-2/assert-2:
* tests/tail-2/assert:
* tests/cp/file-perm-race:
* tests/misc/df:
* tests/misc/truncate-dir-fail:
2009-10-30 10:49:22 +01:00
Jim Meyering
39da66f979 tests: don't let a fail=1 env. setting induce unwarranted test failure
* cfg.mk (sc_fail_is_initialized): New rule.
Fix the offenders:
* tests/cp/acl: Set fail=0
* tests/cp/backup-is-src: Likewise.
* tests/cp/file-perm-race: Likewise.
* tests/cp/reflink-auto: Likewise.
* tests/cp/same-file: Likewise.
* tests/ln/backup-1: Likewise.
* tests/misc/su-fail: Likewise.
* tests/misc/truncate-owned-by-other: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mkdir/special-1: Likewise.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/force: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/into-self-3: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/touch/now-owned-by-other: Likewise.
2009-10-29 16:51:07 +01:00
Jim Meyering
22776f84cb remove stray closing comment delimiter, "*/", in previous change
* gl/lib/regexec.c.diff: Fix a typo.
2009-10-29 14:53:45 +01:00
Eric Blake
17b7d09bf2 maint: avoid exiting with magic number
Cope with gnulib's new sc_prohibit_magic_number_exit rule.

* .x-sc_prohibit_magic_number_exit: New file, to add exemptions.
* Makefile.am (syntax_check_exceptions): Distribute it.
* lib/euidaccess-stat.c (main): Fix culprits.
* src/chcon.c (main): Likewise.
* src/runcon.c (main): Likewise.
* src/setuidgid.c (main): Likewise.
2009-10-29 07:31:23 -06:00
Jim Meyering
f2859424cb build (--enable-gcc-warnings): enable gcc's -Werror also in lib/
* configure.ac (GNULIB_WARN_CFLAGS): Define.
* lib/Makefile.am (AM_CFLAGS): Use $(GNULIB_WARN_CFLAGS)
rather than $(WARN_CFLAGS) and add $(WERROR_CFLAGS).
* gl/lib/regcomp.c.diff: New file.
* gl/lib/regex_internal.c.diff: New file.
* gl/lib/regexec.c.diff: New file.
2009-10-29 08:14:42 +01:00
Jim Meyering
56a66d78ff build: update gnulib submodule to latest 2009-10-29 08:14:42 +01:00
Jim Meyering
e26cb21e6b build: allow whitespace violations in gl/lib/*.diff files
* .gitattributes: Exempt gl/lib/*.diff.
* .x-sc_prohibit_tab_based_indentation: Likewise.
* .x-sc_space_tab:Likewise.
2009-10-29 08:14:42 +01:00
Eric Blake
1c59bb3cef nice, nohup, su: detect write failure to stderr
These programs can print non-fatal diagnostics to stderr prior to
exec'ing a subsidiary program.  However, if we thought the situation
warranted a diagnostic, we insist that the diagnostic be printed
without error, rather than blindly exec, as it may be a security risk.

For an example, try 'nice -n -1 nice 2>/dev/full'.  Failure to raise
priority (by lowering niceness) is not fatal, but failure to inform
the user about failure to change priority is dangerous.

* src/nice.c (main): Declare failure if writing advisory message
to stderr fails.
* src/nohup.c (main): Likewise.
* src/su.c (main): Likewise.
* tests/misc/nice: Test this.
* tests/misc/nohup: Likewise.
* NEWS: Document this.
2009-10-28 21:12:41 -06:00
Jim Meyering
536a1fbe5f doc: tell --enable-gcc-warnings users where to report problems
* README-hacking: Add a caveat for --enable-gcc-warnings.
2009-10-28 18:13:44 +01:00
Jim Meyering
ce22916610 build: make doc checks more user-friendly
* doc/Makefile.am (check-texinfo): Begin moving each individual test
into its own rules.
(sc-avoid-builtin, sc-avoid-path): New rules.
Extracted from check-texinfo.
(syntax_checks): Add them.
2009-10-28 18:07:22 +01:00
Jim Meyering
da17f99b20 doc: avoid failing "make check"
* doc/coreutils.texi (env invocation): s/builtin/built-in/
2009-10-28 18:07:21 +01:00
Pádraig Brady
c07b181396 doc: improve the echo and printf help on escapes
* src/printf.c (usage): Merge strings with echo.c to
aid translators.  Move the description for \NNN beside
the other numeric escape codes.  Don't mention
"character" as that suggests character conversion.
* src/echo.c (usage): Likewise.
Also mention the \xHH escape sequence.
2009-10-28 17:01:29 +00:00
Pádraig Brady
2904d675a4 echo, printf: interpret \e as the Escape character
Match gcc, perl, bash, ksh, tcsh, ... in supporting \e.
* src/printf.c (print_escape_char): Output \x1B when \e encountered.
* src/echo.c (main): Likewise.
* src/stat.c (print_escape_char): Likewise.
* doc/coreutils.texi (echo invocation): Add \e to the list.
* tests/misc/printf: Verify that \e outputs \x1B.
* NEWS: Mention the change in behaviour.
2009-10-28 16:37:07 +00:00
Eric Blake
54491d2751 printenv: ignore bogus variable names
Exposed by env a=b=c printenv a=b.

* src/printenv.c (main): Silently reject = in names.
* tests/misc/printenv: Test for it.
* NEWS: Document this.
2009-10-28 06:24:52 -06:00
Pádraig Brady
42d12b45d3 maint: avoid "make syntax-check" failure
* src/printenv.c: Remove unused "long-options.h"
2009-10-28 11:50:54 +00:00
Eric Blake
75efc921b0 doc: turn env comments into documentation
* src/env.c: Convert introductory comments...
* doc/coreutils.texi (env invocation): ...into documentation.
Suggested by Jim Meyering.
2009-10-27 19:55:37 -06:00
Eric Blake
d6de2f198e env, printenv: add -0/--null option
Allows for unambiguous processing when environment values (or even
non-portable names!) contain newline.

* src/env.c (longopts): Add new option.
(usage): Document it.
(main): Implement it.
* src/printenv.c (longopts): New variable.
(usage): Document new option.
(main): Implement it.
* doc/coreutils.texi (Common options): New macro optNull.
(du invocation, env invocation, printenv invocation): Use it.
* NEWS: Mention this.
* tests/misc/env-null: New test.
* tests/Makefile.am (TESTS): Run it.
2009-10-27 19:55:35 -06:00
Eric Blake
1a81342089 tests: add printenv coverage
* tests/misc/printenv: New test.
* tests/Makefile.am (TESTS): Run it.
* .gitignore: Ignore more cruft.
2009-10-27 19:53:37 -06:00
Eric Blake
0cc0424119 tests: fix PATH problems on cygwin
* tests/misc/sort-compress: Remove non-portable over-restriction
of PATH; besides, commit 3ea177e changed sort to no longer default
to gzip.
* tests/rm/fail-eperm: Untaint, rather than clear, PATH.
* tests/misc/pwd-long: Likewise.  Also skip test if long path
cannot be created.
(normalize_to_cwd_relative): Use eq rather than ==, since cygwin
perl doesn't properly handle 64-bit ino_t numerically.
2009-10-27 18:53:44 -06:00
Eric Blake
f00bbe33e4 tests: clean up tests of env -- handling
The comment in env.c about -- handling has not matched the behavior
in the code since the initial commit back in 1992.

* src/env.c: Fix bogus comment.
* tests/misc/env: Further tweaks, avoiding PATH problems inherent
in testing -i, and testing program name containing =.
* doc/coreutils.texi (env invocation): Mention that intermediate
program is needed to invoke program with name containing =.
2009-10-26 21:30:34 -06:00
Eric Blake
0f3f6bf6bf doc: document PATH interactions with env
* doc/coreutils.texi (env invocation): Mention that PATH is
modified prior to exec.
* tests/misc/env: Test this.
2009-10-26 21:30:32 -06:00
Eric Blake
243f1b1c71 env: reject bogus -u arguments
* src/env.c (main): Use unsetenv rather than putenv to remove
items from environ, and check for failure.
* bootstrap.conf (gnulib_modules): Add unsetenv.
* tests/misc/env: Test this.
* NEWS: Document it.
2009-10-26 21:30:30 -06:00
Eric Blake
c6900474ef maint: let gnulib provide environ
* bootstrap.conf (gnulib_modules): Add environ.
* src/env.c (environ): Delete declaration.
* src/printenv.c (environ): Likewise.
* src/stdbuf.c (environ): Likewise.
* src/su.c (environ): Likewise.
2009-10-26 21:30:28 -06:00
Eric Blake
dae24f5ffc tests: avoid file name not portable to cygwin
* tests/misc/chroot-fail: Use 'no_such', not '...', since cygwin
1.5 silently strips trailing dots.
* tests/misc/nice-fail: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/timeout-parameters: Likewise.
2009-10-26 06:05:44 -06:00
Jim Meyering
c695781753 tests: rm/one-file-system: work around umount failure
* tests/rm/one-file-system (cleanup_): Unmount a/b, rather than
"$other_partition_tmpdir", to accommodate those who link /etc/mtab
to /proc/mounts.  Reported by Gilles Espinasse in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18508
2009-10-26 10:21:25 +01:00
Jim Meyering
d9cf7c911f tests: adjust new env test not to fail
* tests/misc/env: Create ./-i as a link to our "echo" binary,
rather than as a bourne shell script, so that env can exec it.
Set PATH to ".".
2009-10-26 09:59:32 +01:00
Jim Meyering
50e837b1c4 tests: nice: adjust new tests to work more portably
* tests/misc/nice (tests): Accommodate a nice program for which
"nice -n -1 nice" prints nothing.  It should print -1 or (usually) 0.
Otherwise, we'd get syntax errors.
2009-10-26 08:25:34 +01:00
Jim Meyering
501bf7b589 nice: execute program even when setpriority fails due to EACCES
* src/nice.c (perm_related_errno): New function.
(main): Use it, rather than testing only errno == EPERM.
* NEWS (Bug fixes): Mention it.
2009-10-26 08:25:34 +01:00
Pádraig Brady
69fbfd400c timeout: don't orphan monitored programs if they ignore specified signals
* src/timeout.c (install_signal_handlers): Handle any user
specified signal, so that if it does not cause the child
to exit then we don't exit and orphan the child. Previously this
for example, would leave an orphan dd process running:
timeout -sUSR1 1s dd if=/dev/zero of=/dev/null
* NEWS: Mention the fix.
2009-10-25 23:28:38 +00:00
Eric Blake
30e4b6e84b tests: test recent status changes
* tests/misc/nice: Enhance test.
* tests/misc/chroot-fail: New test.
* tests/misc/env: Likewise.
* tests/misc/nice-fail: Likewise.
* tests/misc/su-fail: Likewise.
* tests/Makefile.am (TESTS): Run new tests.
2009-10-23 16:32:26 -06:00
Eric Blake
2122247aca maint: move chroot test
* tests/chroot/credentials: Move...
* tests/misc/chroot-credentials: ...here, to reduce number of
directories.
* tests/Makefile.am (root_tests): Reflect rename.
2009-10-23 16:31:34 -06:00
Eric Blake
bd933c1250 tests: enhance stdbuf and timeout tests
* tests/misc/timeout-parameters: Validate exact exit status.
* tests/misc/stdbuf: Likewise.
* tests/misc/timeout: Likewise.  Use require_built_.
* tests/misc/arch: Likewise.
2009-10-23 16:31:23 -06:00
Eric Blake
1ce9e1e5ca nohup: use EXIT_CANCELED if not POSIXLY_CORRECT
* src/nohup.c (NOHUP_FAILURE): Rename...
(POSIX_NOHUP_FAILURE): ...to this.
(main): Pay attention to POSIXLY_CORRECT, to determine whether to
use status 125 or 127.
* doc/coreutils.texi (nohup invocation): Document this.
* NEWS: Likewise.
* tests/misc/invalid-opt (exit_status): Adjust expected results.
* tests/misc/help-version (expected_failure_status): Likewise.
* tests/misc/nohup: Likewise.
2009-10-23 16:24:08 -06:00
Eric Blake
b6540b96ba chroot, env, nice, su: use EXIT_CANCELED for internal failure
* src/chroot.c (main): Use EXIT_CANCELED, not EXIT_FAILURE.
* src/env.c (main): Likewise.
* src/nice.c (main): Likewise.
* src/su.c (change_identity, main): Likewise.
* doc/coreutils.texi (chroot invocation, env invocation)
(nice invocation, su invocation): Document this.
* NEWS: Likewise.
* tests/misc/invalid-opt (exit_status): Adjust expected results.
* tests/misc/help-version (expected_failure_status): Likewise.
2009-10-23 16:24:05 -06:00
Eric Blake
97777f559a tests: accommodate BSD getopt
* tests/misc/invalid-opt (err_subst): Support alternate spelling.
2009-10-23 16:24:02 -06:00
Eric Blake
c0dcf3238b build: prohibit improper use of stat and lstat
* cfg.mk (sc_prohibit_stat_macro_address): New rule.
* src/ln.c (do_link): Adjust comment to avoid false positive.
* src/stat.c (do_stat): Likewise.
* src/touch.c (main): Likewise.
2009-10-23 06:29:54 -06:00
Eric Blake
a08e13a0fb build: update gnulib submodule to latest, for test cleanups 2009-10-22 21:25:39 -06:00
Eric Blake
5e361387d0 maint: turn on compiler warnings for gnulib tests
* gnulib-tests/Makefile.am (AM_CFLAGS): Add WARN_CFLAGS.
* configure.ac (enable-gcc-warnings): Also use -funit-at-a-time,
to silence gcc 4.3.4 -Wdisabled-optimization.
* .gitignore: Ignore some more files.
2009-10-22 08:05:09 -06:00
Jim Meyering
cbf36952d8 build: prohibit direct use of readlink or readlinkat
* cfg.mk (sc_prohibit_readlink): New rule.
Suggested by Eric Blake.
2009-10-22 12:12:24 +02:00
Giuseppe Scrivano
029b6b14c5 tests: add a test for the `tail -f' race condition bug
If new data becomes available between the initial read and when tail
registers the inotify watch descriptors, ensure that it is read
before a new event happens on the file.
* tests/Makefile.am (TESTS): Add tail-2/inotify-race.
* tests/tail-2/inotify-race: New file.
2009-10-22 10:25:58 +02:00
Giuseppe Scrivano
cd0f3036f6 tail -f: avoid a race condition
* NEWS (Bug fixes): Mention it.
* src/tail.c (check_fspec): New function.
(tail_forever_inotify): Ensure there is no new data before entering the
inotify events wait loop.
2009-10-22 09:11:24 +02:00
Eric Blake
9abbe32c2e build: update gnulib submodule to latest, for utimens enhancements 2009-10-21 21:44:56 -06:00
Eric Blake
54645c195c tests: ensure touch honors trailing slash
* tests/touch/trailing-slash: New test.
* tests/Makefile.am (TESTS): Run it.
2009-10-21 20:45:27 -06:00
Pádraig Brady
710fe413fe md5sum, sha*sum, sum: line-buffer the printed checksums
* src/md5sum.c (main): Set stdout to line buffered mode
to ensure parallel running instances don't intersperse
their output.  This adds 5% to the run time in the worst case
of many zero length files, or 2% with standard file sizes.
* src/sum.c (main): Likewise.
* tests/misc/md5sum-parallel: New test for atomic output.
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix
2009-10-21 16:56:00 +01:00
Pádraig Brady
71adb516de maint: issue warnings for more missing optional libraries
* README-hacking: Suggest to use ./configure --quiet so that
any warnings are easily noticed.
* m4/gmp.m4 (cu_GMP): Warn if libgmp is not available.
* m4/jm-macros.m4 (coreutils_MACROS): Normalize the libcap warning.
* m4/xattr.m4 (gl_FUNC_XATTR): Warn if libattr is not available.
2009-10-20 17:11:00 +01:00
Jim Meyering
6ac6c7e4b7 build: use gnulib's isblank module
* bootstrap.conf (gnulib_modules): Add isblank.
* src/system.h (isblank): Don't define.
* m4/check-decl.m4: Don't check for isblank declaration.
* gnulib: Update submodule to latest.
2009-10-19 07:57:15 +02:00
Jim Meyering
f26508204b maint: factor out duplication in currently unused rules
* src/Makefile.am (fs_normalize_perl_subst): Define.
(fs-magic, fs-kernel-magic): Use it.
2009-10-18 10:26:15 +02:00
Eric Blake
9e13b6a0b4 touch: add -h to change symlink timestamps, where supported
* src/touch.c (no_dereference): New flag variable.
(longopts): Add -h/--no-dereference.
(touch): Add symlink handling.
(usage): Document new option.
(main): Accept new option.
* NEWS: Document it.
* doc/coreutils.texi (touch invocation): Likewise.  Also mention
birthtime.
* tests/touch/no-dereference: New test.
* tests/Makefile.am (TESTS): Run it.
2009-10-17 14:36:28 -06:00
Jim Meyering
527fb951de tests: abmon-align: avoid test failure
* tests/ls/abmon-align: Don't remove (1d;) the first line of output.
That was making the test consider only 11 of 12 month names.
Rewrite not to use \(.*\), as that provoked a malfunction in GNU sed
on powerpc Mac OS X (though we don't know yet whether this is due to a
sed bug, or to miscompilation).  Nelson Beebe reported the test failure.
2009-10-17 12:21:52 +02:00
Jim Meyering
f8653f2af3 build: update gnulib submodule to latest 2009-10-17 12:20:41 +02:00
Jim Meyering
2fa407885c build: don't let environment settings perturb build
Setting the envvars, LIB_FDATASYNC, LIB_XATTR or LIB_CRYPT
could cause a configure-time and/or build-time malfunction.
Typically, a configure-time function-in-library test is performed
via code like this:

  LIB_VAR=
  AC_SUBST([LIB_VAR])
  prefix_saved_LIBS=$LIBS
    AC_SEARCH_LIBS([FUNC], [LIB_NAME],
                   [test "$ac_cv_search_FUNC" = "none required" ||
                    LIB_VAR=$ac_cv_search_FUNC])
  LIBS=$prefix_saved_LIBS

However, in each of the files affected by this change, the LIB_VAR=
initialization was omitted.  Thus, when set in the environment, its
value would propagate into generated Makefiles when FUNC is not found
in LIB_NAME.
* m4/jm-macros.m4 (coreutils_MACROS): Initialize AC_SUBST'd var
* m4/lib-check.m4 (cu_LIB_CHECK): Likewise.
* m4/xattr.m4 (gl_FUNC_XATTR): Likewise.
2009-10-15 21:03:40 +02:00
C de-Avillez
b3cfa712ca tail: add add missing backslash at the end of a line in usage
* src/tail.c (usage): Add missing backslash at the end of a line.
2009-10-13 11:20:20 +02:00
Eric Blake
f25273d7f1 tail: tweak usage for more clarity
* src/tail.c (usage): Spell out -n +K.
* THANKS: Update.
Reported by Jan-Pawel Wrozstinski.
2009-10-12 07:00:12 -06:00
Eric Blake
26e8e602a8 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 15:16:55 -06:00
Eric Blake
7280a913a1 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 15:16:52 -06:00
Eric Blake
7ff00ca82f build: update gnulib submodule to latest, for utimens improvements 2009-10-10 15:16:50 -06:00
Jim Meyering
f7b1873805 tests: adjust tail-2/pid to work around FreeBSD 6.1 failure
* tests/tail-2/pid: Run tail -f --pid=... on an actual file, not on
/dev/null, to avoid this failure on FreeBSD 6.1: tail: /dev/null:
cannot change nonblocking mode: Inappropriate ioctl for device
2009-10-10 15:05:09 +02: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
740 changed files with 19976 additions and 11059 deletions

2
.gitattributes vendored
View File

@@ -5,3 +5,5 @@
# # Derived from the regexp in emacs' lisp/add-log.el.
# [diff "texinfo"]
# funcname = "^@node[ \t][ \t]*\\([^,][^,]*\\)"
gl/lib/*.diff -whitespace

134
.gitignore vendored
View File

@@ -1,74 +1,86 @@
*.I[12]
*.[EIOX]
*.bak
*.o
*/.deps
*~
._bootmp
.gdb-history
.kludge-stamp
.tarball-version
.version
ABOUT-NLS
ChangeLog
GNUmakefile
/ABOUT-NLS
/ChangeLog
/GNUmakefile
/INSTALL
/THANKS-to-translators
/aclocal.m4
/autom4te.cache
/build-aux/.gitignore
/build-aux/compile
/build-aux/config.guess
/build-aux/config.sub
/build-aux/depcomp
/build-aux/install-sh
/build-aux/mdate-sh
/build-aux/missing
/build-aux/texinfo.tex
/build-aux/ylwrap
/config.cache
/config.log
/config.status
/configure
/coreutils-*.tar.gz
/coreutils-*.tar.gz.sig
/coreutils-*.tar.xz
/coreutils-*.tar.xz.sig
/gnulib-tests
/lib/.cvsignore
/lib/.gitignore
/lib/arg-nonnull.h
/lib/arpa
/lib/binary-io.h
/lib/c++defs.h
/lib/charset.alias
/lib/config.h
/lib/config.hin
/lib/configmake.h
/lib/glthread
/lib/libcoreutils.a
/lib/link-warning.h
/lib/printf.c
/lib/progname.c
/lib/progname.h
/lib/selinux
/lib/stamp-h1
/lib/unistr
/lib/uniwidth
/lib/unused-parameter.h
/lib/warn-on-use.h
/m4/.cvsignore
/m4/.gitignore
/maint.mk
/man/*.1
/po/*.gmo
/po/*.po
/po/.gitignore
/po/.reference
/po/LINGUAS
/po/Makefile.in
/po/Makevars
/po/POTFILES
/po/checksums
/po/coreutils.pot
/po/stamp-po
/src/version.c
/src/version.h
/stamp-h1
/tests/*/*.log
/tests/.built-programs
/tests/t?
/tests/test-suite.log
ID
INSTALL
Makefile
Makefile.in
TAGS
THANKS
THANKS-to-translators
aclocal.m4
autom4te.cache
build-aux/.gitignore
build-aux/compile
build-aux/config.guess
build-aux/config.sub
build-aux/depcomp
build-aux/install-sh
build-aux/mdate-sh
build-aux/missing
build-aux/texinfo.tex
build-aux/ylwrap
config.cache
config.h
config.hin
config.log
config.status
configure
coreutils-*.tar.bz2
coreutils-*.tar.bz2.sig
coreutils-*.tar.gz
coreutils-*.tar.gz.sig
coreutils-*.tar.lzma
coreutils-*.tar.lzma.sig
gnulib-tests
lib/.cvsignore
lib/.gitignore
lib/arpa
lib/binary-io.h
lib/charset.alias
lib/configmake.h
lib/libcoreutils.a
lib/printf.c
lib/progname.c
lib/progname.h
lib/selinux
lib/uniwidth
m4/.cvsignore
m4/.gitignore
maint.mk
man/*.1
po/*.gmo
po/*.po
po/.gitignore
po/.reference
po/LINGUAS
po/Makefile.in
po/Makevars
po/POTFILES
po/checksums
po/coreutils.pot
po/stamp-po
src/version.c
src/version.h
stamp-h1
tests/*/*.log

31
.mailmap Normal file
View File

@@ -0,0 +1,31 @@
# Map git author names and email addresses to canonical/preferred form.
<jim@meyering.net> <meyering@iou.iou>
<jim@meyering.net> <meyering@redhat.com>
<jim@meyering.net> <meyering@rho.meyering.net>
<jim@meyering.net> <meyering@vm.meyering.net.localdomain>
Paul Eggert <eggert@cs.ucla.edu> <eggert@penguin.cs.ucla.edu>
Paul Eggert <eggert@cs.ucla.edu> <eggert@CS.UCLA.EDU>
<eggert@cs.ucla.edu> <eggert@twinsun.com>
# Evan's two changes listed my email address.
Evan Hunt <ethanol@armory.com> Evan Hunt <jim@meyering.net>
<P@draigBrady.com> <P@draigBrady.com (trivial change)>
Pádraig Brady <p@draigBrady.com> <P@draigBrady.com>
<chen.guo.0625@gmail.com> <chenguo4@yahoo.com>
<chen.guo.0625@gmail.com> <chenguo4@ucla.edu>
<schwab@linux-m68k.org> <schwab@suse.de>
<aurel32@debian.org> <aurelien@aurel32.net>
<bob@proulx.com> <rwp@fc.hp.com>
<bkorb@gnu.org> <bkorb@veritas.com>
<bruno@clisp.org> <haible@clisp.cons.org>
<eblake@redhat.com> <ebb9@byu.net>
<jrv@debian.org> <jrvz@comcast.net>
<dave.anglin@nrc.ca> <dave@hiauly1.hia.nrc.ca>
<psfales@alcatel-lucent.com> <psfales@lucent.com>
# Prefer spelled-out middle name and its address.
Arne Henrik Juul <arnej@imf.unit.no> Arne H. Juul <arnej@solan.unit.no>
# Had email as name.
Dan Jacobson <jidanni@jidanni.org> jidanni@jidanni.org <jidanni@jidanni.org>

View File

@@ -1 +1 @@
7.5
8.11

View File

@@ -1,6 +1,6 @@
# Suppress valgrind diagnostics we don't care about.
# Copyright (C) 2003, 2004, 2006-2009 Free Software Foundation, Inc.
# Copyright (C) 2003-2004, 2006-2011 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 +0,0 @@
^build-aux/check\.mk$

View File

@@ -1 +0,0 @@
build-aux/cvsu

View File

@@ -1,5 +0,0 @@
ChangeLog
NEWS
src/df.c
src/stat.c
tests/misc/df-P

View File

@@ -1 +0,0 @@
ChangeLog

View File

@@ -1 +0,0 @@
^gl/

View File

@@ -1,2 +0,0 @@
gl/lib/randint.c
lib/euidaccess-stat.c

View File

@@ -1 +0,0 @@
^lib/euidaccess-stat\.c$

View File

@@ -1,4 +0,0 @@
src/system.h
tests/du/2g
old/fileutils/ChangeLog-1997
ChangeLog-2005

View File

@@ -1 +0,0 @@
ChangeLog

View File

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

View File

@@ -1,9 +0,0 @@
^lib/buffer-lcm\.c$
^src/false\.c$
^src/lbracket\.c$
^src/ls-dir\.c$
^src/ls-ls\.c$
^src/ls-vdir\.c$
^src/tac-pipe\.c$
^src/uname-arch\.c$
^src/uname-uname\.c$

View File

@@ -1,9 +0,0 @@
^lib/buffer-lcm\.c$
^src/false\.c$
^src/lbracket\.c$
^src/ls-dir\.c$
^src/ls-ls\.c$
^src/ls-vdir\.c$
^src/tac-pipe\.c$
^src/uname-arch\.c$
^src/uname-uname\.c$

View File

@@ -1,11 +0,0 @@
config(ure|\.(guess|sub))
tests/pr
lib/regex.c
config-log
tests/misc/nl
po/de.po
m4/lib-ld.m4
m4/lib-prefix.m4
m4/po.m4
aclocal.m4
src/c99-to-c89.diff

View File

@@ -1,2 +0,0 @@
config-log
build-aux/config.guess

View File

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

View File

@@ -1 +0,0 @@
^tests/pr/

View File

@@ -1,2 +0,0 @@
^lib/xstrtol\.h$
^build-aux/cvsu$

View File

@@ -1,13 +0,0 @@
^build-aux/config.guess
^configure
^lib/alloca.c
^lib/fts.c
^lib/getdate.c
^lib/getloadavg.c
^lib/gettext.h
^lib/getusershell.c
^lib/mbswidth.c
^lib/strtod.c
^lib/xstrtol.c
^m4/
^tests/misc/pwd-unreadable-parent

View File

@@ -46,11 +46,12 @@ md5sum: Ulrich Drepper, Scott Miller, David Madore
mkdir: David MacKenzie
mkfifo: David MacKenzie
mknod: David MacKenzie
mktemp: Jim Meyering
mktemp: Jim Meyering, Eric Blake
mv: Mike Parker, David MacKenzie, Jim Meyering
nice: David MacKenzie
nl: Scott Bartram, David MacKenzie
nohup: Jim Meyering
nproc: Giuseppe Scrivano
od: Jim Meyering
paste: David M. Ihnat, David MacKenzie
pathchk: Paul Eggert, David MacKenzie, Jim Meyering

View File

@@ -9086,7 +9086,7 @@
split's --verbose option did nothing [broken in 4.5.10 and 5.0]
* src/split.c (longopts): Use `1', not `0' as the value for
for &verbose. Reported by Keith Thompson.
&verbose. Reported by Keith Thompson.
Test for the above fix.
* tests/misc/split-a: Also use --verbose and compare stderr
@@ -11609,7 +11609,7 @@
-----
Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
Copyright (C) 2002-2005, 2009-2011 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, 2009 Free Software Foundation, Inc.
Copyright (C) 2006, 2009-2011 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, 2009 Free Software Foundation, Inc.
Copyright (C) 2007, 2009-2011 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-2009 Free Software Foundation, Inc.
Copyright (C) 2008-2011 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

125
HACKING
View File

@@ -233,6 +233,107 @@ Try to make the summary line fit one of the following forms:
maint: change-description
Curly braces: use judiciously
=============================
Omit the curly braces around an "if", "while", "for" etc. body only when
that body occupies a single line. In every other case we require the braces.
This ensures that it is trivially easy to identify a single-*statement* loop:
each has only one *line* in its body.
Omitting braces with a single-line body is fine:
while (expr)
single_line_stmt ();
However, the moment your loop/if/else body extends onto a second line,
for whatever reason (even if it's just an added comment), then you should
add braces. Otherwise, it would be too easy to insert a statement just
before that comment (without adding braces), thinking it is already a
multi-statement loop:
while (true)
/* comment... */ // BAD: multi-line body without braces
single_line_stmt ();
Do this instead:
while (true)
{ /* Always put braces around a multi-line body. */
/* explanation... */
single_line_stmt ();
}
There is one exception: when the second body line is not at the same
indentation level as the first body line.
if (expr)
error (0, 0, _("a diagnostic that would make this line"
" extend past the 80-column limit"));
It is safe to omit the braces in the code above, since the
further-indented second body line makes it obvious that this is still
a single-statement body.
To reiterate, don't do this:
if (expr)
while (expr_2) // BAD: multi-line body without braces
{
...
}
Do this, instead:
if (expr)
{
while (expr_2)
{
...
}
}
However, there is one exception in the other direction, when even a
one-line block should have braces. That occurs when that one-line,
brace-less block is an "else" block, and the corresponding "then" block
*does* use braces. In that case, either put braces around the "else"
block, or negate the "if"-condition and swap the bodies, putting the
one-line block first and making the longer, multi-line block be the
"else" block.
if (expr)
{
...
...
}
else
x = y; // BAD: braceless "else" with braced "then"
This is preferred, especially when the multi-line body is more than a
few lines long, because it is easier to read and grasp the semantics of
an if-then-else block when the simpler block occurs first, rather than
after the more involved block:
if (!expr)
x = y; /* more readable */
else
{
...
...
}
If you'd rather not negate the condition, then add braces:
if (expr)
{
...
...
}
else
{
x = y;
}
Use SPACE-only indentation in all[*] files
==========================================
We use space-only indentation in nearly all files.
@@ -310,9 +411,9 @@ Nearly every significant change must be accompanied by a test suite
addition that exercises it. If you fix a bug, add at least one test that
fails without the patch, but that succeeds once your patch is applied.
If you add a feature, add tests to exercise as much of the new code
as possible. Note to run tests/misc/newtest in isolation you can do:
as possible. Note to run tests/misc/new-test in isolation you can do:
(cd tests && make check TESTS=misc/newtest VERBOSE=yes)
(cd tests && make check TESTS=misc/new-test VERBOSE=yes)
There are hundreds of tests in the tests/ directories. You can use
tests/sample-test as a template, or one of the various Perl-based ones
@@ -338,12 +439,12 @@ The forms to choose from are in gnulib's doc/Copyright/ directory.
If you want to assign a single change, you should use the file,
doc/Copyright/request-assign.changes:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.changes;hb=HEAD
http://www.gnu.org/software/gnulib/Copyright/request-assign.changes
If you would like to assign past and future contributions to a project,
you'd use doc/Copyright/request-assign.future:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.future;hb=HEAD
http://www.gnu.org/software/gnulib/Copyright/request-assign.future
You may make assignments for up to four projects at a time.
@@ -367,10 +468,8 @@ versions of gcc and the linux kernel, and modern GNU tools.
Ensure that your changes are indented properly.
===============================================
Format the code the way GNU indent does.
In a file with the "indent-tabs-mode: nil" directive at the end,
running "indent --no-tabs" should induce no change.
With other files, there will be some existing differences.
Try not to add any more.
Filtering most source files through "indent --no-tabs" should
induce no change in indentation. Try not to add any more.
Avoid trailing white space
@@ -383,13 +482,11 @@ Do not add any more trailing blanks anywhere. While "make syntax-check"
will alert you if you slip up, it's better to nip any problem in the
bud, as you're typing. A good way to help you adapt to this rule is
to configure your editor to highlight any offending characters in the
files you edit. If you use Emacs, customize its font-lock mode (FIXME:
provide more detail) or try one of its whitespace packages. This appears
to be the one that will end up in emacs 23:
files you edit. If you use Emacs, customize its font-lock mode
or use its WhiteSpace mode:
http://www.emacswiki.org/emacs/WhiteSpace
[that page says its version also works with emacs 21 and 22]
If you use vim, add this to ~/.vimrc:
let c_space_errors=1
@@ -481,10 +578,10 @@ Then just open the index.html file (in the generated lcov-html directory)
in your favorite web browser.
========================================================================
Copyright (C) 2009 Free Software Foundation, Inc.
Copyright (C) 2009-2011 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

View File

@@ -1,6 +1,6 @@
# Make coreutils. -*-Makefile-*-
# Copyright (C) 1990, 1993-2009 Free Software Foundation, Inc.
# Copyright (C) 1990, 1993-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,32 +39,13 @@ changelog_etc = \
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) \
.mailmap \
.prev-version \
.version \
.vg-suppressions \
THANKS.in \
THANKS-to-translators \
THANKStt.in \
bootstrap \
@@ -73,7 +54,8 @@ EXTRA_DIST = \
cfg.mk \
dist-check.mk \
gl/modules/getloadavg.diff \
maint.mk
maint.mk \
thanks-gen
ALL_RECURSIVE_TARGETS += install-root
install-root:
@@ -146,3 +128,25 @@ check-ls-dircolors:
|sed -n '/^ *"/p'|tr , '\n'|sed 's/^ *//' \
|sed -n 's/^"\(..\)"/\1/p'|sort -u); \
test "$$dc" = "$$ls"
# Sort in traditional ASCII order, regardless of the current locale;
# otherwise we may get into trouble with distinct strings that the
# current locale considers to be equal.
ASSORT = LC_ALL=C sort
# Extract all lines up to the first one starting with "##".
prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in
THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version
$(AM_V_GEN) \
{ \
$(prologue); echo; \
{ perl -ne '/^$$/.../^$$/ and print' $(srcdir)/THANKS.in \
| grep -v '^$$' | perl -pe 's/ +/\0/'; \
git log --pretty=format:'%aN%x00%aE' \
| $(ASSORT) -u; \
} | $(srcdir)/thanks-gen \
| LC_ALL=en_US.UTF-8 sort -f; \
echo; \
printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \
} > $@-t && mv $@-t $@

637
NEWS
View File

@@ -1,5 +1,638 @@
GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release 8.12 (2011-04-26) [stable]
** Bug fixes
tail's --follow=name option no longer implies --retry on systems
with inotify support. [bug introduced in coreutils-7.5]
** Changes in behavior
cp's extent-based (FIEMAP) copying code is more reliable in the face
of varying and undocumented file system semantics:
- it no longer treats unwritten extents specially
- a FIEMAP-based extent copy always uses the FIEMAP_FLAG_SYNC flag.
Before, it would incur the performance penalty of that sync only
for 2.6.38 and older kernels. We thought all problems would be
resolved for 2.6.39.
- it now attempts a FIEMAP copy only on a file that appears sparse.
Sparse files are relatively unusual, and the copying code incurs
the performance penalty of the now-mandatory sync only for them.
** Portability
dd once again compiles on AIX 5.1 and 5.2
* Noteworthy changes in release 8.11 (2011-04-13) [stable]
** Bug fixes
cp -a --link would not create a hardlink to a symlink, instead
copying the symlink and then not preserving its timestamp.
[bug introduced in coreutils-8.0]
cp now avoids FIEMAP issues with BTRFS before Linux 2.6.38,
which could result in corrupt copies of sparse files.
[bug introduced in coreutils-8.10]
cut could segfault when invoked with a user-specified output
delimiter and an unbounded range like "-f1234567890-".
[bug introduced in coreutils-5.3.0]
du would infloop when given --files0-from=DIR
[bug introduced in coreutils-7.1]
sort no longer spawns 7 worker threads to sort 16 lines
[bug introduced in coreutils-8.6]
touch built on Solaris 9 would segfault when run on Solaris 10
[bug introduced in coreutils-8.8]
wc would dereference a NULL pointer upon an early out-of-memory error
[bug introduced in coreutils-7.1]
** New features
dd now accepts the 'nocache' flag to the iflag and oflag options,
which will discard any cache associated with the files, or
processed portion thereof.
dd now warns that 'iflag=fullblock' should be used,
in various cases where partial reads can cause issues.
** Changes in behavior
cp now avoids syncing files when possible, when doing a FIEMAP copy.
The sync is only needed on Linux kernels before 2.6.39.
[The sync was introduced in coreutils-8.10]
cp now copies empty extents efficiently, when doing a FIEMAP copy.
It no longer reads the zero bytes from the input, and also can efficiently
create a hole in the output file when --sparse=always is specified.
df now aligns columns consistently, and no longer wraps entries
with longer device identifiers, over two lines.
install now rejects its long-deprecated --preserve_context option.
Use --preserve-context instead.
test now accepts "==" as a synonym for "="
* Noteworthy changes in release 8.10 (2011-02-04) [stable]
** Bug fixes
du would abort with a failed assertion when two conditions are met:
part of the hierarchy being traversed is moved to a higher level in the
directory tree, and there is at least one more command line directory
argument following the one containing the moved sub-tree.
[bug introduced in coreutils-5.1.0]
join --header now skips the ordering check for the first line
even if the other file is empty. [bug introduced in coreutils-8.5]
rm -f no longer fails for EINVAL or EILSEQ on file systems that
reject file names invalid for that file system.
uniq -f NUM no longer tries to process fields after end of line.
[bug introduced in coreutils-7.0]
** New features
cp now copies sparse files efficiently on file systems with FIEMAP
support (ext4, btrfs, xfs, ocfs2). Before, it had to read 2^20 bytes
when copying a 1MiB sparse file. Now, it copies bytes only for the
non-sparse sections of a file. Similarly, to induce a hole in the
output file, it had to detect a long sequence of zero bytes. Now,
it knows precisely where each hole in an input file is, and can
reproduce them efficiently in the output file. mv also benefits
when it resorts to copying, e.g., between file systems.
join now supports -o 'auto' which will automatically infer the
output format from the first line in each file, to ensure
the same number of fields are output for each line.
** Changes in behavior
join no longer reports disorder when one of the files is empty.
This allows one to use join as a field extractor like:
join -a1 -o 1.3,1.1 - /dev/null
* Noteworthy changes in release 8.9 (2011-01-04) [stable]
** Bug fixes
split no longer creates files with a suffix length that
is dependent on the number of bytes or lines per file.
[bug introduced in coreutils-8.8]
* Noteworthy changes in release 8.8 (2010-12-22) [stable]
** Bug fixes
cp -u no longer does unnecessary copying merely because the source
has finer-grained time stamps than the destination.
od now prints floating-point numbers without losing information, and
it no longer omits spaces between floating-point columns in some cases.
sort -u with at least two threads could attempt to read through a
corrupted pointer. [bug introduced in coreutils-8.6]
sort with at least two threads and with blocked output would busy-loop
(spinlock) all threads, often using 100% of available CPU cycles to
do no work. I.e., "sort < big-file | less" could waste a lot of power.
[bug introduced in coreutils-8.6]
sort with at least two threads no longer segfaults due to use of pointers
into the stack of an expired thread. [bug introduced in coreutils-8.6]
sort --compress no longer mishandles subprocesses' exit statuses,
no longer hangs indefinitely due to a bug in waiting for subprocesses,
and no longer generates many more than NMERGE subprocesses.
sort -m -o f f ... f no longer dumps core when file descriptors are limited.
** Changes in behavior
sort will not create more than 8 threads by default due to diminishing
performance gains. Also the --parallel option is no longer restricted
to the number of available processors.
** New features
split accepts the --number option to generate a specific number of files.
* Noteworthy changes in release 8.7 (2010-11-13) [stable]
** Bug fixes
cp, install, mv, and touch no longer crash when setting file times
on Solaris 10 Update 9 [Solaris PatchID 144488 and newer expose a
latent bug introduced in coreutils 8.1, and possibly a second latent
bug going at least as far back as coreutils 5.97]
csplit no longer corrupts heap when writing more than 999 files,
nor does it leak memory for every chunk of input processed
[the bugs were present in the initial implementation]
tail -F once again notices changes in a currently unavailable
remote directory [bug introduced in coreutils-7.5]
** Changes in behavior
cp --attributes-only now completely overrides --reflink.
Previously a reflink was needlessly attempted.
stat's %X, %Y, and %Z directives once again print only the integer
part of seconds since the epoch. This reverts a change from
coreutils-8.6, that was deemed unnecessarily disruptive.
To obtain a nanosecond-precision time stamp for %X use %.X;
if you want (say) just 3 fractional digits, use %.3X.
Likewise for %Y and %Z.
stat's new %W format directive would print floating point seconds.
However, with the above change to %X, %Y and %Z, we've made %W work
the same way as the others.
* Noteworthy changes in release 8.6 (2010-10-15) [stable]
** Bug fixes
du no longer multiply counts a file that is a directory or whose
link count is 1, even if the file is reached multiple times by
following symlinks or via multiple arguments.
du -H and -L now consistently count pointed-to files instead of
symbolic links, and correctly diagnose dangling symlinks.
du --ignore=D now ignores directory D even when that directory is
found to be part of a directory cycle. Before, du would issue a
"NOTIFY YOUR SYSTEM MANAGER" diagnostic and fail.
split now diagnoses read errors rather than silently exiting.
[bug introduced in coreutils-4.5.8]
tac would perform a double-free when given an input line longer than 16KiB.
[bug introduced in coreutils-8.3]
tail -F once again notices changes in a currently unavailable directory,
and works around a Linux kernel bug where inotify runs out of resources.
[bugs introduced in coreutils-7.5]
tr now consistently handles case conversion character classes.
In some locales, valid conversion specifications caused tr to abort,
while in all locales, some invalid specifications were undiagnosed.
[bugs introduced in coreutils 6.9.90 and 6.9.92]
** New features
cp now accepts the --attributes-only option to not copy file data,
which is useful for efficiently modifying files.
du recognizes -d N as equivalent to --max-depth=N, for compatibility
with FreeBSD.
sort now accepts the --debug option, to highlight the part of the
line significant in the sort, and warn about questionable options.
sort now supports -d, -f, -i, -R, and -V in any combination.
stat now accepts the %m format directive to output the mount point
for a file. It also accepts the %w and %W format directives for
outputting the birth time of a file, if one is available.
** Changes in behavior
df now consistently prints the device name for a bind mounted file,
rather than its aliased target.
du now uses less than half as much memory when operating on trees
with many hard-linked files. With --count-links (-l), or when
operating on trees with no hard-linked files, there is no change.
ls -l now uses the traditional three field time style rather than
the wider two field numeric ISO style, in locales where a style has
not been specified. The new approach has nicer behavior in some
locales, including English, which was judged to outweigh the disadvantage
of generating less-predictable and often worse output in poorly-configured
locales where there is an onus to specify appropriate non-default styles.
[The old behavior was introduced in coreutils-6.0 and had been removed
for English only using a different method since coreutils-8.1]
rm's -d now evokes an error; before, it was silently ignored.
sort -g now uses long doubles for greater range and precision.
sort -h no longer rejects numbers with leading or trailing ".", and
no longer accepts numbers with multiple ".". It now considers all
zeros to be equal.
sort now uses the number of available processors to parallelize
the sorting operation. The number of sorts run concurrently can be
limited with the --parallel option or with external process
control like taskset for example.
stat now provides translated output when no format is specified.
stat no longer accepts the --context (-Z) option. Initially it was
merely accepted and ignored, for compatibility. Starting two years
ago, with coreutils-7.0, its use evoked a warning. Printing the
SELinux context of a file can be done with the %C format directive,
and the default output when no format is specified now automatically
includes %C when context information is available.
stat no longer accepts the %C directive when the --file-system
option is in effect, since security context is a file attribute
rather than a file system attribute.
stat now outputs the full sub-second resolution for the atime,
mtime, and ctime values since the Epoch, when using the %X, %Y, and
%Z directives of the --format option. This matches the fact that
%x, %y, and %z were already doing so for the human-readable variant.
touch's --file option is no longer recognized. Use --reference=F (-r)
instead. --file has not been documented for 15 years, and its use has
elicited a warning since coreutils-7.1.
truncate now supports setting file sizes relative to a reference file.
Also errors are no longer suppressed for unsupported file types, and
relative sizes are restricted to supported file types.
* Noteworthy changes in release 8.5 (2010-04-23) [stable]
** Bug fixes
cp and mv once again support preserving extended attributes.
[bug introduced in coreutils-8.4]
cp now preserves "capabilities" when also preserving file ownership.
ls --color once again honors the 'NORMAL' dircolors directive.
[bug introduced in coreutils-6.11]
sort -M now handles abbreviated months that are aligned using blanks
in the locale database. Also locales with 8 bit characters are
handled correctly, including multi byte locales with the caveat
that multi byte characters are matched case sensitively.
sort again handles obsolescent key formats (+POS -POS) correctly.
Previously if -POS was specified, 1 field too many was used in the sort.
[bug introduced in coreutils-7.2]
** New features
join now accepts the --header option, to treat the first line of each
file as a header line to be joined and printed unconditionally.
timeout now accepts the --kill-after option which sends a kill
signal to the monitored command if it's still running the specified
duration after the initial signal was sent.
who: the "+/-" --mesg (-T) indicator of whether a user/tty is accepting
messages could be incorrectly listed as "+", when in fact, the user was
not accepting messages (mesg no). Before, who would examine only the
permission bits, and not consider the group of the TTY device file.
Thus, if a login tty's group would change somehow e.g., to "root",
that would make it unwritable (via write(1)) by normal users, in spite
of whatever the permission bits might imply. Now, when configured
using the --with-tty-group[=NAME] option, who also compares the group
of the TTY device with NAME (or "tty" if no group name is specified).
** Changes in behavior
ls --color no longer emits the final 3-byte color-resetting escape
sequence when it would be a no-op.
join -t '' no longer emits an error and instead operates on
each line as a whole (even if they contain NUL characters).
* Noteworthy changes in release 8.4 (2010-01-13) [stable]
** Bug fixes
nproc --all is now guaranteed to be as large as the count
of available processors, which may not have been the case
on GNU/Linux systems with neither /proc nor /sys available.
[bug introduced in coreutils-8.1]
** Build-related
Work around a build failure when using buggy <sys/capability.h>.
Alternatively, configure with --disable-libcap.
Compilation would fail on systems using glibc-2.7..2.9 due to changes in
gnulib's wchar.h that tickled a bug in at least those versions of glibc's
own <wchar.h> header. Now, gnulib works around the bug in those older
glibc <wchar.h> headers.
Building would fail with a link error (cp/copy.o) when XATTR headers
were installed without the corresponding library. Now, configure
detects that and disables xattr support, as one would expect.
* Noteworthy changes in release 8.3 (2010-01-07) [stable]
** Bug fixes
cp -p, install -p, mv, and touch -c could trigger a spurious error
message when using new glibc coupled with an old kernel.
[bug introduced in coreutils-6.12].
ls -l --color no longer prints "argetm" in front of dangling
symlinks when the 'LINK target' directive was given to dircolors.
[bug introduced in fileutils-4.0]
pr's page header was improperly formatted for long file names.
[bug introduced in coreutils-7.2]
rm -r --one-file-system works once again.
The rewrite to make rm use fts introduced a regression whereby
a commmand of the above form would fail for all subdirectories.
[bug introduced in coreutils-8.0]
stat -f recognizes more file system types: k-afs, fuseblk, gfs/gfs2, ocfs2,
and rpc_pipefs. Also Minix V3 is displayed correctly as minix3, not minux3.
[bug introduced in coreutils-8.1]
tail -f (inotify-enabled) once again works with remote files.
The use of inotify with remote files meant that any changes to those
files that was not done from the local system would go unnoticed.
[bug introduced in coreutils-7.5]
tail -F (inotify-enabled) would abort when a tailed file is repeatedly
renamed-aside and then recreated.
[bug introduced in coreutils-7.5]
tail -F (inotify-enabled) could fail to follow renamed files.
E.g., given a "tail -F a b" process, running "mv a b" would
make tail stop tracking additions to "b".
[bug introduced in coreutils-7.5]
touch -a and touch -m could trigger bugs in some file systems, such
as xfs or ntfs-3g, and fail to update timestamps.
[bug introduced in coreutils-8.1]
wc now prints counts atomically so that concurrent
processes will not intersperse their output.
[the issue dates back to the initial implementation]
* Noteworthy changes in release 8.2 (2009-12-11) [stable]
** Bug fixes
id's use of mgetgroups no longer writes beyond the end of a malloc'd buffer
[bug introduced in coreutils-8.1]
id no longer crashes on systems without supplementary group support.
[bug introduced in coreutils-8.1]
rm once again handles zero-length arguments properly.
The rewrite to make rm use fts introduced a regression whereby
a command like "rm a '' b" would fail to remove "a" and "b", due to
the presence of the empty string argument.
[bug introduced in coreutils-8.0]
sort is now immune to the signal handling of its parent.
Specifically sort now doesn't exit with an error message
if it uses helper processes for compression and its parent
ignores CHLD signals. [bug introduced in coreutils-6.9]
tail without -f no longer accesses uninitialized memory
[bug introduced in coreutils-7.6]
timeout is now immune to the signal handling of its parent.
Specifically timeout now doesn't exit with an error message
if its parent ignores CHLD signals. [bug introduced in coreutils-7.6]
a user running "make distcheck" in the coreutils source directory,
with TMPDIR unset or set to the name of a world-writable directory,
and with a malicious user on the same system
was vulnerable to arbitrary code execution
[bug introduced in coreutils-5.0]
* Noteworthy changes in release 8.1 (2009-11-18) [stable]
** Bug fixes
chcon no longer exits immediately just because SELinux is disabled.
Even then, chcon may still be useful.
[bug introduced in coreutils-8.0]
chcon, chgrp, chmod, chown and du now diagnose an ostensible directory cycle
and arrange to exit nonzero. Before, they would silently ignore the
offending directory and all "contents."
env -u A=B now fails, rather than silently adding A to the
environment. Likewise, printenv A=B silently ignores the invalid
name. [the bugs date back to the initial implementation]
ls --color now handles files with capabilities correctly. Previously
files with capabilities were often not colored, and also sometimes, files
without capabilites were colored in error. [bug introduced in coreutils-7.0]
md5sum now prints checksums atomically so that concurrent
processes will not intersperse their output.
This also affected sum, sha1sum, sha224sum, sha384sum and sha512sum.
[the bug dates back to the initial implementation]
mktemp no longer leaves a temporary file behind if it was unable to
output the name of the file to stdout.
[the bug dates back to the initial implementation]
nice -n -1 PROGRAM now runs PROGRAM even when its internal setpriority
call fails with errno == EACCES.
[the bug dates back to the initial implementation]
nice, nohup, and su now refuse to execute the subsidiary program if
they detect write failure in printing an otherwise non-fatal warning
message to stderr.
stat -f recognizes more file system types: afs, cifs, anon-inode FS,
btrfs, cgroupfs, cramfs-wend, debugfs, futexfs, hfs, inotifyfs, minux3,
nilfs, securityfs, selinux, xenfs
tail -f (inotify-enabled) now avoids a race condition.
Before, any data appended in the tiny interval between the initial
read-to-EOF and the inotify watch initialization would be ignored
initially (until more data was appended), or forever, if the file
were first renamed or unlinked or never modified.
[The race was introduced in coreutils-7.5]
tail -F (inotify-enabled) now consistently tails a file that has been
replaced via renaming. That operation provokes either of two sequences
of inotify events. The less common sequence is now handled as well.
[The bug came with the implementation change in coreutils-7.5]
timeout now doesn't exit unless the command it is monitoring does,
for any specified signal. [bug introduced in coreutils-7.0].
** Changes in behavior
chroot, env, nice, and su fail with status 125, rather than 1, on
internal error such as failure to parse command line arguments; this
is for consistency with stdbuf and timeout, and avoids ambiguity
with the invoked command failing with status 1. Likewise, nohup
fails with status 125 instead of 127.
du (due to a change in gnulib's fts) can now traverse NFSv4 automounted
directories in which the stat'd device number of the mount point differs
during a traversal. Before, it would fail, because such a mismatch would
usually represent a serious error or a subversion attempt.
echo and printf now interpret \e as the Escape character (0x1B).
rm -f /read-only-fs/nonexistent now succeeds and prints no diagnostic
on systems with an unlinkat syscall that sets errno to EROFS in that case.
Before, it would fail with a "Read-only file system" diagnostic.
Also, "rm /read-only-fs/nonexistent" now reports "file not found" rather
than the less precise "Read-only file system" error.
** New programs
nproc: Print the number of processing units available to a process.
** New features
env and printenv now accept the option --null (-0), as a means to
avoid ambiguity with newlines embedded in the environment.
md5sum --check now also accepts openssl-style checksums.
So do sha1sum, sha224sum, sha384sum and sha512sum.
mktemp now accepts the option --suffix to provide a known suffix
after the substitution in the template. Additionally, uses such as
"mktemp fileXXXXXX.txt" are able to infer an appropriate --suffix.
touch now accepts the option --no-dereference (-h), as a means to
change symlink timestamps on platforms with enough support.
* Noteworthy changes in release 8.0 (2009-10-06) [beta]
** Bug fixes
cp --preserve=xattr and --archive now preserve extended attributes even
when the source file doesn't have write access.
[bug introduced in coreutils-7.1]
touch -t [[CC]YY]MMDDhhmm[.ss] now accepts a timestamp string ending in .60,
to accommodate leap seconds.
[the bug dates back to the initial implementation]
ls --color now reverts to the color of a base file type consistently
when the color of a more specific type is disabled.
[bug introduced in coreutils-5.90]
ls -LR exits with status 2, not 0, when it encounters a cycle
"ls -is" is now consistent with ls -lis in ignoring values returned
from a failed stat/lstat. For example ls -Lis now prints "?", not "0",
for the inode number and allocated size of a dereferenced dangling symlink.
tail --follow --pid now avoids a race condition where data written
just before the process dies might not have been output by tail.
Also, tail no longer delays at all when the specified pid is not live.
[The race was introduced in coreutils-7.5,
and the unnecessary delay was present since textutils-1.22o]
** Portability
On Solaris 9, many commands would mistakenly treat file/ the same as
file. Now, even on such a system, path resolution obeys the POSIX
rules that a trailing slash ensures that the preceeding name is a
directory or a symlink to a directory.
** Changes in behavior
id no longer prints SELinux " context=..." when the POSIXLY_CORRECT
environment variable is set.
readlink -f now ignores a trailing slash when deciding if the
last component (possibly via a dangling symlink) can be created,
since mkdir will succeed in that case.
** New features
ln now accepts the options --logical (-L) and --physical (-P),
added by POSIX 2008. The default behavior is -P on systems like
GNU/Linux where link(2) creates hard links to symlinks, and -L on
BSD systems where link(2) follows symlinks.
stat: without -f, a command-line argument of "-" now means standard input.
With --file-system (-f), an argument of "-" is now rejected.
If you really must operate on a file named "-", specify it as
"./-" or use "--" to separate options from arguments.
** Improvements
rm: rewrite to use gnulib's fts
This makes rm -rf significantly faster (400-500%) in some pathological
cases, and slightly slower (20%) in at least one pathological case.
rm -r deletes deep hierarchies more efficiently. Before, execution time
was quadratic in the depth of the hierarchy, now it is merely linear.
However, this improvement is not as pronounced as might be expected for
very deep trees, because prior to this change, for any relative name
length longer than 8KiB, rm -r would sacrifice official conformance to
avoid the disproportionate quadratic performance penalty. Leading to
another improvement:
rm -r is now slightly more standards-conformant when operating on
write-protected files with relative names longer than 8KiB.
* Noteworthy changes in release 7.6 (2009-09-11) [stable]
** Bug fixes
@@ -2629,10 +3262,10 @@ packages, see ./old/*/NEWS.
========================================================================
Copyright (C) 2001-2009 Free Software Foundation, Inc.
Copyright (C) 2001-2011 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

9
README
View File

@@ -11,7 +11,7 @@ The programs that can be built with this package are:
csplit cut date dd df dir dircolors dirname du echo env expand expr
factor false fmt fold groups head hostid hostname id install join kill
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
nproc od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
sleep sort split stat stdbuf stty su sum sync tac tail tee test timeout
touch tr true truncate tsort tty uname unexpand uniq unlink uptime users
@@ -223,16 +223,19 @@ For general documentation on the coding and usage standards
this distribution follows, see the GNU Coding Standards,
http://www.gnu.org/prep/standards_toc.html.
For any copyright year range specified as YYYY-ZZZZ in this package
note that the range specifies every single year in that closed interval.
Mail suggestions and bug reports for these programs to
the address on the last line of --help output.
========================================================================
Copyright (C) 1998, 2002-2009 Free Software Foundation, Inc.
Copyright (C) 1998, 2002-2011 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

View File

@@ -28,14 +28,26 @@ You can get a copy of the source repository like this:
$ git clone git://git.sv.gnu.org/coreutils
$ cd coreutils
As an optional step, if you already have a copy of the gnulib git
repository on your hard drive, then you can use it as a reference to
reduce download time and disk space requirements:
$ export GNULIB_SRCDIR=/path/to/gnulib
The next step is to get and check other files needed to build,
which are extracted from other source packages:
$ ./bootstrap
To use the most-recent gnulib (as opposed to the gnulib version that
the package last synchronized to), do this next:
$ git submodule foreach git pull origin master
$ git commit -m 'build: update gnulib submodule to latest' gnulib
And there you are! Just
$ ./configure #[--enable-gcc-warnings]
$ ./configure --quiet #[--enable-gcc-warnings] [*]
$ make
$ make check
@@ -48,9 +60,38 @@ should output no difference.
Enjoy!
[*] The --enable-gcc-warnings option is useful only with glibc
and with a very recent version of gcc. You'll probably also have
to use recent system headers. If you configure with this option,
and spot a problem, please be sure to send the report to the bug
reporting address of this package, and not to that of gnulib, even
if the problem seems to originate in a gnulib-provided file.
* Submitting patches
If you develop a fix or a new feature, please send it to the
appropriate bug-reporting address as reported by the --help option of
each program. One way to do this is to use vc-dwim
<http://www.gnu.org/software/vc-dwim/>), as follows.
Run the command "vc-dwim --help", copy its definition of the
"git-changelog-symlink-init" function into your shell, and then run
this function at the top-level directory of the package.
Edit the ChangeLog file that this command creates, creating a
properly-formatted entry according to the GNU coding standards
<http://www.gnu.org/prep/standards/html_node/Change-Logs.html>.
Run the command "vc-dwim" and make sure its output looks good.
Run "vc-dwim --commit".
Run the command "git format-patch --stdout -1", and email its output
in, using the output's subject line.
-----
Copyright (C) 2002-2009 Free Software Foundation, Inc.
Copyright (C) 2002-2011 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

@@ -10,9 +10,12 @@ coreutils package, see these:
http://mail.gnu.org/mailman/listinfo/coreutils-announce
http://mail.gnu.org/mailman/listinfo/bug-coreutils
http://mail.gnu.org/mailman/listinfo/coreutils
mailing list archives are here:
http://news.gmane.org/gmane.comp.gnu.coreutils.announce
http://news.gmane.org/gmane.comp.gnu.core-utils.bugs (up to the minute)
http://mail.gnu.org/pipermail/bug-coreutils/ (updated every 12 hours)
http://news.gmane.org/gmane.comp.gnu.coreutils.general
http://mail.gnu.org/pipermail/coreutils/ (updated every 12 hours)

View File

@@ -14,18 +14,26 @@ I.E. the tools checked for by the bootstrap script and include:
- Texinfo <http://www.gnu.org/software/texinfo/>
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.
If these programs are not available use the following instructions
to build them and install the results into a directory that you will
then use when building this package.
Even if the official version of a package for your system is too old,
please install it, as it may be required to build the newer versions.
The examples below install into $HOME/coreutils/deps/, so if you are
going to follow these instructions, first ensure that your $PATH is
set correctly by running this command:
prefix=$HOME/coreutils/deps
export PATH=$prefix/bin:$PATH
* autoconf *
# Note Autoconf 2.62 or newer is needed to build automake-1.11
# Note Autoconf 2.62 or newer is needed to build automake-1.11.1
git clone --depth=1 git://git.sv.gnu.org/autoconf.git
git checkout v2.62
autoreconf -vi
./configure --prefix=$HOME/coreutils/deps
./configure --prefix=$prefix
make install
* automake *
@@ -33,12 +41,12 @@ as they may be required to build the newer versions.
# 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
git checkout v1.11.1
./bootstrap
./configure --prefix=$HOME/coreutils/deps
./configure --prefix=$prefix
make install
coreutils uses XZ utils (successor to LZMA) to create
This package 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.
@@ -47,10 +55,7 @@ requires version 1.10a or newer, as well as the xz program itself.
git clone git://ctrl.tukaani.org/xz.git
cd xz
./autogen.sh
./configure --prefix=$HOME/coreutils/deps
./configure --prefix=$prefix
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
Now you can build this package as described in README-hacking.

View File

@@ -7,92 +7,103 @@ 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.
* Ensure that you've pushed all changes that belong in the release
and that the NixOS/Hydra autobuilder is reporting all is well:
* Run bootstrap, (assuming your local copy of gnulib is in /gnulib):
./bootstrap --gnulib-srcdir=/gnulib
http://hydra.nixos.org/jobset/gnu/coreutils-master
* Run bootstrap one last time. This downloads any new translations:
./bootstrap
FIXME: enable excluded programs like arch? to get their manual pages?
* Pre-release testing:
On at least one SELinux-enabled (enforcing) and one non-SELinux system,
run all tests, both root-only and regular.
Run *all* non-root tests, including expensive and very expensive ones i.e.,
run this: make -j1 check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
Run the root-only tests:
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
Run the following on at least one SELinux-enabled (enforcing) and
one non-SELinux system:
* Run "make distcheck"
n=$(( ($(nproc) + 1) / 2 ))
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k -j$(nproc) check-root\
&& make distcheck \
&& make -j$n check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
* Manually set the date, version number, and [stable/alpha/beta] on
line 3 of NEWS, then do e.g.,:
Note that the use of -j$n tells make to use approximately half of the
available processing units. If you use -jN, for larger N, some of the
expensive tests are likely to interfere with concurrent performance-measuring
or timing-sensitive tests, resulting in spurious failures.
v=7.3
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
git tag -s -m "coreutils $v" v$v HEAD
If "make distcheck" doesn't run "make syntax-check" for you, then run
it manually:
make syntax-check
* Set the date, version number, and release type [stable/alpha/beta] on
line 3 of NEWS, commit that, and tag the release by running e.g.,
build-aux/do-release-commit-and-tag X.Y stable
* 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,major}.
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
it builds and passes all tests.
* While that's happening, write the release announcement that you will
soon post.
soon post. Start with the template, $HOME/announce-coreutils-X.Y
that was just created by that "make" command.
Once all the builds and tests have passed,
* Run the gnupload command that was suggested by your "make major" run above.
* Run the gnupload command that was suggested by your "make stable" 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>
* Push the NEWS-updating changes and the new tag:
* 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]
v=$(cat .prev-version)
git push origin master tag v$v
* Approve the announcement here:
http://lists.gnu.org/mailman/admindb/coreutils-announce
* Announce it on Savannah first, so you can include the preferable
savannah.org announcement link in the email message.
* Announce it on Savannah, too:
From here:
https://savannah.gnu.org/projects/coreutils/
click on the "submit news", then write something like the following:
(If there is no such button, then enable "News" for the project via
the Main -> "Select Features" menu item, or via this link:
https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=coreutils)
Subject: coreutils-7.2 released [stable]
The announcement is here:
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/49
Subject: coreutils-X.Y released [stable]
+verbatim+
...paste the announcement here...
-verbatim-
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
* Send the announcement email message.
* Approve the announcement here:
http://lists.gnu.org/mailman/admindb/coreutils-announce
* 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-2006, 2009 Free Software Foundation, Inc.
# Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,26 +16,34 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Convert Makefile.am files:
# find tests -name Makefile.am | xargs grep -wl PATH|xargs perl -pi -e \
# 's,src(\$\(PATH_SEPARATOR\)\$\$PATH),src/vg$1,'
# find tests -name check.mk | xargs grep -wl PATH |
# xargs perl -pi -e 's,src(\$\(PATH_SEPARATOR\)),src/vg$1,'
# To restore:
# find tests -name Makefile.am|xargs grep -wl PATH|xargs perl -pi -e 's,src/vg,src,'
# find tests -name check.mk | xargs grep -wl PATH |
# xargs perl -pi -e 's,src/vg,src,'
#
# Create this symlink for suppressions (this is no longer necessary,
# with Linux kernel 2.6.9 and valgrind-2.2.0):
# ln -s $PWD/.vg-suppressions /tmp/cu-vg
# Create src/vg:
coreutils=$(echo 'spy:;@echo $(all_programs)' | (cd src; make -f Makefile -f - spy | tr -s '\n ' ' '))
coreutils=$(echo 'spy:;@echo $(all_programs) $(noinst_PROGRAMS)' |
(cd src; make -f Makefile -f - spy | tr -s '\n ' ' '))
mkdir -p src/vg
pwd=`pwd`
srcdir=$pwd/src
_path='export PATH='$srcdir':${PATH#*:}'
pre='#!/bin/sh\n'"$_path"'\n'
n=15
vg='exec /usr/bin/valgrind --suppressions=/tmp/cu-vg --log-fd=3 --leak-check=yes --track-fds=yes --leak-check=full --num-callers='$n
n=15 # stack trace depth
log_fd=3 # One can redirect this to file like 3>vg.log
test -e /tmp/cu-vg && suppressions='--supressions=/tmp/cu-vg'
vg="exec /usr/bin/valgrind $suppressions --log-fd=$log_fd \
--leak-check=yes --track-fds=yes --leak-check=full --num-callers=$n"
cat <<EOF > src/vg/gen
for i in $coreutils; do
printf "$pre$vg -- \$i"' "\$@"\n' > \$i

View File

@@ -1,10 +1,16 @@
These people have contributed to the GNU coreutils (formerly, the fileutils,
textutils, and/or sh-utils packages). Some have reported problems, others
have contributed improvements to the documentation, actual code, and even
complete programs. Those contributions are described in the ChangeLog
files. If your name has been left out, if you'd rather not be listed,
or if you'd prefer a different address be used, please send a note to
the bug-report mailing list (as seen on last line of e.g., cp --help).
complete programs. Those contributions are described in the version control
logs and ChangeLog files. If your name has been left out, if you'd rather
not be listed, or if you'd prefer a different address be used, please send a
note to the bug-report mailing list (as seen at end of e.g., cp --help).
##
## There is no need to list here any name that appears as an Author in
## "git log" output. Those are automatically added when this template
## is used to generate the THANKS file. Note that numerous people listed
## here would have been listed as commit authors if we had been using git
## for version control when they contributed.
??? kytek@cybercomm.net
A Costa agcosta@gis.net
@@ -12,10 +18,12 @@ Aaron Hawley ashawley@uvm.edu
Achim Blumensath blume@corona.oche.de
Adam Jimerson vendion@charter.net
Adam Klein aklein@debian.org
Adam Sampson ats@offog.org
Adrian Bunk bunk@stusta.de
AIDA Shinra shinra@j10n.org
Akim Demaille demaille@inf.enst.fr
Alain Magloire alain@qnx.com
Alan Curry pacman@kosh.dhis.org
Alan Iwi iwi@atm.ox.ac.uk
Albert Chin-A-Young china@thewrittenword.com
Albert Hopkins ahopkins@dynacare.com
@@ -36,12 +44,10 @@ Andreas Frische andreasfrische@gmail.com
Andreas Gruenbacher ag@bestbits.at
Andreas Jaeger jaeger@gnu.org
Andreas Luik luik@isa.de
Andreas Schwab schwab@linux-m68k.org
Andreas Stolcke stolcke@ICSI.Berkeley.EDU
Andrei Gaponenko andr@triumf.ca
Andres Soolo andres@soolo.matti.ee
Andrew Burgess aab@cichlid.com
Andrew Church achurch@achurch.org
Andrew Dalke dalke@bioreason.com
Andrew Fabbro andrew@fabbro.org
Andrew Pham andpha@us.ibm.com
@@ -52,22 +58,22 @@ Andy Longton alongton@metamark.com
Anthony Thyssen anthony@griffith.edu.au
Antonio Rendas ajrendas@yahoo.com
Ariel Faigon ariel@cthulhu.engr.sgi.com
Arne H. Juul arnej@solan.unit.no
Arjan Opmeer arjan.opmeer@gmail.com
Arne Henrik Juul arnej@imf.unit.no
Arnold Robbins arnold@skeeve.com
Arthur Pool pool@commerce.uq.edu.au
Arun Sharma arun.sharma@intel.com
Arvind Autar Autar022@planet.nl
Augey Mikus mikus@dqc.org
Aurelien Jarno aurel32@debian.org
Austin Donnelly Austin.Donnelly@cl.cam.ac.uk
Axel Kittenberger Anshil@gmx.net
Barry Kelly http://barrkel.blogspot.com/
Bauke Jan Douma bjdouma@xs4all.nl
Ben Elliston bje@air.net.au
Ben Harris bjh21@netbsd.org
Benjamin Cutler cutlerbc@simla.colostate.edu
Ben Walton bwalton@artsci.utoronto.ca
Bengt Martensson bengt@mathematik.uni-Bremen.de
Benjamin Cutler cutlerbc@simla.colostate.edu
Bernard Giroud bernard.giroud@creditlyonnais.ch
Bernd Eckenfels ecki@debian.org
Bernd Leibing bernd.leibing@rz.uni-ulm.de
@@ -82,26 +88,25 @@ Bill Brelsford wb@k2di.net
Bill Peters peters@gaffel.as.arizona.edu
Bjorn Helgaas helgaas@rsn.hp.com
Bob McCracken kerouac@ravenet.com
Bob Proulx rwp@fc.hp.com
Branden Robinson branden@necrotic.deadbeast.net
Brendan O'Dea bod@compusol.com.au
Brian Kimball bfk@footbag.org
Brian M. Carlson sandals@crustytoothpaste.ath.cx
Brian Silverman bsilverman@conceptxdesign.com
Brian Youmans 3diff@gnu.org
Bruce Korb bkorb@veritas.com
Bruce Robertson brucer@theodolite.dyndns.org
Bruno Haible haible@clisp.cons.org
C de-Avillez hggdh2@gmail.com
Carl Johnson carlj@cjlinux.home.org
Carl Lowenstein cdl@mpl.UCSD.EDU
Carl Roth roth@urs.us
Carlos Canau Carlos.Canau@relay.puug.pt
Charles Karney karney@pppl.gov
Charles Randall crandall@matchlogic.com
Chas. Owens chas.owens@gmail.com
Chip Salzenberg chip@valinux.com
Chris Clayton chris2553@googlemail.com
Chris Faylor cgf@cygnus.com
Chris J. Bednar cjb@AdvancedDataSolutions.com
Chris Jones cjns1989@gmail.com
Chris Lesniewski ctl@mit.edu
Chris Sylvain csylvain@umm.edu
Chris Yeo cyeo@biking.org
@@ -114,7 +119,6 @@ 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
@@ -124,10 +128,8 @@ Cyril Bouthors cyril@bouthors.org
Dale Scheetz dwarf@polaris.net
Dameon G. Rogers dgr03@uark.edu
Dan Hagerty hag@gnu.ai.it.edu
Dan Jacobson jidanni@jidanni.org
Dan Pascu dan@services.iiruc.ro
Daniel Bergstrom noa@melody.se
Daniel Dunbar ddunbar@stanford.edu
Daniel P. Berrangé berrange@redhat.com
Dániel Varga danielv@axelero.hu
Danny Levinson danny.levinson@overture.com
@@ -135,7 +137,6 @@ Darrel Francis d.francis@cheerful.com
Darren Salt ds@youmustbejoking.demon.co.uk
Dave Beckett dajobe@dajobe.org
David Alan Gilbert gilbertd@treblig.org
David Bartley dtbartle@csclub.uwaterloo.ca
David Dyck dcd@tc.fluke.COM
David Eisner cradle@umd.edu
David Flynn dav@chess.plus.com
@@ -148,21 +149,21 @@ Dawson Engler engler@stanford.edu
Dean Gaudet dean-savannah@arctic.org
Deepak Goel deego@gnufans.org
Denis Excoffier denis.excoffier@airbus.com
Denis McKeon dmckeon@swcp.com
Dennis Henriksen opus@flamingo.osrl.dk
Dennis Clarke dclarke@blastwave.org
Dennis Smit ds@nerds-incorporated.org
Derek Clegg dclegg@next.com
Dick Streefland dick_streefland@tasking.com
Dirk Lattermann dlatt@t-online.de
Dirk-Jan Faber djfaber@snow.nl
Dmitry Rutsky rutsky@school.ioffe.rssi.ru
Dmitry V. Levin ldv@altlinux.org
Don Parsons dparsons@synapse.kent.edu
Donni Erpel donald@appc11.gsi.de
Doug Coleman coleman@iarc1.ece.utexas.edu
Doug McLaren dougmc@comco.com
Dragos Harabor dharabor@us.oracle.com
Duncan Roe duncanr@optimation.com.au
Ed Avis ed@membled.com
Edward Welbourne eddy@opera.com
Edzer Pebesma Edzer.Pebesma@rivm.nl
Egmont Koblinger egmont@uhulinux.hu
@@ -170,20 +171,18 @@ Eirik Fuller eirik@hackrat.com
Eivind eivindt@multinet.no
Elbert Pol elbert.pol@gmail.com
Eli Zaretskii eliz@is.elta.co.il
Elias Pipping pipping@gentoo.org
Emile LeBlanc leblanc@math.toronto.edu
Erik Auerswald auerswal@unix-ag.uni-kl.de
Emmanuel Lacour elacour@home-dn.net
Eric Backus ericb@lsid.hp.com
Eric Blake ebb9@byu.net
Eric G. Miller egm2@jps.net
Eric Pemente pemente@northpark.edu
Eric S. Raymond esr@snark.thyrsus.com
Erik Bennett bennett@cvo.oneworld.com
Erik Corry erik@kroete2.freinet.de
Evan Hunt ethanol@armory.com
Felix Lee flee@teleport.com
Felix Rauch Valenti frauch@cse.unsw.edu.au
Ferdinand fw@scenic.mine.nu
Filipus Klutiero chealer@gmail.com
Fletcher Mattox fletcher@cs.utexas.edu
Florent Bayle florent@sarcelle.net
Florian Schlichting fschlich@cis.fu-berlin.de
@@ -245,7 +244,9 @@ Ian Turner vectro@pipeline.com
Iida Yosiaki iida@gnu.org
Ilya N. Golubev gin@mo.msk.ru
Ingo Saitz ingo@debian.org
Ivan Labath labath3@st.fmph.uniba.sk
Ivo Timmermans ivo@debian.org
Jacky Fong jacky.fong@utoronto.ca
James james@albion.glarp.com
James Antill jmanti%essex.ac.uk@seralph21.essex.ac.uk
James Lemley James.Lemley@acxiom.com
@@ -253,13 +254,13 @@ James Hunt jamesodhunt@hotmail.com
James Ralston ralston@pobox.com
James Sneeringer jvs@ocslink.com
James Tanis jtt@soscorp.com
James Youngman jay@gnu.org
Jamie Lokier jamie@imbolc.ucc.ie
Jamie McClelland jm@mayfirst.org
Jan Engelhardt jengelh@medozas.de
Jan Fedak J.Fedak@sh.cvut.cz
Jan Moringen jan.moringen@uni-bielefeld.de
Jan Nieuwenhuizen janneke@gnu.org
Jan-Pawel Wrozstinski jpwroz@gmail.com
Janos Farkas chexum@shadow.banki.hu
Jarkko Hietaniemi jhi@epsilon.hut.fi
Jarod Wilson jwilson@redhat.com
@@ -280,13 +281,11 @@ 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
Johan Danielsson joda@pdc.kth.se
John Bley jbb6@acpub.duke.edu
John David Anglin dave.anglin@nrc.ca
John Gatewood Ham zappaman@alphabox.compsci.buu.ac.th
John Gotts jgotts@umich.edu
John Kendall kendall@capps.com
@@ -294,6 +293,7 @@ John Kodis kodis@acm.org
John Murphy jam@philabs.research.philips.com
John Roll john@panic.harvard.edu
John Salmon johns@mullet.anu.edu.au
John Stanley johnstops@verizon.net
John Summerfield summer@OS2.ami.com.au
Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
Joost van Baal joostvb@xs4all.nl
@@ -328,12 +328,14 @@ Kirk Kelsey kirk.kelsey@0x4b.net
Kristin E Thomas kristint@us.ibm.com
Kjetil Torgrim Homme kjetilho@ifi.uio.no
Kristoffer Rose kris@diku.dk
Ladislav Hagara ladislav.hagara@unob.cz
Larry McVoy lm@sgi.com
Lars Hecking lhecking@nmrc.ucc.ie
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
@@ -341,6 +343,7 @@ M. P. Suzuki mpsuzuki@hiroshima-u.ac.jp
Maciej Kwapulinski pikpok@univ.gda.pl
Manas Garg manas@cygsoft.com
Manfred Hollstein manfred@s-direktnet.de
Марк Коренберг socketpair@gmail.com
Marc Boucher marc@mbsi.ca
Marc Haber mh+debian-bugs@zugschlus.de
Marc Lehman schmorp@schmorp.de
@@ -365,6 +368,7 @@ Martin martin@dresden.nacamar.de
Martin Buck martin.buck@ascom.ch
Martin Gallant martyg@goodbit.net
Martin Hippe martin.hippe@schlund.de
Martin Jacobs martin.jacobs@arcor.de
Martin Michlmayr tbm@cyrius.com
Martin Mitchell martin@debian.org
Martin P.J. Zinser zinser@decus.de
@@ -372,6 +376,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
@@ -384,7 +389,6 @@ Matthew Clarke Matthew_Clarke@mindlink.bc.ca
Matthew S. Levine mslevine@theory.lcs.mit.edu
Matthew Smith matts@bluesguitar.org
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
@@ -393,7 +397,7 @@ Max Chang maxchang@ucla.edu
Meelis Roos mroos@tartu.cyber.ee
Michael michael@aplatform.com
Michael ??? michael@roka.net
Michael Bacarella mbac@netgraft.com>
Michael Bacarella mbac@netgraft.com
Michael Deutschmann michael@talamasca.ocis.net
Michael Elizabeth Chastain mec.gnu@mindspring.com
Michael Gaughen mgaughen@polyserve.com
@@ -403,9 +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
Michael van Elst mlelstv@dev.de.cw.net
Michael Veksler mveksler@techunix.technion.ac.il
@@ -414,11 +416,9 @@ Michal Politowski mpol@charybda.icm.edu.pl
Michal Svec msvec@suse.cz
Michel Robitaille robitail@IRO.UMontreal.CA
Michiel Bacchiani bacchian@raven.bu.edu
Mikael Magnusson mikachu@gmail.com
Mike Castle dalgoda@ix.netcom.com
Mike Coleman mkc@mathdogs.com
Mike Jetzer mjetzer@mke.catalystwms.com
Mike Frysinger vapier@gentoo.org
Mikko Tuumanen m@sorvankyla.yok.utu.fi
Mikulas Patocka mikulas@artax.karlin.mff.cuni.cz
Miles Bader miles@gnu.ai.mit.edu
@@ -446,10 +446,8 @@ 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
Paul Eggert eggert@twinsun.com
Paul Ghaleb paul.ghaleb@st.com
Paul Jarc prj@po.cwru.edu
Paul Nevai nevai@ops.mps.ohio-state.edu
@@ -464,33 +462,28 @@ Per Starbäck starback@stp.lingfil.uu.se
Peter Breitenlohner peb@mppmu.mpg.de
Peter Dyballa peter_dyballa@web.de
Peter Eriksson peter@ifm.liu.se
Peter Fales psfales@lucent.com
Peter Horst peter@ointment.org
Peter Moulder reiter@netspace.net.au
Peter O'Gorman bug-coreutils@mlists.thewrittenword.com
Peter Samuelson psamuels@sampo.creighton.edu
Peter Seebach seebs@taniemarie.solon.com
Petr Uzel petr.uzel@suse.cz
Petter Reinholdtsen pere@hungry.com
Phelippe Neveu pneveu@pcigeomatics.com
Phil Richards phil.richards@vf.vodafone.co.uk
Philip Rowlands phr@doc.ic.ac.uk
Philippe De Muyter phdm@macqel.be
Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
Phillip Jones mouse@datastacks.com
Piergiorgio Sartor sartor@sony.de
Pieter Bowman bowman@math.utah.edu
Piotr Gackiewicz gacek@intertele.pl
Piotr Kwapulinski kwap@univ.gda.pl
Prashant TR tr@eth.net
Priit Jõerüüt jemm4jemm@yahoo.com
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Ralf W. Stephan stephan@tmt.de
Ralf Wildenhues Ralf.Wildenhues@gmx.de
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
Ren Yang ryang@redhat.com
Richard A Downing richard.downing@bcs.org.uk
Richard Braakman dark@xs4all.nl
Richard Dawe rich@phekda.freeserve.co.uk
@@ -500,9 +493,12 @@ Richard Sharman rsharman@magmacom.com
Rick Sladkey jrs@world.std.com
Rik Faith faith@cs.unc.edu
Risto Kankkunen kankkune@lingsoft.fi
Rob Wortman wyrm@haell.com
Robert H. de Vries robert@and.nl
Robert Lindgren robert@orcafat.com
Robert Millan zeratul2@wanadoo.es
Robert Schwebel r.schwebel@pengutronix.de
Robin H. Johnson robbat2@gentoo.org
Rogier Wolff R.E.Wolff@BitWizard.nl
Roland Huebner ro-huebner@gmx.de
Roland Turner raz.tah.bet@raz.cx
@@ -519,14 +515,17 @@ Samuli Karkkainen Samuli.Karkkainen@hut.fi
Sander van Malssen svm@kozmix.ow.nl
Santiago Vila Doncel sanvila@unex.es
Savochkin Andrey Vladimirovich saw@msu.ru
Scott Harrison scott.gnu.2009@scottrix.co.uk
Scott Lurndal slurn@griffin.engr.sgi.com
Sébastien Maret smaret@umich.edu
Sergei Steshenko sergstesh@yahoo.com
Sergey Vlasov vsu@altlinux.org
Shing-Shong Shei shei@cs.indiana.edu
Soeren Sonnenburg sonnenburg@informatik.hu-berlin.de
Solar Designer solar@owl.openwall.com
Stanislav Ievlev inger@altlinux.ru
Stavros Passas stabat@ics.forth.gr
Stefan Vargyas stvar@yahoo.com
Stéphane Chazelas Stephane_CHAZELAS@yahoo.fr
Stephen Depooter sbdep@myrealbox.com
Stephen Eglen eglen@pcg.wustl.edu
@@ -535,20 +534,20 @@ Stephen Smoogen smooge@mindspring.com
Steve McConnel steve@acadcomp.sil.org
Steve McIntyre steve@einval.com
Steve Ward planet36@gmail.com
Steven Drake sbd@users.sourceforge.net
Steven G. Johnson stevenj@alum.mit.edu
Steven Mocking ufo@quicknet.nl
Steven Parkes smparkes@smparkes.net
Steven Schveighoffer schveiguy@yahoo.com
Steven P Watson steven@magelico.net
Stuart Citrin ctrn3e8@gmail.com
Stuart Kemp skemp@peter.bmc.com
Stuart Shelton stuart@shelton.me
Sven Joachim svenjoac@gmx.de
Szakacsits Szabolcs szaka@sienet.hu
Tadayoshi Funaba tadf@kt.rim.or.jp
TAKAI Kousuke takai@vlsi.kuee.kyoto-u.ac.jp
Theodore Ts'o tytso@rsts-11.mit.edu
The Wanderer inverseparadox@comcast.net
Theodoros V. Kalamatianos nyb@users.sourceforge.net
Thomas Bushnell thomas@gnu.ai.mit.edu
Thomas Goerlich thomas@schnappmatik.de
Thomas Hood jdthood@yahoo.co.uk
@@ -561,8 +560,8 @@ Tim J. Robbins tjr@FreeBSD.org
Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
Tim Ryan Tim_Ryan@bnz.co.nz
Tim Smithers mouse@dmouse.com.au
Tim Underwood timunderwood@gmail.com
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
@@ -586,6 +585,7 @@ Ulrich Hermisson ulrich_hermisson@hotmail.com
Urs Thuermann urs@isnogud.escape.de
Uwe H. Steinfeld usteinfeld@gmx.net
Vesselin Atanasov vesselin@bgnet.bg
Ville Skyttä ville.skytta@iki.fi
Vin Shelton acs@alumni.princeton.edu
Vineet Chadha chadha@acis.ufl.edu
Vitali Lovich vlovich@gmail.com
@@ -608,8 +608,10 @@ 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
Yang Ren ryang@redhat.com
Yanko Kaneti yaneti@declera.com
Yann Dirson dirson@debian.org
Zvi Har'El rl@math.technion.ac.il
Yutaka Amanai yasai-itame1942@jade.plala.or.jp
;; Local Variables:
;; coding: utf-8

10
TODO
View File

@@ -12,7 +12,6 @@ Modify chmod so that it does not change an inode's st_ctime
Discussed more recently on <http://bugs.debian.org/497514>.
document the following in coreutils.texi:
mktemp
[
pinky
@@ -35,6 +34,9 @@ printf:
platforms where the native *printf(3) is deficient.
Suggestion from Eric Blake.
consider adding some implementation of the "col" utility
Suggested by Karl Berry.
renice: POSIX utility, needs implementing.
suggestion from Karl Berry (among others).
Bob Proulx is working on this.
@@ -60,10 +62,6 @@ Integrate use of sendfile, suggested here:
http://mail.gnu.org/archive/html/bug-fileutils/2003-03/msg00030.html
I don't plan to do that, since a few tests demonstrate no significant benefit.
Should printf '\0123' print "\n3"?
per report from TAKAI Kousuke on Mar 27
http://mail.gnu.org/archive/html/bug-coreutils/2003-03/index.html
printf: consider adapting builtins/printf.def from bash
tail: don't use xlseek; it *exits*.
@@ -170,7 +168,7 @@ pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
-----
Copyright (C) 2002-2009 Free Software Foundation, Inc.
Copyright (C) 2002-2011 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

328
bootstrap
View File

@@ -1,8 +1,10 @@
#! /bin/sh
# Print a version string.
scriptversion=2011-03-03.12; # UTC
# Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
# Copyright (C) 2003-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +19,15 @@
# 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.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as build-aux/bootstrap in gnulib, however, to
# be useful to your project, you should place a copy of it under
# version control in the top-level directory of your project. The
# intent is that all customization can be done with a bootstrap.conf
# file also maintained in your version control; gnulib comes with a
# template build-aux/bootstrap.conf to get you started.
# Please report bugs or propose patches to bug-gnulib@gnu.org.
nl='
'
@@ -32,24 +42,32 @@ local_gl_dir=gl
bt='._bootmp'
bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
bt2=${bt}2
me=$0
usage() {
cat <<EOF
Usage: $0 [OPTION]...
Usage: $me [OPTION]...
Bootstrap this package from the checked-out sources.
Options:
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
do not want to waste your bandwidth downloading
them again.
--copy Copy files instead of creating symbolic links.
--force Attempt to bootstrap even if the sources seem
not to have been checked out.
--skip-po Do not download po files.
them again. Defaults to \$GNULIB_SRCDIR
--bootstrap-sync if this bootstrap script is not identical to
the version in the local gnulib sources,
update this script, and then restart it with
/bin/sh or the shell \$CONFIG_SHELL
--no-bootstrap-sync do not check whether bootstrap is out of sync
--copy copy files instead of creating symbolic links
--force attempt to bootstrap even if the sources seem
not to have been checked out
--no-git do not use git to update gnulib. Requires that
--gnulib-srcdir point to a correct gnulib snapshot
--skip-po do not download po files
If the file $0.conf exists in the same directory as this script, its
If the file $me.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
@@ -70,13 +88,22 @@ gnulib_modules=
# Any gnulib files needed that are not in modules.
gnulib_files=
# A function to be called to edit gnulib.mk right after it's created.
# Override it via your own definition in bootstrap.conf.
gnulib_mk_hook() { :; }
# A function to be called after everything else in this script.
# Override it via your own definition in bootstrap.conf.
bootstrap_epilogue() { :; }
# The command to download all .po files for a specified domain into
# a specified directory. Fill in the first %s is the domain name, and
# the second with the destination directory. Use rsync's -L and -r
# options because the latest/%s directory and the .po files within are
# all symlinks.
po_download_command_format=\
"rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'"
"rsync --delete --exclude '*.s1' -Lrtvz \
'translationproject.org::tp/latest/%s/' '%s'"
extract_package_name='
/^AC_INIT(/{
@@ -129,7 +156,8 @@ XGETTEXT_OPTIONS='\\\
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
'
# Package bug report address for gettext files
# Package bug report address and copyright holder for gettext files
COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
MSGID_BUGS_ADDRESS=bug-$package@gnu.org
# Files we don't want to import.
@@ -148,14 +176,26 @@ copy=false
# on which version control system (if any) is used in the source directory.
vc_ignore=auto
# Set this to true in bootstrap.conf to enable --bootstrap-sync by
# default.
bootstrap_sync=false
# Use git to update gnulib sources
use_git=true
# 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
if eval test x"\$$find_tool_envvar" = x; then
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
@@ -163,21 +203,23 @@ find_tool ()
break
fi
done
else
find_tool_error_prefix="\$$find_tool_envvar: "
fi
if test x"$find_tool_res" = x; then
echo >&2 "$0: $find_tool_name is required"
echo >&2 "$me: one of these is required: $find_tool_names"
exit 1
fi
($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
echo >&2 "$0: cannot run $find_tool_res --version"
echo >&2 "$me: ${find_tool_error_prefix}cannot run $find_tool_res --version"
exit 1
}
eval "$find_tool_envvar=\"$find_tool_res\""
eval "$find_tool_envvar=\$find_tool_res"
eval "export $find_tool_envvar"
}
# Find sha1sum, named gsha1sum on MacPorts.
find_tool SHA1SUM sha1sum gsha1sum
# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum
# Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory
@@ -212,12 +254,25 @@ do
checkout_only_file=;;
--copy)
copy=true;;
--bootstrap-sync)
bootstrap_sync=true;;
--no-bootstrap-sync)
bootstrap_sync=false;;
--no-git)
use_git=false;;
*)
echo >&2 "$0: $option: unknown option"
exit 1;;
esac
done
if $use_git || test -d "$GNULIB_SRCDIR"; then
:
else
echo "$0: Error: --no-git requires --gnulib-srcdir" >&2
exit 1
fi
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
exit 1
@@ -234,6 +289,21 @@ insert_sorted_if_absent() {
|| exit 1
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
# insert_sorted_if_absent.
insert_vc_ignore() {
vc_ignore_file="$1"
pattern="$2"
case $vc_ignore_file in
*.gitignore)
# A .gitignore entry that does not start with `/' applies
# recursively to subdirectories, so prepend `/' to every
# .gitignore entry.
pattern=`echo "$pattern" | sed s,^,/,`;;
esac
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
}
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
found_aux_dir=no
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
@@ -252,7 +322,7 @@ if test ! -d $build_aux; then
mkdir $build_aux
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
insert_sorted_if_absent $dot_ig $build_aux
insert_vc_ignore $dot_ig $build_aux
done
fi
@@ -302,10 +372,21 @@ get_version() {
$app --version >/dev/null 2>&1 || return 1
$app --version 2>&1 |
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
t done
d
:done
sed -n '# Move version to start of line.
s/.*[v ]\([0-9]\)/\1/
# Skip lines that do not start with version.
/^[0-9]/!d
# Remove characters after the version.
s/[^.a-z0-9-].*//
# The first component must be digits only.
s/^\([0-9]*\)[a-z-].*/\1/
#the following essentially does s/5.005/5.5/
s/\.0*\([1-9]\)/.\1/g
p
q'
}
@@ -313,18 +394,26 @@ check_versions() {
ret=0
while read app req_ver; do
# We only need libtoolize from the libtool package.
if test "$app" = libtool; then
app=libtoolize
fi
# Exempt git if --no-git is in effect.
if test "$app" = git; then
$use_git || continue
fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
appvar=`echo $app | tr '[a-z]' '[A-Z]'`
appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
test "$appvar" = TAR && appvar=AMTAR
eval "app=\${$appvar-$app}"
inst_ver=$(get_version $app)
if [ ! "$inst_ver" ]; then
echo "Error: '$app' not found" >&2
echo "$me: Error: '$app' not found" >&2
ret=1
elif [ ! "$req_ver" = "-" ]; then
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
if [ ! "$latest_ver" = "$inst_ver" ]; then
echo "Error: '$app' version == $inst_ver is too old" >&2
echo "$me: Error: '$app' version == $inst_ver is too old" >&2
echo " '$app' version >= $req_ver is required" >&2
ret=1
fi
@@ -337,16 +426,30 @@ check_versions() {
print_versions() {
echo "Program Min_version"
echo "----------------------"
printf "$buildreq"
printf %s "$buildreq"
echo "----------------------"
# can't depend on column -t
}
use_libtool=0
# We'd like to use grep -E, to see if any of LT_INIT,
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
# but that's not portable enough (e.g., for Solaris).
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
&& use_libtool=1
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
&& use_libtool=1
if test $use_libtool = 1; then
find_tool LIBTOOLIZE glibtoolize libtoolize
fi
if ! printf "$buildreq" | check_versions; then
test -f README-prereq &&
echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
echo
print_versions
echo >&2
if test -f README-prereq; then
echo "$0: See README-prereq for how to get the prerequisite programs" >&2
else
echo "$0: Please install the prerequisite programs" >&2
fi
exit 1
fi
@@ -357,18 +460,18 @@ if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if git config merge.merge-changelog.driver >/dev/null ; then
:
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
echo "initializing git-merge-changelog driver"
echo "$0: initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
else
echo "consider installing git-merge-changelog from gnulib"
echo "$0: consider installing git-merge-changelog from gnulib"
fi
fi
cleanup_gnulib() {
status=$?
rm -fr gnulib
rm -fr "$gnulib_path"
exit $status
}
@@ -376,6 +479,9 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@"
}
gnulib_path=`git_modules_config submodule.gnulib.path`
test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
@@ -385,34 +491,58 @@ case ${GNULIB_SRCDIR--} in
git submodule init || exit $?
git submodule update || exit $?
elif [ ! -d gnulib ]; then
elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
git clone $shallow git://git.sv.gnu.org/gnulib ||
shallow=
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
cleanup_gnulib
trap - 1 2 13 15
fi
GNULIB_SRCDIR=gnulib
GNULIB_SRCDIR=$gnulib_path
;;
*)
# Redirect the gnulib submodule to the directory on the command line
# if possible.
# Use GNULIB_SRCDIR as a reference.
if test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
git submodule init
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
echo "$0: getting gnulib files..."
git submodule update || exit $?
GNULIB_SRCDIR=gnulib
if git submodule -h|grep -- --reference > /dev/null; then
# Prefer the one-liner available in git 1.6.4 or newer.
git submodule update --init --reference "$GNULIB_SRCDIR" \
"$gnulib_path" || exit $?
else
# This fallback allows at least git 1.5.5.
if test -f "$gnulib_path"/gnulib-tool; then
# Since file already exists, assume submodule init already complete.
git submodule update || exit $?
else
# Older git can't clone into an empty directory.
rmdir "$gnulib_path" 2>/dev/null
git clone --reference "$GNULIB_SRCDIR" \
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init && git submodule update \
|| exit $?
fi
fi
GNULIB_SRCDIR=$gnulib_path
fi
;;
esac
if $bootstrap_sync; then
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
echo "$0: updating bootstrap and restarting..."
exec sh -c \
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
"$0" "$@" --no-bootstrap-sync
}
fi
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit
@@ -421,27 +551,29 @@ gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
download_po_files() {
subdir=$1
domain=$2
echo "$0: getting translations into $subdir for $domain..."
echo "$me: getting translations into $subdir for $domain..."
cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
eval "$cmd"
}
# Download .po files to $po_dir/.reference and copy only the new
# Mirror .po files to $po_dir/.reference and copy only the new
# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
# Note po files that exist locally only are left in $po_dir but will
# not be included in LINGUAS and hence will not be distributed.
update_po_files() {
# Directory containing primary .po files.
# Overwrite them only when we're sure a .po file is new.
po_dir=$1
domain=$2
# Download *.po files into this dir.
# Mirror *.po files into this dir.
# Usually contains *.s1 checksum files.
ref_po_dir="$po_dir/.reference"
test -d $ref_po_dir || mkdir $ref_po_dir || return
download_po_files $ref_po_dir $domain \
&& ls "$ref_po_dir"/*.po 2>/dev/null |
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
test "$langs" = '*' && langs=x
@@ -453,7 +585,7 @@ update_po_files() {
! test -f "$po_dir/$po.po" ||
! $SHA1SUM -c --status "$cksum_file" \
< "$new_po" > /dev/null; then
echo "updated $po_dir/$po.po..."
echo "$me: updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" \
&& $SHA1SUM < "$new_po" > "$cksum_file"
fi
@@ -491,20 +623,20 @@ symlink_to_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,.*/,,'`
insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
done
fi
if $copy; then
{
test ! -h "$dst" || {
echo "$0: rm -f $dst" &&
echo "$me: rm -f $dst" &&
rm -f "$dst"
}
} &&
test -f "$dst" &&
cmp -s "$src" "$dst" || {
echo "$0: cp -fp $src $dst" &&
echo "$me: cp -fp $src $dst" &&
cp -fp "$src" "$dst"
}
else
@@ -518,7 +650,7 @@ symlink_to_dir()
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
echo >&2 "$0: invalid symlink calculation: $src -> $dst"
echo >&2 "$me: invalid symlink calculation: $src -> $dst"
exit 1;;
/*/*/*/*/) dot_dots=../../../;;
/*/*/*/) dot_dots=../../;;
@@ -526,7 +658,7 @@ symlink_to_dir()
esac;;
esac
echo "$0: ln -fs $dot_dots$src $dst" &&
echo "$me: ln -fs $dot_dots$src $dst" &&
ln -fs "$dot_dots$src" "$dst"
}
fi
@@ -559,7 +691,7 @@ cp_mark_as_generated()
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" &&
echo "$me: 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" &&
@@ -572,13 +704,12 @@ cp_mark_as_generated()
(
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"
else
echo "$0: cp $cp_src $cp_dst # with edits" &&
echo "$me: cp $cp_src $cp_dst # with edits" &&
mv -f "$cp_dst-t" "$cp_dst"
fi
fi
@@ -597,7 +728,7 @@ version_controlled_file() {
elif test -d .svn; then
svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
else
echo "$0: no version control for $dir/$file?" >&2
echo "$me: no version control for $dir/$file?" >&2
fi
test $found = yes
}
@@ -609,31 +740,34 @@ slurp() {
for file in `ls -a $1/$dir`; do
case $file in
.|..) continue;;
.*) continue;; # FIXME: should all file names starting with "." be ignored?
# FIXME: should all file names starting with "." be ignored?
.*) continue;;
esac
test -d $1/$dir/$file && continue
for excluded_file in $excluded_files; do
test "$dir/$file" = "$excluded_file" && continue 2
done
if test $file = Makefile.am; then
if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
copied=$copied${sep}$gnulib_mk; sep=$nl
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 ..." &&
sed "$remove_intl" $1/$dir/$file |
cmp - $dir/$gnulib_mk > /dev/null || {
echo "$me: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
rm -f $dir/$gnulib_mk &&
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk &&
gnulib_mk_hook $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"
echo "$me: $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/* ..."
echo "$me: 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([AM_INTL_SUBDIR], [])
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
$a\
@@ -649,18 +783,25 @@ slurp() {
test $dot_ig = x && continue
ig=$dir/$dot_ig
if test -n "$copied"; then
insert_sorted_if_absent $ig "$copied"
insert_vc_ignore $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"
f=`echo "$copied" |
sed '
s/\.in\.h$/.h/
s/\.sin$/.sed/
s/\.y$/.c/
s/\.gperf$/.h/
'
`
insert_vc_ignore $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"
insert_vc_ignore $ig "$f"
fi
done
done
@@ -685,6 +826,12 @@ gnulib_tool_options="\
--local-dir $local_gl_dir\
$gnulib_tool_option_extras\
"
if test $use_libtool = 1; then
case "$gnulib_tool_options " in
*' --libtool '*) ;;
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
esac
fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
slurp $bt || exit
@@ -721,28 +868,24 @@ find "$m4_base" "$source_base" \
# Reconfigure, getting other files.
# Skip autoheader if it's not needed.
grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
AUTOHEADER=true
for command in \
libtool \
"${ACLOCAL-aclocal} --force -I m4" \
"${ACLOCAL-aclocal} --force -I '$m4_base' $ACLOCAL_FLAGS" \
"${AUTOCONF-autoconf} --force" \
"${AUTOHEADER-autoheader} --force" \
"${AUTOMAKE-automake} --add-missing --copy --force-missing"
do
if test "$command" = libtool; then
use_libtool=0
# We'd like to use grep -E, to see if any of LT_INIT,
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
# but that's not portable enough (e.g., for Solaris).
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
&& use_libtool=1
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
&& use_libtool=1
test $use_libtool = 0 \
&& continue
command="${LIBTOOLIZE-libtoolize} -c -f"
fi
echo "$0: $command ..."
$command || exit
eval "$command" || exit
done
@@ -762,13 +905,14 @@ if test $with_gettext = yes; then
rm -f po/Makevars
sed '
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
/^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars
' po/Makevars.template >po/Makevars || exit 1
if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same.
@@ -782,17 +926,21 @@ if test $with_gettext = yes; then
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
' <po/Makevars.template >runtime-po/Makevars
' po/Makevars.template >runtime-po/Makevars || exit 1
# Copy identical files from po to runtime-po.
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
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'."
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,6 +1,6 @@
# Bootstrap configuration.
# Copyright (C) 2006-2009 Free Software Foundation, Inc.
# Copyright (C) 2006-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,21 +20,6 @@
avoided_gnulib_modules='
--avoid=canonicalize-lgpl
--avoid=dummy
--avoid=lock
'
# These modules are obsolete and can probably be removed soon,
# but leave them in for now to minimize changes.
obsolete_gnulib_modules='
atexit
memcmp
memcpy
memmove
memset
rename
strcspn
strtod
strtol
'
# gnulib modules used by this package.
@@ -42,6 +27,7 @@ gnulib_modules="
$avoided_gnulib_modules
$obsolete_gnulib_modules
acl
alignof
alloca
announce-gen
areadlink-with-size
@@ -54,7 +40,7 @@ gnulib_modules="
c-strcase
c-strtod
c-strtold
calloc
calloc-gnu
canon-host
canonicalize
chown
@@ -70,18 +56,25 @@ gnulib_modules="
cycle-check
d-ino
d-type
di-set
diacrit
dirfd
dirname
do-release-commit-and-tag
dtoastr
dup2
environ
error
euidaccess
exclude
exitfail
faccessat
fadvise
fchdir
fcntl
fcntl-safer
fdl
fdutimensat
file-type
fileblocks
filemode
@@ -90,13 +83,16 @@ gnulib_modules="
fnmatch-gnu
fopen-safer
fprintftime
freopen
freopen-safer
fseeko
fsusage
fsync
ftello
ftruncate
ftoastr
fts
gendocs
getdate
full-read
full-write
getgroups
gethrxtime
getline
@@ -105,7 +101,7 @@ gnulib_modules="
getopt-gnu
getpagesize
getpass-gnu
gettext
gettext-h
gettime
gettimeofday
getugroups
@@ -113,12 +109,14 @@ gnulib_modules="
git-version-gen
gitlog-to-changelog
gnu-make
gnu-web-doc-update
gnumakefile
gnupload
group-member
hard-locale
hash
hash-pjw
heap
host-os
human
idcache
@@ -126,16 +124,19 @@ gnulib_modules="
inttostr
inttypes
isapipe
isblank
lchmod
lchown
ldtoastr
lib-ignore
linebuffer
link
link-follow
linkat
long-options
lstat
maintainer-makefile
malloc
malloc-gnu
manywarnings
mbrtowc
mbsalign
@@ -154,7 +155,10 @@ gnulib_modules="
modechange
mountlist
mpsort
netinet_in
nproc
obstack
parse-datetime
pathmax
perl
physmem
@@ -164,21 +168,22 @@ gnulib_modules="
priv-set
progname
propername
pthread
putenv
quote
quotearg
raise
randint
randperm
read-file
readlink
readtokens
readtokens0
readutmp
realloc
realloc-gnu
regex
rename-dest-slash
remove
rename
rmdir
rmdir-errno
root-dev-ino
rpmatch
safe-read
@@ -197,20 +202,26 @@ gnulib_modules="
stdlib-safer
stpcpy
stpncpy
strdup
strdup-posix
strftime
strpbrk
strsignal
strtod
strtoimax
strtol
strtoumax
strverscmp
symlink
sys_ioctl
sys_stat
sys_wait
termios
timespec
tzset
uname
unicodeio
unistd-safer
unlink-busy
unlinkdir
unlocked-io
unsetenv
update-copyright
uptime
useless-if-before-free
@@ -222,8 +233,8 @@ gnulib_modules="
verify
verror
version-etc-fsf
warnings
wcwidth
wcswidth
winsz-ioctl
winsz-termios
write-any-file
@@ -235,6 +246,7 @@ gnulib_modules="
xnanosleep
xprintf
xprintf-posix
xreadlink
xstrtod
xstrtoimax
xstrtol
@@ -290,8 +302,6 @@ if test $gettext_external = 1; then
excluded_files='
m4/glibc2.m4
m4/intdiv0.m4
m4/lcmessage.m4
m4/lock.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
@@ -302,19 +312,40 @@ gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
# Build prerequisites
buildreq="\
autoconf 2.61
automake 1.11
autoconf 2.62
automake 1.11.1
autopoint -
bison -
gettext -
gettext 0.17
git 1.4.4
gperf -
gzip -
makeinfo -
patch -
perl 5.5
rsync -
tar -
xz -
"
# Automake requires that ChangeLog exist.
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
# Since this is a "GNU" package, replace this line
# if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null \
# | grep -v 'libtool:' >/dev/null; then
# with this:
# if true; then
# Why? That pipeline searches all files in $(top_srcdir), and if you
# happen to have large files (or apparently large sparse files), the
# first grep may well run out of memory.
perl -pi -e 's/if LC_ALL=C grep .GNU .PACKAGE.*; then/if true; then/' \
po/Makefile.in.in
}

View File

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

299
cfg.mk
View File

@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*-
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
# Copyright (C) 2003-2011 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,24 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for major releases.
gnu_ftp_host-alpha = alpha.gnu.org
gnu_ftp_host-beta = alpha.gnu.org
gnu_ftp_host-major = ftp.gnu.org
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
# Used in maint.mk's web-manual rule
manual_title = Core GNU utilities
url_dir_list = \
ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
# The GnuPG ID of the key used to sign the tarballs.
gpg_key_ID = B9AB9A16
# Tests not to run as part of "make distcheck".
local-checks-to-skip = strftime-check
local-checks-to-skip = \
sc_texinfo_acronym
# Tools used to bootstrap this package, used for "announcement".
bootstrap-tools = autoconf,automake,gnulib,bison
@@ -39,14 +27,20 @@ bootstrap-tools = autoconf,automake,gnulib,bison
# Now that we have better tests, make this the default.
export VERBOSE = yes
old_NEWS_hash = 93ff8e5850f630855f9e834fec416830
old_NEWS_hash = 656dc592d4ed57c83662be60caa1af9e
# Add an exemption for sc_makefile_at_at_check.
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
# Our help-version script is in a slightly different location.
_hv_file ?= $(srcdir)/tests/misc/help-version
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
dd = $(srcdir)/src/dd.c
sc_dd_O_FLAGS:
@rm -f $@.1 $@.2
@{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
$(dd); } | sort > $@.1
@{ echo O_FULLBLOCK; echo O_NOCACHE; \
perl -nle '/^ +\| (O_\w*)$$/ and print $$1' $(dd); } | sort > $@.1
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
$(dd); } | sort > $@.2
@diff -u $@.1 $@.2 || diff=1 || diff=; \
@@ -86,7 +80,7 @@ sc_root_tests:
@if test -d tests \
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^require_root_$$' \
grep -nl '^ *require_root_$$' \
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/tests/Makefile.am \
@@ -99,52 +93,6 @@ 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 \
fnmatch_.h \
intprops.h \
inttypes_.h \
lchown.h \
openat.h \
stat-macros.h \
stdint_.h
# Create a list of regular expressions matching the names
# of macros that are guaranteed by parts of gnulib to be defined.
.re-defmac:
@(cd $(srcdir)/lib; \
for f in $(headers_with_interesting_macro_defs); do \
test -f $$f && \
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
done; \
) | sort -u \
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
| sed 's/^/^# *define /' \
> $@-t
@mv $@-t $@
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
grep -f .re-defmac $$($(VC_LIST)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
fi
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@@ -154,13 +102,21 @@ sc_always_defined_macros: .re-defmac
> $@-t
@mv $@-t $@
define gl_trap_
Exit () { set +e; (exit $$1); exit $$1; }; \
for sig in 1 2 3 13 15; do \
eval "trap 'Exit $$(expr $$sig + 128)' $$sig"; \
done
endef
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0; \
$(gl_trap_); \
grep -nE -f .re-list \
$$($(VC_LIST_EXCEPT) | grep '^src/') \
$$($(VC_LIST_EXCEPT) | grep '^\($(srcdir)/\)\?src/') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
fi
@@ -174,11 +130,50 @@ sc_sun_os_names:
ALL_RECURSIVE_TARGETS += sc_tight_scope
sc_tight_scope:
@$(MAKE) -C src $@
@$(MAKE) -s -C src $@
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
sc_check-AUTHORS:
@$(MAKE) -C src $@
@$(MAKE) -s -C src $@
# Look for lines longer than 80 characters, except omit:
# - program-generated long lines in diff headers,
# - tests involving long checksum lines, and
# - the 'pr' test cases.
LINE_LEN_MAX = 80
FILTER_LONG_LINES = \
/^[^:]*\.diff:[^:]*:@@ / d; \
\|^[^:]*tests/misc/sha[0-9]*sum[-:]| d; \
\|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
sc_long_lines:
@files=$$($(VC_LIST_EXCEPT)) \
halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
for file in $$files; do \
expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \
sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \
done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
# Option descriptions should not start with a capital letter
# One could grep source directly as follows:
# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
# but that would miss descriptions not on the same line as the -option.
ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
sc_option_desc_uppercase:
@$(MAKE) -s -C src all_programs
@$(MAKE) -s -C man $@
# Ensure all man/*.[1x] files are present
ALL_RECURSIVE_TARGETS += sc_man_file_correlation
sc_man_file_correlation:
@$(MAKE) -s -C src all_programs
@$(MAKE) -s -C man $@
# Ensure that the end of each release's section is marked by two empty lines.
sc_NEWS_two_empty_lines:
@sed -n 4,/Noteworthy/p $(srcdir)/NEWS \
| perl -n0e '/(^|\n)\n\n\* Noteworthy/ or exit 1' \
|| { echo '$(ME): use two empty lines to separate NEWS sections' \
1>&2; exit 1; } || :
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
@@ -191,6 +186,18 @@ sc_no_exec_perl_coreutils:
exit 1; } || :; \
fi
# Don't use "readlink" or "readlinkat" directly
sc_prohibit_readlink:
@prohibit='\<readlink(at)? \(' \
halt='do not use readlink(at); use via xreadlink or areadlink*' \
$(_sc_search_regexp)
# Don't use address of "stat" or "lstat" functions
sc_prohibit_stat_macro_address:
@prohibit='\<l?stat '':|&l?stat\>' \
halt='stat() and lstat() may be function-like macros' \
$(_sc_search_regexp)
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
@@ -200,7 +207,7 @@ sc_strftime_check:
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format | grep '^ `%.'\' \
info libc date calendar format 2>/dev/null|grep '^ `%.'\'\
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
@@ -208,14 +215,154 @@ sc_strftime_check:
# Indent only with spaces.
sc_prohibit_tab_based_indentation:
@re='^ * ' \
msg='TAB in indentation; use only spaces' \
$(_prohibit_regexp)
@prohibit='^ * ' \
halt='TAB in indentation; use only spaces' \
$(_sc_search_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)
@prohibit='^( *[*#] *)?indent-tabs-mode:' \
halt='use of emacs indent-tabs-mode: setting' \
$(_sc_search_regexp)
# Ensure that each file that contains fail=1 also contains fail=0.
# Otherwise, setting file=1 in the environment would make tests fail
# unexpectedly.
sc_prohibit_fail_0:
@prohibit='\<fail=0\>' \
halt='fail=0 initialization' \
$(_sc_search_regexp)
# Ensure that "stdio--.h" is used where appropriate.
sc_require_stdio_safer:
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
files=$$(grep -l '\bfreopen \?(' $$($(VC_LIST_EXCEPT) \
| grep '\.[ch]$$')); \
test -n "$$files" && grep -LE 'include "stdio--.h"' $$files \
| grep . && \
{ echo '$(ME): the above files should use "stdio--.h"' \
1>&2; exit 1; } || :; \
else :; \
fi
sc_prohibit_perl_hash_quotes:
@prohibit="\{'[A-Z_]+' *[=}]" \
halt="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}" \
$(_sc_search_regexp)
# Prefer xnanosleep over other less-precise sleep methods
sc_prohibit_sleep:
@prohibit='\<(nano|u)?sleep \(' \
halt='prefer xnanosleep over other sleep interfaces' \
$(_sc_search_regexp)
# Use print_ver_ (from init.cfg), not open-coded $VERBOSE check.
sc_prohibit_verbose_version:
@prohibit='test "\$$VERBOSE" = yes && .* --version' \
halt='use the print_ver_ function instead...' \
$(_sc_search_regexp)
###########################################################
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
_pre_anchored = ^\($(_pre)\)
_comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
# help font-lock mode: '
# A sed expression that removes ANSI C and ISO C99 comments.
# Derived from the one in GNU gettext's 'moopp' preprocessor.
_sed_remove_comments = \
/[/][/*]/{ \
ta; \
:a; \
s,$(_pre_anchored)//.*,\1,; \
te; \
s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
ta; \
/^$(_pre)[/][*]/{ \
s,$(_pre_anchored)/[*].*,\1 ,; \
tu; \
:u; \
n; \
s,^\($(_comment_and_close),,; \
tv; \
s,^.*$$,,; \
bu; \
:v; \
}; \
:e; \
}
# Quote all single quotes.
_sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
# help font-lock mode: '
_space_before_paren_exempt =? \\n\\$$
_space_before_paren_exempt = \
(^ *\#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
# Ensure that there is a space before each open parenthesis in C code.
sc_space_before_open_paren:
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
fail=0; \
for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
| grep -i '[[:alnum:]](' \
| grep -vE '$(_space_before_paren_exempt)' \
| grep . && { fail=1; echo "*** $$c"; }; \
done; \
test $$fail = 1 && \
{ echo '$(ME): the above files lack a space-before-open-paren' \
1>&2; exit 1; } || :; \
else :; \
fi
# Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
# Use STREQ_LEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
sc_prohibit_strncmp:
@grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \
$$($(VC_LIST_EXCEPT)) \
| grep -vE ':# *define STR(N?EQ_LEN|PREFIX)\(' && \
{ echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
1>&2; exit 1; } || :
# Override the default Cc: used in generating an announcement.
announcement_Cc_ = $(translation_project_), \
coreutils@gnu.org, coreutils-announce@gnu.org
include $(srcdir)/dist-check.mk
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
# List syntax-check exemptions.
exclude_file_name_regexp--sc_space_tab = \
^(tests/pr/|tests/misc/nl$$|gl/.*\.diff$$)
exclude_file_name_regexp--sc_bindtextdomain = ^(gl/.*|lib/euidaccess-stat)\.c$$
exclude_file_name_regexp--sc_unmarked_diagnostics = ^build-aux/cvsu$$
exclude_file_name_regexp--sc_error_message_uppercase = ^build-aux/cvsu$$
exclude_file_name_regexp--sc_trailing_blank = ^tests/pr/
exclude_file_name_regexp--sc_system_h_headers = \
^src/((system|copy)\.h|libstdbuf\.c)$$
_src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
exclude_file_name_regexp--sc_require_config_h_first = \
(^lib/buffer-lcm\.c|src/$(_src)\.c)$$
exclude_file_name_regexp--sc_require_config_h = \
$(exclude_file_name_regexp--sc_require_config_h_first)
exclude_file_name_regexp--sc_po_check = ^gl/
exclude_file_name_regexp--sc_prohibit_always-defined_macros = ^src/seq\.c$$
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
exclude_file_name_regexp--sc_program_name = ^(gl/.*|lib/euidaccess-stat)\.c$$
exclude_file_name_regexp--sc_file_system = \
NEWS|^(tests/init\.cfg|src/df\.c|tests/misc/df-P)$$
exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
^m4/stat-prog\.m4$$
exclude_file_name_regexp--sc_prohibit_fail_0 = \
(^tests/init\.sh|Makefile\.am|\.mk)$$
exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
^tests/pr/|(^gl/lib/reg.*\.c\.diff|Makefile(\.am)?|\.mk|^man/help2man)$$
exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
^(src/system\.h|tests/du/2g)$$

View File

@@ -1,7 +1,7 @@
# -*- autoconf -*-
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1991, 1993-2009 Free Software Foundation, Inc.
# Copyright (C) 1991, 1993-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
dnl Written by Jim Meyering.
AC_PREREQ([2.61])
AC_PREREQ([2.62])
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
# indicates that it is built from the 219th delta (in _some_ repository)
@@ -32,7 +32,7 @@ AC_CONFIG_SRCDIR([src/ls.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
AC_PROG_CC_STDC
@@ -98,17 +98,14 @@ if test "$gl_gcc_warnings" = yes; then
done
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
# Offenders in pre-fts remove.c; FIXME: remove upon remove.c rewrite
gl_WARN_ADD([-Wno-jump-misses-init])
# In spite of excluding -Wlogical-op above, it is enabled, as of
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
gl_WARN_ADD([-Wno-logical-op])
gl_WARN_ADD([-fdiagnostics-show-option])
gl_WARN_ADD([-funit-at-a-time])
AC_SUBST([WARN_CFLAGS])
@@ -116,13 +113,28 @@ if test "$gl_gcc_warnings" = yes; then
AC_DEFINE([_FORTIFY_SOURCE], [2],
[enable compile-time and run-time bounds-checking, and some warnings])
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
# We use a slightly smaller set of warning options for lib/.
# Remove the following and save the result in GNULIB_WARN_CFLAGS.
nw=
nw="$nw -Wuninitialized"
nw="$nw -Wunused-macros"
nw="$nw -Wmissing-prototypes"
nw="$nw -Wold-style-definition"
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
AC_SUBST([GNULIB_WARN_CFLAGS])
# For gnulib-tests, the set is slightly smaller still.
nw=
nw="$nw -Wstrict-prototypes"
gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
[$GNULIB_WARN_CFLAGS], [$nw])
AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
fi
AC_FUNC_FORK
optional_bin_progs=
AC_CHECK_FUNCS([uname],
gl_ADD_PROG([optional_bin_progs], [uname]))
AC_CHECK_FUNCS([chroot],
gl_ADD_PROG([optional_bin_progs], [chroot]))
AC_CHECK_FUNCS([gethostid],
@@ -150,18 +162,18 @@ int main()
time_t now = time ((time_t *) 0);
int hour_GMT0, hour_unset;
if (putenv ("TZ=GMT0") != 0)
exit (1);
return 1;
hour_GMT0 = localtime (&now)->tm_hour;
unset_TZ ();
hour_unset = localtime (&now)->tm_hour;
if (putenv ("TZ=PST8") != 0)
exit (1);
return 1;
if (localtime (&now)->tm_hour == hour_GMT0)
exit (1);
return 1;
unset_TZ ();
if (localtime (&now)->tm_hour != hour_unset)
exit (1);
exit (0);
return 1;
return 0;
}]])],
[utils_cv_localtime_cache=no],
[utils_cv_localtime_cache=yes],
@@ -326,7 +338,6 @@ if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
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
@@ -335,7 +346,6 @@ 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
############################################################################
@@ -389,6 +399,13 @@ esac
# corresponding ./configure option argument is comma-separated on input.
gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [arch,hostname,su])
# Now that we know which programs will actually be built up, figure out
# which optional helper progs should be compiled.
optional_pkglib_progs=
case " $optional_bin_progs " in
*' stdbuf '*) gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so]) ;;
esac
# Set INSTALL_SU if su installation has been requested via
# --enable-install-program=su.
AC_SUBST([INSTALL_SU])
@@ -423,8 +440,10 @@ CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am'
AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
############################################################################
# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
# translatable strings, we must use need-formatstring-macros here.
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.15])
AM_GNU_GETTEXT_VERSION([0.17])
# For a test of uniq: it uses the $LOCALE_FR envvar.
gt_LOCALE_FR

View File

@@ -4,36 +4,63 @@ bin=bin-$$$$
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
tmpdir = $(abs_top_builddir)/tests/torture
t=$(tmpdir)/$(PACKAGE)/test
pfx=$(t)/i
built_programs = \
$$(echo 'spy:;@echo $$(bin_PROGRAMS)' \
| MAKEFLAGS= $(MAKE) -s -C src -f Makefile -f - spy \
| fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u)
# 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)-$$$$")
tp = $(tmpdir)/taint
t_prefix = $(tp)/a
t_taint = '$(t_prefix) b'
fake_home = $(tp)/home
# When extracting from a distribution tarball, extract using the fastest
# method possible. With dist-xz, that means using the *.xz file.
ifneq ('', $(filter *.xz, $(DIST_ARCHIVES)))
tar_decompress_opt_ = J
suffix_ = xz
else
ifneq ('', $(filter *.gz, $(DIST_ARCHIVES)))
tar_decompress_opt_ = z
suffix_ = gz
else
tar_decompress_opt_ = j
suffix_ = bz2
endif
endif
amtar_extract_ = $(AMTAR) -$(tar_decompress_opt_)xf
preferred_tarball_ = $(distdir).tar.$(suffix_)
# 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.
# Skip this test when using libtool, since libtool-generated scripts
# cannot deal with a space-tainted srcdir.
ALL_RECURSIVE_TARGETS += taint-distcheck
taint-distcheck: $(DIST_ARCHIVES)
grep '^[ ]*LT_INIT' configure.ac >/dev/null && exit 0 || :
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
$(amtar_extract_) $(preferred_tarball_) -C $(t_taint)
mkfifo $(fake_home)/fifo
touch $(fake_home)/f
mkdir -p $(fake_home)/d/e
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
HOME=$(fake_home); export HOME; \
cd $(t_taint)/$(distdir) \
&& ./configure \
&& $(MAKE) \
&& HOME=$(fake_home) $(MAKE) check \
&& $(MAKE) check \
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
&& diff $(tp)/.ls-before $(tp)/.ls-after \
&& test -d $(t_prefix)
@@ -50,8 +77,9 @@ define install-transform-check
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.
# Note that neither the binary, ginstall, nor the [.1 man page is installed.
define my-instcheck
echo running my-instcheck; \
$(MAKE) prefix=$(pfx) install \
&& test ! -f $(pfx)/bin/ginstall \
&& { fail=0; \
@@ -68,8 +96,16 @@ define my-instcheck
}
endef
# 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.
define coreutils-path-check
{ \
echo running coreutils-path-check; \
if test -f $(srcdir)/src/true.c; then \
fail=1; \
mkdir $(bin) \
@@ -97,37 +133,38 @@ define coreutils-path-check
}
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.
# Use this to make sure we don't run these programs when building
# from a virgin compressed tarball file, below.
null_AM_MAKEFLAGS ?= \
ACLOCAL=false \
AUTOCONF=false \
AUTOMAKE=false \
AUTOHEADER=false \
GPERF=false \
MAKEINFO=false
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
$(amtar_extract_) $(preferred_tarball_) -C $(t)
(set -e; cd $(t)/$(distdir); \
./configure --quiet --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
&& $(amtar_extract_) - ) < $(preferred_tarball_)
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
-rm -rf $(t)
rmdir $(tmpdir)/$(PACKAGE) $(tmpdir)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "ready for distribution:"; \
for i in $(DIST_ARCHIVES); do echo " $$i"; done; \
echo "========================"

44
doc/.gitignore vendored
View File

@@ -1,22 +1,22 @@
constants.texi
coreutils.aux
coreutils.cp
coreutils.cps
coreutils.dvi
coreutils.fl
coreutils.fn
coreutils.html
coreutils.info
coreutils.ky
coreutils.log
coreutils.op
coreutils.pdf
coreutils.pg
coreutils.toc
coreutils.tp
coreutils.vr
fdl.texi
gendocs_template
getdate.texi
stamp-vti
version.texi
/constants.texi
/coreutils.aux
/coreutils.cp
/coreutils.cps
/coreutils.dvi
/coreutils.fl
/coreutils.fn
/coreutils.html
/coreutils.info
/coreutils.ky
/coreutils.log
/coreutils.op
/coreutils.pdf
/coreutils.pg
/coreutils.toc
/coreutils.tp
/coreutils.vr
/fdl.texi
/gendocs_template
/parse-datetime.texi
/stamp-vti
/version.texi

View File

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

View File

@@ -1,6 +1,6 @@
# Make coreutils documentation. -*-Makefile-*-
# Copyright (C) 1995-1998, 2001-2009 Free Software Foundation, Inc.
# Copyright (C) 1995-1998, 2001-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
info_TEXINFOS = coreutils.texi
EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
EXTRA_DIST = perm.texi parse-datetime.texi constants.texi fdl.texi
# The following is necessary if the package name is 8 characters or longer.
# If the info documentation would be split into 10 or more separate files,
@@ -30,13 +30,13 @@ EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
AM_MAKEINFOFLAGS = --no-split
constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
LC_ALL=C \
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c > t-$@
LC_ALL=C \
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
$(top_srcdir)/src/shred.c >> t-$@
mv t-$@ $@
$(AM_V_GEN)LC_ALL=C; export LC_ALL; \
{ sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c && \
sed -n -e \
's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
$(top_srcdir)/src/shred.c; } > t-$@ \
&& mv t-$@ $@
MAINTAINERCLEANFILES = constants.texi
@@ -48,8 +48,10 @@ _W = (^|[^A-Za-z0-9_])
W_ = ([^A-Za-z0-9_]|$$)
syntax_checks = \
sc-avoid-builtin \
sc-avoid-io \
sc-avoid-non-zero \
sc-avoid-path \
sc-avoid-timezone \
sc-avoid-zeroes \
sc-exponent-grouping \
@@ -59,6 +61,7 @@ syntax_checks = \
.PHONY: $(syntax_checks) check-texinfo
# List words/regexps here that should not appear in the texinfo documentation.
BAD_POSIX_PERL = /\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/
check-texinfo: $(syntax_checks)
$(AM_V_GEN)fail=0; \
grep '@url{' $(srcdir)/*.texi && fail=1; \
@@ -68,11 +71,20 @@ check-texinfo: $(syntax_checks)
| $(EGREP) -v 'setfilename|[{]filename[}]' \
&& fail=1; \
$(PERL) -e 1 2> /dev/null && { $(PERL) -ne \
'/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \
'$(BAD_POSIX_PERL) and print,exit 1' \
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \
exit $$fail
sc-avoid-builtin:
$(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi \
&& exit 1 || :
sc-avoid-path:
$(AM_V_GEN)fail=0; \
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
| $(EGREP) -v 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
| $(EGREP) -v \
'PATH=|path search|search path|@vindex PATH$$|@env[{]PATH[}]' \
&& fail=1; \
exit $$fail
# Use `time zone', not `timezone'.
@@ -98,7 +110,8 @@ sc-avoid-non-zero:
# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent).
sc-avoid-zeroes:
$(AM_V_GEN)$(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

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,
@c 2008-2009 Free Software Foundation, Inc.
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008-2011 Free Software
@c 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

37
gl/lib/fadvise.c Normal file
View File

@@ -0,0 +1,37 @@
/* Declare an access pattern hint for files.
Copyright (C) 2010-2011 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 "fadvise.h"
#include <stdio.h>
#include <fcntl.h>
#include "ignore-value.h"
void
fdadvise (int fd, off_t offset, off_t len, fadvice_t advice)
{
#if HAVE_POSIX_FADVISE
ignore_value (posix_fadvise (fd, offset, len, advice));
#endif
}
void
fadvise (FILE *fp, fadvice_t advice)
{
if (fp)
fdadvise (fileno (fp), 0, 0, advice);
}

72
gl/lib/fadvise.h Normal file
View File

@@ -0,0 +1,72 @@
/* Declare an access pattern hint for files.
Copyright (C) 2010-2011 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 <fcntl.h>
#include <sys/types.h>
/* There are a few hints one can provide, which have the
following characteristics on Linux 2.6.31 at least.
POSIX_FADV_SEQUENTIAL
Doubles the size of read ahead done for file
POSIX_FADV_WILLNEED
_synchronously_ prepopulate the buffer cache with the file
POSIX_FADV_NOREUSE
Could lower priority of data in buffer caches,
but currently does nothing.
POSIX_FADV_DONTNEED
Drop the file from cache.
Note this is automatically done when files are unlinked.
We use this enum "type" both to make it explicit that
these options are mutually exclusive, and to discourage
the passing of the possibly undefined POSIX_FADV_... values.
Note we could #undef the POSIX_FADV_ values, but that would
preclude using the posix_fadvise() function with its standard
constants. Using posix_fadvise() might be required if the return
value is needed, but it must be guarded by appropriate #ifdefs. */
#if HAVE_POSIX_FADVISE
typedef enum {
FADVISE_NORMAL = POSIX_FADV_NORMAL,
FADVISE_SEQUENTIAL = POSIX_FADV_SEQUENTIAL,
FADVISE_NOREUSE = POSIX_FADV_NOREUSE,
FADVISE_DONTNEED = POSIX_FADV_DONTNEED,
FADVISE_WILLNEED = POSIX_FADV_WILLNEED,
FADVISE_RANDOM = POSIX_FADV_RANDOM,
} fadvice_t;
#else
typedef enum {
FADVISE_NORMAL,
FADVISE_SEQUENTIAL,
FADVISE_NOREUSE,
FADVISE_DONTNEED,
FADVISE_WILLNEED,
FADVISE_RANDOM,
} fadvice_t;
#endif
/* We ignore any errors as these hints are only advisory.
There is the chance one can pass invalid ADVICE, which will
not be indicated, but given the simplicity of the interface
this is unlikely. Also not returning errors allows the
unconditional passing of descriptors to non standard files,
which will just be ignored if unsupported. */
void fdadvise (int fd, off_t offset, off_t len, fadvice_t advice);
void fadvise (FILE *fp, fadvice_t advice);

149
gl/lib/heap.c Normal file
View File

@@ -0,0 +1,149 @@
/* Barebones heap implementation supporting only insert and pop.
Copyright (C) 2010-2011 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/>. */
/* Full implementation: GDSL (http://gna.org/projects/gdsl/) by Nicolas
Darnis <ndarnis@free.fr>. */
#include <config.h>
#include "heap.h"
#include "stdlib--.h"
#include "xalloc.h"
static int heap_default_compare (void const *, void const *);
static size_t heapify_down (void **, size_t, size_t,
int (*) (void const *, void const *));
static void heapify_up (void **, size_t,
int (*) (void const *, void const *));
struct heap
{
void **array; /* array[0] is not used */
size_t capacity; /* Array size */
size_t count; /* Used as index to last element. Also is num of items. */
int (*compare) (void const *, void const *);
};
/* Allocate memory for the heap. */
struct heap *
heap_alloc (int (*compare) (void const *, void const *), size_t n_reserve)
{
struct heap *heap = xmalloc (sizeof *heap);
if (n_reserve == 0)
n_reserve = 1;
heap->array = xnmalloc (n_reserve, sizeof *(heap->array));
heap->array[0] = NULL;
heap->capacity = n_reserve;
heap->count = 0;
heap->compare = compare ? compare : heap_default_compare;
return heap;
}
static int
heap_default_compare (void const *a, void const *b)
{
return 0;
}
void
heap_free (struct heap *heap)
{
free (heap->array);
free (heap);
}
/* Insert element into heap. */
int
heap_insert (struct heap *heap, void *item)
{
if (heap->capacity - 1 <= heap->count)
heap->array = x2nrealloc (heap->array, &heap->capacity,
sizeof *(heap->array));
heap->array[++heap->count] = item;
heapify_up (heap->array, heap->count, heap->compare);
return 0;
}
/* Pop top element off heap. */
void *
heap_remove_top (struct heap *heap)
{
if (heap->count == 0)
return NULL;
void *top = heap->array[1];
heap->array[1] = heap->array[heap->count--];
heapify_down (heap->array, heap->count, 1, heap->compare);
return top;
}
/* Move element down into appropriate position in heap. */
static size_t
heapify_down (void **array, size_t count, size_t initial,
int (*compare) (void const *, void const *))
{
void *element = array[initial];
size_t parent = initial;
while (parent <= count / 2)
{
size_t child = 2 * parent;
if (child < count && compare (array[child], array[child+1]) < 0)
child++;
if (compare (array[child], element) <= 0)
break;
array[parent] = array[child];
parent = child;
}
array[parent] = element;
return parent;
}
/* Move element up into appropriate position in heap. */
static void
heapify_up (void **array, size_t count,
int (*compare) (void const *, void const *))
{
size_t k = count;
void *new_element = array[k];
while (k != 1 && compare (array[k/2], new_element) <= 0)
{
array[k] = array[k/2];
k /= 2;
}
array[k] = new_element;
}

26
gl/lib/heap.h Normal file
View File

@@ -0,0 +1,26 @@
/* Barebones heap implementation supporting only insert and pop.
Copyright (C) 2010-2011 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/>. */
/* Full implementation: GDSL (http://gna.org/projects/gdsl/) by Nicolas
Darnis <ndarnis@free.fr>. Adapted by Gene Auyeung. */
#include <stddef.h>
struct heap *heap_alloc (int (*) (void const *, void const *), size_t);
void heap_free (struct heap *);
int heap_insert (struct heap *heap, void *item);
void *heap_remove_top (struct heap *heap);

View File

@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009 Free Software Foundation, Inc.
Copyright (C) 2009-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <wchar.h>
@@ -32,6 +33,7 @@
#endif
/* Replace non printable chars.
Note \t and \n etc. are non printable.
Return 1 if replacement made, 0 otherwise. */
static bool
@@ -77,27 +79,6 @@ wc_truncate (wchar_t *wc, size_t width)
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.
@@ -119,19 +100,19 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
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.
number of leading spaces.
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).
Return SIZE_MAX upon error (invalid multi-byte sequence in SRC,
or malloc failure), unless MBA_UNIBYTE_FALLBACK is specified.
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 ret = SIZE_MAX;
size_t src_size = strlen (src) + 1;
char *newstr = NULL;
wchar_t *str_wc = NULL;
@@ -148,44 +129,63 @@ mbsalign (const char *src, char *dest, size_t dest_size,
if (MB_CUR_MAX > 1)
{
size_t src_chars = mbstowcs (NULL, src, 0);
if (src_chars == (size_t) -1)
goto mbsalign_cleanup;
if (src_chars == SIZE_MAX)
{
if (flags & MBA_UNIBYTE_FALLBACK)
goto mbsalign_unibyte;
else
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)
{
if (flags & MBA_UNIBYTE_FALLBACK)
goto mbsalign_unibyte;
else
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);
n_cols = 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))
if (wc_enabled && (conversion || (n_cols > *width)))
{
newstr = malloc (src_size);
if (newstr == NULL)
goto mbsalign_cleanup;
str_to_print = newstr;
if (wc_enabled)
if (conversion)
{
/* May have increased the size by converting
\t to \uFFFD for example. */
src_size = wcstombs (NULL, str_wc, 0) + 1;
}
newstr = malloc (src_size);
if (newstr == NULL)
{
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 (flags & MBA_UNIBYTE_FALLBACK)
goto mbsalign_unibyte;
else
goto mbsalign_cleanup;
}
str_to_print = newstr;
n_cols = wc_truncate (str_wc, *width);
n_used_bytes = wcstombs (newstr, str_wc, src_size);
}
if (*width > n_cols)
mbsalign_unibyte:
if (n_cols > *width) /* Unibyte truncation required. */
{
n_cols = *width;
n_used_bytes = n_cols;
}
if (*width > n_cols) /* Padding required. */
n_spaces = *width - n_cols;
/* indicate to caller how many cells needed (not including padding). */
@@ -197,16 +197,11 @@ mbsalign (const char *src, char *dest, size_t dest_size,
/* Write as much NUL terminated output to DEST as possible. */
if (dest_size != 0)
{
size_t start_spaces, end_spaces, space_left;
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;
@@ -215,10 +210,16 @@ mbsalign (const char *src, char *dest, size_t dest_size,
start_spaces = n_spaces;
end_spaces = 0;
break;
case MBS_ALIGN_CENTER:
default:
start_spaces = n_spaces / 2 + n_spaces % 2;
end_spaces = n_spaces / 2;
break;
}
dest = mbs_align_pad (dest, dest_end, start_spaces);
dest = mempcpy(dest, str_to_print, MIN (n_used_bytes, dest_end - dest));
space_left = dest_end - dest;
dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left));
mbs_align_pad (dest, dest_end, end_spaces);
}
@@ -229,3 +230,40 @@ mbsalign_cleanup:
return ret;
}
/* A wrapper around mbsalign() to dynamically allocate the
minimum amount of memory to store the result.
Return NULL on failure. */
char *
ambsalign (const char *src, size_t *width, mbs_align_t align, int flags)
{
size_t orig_width = *width;
size_t size = *width; /* Start with enough for unibyte mode. */
size_t req = size;
char *buf = NULL;
while (req >= size)
{
char *nbuf;
size = req + 1; /* Space for NUL. */
nbuf = realloc (buf, size);
if (nbuf == NULL)
{
free (buf);
buf = NULL;
break;
}
buf = nbuf;
*width = orig_width;
req = mbsalign (src, buf, size, width, align, flags);
if (req == SIZE_MAX)
{
free (buf);
buf = NULL;
break;
}
}
return buf;
}

View File

@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009 Free Software Foundation, Inc.
Copyright (C) 2009-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,6 +18,29 @@
typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
enum {
/* Use unibyte mode for invalid multibyte strings
or when heap memory is exhausted. */
MBA_UNIBYTE_FALLBACK = 0x0001
#if 0 /* Other possible options. */
/* Skip invalid multibyte chars rather than failing */
MBA_IGNORE_INVALID = 0x0002,
/* Align multibyte strings using "figure space" (\u2007) */
MBA_USE_FIGURE_SPACE = 0x0004,
/* Don't add any padding */
MBA_TRUNCATE_ONLY = 0x0008,
/* Don't truncate */
MBA_PAD_ONLY = 0x0010,
#endif
};
size_t
mbsalign (const char *src, char *dest, size_t dest_size,
size_t *width, mbs_align_t align, int flags);
char *
ambsalign (const char *src, size_t *width, mbs_align_t align, int flags);

View File

@@ -1,142 +0,0 @@
/* mgetgroups.c -- return a list of the groups a user is in
Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Extracted from coreutils' src/id.c. */
#include <config.h>
#include "mgetgroups.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#if HAVE_GETGROUPLIST
# include <grp.h>
#endif
#include "getugroups.h"
#include "xalloc.h"
static GETGROUPS_T *
realloc_groupbuf (GETGROUPS_T *g, size_t num)
{
if (xalloc_oversized (num, sizeof (*g)))
{
errno = ENOMEM;
return NULL;
}
return realloc (g, num * sizeof (*g));
}
/* Like getugroups, but store the result in malloc'd storage.
Set *GROUPS to the malloc'd list of all group IDs of which USERNAME
is a member. If GID is not -1, store it first. GID should be the
group ID (pw_gid) obtained from getpwuid, in case USERNAME is not
listed in the groups database (e.g., /etc/groups). Upon failure,
don't modify *GROUPS, set errno, and return -1. Otherwise, return
the number of groups. */
int
mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
{
int max_n_groups;
int ng;
GETGROUPS_T *g;
#if HAVE_GETGROUPLIST
/* We prefer to use getgrouplist if available, because it has better
performance characteristics.
In glibc 2.3.2, getgrouplist is buggy. If you pass a zero as the
length of the output buffer, getgrouplist will still write to the
buffer. Contrary to what some versions of the getgrouplist
manpage say, this doesn't happen with nonzero buffer sizes.
Therefore our usage here just avoids a zero sized buffer. */
if (username)
{
enum { N_GROUPS_INIT = 10 };
max_n_groups = N_GROUPS_INIT;
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
return -1;
while (1)
{
GETGROUPS_T *h;
int last_n_groups = max_n_groups;
/* getgrouplist updates max_n_groups to num required. */
ng = getgrouplist (username, gid, g, &max_n_groups);
/* Some systems (like Darwin) have a bug where they
never increase max_n_groups. */
if (ng < 0 && last_n_groups == max_n_groups)
max_n_groups *= 2;
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
{
int saved_errno = errno;
free (g);
errno = saved_errno;
return -1;
}
g = h;
if (0 <= ng)
{
*groups = g;
/* On success some systems just return 0 from getgrouplist,
so return max_n_groups rather than ng. */
return max_n_groups;
}
}
}
/* else no username, so fall through and use getgroups. */
#endif
max_n_groups = (username
? getugroups (0, NULL, username, gid)
: getgroups (0, NULL));
/* If we failed to count groups with NULL for a buffer,
try again with a non-NULL one, just in case. */
if (max_n_groups < 0)
max_n_groups = 5;
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
return -1;
ng = (username
? getugroups (max_n_groups, g, username, gid)
: getgroups (max_n_groups, g));
if (ng < 0)
{
int saved_errno = errno;
free (g);
errno = saved_errno;
return -1;
}
*groups = g;
return ng;
}

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generator, ISAAC.
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
Copyright (C) 1999-2006, 2009 Free Software Foundation, Inc.
Copyright (C) 1999-2006, 2009-2011 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
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 Colin Plumb. */
Written by Colin Plumb and Paul Eggert. */
/*
* --------------------------------------------------------------------
@@ -34,60 +34,90 @@
#include "rand-isaac.h"
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include "gethrxtime.h"
/* This index operation is more efficient on many processors */
#define ind(mm, x) \
(* (uint32_t *) ((char *) (mm) \
+ ((x) & (ISAAC_WORDS - 1) * sizeof (uint32_t))))
/*
* The central step. This uses two temporaries, x and y. mm is the
* whole state array, while m is a pointer to the current word. off is
* the offset from m to the word ISAAC_WORDS/2 words away in the mm array,
* i.e. +/- ISAAC_WORDS/2.
*/
#define isaac_step(mix, a, b, mm, m, off, r) \
( \
a = ((a) ^ (mix)) + (m)[off], \
x = *(m), \
*(m) = y = ind (mm, x) + (a) + (b), \
*(r) = b = ind (mm, (y) >> ISAAC_LOG) + x \
)
/* Use and update *S to generate random data to fill R. */
void
isaac_refill (struct isaac_state *s, uint32_t r[ISAAC_WORDS])
/* The minimum of two sizes A and B. */
static inline size_t
min (size_t a, size_t b)
{
uint32_t a, b; /* Caches of a and b */
uint32_t x, y; /* Temps needed by isaac_step macro */
uint32_t *m = s->mm; /* Pointer into state array */
return (a < b ? a : b);
}
a = s->a;
b = s->b + (++s->c);
/* A if 32-bit ISAAC, B if 64-bit. This is a macro, not an inline
function, to prevent undefined behavior if the unused argument
shifts by more than a word width. */
#define IF32(a, b) (ISAAC_BITS == 32 ? (a) : (b))
/* Discard bits outside the desired range. On typical machines, any
decent compiler should optimize this function call away to nothing.
But machines with pad bits in integers may need to do more work. */
static inline isaac_word
just (isaac_word a)
{
isaac_word desired_bits = ((isaac_word) 1 << 1 << (ISAAC_BITS - 1)) - 1;
return a & desired_bits;
}
/* The index operation. On typical machines whose words are exactly
the right size, this is optimized to a mask, an addition, and an
indirect load. Atypical machines need more work. */
static inline isaac_word
ind (isaac_word const *m, isaac_word x)
{
return (sizeof *m * CHAR_BIT == ISAAC_BITS
? (* (isaac_word *) ((char *) m
+ (x & ((ISAAC_WORDS - 1) * sizeof *m))))
: m[(x / (ISAAC_BITS / CHAR_BIT)) & (ISAAC_WORDS - 1)]);
}
/* Use and update *S to generate random data to fill RESULT. */
void
isaac_refill (struct isaac_state *s, isaac_word result[ISAAC_WORDS])
{
/* Caches of S->a and S->b. */
isaac_word a = s->a;
isaac_word b = s->b + (++s->c);
/* Pointers into state array and into result. */
isaac_word *m = s->m;
isaac_word *r = result;
enum { HALF = ISAAC_WORDS / 2 };
/* The central step. S->m is the whole state array, while M is a
pointer to the current word. OFF is the offset from M to the
word ISAAC_WORDS/2 words away in the SM array, i.e. +/-
ISAAC_WORDS/2. A and B are state variables, and R the result.
This updates A, B, M[I], and R[I]. */
#define ISAAC_STEP(i, off, mix) \
{ \
isaac_word x, y; \
a = (IF32 (a, 0) ^ (mix)) + m[off + (i)]; \
x = m[i]; \
m[i] = y = ind (s->m, x) + a + b; \
r[i] = b = just (ind (s->m, y >> ISAAC_WORDS_LOG) + x); \
}
do
{
isaac_step (a << 13, a, b, s->mm, m, ISAAC_WORDS / 2, r);
isaac_step (a >> 6, a, b, s->mm, m + 1, ISAAC_WORDS / 2, r + 1);
isaac_step (a << 2, a, b, s->mm, m + 2, ISAAC_WORDS / 2, r + 2);
isaac_step (a >> 16, a, b, s->mm, m + 3, ISAAC_WORDS / 2, r + 3);
ISAAC_STEP (0, HALF, IF32 ( a << 13, ~ (a ^ (a << 21))));
ISAAC_STEP (1, HALF, IF32 (just (a) >> 6, a ^ (just (a) >> 5)));
ISAAC_STEP (2, HALF, IF32 ( a << 2, a ^ ( a << 12)));
ISAAC_STEP (3, HALF, IF32 (just (a) >> 16, a ^ (just (a) >> 33)));
r += 4;
}
while ((m += 4) < s->mm + ISAAC_WORDS / 2);
while ((m += 4) < s->m + HALF);
do
{
isaac_step (a << 13, a, b, s->mm, m, -ISAAC_WORDS / 2, r);
isaac_step (a >> 6, a, b, s->mm, m + 1, -ISAAC_WORDS / 2, r + 1);
isaac_step (a << 2, a, b, s->mm, m + 2, -ISAAC_WORDS / 2, r + 2);
isaac_step (a >> 16, a, b, s->mm, m + 3, -ISAAC_WORDS / 2, r + 3);
ISAAC_STEP (0, -HALF, IF32 ( a << 13, ~ (a ^ (a << 21))));
ISAAC_STEP (1, -HALF, IF32 (just (a) >> 6, a ^ (just (a) >> 5)));
ISAAC_STEP (2, -HALF, IF32 ( a << 2, a ^ ( a << 12)));
ISAAC_STEP (3, -HALF, IF32 (just (a) >> 16, a ^ (just (a) >> 33)));
r += 4;
}
while ((m += 4) < s->mm + ISAAC_WORDS);
while ((m += 4) < s->m + ISAAC_WORDS);
s->a = a;
s->b = b;
}
@@ -96,205 +126,133 @@ isaac_refill (struct isaac_state *s, uint32_t r[ISAAC_WORDS])
* The basic seed-scrambling step for initialization, based on Bob
* Jenkins' 256-bit hash.
*/
#define mix(a,b,c,d,e,f,g,h) \
( a ^= b << 11, d += a, \
b += c, b ^= c >> 2, e += b, \
c += d, c ^= d << 8, f += c, \
d += e, d ^= e >> 16, g += d, \
e += f, e ^= f << 10, h += e, \
f += g, f ^= g >> 4, a += f, \
g += h, g ^= h << 8, b += g, \
h += a, h ^= a >> 9, c += h, \
a += b )
#if ISAAC_BITS == 32
#define mix(a, b, c, d, e, f, g, h) \
{ \
a ^= b << 11; d += a; \
b += c; b ^= just (c) >> 2; e += b; \
c += d; c ^= d << 8; f += c; \
d += e; d ^= just (e) >> 16; g += d; \
e += f; e ^= f << 10; h += e; \
f += g; f ^= just (g) >> 4; a += f; \
g += h; g ^= h << 8; b += g; \
h += a; h ^= just (a) >> 9; c += h; \
a += b; \
}
#else
#define mix(a, b, c, d, e, f, g, h) \
{ \
a -= e; f ^= just (h) >> 9; h += a; \
b -= f; g ^= a << 9; a += b; \
c -= g; h ^= just (b) >> 23; b += c; \
d -= h; a ^= c << 15; c += d; \
e -= a; b ^= just (d) >> 14; d += e; \
f -= b; c ^= e << 20; e += f; \
g -= c; d ^= just (f) >> 17; f += g; \
h -= d; e ^= g << 14; g += h; \
}
#endif
/* The basic ISAAC initialization pass. */
static void
isaac_mix (struct isaac_state *s, uint32_t const seed[/* ISAAC_WORDS */])
{
int i;
uint32_t a = s->iv[0];
uint32_t b = s->iv[1];
uint32_t c = s->iv[2];
uint32_t d = s->iv[3];
uint32_t e = s->iv[4];
uint32_t f = s->iv[5];
uint32_t g = s->iv[6];
uint32_t h = s->iv[7];
for (i = 0; i < ISAAC_WORDS; i += 8)
{
a += seed[i];
b += seed[i + 1];
c += seed[i + 2];
d += seed[i + 3];
e += seed[i + 4];
f += seed[i + 5];
g += seed[i + 6];
h += seed[i + 7];
mix (a, b, c, d, e, f, g, h);
s->mm[i] = a;
s->mm[i + 1] = b;
s->mm[i + 2] = c;
s->mm[i + 3] = d;
s->mm[i + 4] = e;
s->mm[i + 5] = f;
s->mm[i + 6] = g;
s->mm[i + 7] = h;
}
s->iv[0] = a;
s->iv[1] = b;
s->iv[2] = c;
s->iv[3] = d;
s->iv[4] = e;
s->iv[5] = f;
s->iv[6] = g;
s->iv[7] = h;
}
#define ISAAC_MIX(s, a, b, c, d, e, f, g, h, seed) \
{ \
int i; \
\
for (i = 0; i < ISAAC_WORDS; i += 8) \
{ \
a += seed[i]; \
b += seed[i + 1]; \
c += seed[i + 2]; \
d += seed[i + 3]; \
e += seed[i + 4]; \
f += seed[i + 5]; \
g += seed[i + 6]; \
h += seed[i + 7]; \
mix (a, b, c, d, e, f, g, h); \
s->m[i] = a; \
s->m[i + 1] = b; \
s->m[i + 2] = c; \
s->m[i + 3] = d; \
s->m[i + 4] = e; \
s->m[i + 5] = f; \
s->m[i + 6] = g; \
s->m[i + 7] = h; \
} \
}
#if 0 /* Provided for reference only; not used in this code */
/*
* Initialize the ISAAC RNG with the given seed material.
* Its size MUST be a multiple of ISAAC_BYTES, and may be
* stored in the s->mm array.
* stored in the s->m array.
*
* This is a generalization of the original ISAAC initialization code
* to support larger seed sizes. For seed sizes of 0 and ISAAC_BYTES,
* it is identical.
*/
static void
isaac_init (struct isaac_state *s, uint32_t const *seed, size_t seedsize)
isaac_init (struct isaac_state *s, isaac_word const *seed, size_t seedsize)
{
static uint32_t const iv[8] =
{
0x1367df5a, 0x95d90059, 0xc3163e4b, 0x0f421ad8,
0xd92a4a78, 0xa51a3c49, 0xc4efea1b, 0x30609119};
int i;
isaac_word a, b, c, d, e, f, g, h;
# if 0
/* The initialization of iv is a precomputed form of: */
for (i = 0; i < 7; i++)
iv[i] = 0x9e3779b9; /* the golden ratio */
for (i = 0; i < 4; ++i) /* scramble it */
mix (iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
# endif
a = b = c = d = e = f = g = h = /* the golden ratio */
IF32 (UINT32_C (0x9e3779b9), UINT64_C (0x9e3779b97f4a7c13));
for (int i = 0; i < 4; i++) /* scramble it */
mix (a, b, c, d, e, f, g, h);
s->a = s->b = s->c = 0;
for (i = 0; i < 8; i++)
s->iv[i] = iv[i];
if (seedsize)
{
/* First pass (as in reference ISAAC code) */
isaac_mix (s, seed);
ISAAC_MIX (s, a, b, c, d, e, f, g, h, 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);
s->m[i] += seed[i];
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
}
}
else
{
/* The no seed case (as in reference ISAAC code) */
for (i = 0; i < ISAAC_WORDS; i++)
s->mm[i] = 0;
s->m[i] = 0;
}
/* Final pass */
isaac_mix (s, s->mm);
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
}
#endif
/* Initialize *S to a somewhat-random value. */
static void
isaac_seed_start (struct isaac_state *s)
{
static uint32_t const iv[8] =
{
0x1367df5a, 0x95d90059, 0xc3163e4b, 0x0f421ad8,
0xd92a4a78, 0xa51a3c49, 0xc4efea1b, 0x30609119
};
#if 0
/* The initialization of iv is a precomputed form of: */
int i;
for (i = 0; i < 7; i++)
iv[i] = 0x9e3779b9; /* the golden ratio */
for (i = 0; i < 4; ++i) /* scramble it */
mix (iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
#endif
memset (s->mm, 0, sizeof s->mm);
memcpy (s->iv, iv, sizeof s->iv);
/* s->c gets used for a data pointer during the seeding phase */
s->a = s->b = s->c = 0;
}
/* Add a buffer of seed material. */
static void
isaac_seed_data (struct isaac_state *s, void const *buffer, size_t size)
{
unsigned char const *buf = buffer;
unsigned char *p;
size_t avail;
size_t i;
avail = sizeof s->mm - s->c; /* s->c is used as a write pointer */
/* Do any full buffers that are necessary */
while (size > avail)
{
p = (unsigned char *) s->mm + s->c;
for (i = 0; i < avail; i++)
p[i] ^= buf[i];
buf += avail;
size -= avail;
isaac_mix (s, s->mm);
s->c = 0;
avail = sizeof s->mm;
}
/* And the final partial block */
p = (unsigned char *) s->mm + s->c;
for (i = 0; i < size; i++)
p[i] ^= buf[i];
s->c = size;
}
/* End of seeding phase; get everything ready to produce output. */
static void
isaac_seed_finish (struct isaac_state *s)
{
isaac_mix (s, s->mm);
isaac_mix (s, s->mm);
/* Now reinitialize c to start things off right */
s->c = 0;
}
#define ISAAC_SEED(s,x) isaac_seed_data (s, &(x), sizeof (x))
/* Initialize *S to a somewhat-random value; this starts seeding,
seeds with somewhat-random data, and finishes seeding. */
/* Initialize *S to a somewhat-random value, derived from a seed
stored in S->m. */
void
isaac_seed (struct isaac_state *s)
{
isaac_seed_start (s);
isaac_word a = IF32 (UINT32_C (0x1367df5a), UINT64_C (0x647c4677a2884b7c));
isaac_word b = IF32 (UINT32_C (0x95d90059), UINT64_C (0xb9f8b322c73ac862));
isaac_word c = IF32 (UINT32_C (0xc3163e4b), UINT64_C (0x8c0ea5053d4712a0));
isaac_word d = IF32 (UINT32_C (0x0f421ad8), UINT64_C (0xb29b2e824a595524));
isaac_word e = IF32 (UINT32_C (0xd92a4a78), UINT64_C (0x82f053db8355e0ce));
isaac_word f = IF32 (UINT32_C (0xa51a3c49), UINT64_C (0x48fe4a0fa5a09315));
isaac_word g = IF32 (UINT32_C (0xc4efea1b), UINT64_C (0xae985bf2cbfc89ed));
isaac_word h = IF32 (UINT32_C (0x30609119), UINT64_C (0x98f5704f6c44c0ab));
{ pid_t t = getpid (); ISAAC_SEED (s, t); }
{ pid_t t = getppid (); ISAAC_SEED (s, t); }
{ uid_t t = getuid (); ISAAC_SEED (s, t); }
{ gid_t t = getgid (); ISAAC_SEED (s, t); }
#if 0
/* The initialization of a through h is a precomputed form of: */
a = b = c = d = e = f = g = h = /* the golden ratio */
IF32 (UINT32_C (0x9e3779b9), UINT64_C (0x9e3779b97f4a7c13));
for (int i = 0; i < 4; i++) /* scramble it */
mix (a, b, c, d, e, f, g, h);
#endif
{
xtime_t t = gethrxtime ();
ISAAC_SEED (s, t);
}
/* Mix S->m so that every part of the seed affects every part of the
state. */
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
isaac_seed_finish (s);
s->a = s->b = s->c = 0;
}

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generator, ISAAC.
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
Copyright (C) 1999-2005, 2009 Free Software Foundation, Inc.
Copyright (C) 1999-2005, 2009-2011 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
@@ -16,28 +16,50 @@
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 Colin Plumb. */
Written by Colin Plumb and Paul Eggert. */
#ifndef RAND_ISAAC_H
# define RAND_ISAAC_H
#ifndef _GL_RAND_ISAAC_H
#define _GL_RAND_ISAAC_H
# include <stdint.h>
#include <stddef.h>
#include <stdint.h>
/* Size of the state tables to use. ISAAC_LOG should be at least 3,
/* Log base 2 of the number of useful bits in an ISAAC word. It must
be either 5 or 6. By default, this uses a value that should be
faster for this architecture. */
#ifndef ISAAC_BITS_LOG
#if SIZE_MAX >> 31 >> 31 < 3 /* SIZE_MAX < 2**64 - 1 */
#define ISAAC_BITS_LOG 5
#else
#define ISAAC_BITS_LOG 6
#endif
#endif
/* The number of bits in an ISAAC word. */
#define ISAAC_BITS (1 << ISAAC_BITS_LOG)
#if ISAAC_BITS == 32
typedef uint_least32_t isaac_word;
#else
typedef uint_least64_t isaac_word;
#endif
/* Size of the state tables to use. ISAAC_WORDS_LOG should be at least 3,
and smaller values give less security. */
# define ISAAC_LOG 8
# define ISAAC_WORDS (1 << ISAAC_LOG)
# define ISAAC_BYTES (ISAAC_WORDS * sizeof (uint32_t))
#define ISAAC_WORDS_LOG 8
#define ISAAC_WORDS (1 << ISAAC_WORDS_LOG)
#define ISAAC_BYTES (ISAAC_WORDS * sizeof (isaac_word))
/* RNG state variables. The members of this structure are private. */
/* State variables for the random number generator. The M member
should be seeded with nonce data before calling isaac_seed. The
other members are private. */
struct isaac_state
{
uint32_t mm[ISAAC_WORDS]; /* Main state array */
uint32_t iv[8]; /* Seeding initial vector */
uint32_t a, b, c; /* Extra index variables */
isaac_word m[ISAAC_WORDS]; /* Main state array */
isaac_word a, b, c; /* Extra variables */
};
void isaac_seed (struct isaac_state *);
void isaac_refill (struct isaac_state *, uint32_t[ISAAC_WORDS]);
void isaac_refill (struct isaac_state *, isaac_word[ISAAC_WORDS]);
#endif

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
Copyright (C) 2006, 2009-2011 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
@@ -125,7 +125,7 @@ randint_genmax (struct randint_source *s, randint genmax)
randint randmax = s->randmax;
randint choices = genmax + 1;
for (;;)
while (1)
{
if (randmax < genmax)
{

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
Copyright (C) 2006, 2009-2011 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, 2009 Free Software Foundation, Inc.
Copyright (C) 2006-2007, 2009-2011 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 buffers of random data.
Copyright (C) 2006, 2008-2009 Free Software Foundation, Inc.
Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,12 +24,15 @@
#include <errno.h>
#include <error.h>
#include <exitfail.h>
#include <fcntl.h>
#include <quotearg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@ -60,6 +63,10 @@
# define ALIGNED_POINTER(ptr, type) ((size_t) (ptr) % alignof (type) == 0)
#endif
#ifndef NAME_OF_NONCE_DEVICE
#define NAME_OF_NONCE_DEVICE "/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. */
@@ -100,7 +107,7 @@ struct randread_source
/* Up to a buffer's worth of pseudorandom data. */
union
{
uint32_t w[ISAAC_WORDS];
isaac_word w[ISAAC_WORDS];
unsigned char b[ISAAC_BYTES];
} data;
} isaac;
@@ -133,6 +140,52 @@ simple_new (FILE *source, void const *handler_arg)
return s;
}
/* Put a nonce value into BUFFER, with size BUFSIZE, but do not get
more than BYTES_BOUND bytes' worth of random information from any
nonce device. */
static void
get_nonce (void *buffer, size_t bufsize, size_t bytes_bound)
{
char *buf = buffer;
ssize_t seeded = 0;
/* Get some data from FD if available. */
int fd = open (NAME_OF_NONCE_DEVICE, O_RDONLY | O_BINARY);
if (0 <= fd)
{
seeded = read (fd, buf, MIN (bufsize, bytes_bound));
if (seeded < 0)
seeded = 0;
close (fd);
}
/* If there's no nonce device, use a poor approximation
by getting the time of day, etc. */
# define ISAAC_SEED(type, initialize_v) \
if (seeded < bufsize) \
{ \
type v; \
size_t nbytes = MIN (sizeof v, bufsize - seeded); \
initialize_v; \
memcpy (buf + seeded, &v, nbytes); \
seeded += nbytes; \
}
ISAAC_SEED (struct timeval, gettimeofday (&v, NULL));
ISAAC_SEED (pid_t, v = getpid ());
ISAAC_SEED (pid_t, v = getppid ());
ISAAC_SEED (uid_t, v = getuid ());
ISAAC_SEED (uid_t, v = getgid ());
#ifdef lint
/* Normally we like having the extra randomness from uninitialized
parts of BUFFER. However, omit this randomness if we want to
avoid false-positives from memory-checking debugging tools. */
memset (buf + seeded, 0, bufsize - seeded);
#endif
}
/* Create and initialize a random data source from NAME, or use a
reasonable default source if NAME is null. BYTES_BOUND is an upper
bound on the number of bytes that will be needed. If zero, it is a
@@ -165,6 +218,8 @@ randread_new (char const *name, size_t bytes_bound)
else
{
s->buf.isaac.buffered = 0;
get_nonce (s->buf.isaac.state.m, sizeof s->buf.isaac.state.m,
bytes_bound);
isaac_seed (&s->buf.isaac.state);
}
@@ -199,7 +254,7 @@ randread_set_handler_arg (struct randread_source *s, void const *handler_arg)
static void
readsource (struct randread_source *s, unsigned char *p, size_t size)
{
for (;;)
while (true)
{
size_t inbytes = fread (p, sizeof *p, size, s->source);
int fread_errno = errno;
@@ -221,7 +276,7 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
{
size_t inbytes = isaac->buffered;
for (;;)
while (true)
{
if (size <= inbytes)
{
@@ -236,9 +291,9 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
/* If P is aligned, write to *P directly to avoid the overhead
of copying from the buffer. */
if (ALIGNED_POINTER (p, uint32_t))
if (ALIGNED_POINTER (p, isaac_word))
{
uint32_t *wp = (uint32_t *) p;
isaac_word *wp = (isaac_word *) p;
while (ISAAC_BYTES <= size)
{
isaac_refill (&isaac->state, wp);

View File

@@ -1,6 +1,6 @@
/* Generate buffers of random data.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
Copyright (C) 2006, 2009-2011 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

63
gl/lib/regcomp.c.diff Normal file
View File

@@ -0,0 +1,63 @@
diff --git a/lib/regcomp.c b/lib/regcomp.c
index d5968bd..4926676 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -541,7 +541,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
size_t errbuf_size;
#else /* size_t might promote */
size_t
-regerror (int errcode, const regex_t *_Restrict_ preg,
+regerror (int errcode, const regex_t *_Restrict_ preg _UNUSED_PARAMETER_,
char *_Restrict_ errbuf, size_t errbuf_size)
#endif
{
@@ -1383,7 +1383,7 @@ calc_first (void *extra, bin_tree_t *node)
/* Pass 2: compute NEXT on the tree. Preorder visit. */
static reg_errcode_t
-calc_next (void *extra, bin_tree_t *node)
+calc_next (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
{
switch (node->token.type)
{
@@ -2744,7 +2744,8 @@ static reg_errcode_t
internal_function
build_collating_symbol (bitset_t sbcset,
# ifdef RE_ENABLE_I18N
- re_charset_t *mbcset, Idx *coll_sym_alloc,
+ re_charset_t *mbcset _UNUSED_PARAMETER_,
+ Idx *coll_sym_alloc _UNUSED_PARAMETER_,
# endif
const unsigned char *name)
{
@@ -3323,7 +3324,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
static reg_errcode_t
parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
- re_token_t *token, int token_len, re_dfa_t *dfa,
+ re_token_t *token, int token_len,
+ re_dfa_t *dfa _UNUSED_PARAMETER_,
reg_syntax_t syntax, bool accept_hyphen)
{
#ifdef RE_ENABLE_I18N
@@ -3410,8 +3412,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
static reg_errcode_t
#ifdef RE_ENABLE_I18N
-build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
- Idx *equiv_class_alloc, const unsigned char *name)
+build_equiv_class (bitset_t sbcset, re_charset_t *mbcset _UNUSED_PARAMETER_,
+ Idx *equiv_class_alloc _UNUSED_PARAMETER_,
+ const unsigned char *name)
#else /* not RE_ENABLE_I18N */
build_equiv_class (bitset_t sbcset, const unsigned char *name)
#endif /* not RE_ENABLE_I18N */
@@ -3816,7 +3819,7 @@ free_token (re_token_t *node)
and its children. */
static reg_errcode_t
-free_tree (void *extra, bin_tree_t *node)
+free_tree (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
{
free_token (&node->token);
return REG_NOERROR;

View File

@@ -0,0 +1,25 @@
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 904b88e..61c8d9d 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "verify.h"
+#include "intprops.h"
static void re_string_construct_common (const char *str, Idx len,
re_string_t *pstr,
RE_TRANSLATE_TYPE trans, bool icase,
@@ -1390,7 +1392,10 @@ static void
internal_function
re_node_set_remove_at (re_node_set *set, Idx idx)
{
- if (idx < 0 || idx >= set->nelem)
+ verify (! TYPE_SIGNED (Idx));
+ /* if (idx < 0)
+ return; */
+ if (idx >= set->nelem)
return;
--set->nelem;
for (; idx < set->nelem; idx++)

View File

@@ -0,0 +1,14 @@
diff --git i/lib/regex_internal.h w/lib/regex_internal.h
index 859832f..3c7fe06 100644
--- i/lib/regex_internal.h
+++ w/lib/regex_internal.h
@@ -826,7 +826,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
static int
internal_function __attribute ((pure))
-re_string_elem_size_at (const re_string_t *pstr, Idx idx)
+re_string_elem_size_at (const re_string_t *pstr _UNUSED_PARAMETER_,
+ Idx idx _UNUSED_PARAMETER_)
{
# ifdef _LIBC
const unsigned char *p, *extra;

45
gl/lib/regexec.c.diff Normal file
View File

@@ -0,0 +1,45 @@
diff --git a/lib/regexec.c b/lib/regexec.c
index 21a8166..7762437 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "verify.h"
+#include "intprops.h"
static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
Idx n) internal_function;
static void match_ctx_clean (re_match_context_t *mctx) internal_function;
@@ -378,8 +380,11 @@ re_search_2_stub (struct re_pattern_buffer *bufp,
Idx len = length1 + length2;
char *s = NULL;
- if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0))
- return -2;
+ verify (! TYPE_SIGNED (Idx));
+ if (BE (len < length1, 0))
+ return -2;
+ /* if (BE (length1 < 0 || length2 < 0 || stop < 0, 0))
+ return -2; */
/* Concatenate the strings. */
if (length2 > 0)
@@ -431,11 +436,14 @@ re_search_stub (struct re_pattern_buffer *bufp,
Idx last_start = start + range;
/* Check for out-of-range. */
- if (BE (start < 0 || start > length, 0))
- return -1;
+ verify (! TYPE_SIGNED (Idx));
+ /* if (BE (start < 0, 0))
+ return -1; */
+ if (BE (start > length, 0))
+ return -1;
if (BE (length < last_start || (0 <= range && last_start < start), 0))
last_start = length;
- else if (BE (last_start < 0 || (range < 0 && start <= last_start), 0))
+ else if (BE (/* last_start < 0 || */ (range < 0 && start <= last_start), 0))
last_start = 0;
__libc_lock_lock (dfa->lock);

View File

@@ -1,5 +1,5 @@
/* root-dev-ino.c -- get the device and inode numbers for `/'.
Copyright (C) 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
Copyright (C) 2003, 2005-2006, 2009-2011 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, 2009 Free Software Foundation, Inc.
Copyright (C) 2003, 2006, 2009-2011 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,301 +0,0 @@
/* tempname.c - generate the name of a temporary file.
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */
#if !_LIBC
# include <config.h>
# include "tempname.h"
# include "randint.h"
#endif
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#ifndef __set_errno
# define __set_errno(Val) errno = (Val)
#endif
#include <stdio.h>
#ifndef P_tmpdir
# define P_tmpdir "/tmp"
#endif
#ifndef TMP_MAX
# define TMP_MAX 238328
#endif
#ifndef __GT_FILE
# define __GT_FILE 0
# define __GT_BIGFILE 1
# define __GT_DIR 2
# define __GT_NOCREATE 3
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/time.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/stat.h>
#if _LIBC
# define struct_stat64 struct stat64
# define small_open __open
# define large_open __open64
#else
# define struct_stat64 struct stat
# define small_open open
# define large_open open
# define __gen_tempname gen_tempname
# define __getpid getpid
# define __gettimeofday gettimeofday
# define __mkdir mkdir
# define __lxstat64(version, file, buf) lstat (file, buf)
# define __xstat64(version, file, buf) stat (file, buf)
#endif
#if ! (HAVE___SECURE_GETENV || _LIBC)
# define __secure_getenv getenv
#endif
#if _LIBC
/* Return nonzero if DIR is an existent directory. */
static int
direxists (const char *dir)
{
struct_stat64 buf;
return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
}
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
non-null and exists, uses it; otherwise uses the first of $TMPDIR,
P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
doesn't exist, none of the searched dirs exists, or there's not
enough space in TMPL. */
int
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
int try_tmpdir)
{
const char *d;
size_t dlen, plen;
if (!pfx || !pfx[0])
{
pfx = "file";
plen = 4;
}
else
{
plen = strlen (pfx);
if (plen > 5)
plen = 5;
}
if (try_tmpdir)
{
d = __secure_getenv ("TMPDIR");
if (d != NULL && direxists (d))
dir = d;
else if (dir != NULL && direxists (dir))
/* nothing */ ;
else
dir = NULL;
}
if (dir == NULL)
{
if (direxists (P_tmpdir))
dir = P_tmpdir;
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
dir = "/tmp";
else
{
__set_errno (ENOENT);
return -1;
}
}
dlen = strlen (dir);
while (dlen > 1 && dir[dlen - 1] == '/')
dlen--; /* remove trailing slashes */
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
if (tmpl_len < dlen + 1 + plen + 6 + 1)
{
__set_errno (EINVAL);
return -1;
}
sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
static inline bool
check_x_suffix (char const *s, size_t len)
{
return strspn (s, "X") == len;
}
/* These are the characters used in temporary file names. */
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/* Generate a temporary file name based on TMPL. TMPL must end in a
a sequence of at least X_SUFFIX_LEN "X"s. The name constructed
does not exist at the time of the call to __gen_tempname. TMPL is
overwritten with the result.
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
at the time of the call.
__GT_FILE: create the file using open(O_CREAT|O_EXCL)
and return a read-write fd. The file is mode 0600.
__GT_BIGFILE: same as __GT_FILE but use open64().
__GT_DIR: create a directory, which will be mode 0700.
We use a clever algorithm to get hard-to-predict names. */
int
gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len)
{
size_t len;
char *XXXXXX;
unsigned int count;
int fd = -1;
int save_errno = errno;
struct_stat64 st;
struct randint_source *rand_src;
/* A lower bound on the number of temporary files to attempt to
generate. The maximum total number of temporary file names that
can exist for a given template is 62**6. It should never be
necessary to try all these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to
give the system administrator the chance to remove the problems. */
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
conform to POSIX, this must be no smaller than TMP_MAX. */
#if ATTEMPTS_MIN < TMP_MAX
unsigned int attempts = TMP_MAX;
#else
unsigned int attempts = ATTEMPTS_MIN;
#endif
len = strlen (tmpl);
if (len < x_suffix_len || ! check_x_suffix (&tmpl[len - x_suffix_len],
x_suffix_len))
{
__set_errno (EINVAL);
return -1;
}
rand_src = randint_all_new (NULL, 8);
if (! rand_src)
return -1;
/* This is where the Xs start. */
XXXXXX = &tmpl[len - x_suffix_len];
for (count = 0; count < attempts; ++count)
{
size_t i;
for (i = 0; i < x_suffix_len; i++)
{
XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
}
switch (kind)
{
case __GT_FILE:
fd = small_open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
case __GT_BIGFILE:
fd = large_open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
case __GT_DIR:
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
break;
case __GT_NOCREATE:
/* This case is backward from the other three. This function
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
{
if (errno == ENOENT)
{
__set_errno (save_errno);
fd = 0;
goto done;
}
else
{
/* Give up now. */
fd = -1;
goto done;
}
}
continue;
default:
assert (! "invalid KIND in __gen_tempname");
}
if (fd >= 0)
{
__set_errno (save_errno);
goto done;
}
else if (errno != EEXIST)
{
fd = -1;
goto done;
}
}
randint_all_free (rand_src);
/* We got out of the loop because we ran out of combinations to try. */
__set_errno (EEXIST);
return -1;
done:
{
int saved_errno = errno;
randint_all_free (rand_src);
__set_errno (saved_errno);
}
return fd;
}
int
__gen_tempname (char *tmpl, int kind)
{
return gen_tempname_len (tmpl, kind, 6);
}

193
gl/lib/tempname.c.diff Normal file
View File

@@ -0,0 +1,193 @@
diff --git c/lib/tempname.c i/lib/tempname.c
index 2da5afe..562955a 100644
--- c/lib/tempname.c
+++ i/lib/tempname.c
@@ -22,6 +22,7 @@
#if !_LIBC
# include <config.h>
# include "tempname.h"
+# include "randint.h"
#endif
#include <sys/types.h>
@@ -49,6 +50,7 @@
# error report this to bug-gnulib@gnu.org
#endif
+#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -179,14 +181,21 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
}
#endif /* _LIBC */
+static inline bool
+check_x_suffix (char const *s, size_t len)
+{
+ return len <= strspn (s, "X");
+}
+
/* These are the characters used in temporary file names. */
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/* Generate a temporary file name based on TMPL. TMPL must match the
- rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
+ rules for mk[s]temp (i.e. end in at least X_SUFFIX_LEN "X"s,
+ possibly with a suffix).
The name constructed does not exist at the time of the call to
- __gen_tempname. TMPL is overwritten with the result.
+ this function. TMPL is overwritten with the result.
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
@@ -197,23 +206,24 @@ static const char letters[] =
We use a clever algorithm to get hard-to-predict names. */
int
-__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
+gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len)
{
- int len;
+ size_t len;
char *XXXXXX;
- static uint64_t value;
- uint64_t random_time_bits;
unsigned int count;
int fd = -1;
int save_errno = errno;
struct_stat64 st;
+ struct randint_source *rand_src;
/* A lower bound on the number of temporary files to attempt to
generate. The maximum total number of temporary file names that
can exist for a given template is 62**6. It should never be
necessary to try all these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to
- give the system administrator the chance to remove the problems. */
+ give the system administrator the chance to remove the problems.
+ This value requires that X_SUFFIX_LEN be at least 3. */
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
@@ -225,43 +235,28 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
#endif
len = strlen (tmpl);
- if (len < 6 + suffixlen || memcmp (&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
+ if (len < x_suffix_len + suffixlen
+ || ! check_x_suffix (&tmpl[len - x_suffix_len - suffixlen],
+ x_suffix_len))
{
__set_errno (EINVAL);
return -1;
}
/* This is where the Xs start. */
- XXXXXX = &tmpl[len - 6 - suffixlen];
+ XXXXXX = &tmpl[len - x_suffix_len - suffixlen];
/* Get some more or less random data. */
-#ifdef RANDOM_BITS
- RANDOM_BITS (random_time_bits);
-#else
- {
- struct timeval tv;
- __gettimeofday (&tv, NULL);
- random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
- }
-#endif
- value += random_time_bits ^ __getpid ();
+ rand_src = randint_all_new (NULL, 8);
+ if (! rand_src)
+ return -1;
- for (count = 0; count < attempts; value += 7777, ++count)
+ for (count = 0; count < attempts; ++count)
{
- uint64_t v = value;
-
- /* Fill in the random bits. */
- XXXXXX[0] = letters[v % 62];
- v /= 62;
- XXXXXX[1] = letters[v % 62];
- v /= 62;
- XXXXXX[2] = letters[v % 62];
- v /= 62;
- XXXXXX[3] = letters[v % 62];
- v /= 62;
- XXXXXX[4] = letters[v % 62];
- v /= 62;
- XXXXXX[5] = letters[v % 62];
+ size_t i;
+
+ for (i = 0; i < x_suffix_len; i++)
+ XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
switch (kind)
{
@@ -276,7 +271,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
break;
case __GT_NOCREATE:
- /* This case is backward from the other three. __gen_tempname
+ /* This case is backward from the other three. This function
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
@@ -285,11 +280,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
if (errno == ENOENT)
{
__set_errno (save_errno);
- return 0;
+ fd = 0;
+ goto done;
}
else
- /* Give up now. */
- return -1;
+ {
+ /* Give up now. */
+ fd = -1;
+ goto done;
+ }
}
continue;
@@ -301,13 +300,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
if (fd >= 0)
{
__set_errno (save_errno);
- return fd;
+ goto done;
}
else if (errno != EEXIST)
- return -1;
+ {
+ fd = -1;
+ goto done;
+ }
}
+ randint_all_free (rand_src);
+
/* We got out of the loop because we ran out of combinations to try. */
__set_errno (EEXIST);
return -1;
+
+ done:
+ {
+ int saved_errno = errno;
+ randint_all_free (rand_src);
+ __set_errno (saved_errno);
+ }
+ return fd;
+}
+
+int
+__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
+{
+ return gen_tempname_len (tmpl, suffixlen, flags, kind, 6);
}

View File

@@ -1,41 +0,0 @@
/* Create a temporary file or directory.
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* header written by Eric Blake */
/* In gnulib, always prefer large files. GT_FILE maps to
__GT_BIGFILE, not __GT_FILE, for a reason. */
#define GT_FILE 1
#define GT_DIR 2
#define GT_NOCREATE 3
/* Generate a temporary file name based on TMPL. TMPL must match the
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
does not exist at the time of the call to gen_tempname. TMPL is
overwritten with the result.
KIND may be one of:
GT_NOCREATE: simply verify that the name does not exist
at the time of the call.
GT_FILE: create a large file using open(O_CREAT|O_EXCL)
and return a read-write fd. The file is mode 0600.
GT_DIR: create a directory, which will be mode 0700.
We use a clever algorithm to get hard-to-predict names. */
#include <stddef.h>
extern int gen_tempname (char *tmpl, int kind);
extern int gen_tempname_len (char *tmpl, int kind, size_t x_suffix_len);

12
gl/lib/tempname.h.diff Normal file
View File

@@ -0,0 +1,12 @@
diff --git c/lib/tempname.h i/lib/tempname.h
index cd69e7d..9757db2 100644
--- c/lib/tempname.h
+++ i/lib/tempname.h
@@ -46,5 +46,7 @@
We use a clever algorithm to get hard-to-predict names. */
extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
+extern int gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len);
#endif /* GL_TEMPNAME_H */

View File

@@ -1,41 +0,0 @@
/* a wrapper for frepoen
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 <config.h>
#include "xfreopen.h"
#include <errno.h>
#include "error.h"
#include "exitfail.h"
#include "quote.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
void
xfreopen (char const *filename, char const *mode, FILE *fp)
{
if (!freopen (filename, mode, fp))
{
char const *f = (filename ? filename
: (fp == stdin ? _("stdin")
: (fp == stdout ? _("stdout")
: (fp == stderr ? _("stderr")
: _("unknown stream")))));
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
quote_n (0, f), quote_n (1, mode));
}
}

View File

@@ -1,2 +0,0 @@
#include <stdio.h>
void xfreopen (char const *filename, char const *mode, FILE *fp);

View File

@@ -1,11 +0,0 @@
#serial 3
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.
AC_DEFUN([gl_MGETGROUPS],
[
AC_CHECK_FUNCS([getgrouplist])
AC_LIBOBJ([mgetgroups])
])

View File

@@ -1,5 +1,5 @@
#serial 3
dnl Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
dnl Copyright (C) 2005-2006, 2009-2011 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.

24
gl/modules/fadvise Normal file
View File

@@ -0,0 +1,24 @@
Description:
Declare an access pattern hint for files.
Files:
lib/fadvise.c
lib/fadvise.h
Depends-on:
ignore-value
configure.ac:
AC_CHECK_FUNCS_ONCE([posix_fadvise])
Makefile.am:
lib_SOURCES += fadvise.c fadvise.h
Include:
"fadvise.h"
License:
LGPL
Maintainer:
Pádraig Brady

10
gl/modules/fadvise-tests Normal file
View File

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

24
gl/modules/heap Normal file
View File

@@ -0,0 +1,24 @@
Description:
Binary heap with minimal number of methods. Used in sort.
Files:
lib/heap.c
lib/heap.h
Depends-on:
stdlib-safer
xalloc
configure.ac:
Makefile.am:
lib_SOURCES += heap.c heap.h
Include:
"heap.h"
License
GPL
Maintainer:
Gene Auyeung

View File

@@ -0,0 +1,9 @@
diff --git i/modules/link-tests w/modules/link-tests
index d8e7b1a..aca0e74 100644
--- i/modules/link-tests
+++ w/modules/link-tests
@@ -12,3 +12,4 @@ configure.ac:
Makefile.am:
TESTS += test-link
check_PROGRAMS += test-link
+test_link_LDADD = $(LDADD) @LIBINTL@

View File

@@ -10,6 +10,7 @@ wchar
wctype
wcwidth
mempcpy
stdint
configure.ac:

11
gl/modules/mbsalign-tests Normal file
View File

@@ -0,0 +1,11 @@
Files:
tests/test-mbsalign.c
tests/macros.h
Depends-on:
configure.ac:
Makefile.am:
TESTS += test-mbsalign
check_PROGRAMS += test-mbsalign

View File

@@ -1,24 +0,0 @@
Description:
Return the group IDs of a user in malloc'd storage.
Files:
lib/mgetgroups.c
lib/mgetgroups.h
m4/mgetgroups.m4
Depends-on:
getugroups
xalloc
configure.ac:
gl_MGETGROUPS
Makefile.am:
Include:
License:
LGPL
Maintainer:
Jim Meyering

View File

@@ -10,8 +10,9 @@ lib/randread.h
Depends-on:
error
exitfail
inline
fopen-safer
gethrxtime
gettimeofday
quotearg
stdbool
stdint

11
gl/modules/randread-tests Normal file
View File

@@ -0,0 +1,11 @@
Files:
tests/test-rand-isaac.c
tests/macros.h
Depends-on:
configure.ac:
Makefile.am:
TESTS += test-rand-isaac
check_PROGRAMS += test-rand-isaac

View File

@@ -0,0 +1,9 @@
diff --git a/modules/rename-tests b/modules/rename-tests
index be1b423..fea330a 100644
--- a/modules/rename-tests
+++ b/modules/rename-tests
@@ -14,3 +14,4 @@ configure.ac:
Makefile.am:
TESTS += test-rename
check_PROGRAMS += test-rename
+test_rename_LDADD = $(LDADD) @LIBINTL@

View File

@@ -1,25 +0,0 @@
Description:
a wrapper for frepoen
Files:
lib/xfreopen.c
lib/xfreopen.h
Depends-on:
error
exitfail
quote
configure.ac:
Makefile.am:
lib_SOURCES += xfreopen.c xfreopen.h
Include:
"xfreopen.h"
License:
LGPL
Maintainer:
Jim Meyering

50
gl/tests/test-fadvise.c Normal file
View File

@@ -0,0 +1,50 @@
/* Test that fadvise works as advertised.
Copyright (C) 2010-2011 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 <stdio.h>
#include "fadvise.h"
/* We ignore any errors as these hints are only advisory.
* There is the chance one can pass invalid ADVICE, which will
* not be indicated, but given the simplicity of the interface
* this is unlikely. Also not returning errors allows the
* unconditional passing of descriptors to non standard files,
* which will just be ignored if unsupported. */
int
main (void)
{
/* Valid. */
fadvise (stdin, FADVISE_SEQUENTIAL);
fdadvise (fileno (stdin), 0, 0, FADVISE_RANDOM);
/* Ignored. */
fadvise (NULL, FADVISE_RANDOM);
/* Invalid. */
fdadvise (42, 0, 0, FADVISE_RANDOM);
/* Unfortunately C enums are not types.
One could hack type safety by wrapping in a struct,
but it's probably not worth the complexity in this case. */
fadvise (stdin, FADVISE_SEQUENTIAL + FADVISE_RANDOM);
fadvise (stdin, 4242);
return 0;
}

100
gl/tests/test-mbsalign.c Normal file
View File

@@ -0,0 +1,100 @@
/* Test that mbsalign works as advertised.
Copyright (C) 2010-2011 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 "macros.h"
#include <stdlib.h>
#include <locale.h>
int
main (void)
{
char dest[4 * 16 + 1];
size_t width, n;
/* Test unibyte truncation. */
width = 4;
n = mbsalign ("t\tés", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 4);
/* Test center alignment. */
width = 4;
n = mbsalign ("es", dest, sizeof dest, &width, MBS_ALIGN_CENTER, 0);
ASSERT (*dest == ' ' && *(dest + n - 1) == ' ');
if (setlocale (LC_ALL, "en_US.UTF8"))
{
/* Check invalid input is flagged. */
width = 4;
n = mbsalign ("t\xe1\xe2s", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == (size_t) -1);
/* Check invalid input is treated as unibyte */
width = 4;
n = mbsalign ("t\xe1\xe2s", dest, sizeof dest, &width,
MBS_ALIGN_LEFT, MBA_UNIBYTE_FALLBACK);
ASSERT (n == 4);
/* Test multibyte center alignment. */
width = 4;
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_CENTER, 0);
ASSERT (*dest == ' ' && *(dest + n - 1) == ' ');
/* Test multibyte left alignment. */
width = 4;
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (*(dest + n - 1) == ' ' && *(dest + n - 2) == ' ');
/* Test multibyte right alignment. */
width = 4;
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_RIGHT, 0);
ASSERT (*(dest) == ' ' && *(dest + 1) == ' ');
/* multibyte multicell truncation. */
width = 4; /* cells */
n = mbsalign ("日月火水", dest, sizeof dest, &width,
MBS_ALIGN_LEFT, 0);
ASSERT (n == 6); /* 2 characters */
/* multibyte unicell truncation. */
width = 3; /* cells */
n = mbsalign ("¹²³⁴", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 6); /* 3 characters */
/* Check independence from dest buffer. */
width = 4; /* cells */
n = mbsalign ("¹²³⁴", dest, 0, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 9); /* 4 characters */
/* Check that width is updated with cells required before padding. */
width = 4; /* cells */
n = mbsalign ("¹²³", dest, 0, &width, MBS_ALIGN_LEFT, 0);
ASSERT (width == 3);
/* Test case where output is larger than input
(as tab converted to multi byte replacement char). */
width = 4;
n = mbsalign ("t\tés" /* 6 including NUL */ , dest, sizeof dest,
&width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 7);
}
return 0;
}

591
gl/tests/test-rand-isaac.c Normal file
View File

@@ -0,0 +1,591 @@
/* Test the ISAAC or ISAAC64 pseudorandom number generator.
Copyright (C) 2010-2011 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. */
#include <config.h>
#include "rand-isaac.h"
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
#include "macros.h"
/* This expected output was generated by running the programs in
<http://burtleburtle.net/bob/rand/isaacafa.html>, as last modified
on 2010-01-22. The 32-bit numbers were output by rand.c, and the
64-bit by isaac64.c, both on x86, as those programs are not
portable to 64-bit platforms. */
static isaac_word const expected[2][ISAAC_WORDS] =
{
#if ISAAC_BITS == 32
{
UINT32_C (0xf650e4c8), UINT32_C (0xe448e96d),
UINT32_C (0x98db2fb4), UINT32_C (0xf5fad54f),
UINT32_C (0x433f1afb), UINT32_C (0xedec154a),
UINT32_C (0xd8370487), UINT32_C (0x46ca4f9a),
UINT32_C (0x5de3743e), UINT32_C (0x88381097),
UINT32_C (0xf1d444eb), UINT32_C (0x823cedb6),
UINT32_C (0x6a83e1e0), UINT32_C (0x4a5f6355),
UINT32_C (0xc7442433), UINT32_C (0x25890e2e),
UINT32_C (0x7452e319), UINT32_C (0x57161df6),
UINT32_C (0x38a824f3), UINT32_C (0x002ed713),
UINT32_C (0x29f55449), UINT32_C (0x51c08d83),
UINT32_C (0xd78cb99e), UINT32_C (0xa0cc74f3),
UINT32_C (0x8f651659), UINT32_C (0xcbc8b7c2),
UINT32_C (0xf5f71c69), UINT32_C (0x12ad6419),
UINT32_C (0xe5792e1b), UINT32_C (0x860536b8),
UINT32_C (0x09b3ce98), UINT32_C (0xd45d6d81),
UINT32_C (0xf3b26129), UINT32_C (0x17e38f85),
UINT32_C (0x29cf72ce), UINT32_C (0x349947b0),
UINT32_C (0xc998f9ff), UINT32_C (0xb5e13dae),
UINT32_C (0x32ae2a2b), UINT32_C (0xf7cf814c),
UINT32_C (0x8ebfa303), UINT32_C (0xcf22e064),
UINT32_C (0x0b923200), UINT32_C (0xeca4d58a),
UINT32_C (0xef53cec4), UINT32_C (0xd0f7b37d),
UINT32_C (0x9c411a2a), UINT32_C (0xffdf8a80),
UINT32_C (0xb40e27bc), UINT32_C (0xb4d2f976),
UINT32_C (0x44b89b08), UINT32_C (0xf37c71d5),
UINT32_C (0x1a70e7e9), UINT32_C (0x0bdb9c30),
UINT32_C (0x60dc5207), UINT32_C (0xb3c3f24b),
UINT32_C (0xd7386806), UINT32_C (0x229749b5),
UINT32_C (0x4e232cd0), UINT32_C (0x91dabc65),
UINT32_C (0xa70e1101), UINT32_C (0x8b87437e),
UINT32_C (0x5781414f), UINT32_C (0xcdbc62e2),
UINT32_C (0x8107c9ff), UINT32_C (0x69d2e4ae),
UINT32_C (0x3b18e752), UINT32_C (0xb143b688),
UINT32_C (0x6f4e0772), UINT32_C (0x95138769),
UINT32_C (0x943c3c74), UINT32_C (0xafc17a97),
UINT32_C (0x0fd43963), UINT32_C (0x6a529b0b),
UINT32_C (0xd8c58a6a), UINT32_C (0xa8bcc22d),
UINT32_C (0x2db35dfe), UINT32_C (0xa7a2f402),
UINT32_C (0x6cb167db), UINT32_C (0x538e1f4e),
UINT32_C (0x7275e277), UINT32_C (0x1d3b8e97),
UINT32_C (0xecc5dc91), UINT32_C (0x15e3a5b9),
UINT32_C (0x03696614), UINT32_C (0x30ab93ec),
UINT32_C (0xac9fe69d), UINT32_C (0x7bc76811),
UINT32_C (0x60eda8da), UINT32_C (0x28833522),
UINT32_C (0xd5295ebc), UINT32_C (0x5adb60e7),
UINT32_C (0xf7e1cdd0), UINT32_C (0x97166d14),
UINT32_C (0xb67ec13a), UINT32_C (0x210f3925),
UINT32_C (0x64af0fef), UINT32_C (0x0d028684),
UINT32_C (0x3aea3dec), UINT32_C (0xb058bafb),
UINT32_C (0xb8b0ccfc), UINT32_C (0xf2b5cc05),
UINT32_C (0xe3a662d9), UINT32_C (0x814bc24c),
UINT32_C (0x2364a1aa), UINT32_C (0x37c0ed05),
UINT32_C (0x2b36505c), UINT32_C (0x451e7ec8),
UINT32_C (0x5d2a542f), UINT32_C (0xe43d0fbb),
UINT32_C (0x91c8d925), UINT32_C (0x60d4d5f8),
UINT32_C (0x12a0594b), UINT32_C (0x9e8a51da),
UINT32_C (0xcd49ebdb), UINT32_C (0x1b0dcdc1),
UINT32_C (0xcd57c7f7), UINT32_C (0xe6344451),
UINT32_C (0x7ded386f), UINT32_C (0x2f36fa86),
UINT32_C (0xa6d12101), UINT32_C (0x33bc405d),
UINT32_C (0xb388d96c), UINT32_C (0xdb6dbe96),
UINT32_C (0xfe29661c), UINT32_C (0x13edc0cb),
UINT32_C (0xcb0eee4a), UINT32_C (0x70cc94ae),
UINT32_C (0xde11ed34), UINT32_C (0x0606cf9f),
UINT32_C (0x3a6ce389), UINT32_C (0x23d74f4e),
UINT32_C (0xa37f63ff), UINT32_C (0x917bdec2),
UINT32_C (0xd73f72d4), UINT32_C (0x0e7e0e67),
UINT32_C (0x3d77d9a2), UINT32_C (0x13add922),
UINT32_C (0x8891b3db), UINT32_C (0x01a9bd70),
UINT32_C (0x56a001e3), UINT32_C (0xd51f093d),
UINT32_C (0xcc033ce3), UINT32_C (0x5ad0d3b0),
UINT32_C (0x34105a8c), UINT32_C (0x6a123f57),
UINT32_C (0xbd2e5024), UINT32_C (0x7364944b),
UINT32_C (0xe89b1a3b), UINT32_C (0x21835c4d),
UINT32_C (0x9f39e2d9), UINT32_C (0xd405ded8),
UINT32_C (0x294d37e5), UINT32_C (0xbccaaeed),
UINT32_C (0x35a124b5), UINT32_C (0x6708a2bc),
UINT32_C (0xb00960ba), UINT32_C (0x2a98121a),
UINT32_C (0x4d8fae82), UINT32_C (0x0bb3263f),
UINT32_C (0x12595a19), UINT32_C (0x6a107589),
UINT32_C (0x0809e494), UINT32_C (0x21c171ec),
UINT32_C (0x884d6825), UINT32_C (0x14c8009b),
UINT32_C (0xb0b84e7b), UINT32_C (0x03fb88f4),
UINT32_C (0x28e7cb78), UINT32_C (0x9388b13b),
UINT32_C (0xdd2dc1d5), UINT32_C (0x848f520a),
UINT32_C (0x07c28cd1), UINT32_C (0x68a39358),
UINT32_C (0x72c9137d), UINT32_C (0x127dd430),
UINT32_C (0xc613f157), UINT32_C (0x8c2f0d55),
UINT32_C (0xf7d3f39f), UINT32_C (0x309bfb78),
UINT32_C (0x8406b137), UINT32_C (0x46c0a6f5),
UINT32_C (0x3718d597), UINT32_C (0x08607f04),
UINT32_C (0x76904b6d), UINT32_C (0x04db4e13),
UINT32_C (0xcd7411a7), UINT32_C (0xb510ce0e),
UINT32_C (0xbfc7f7cc), UINT32_C (0xb83f957a),
UINT32_C (0xfdfef62d), UINT32_C (0xc35e4580),
UINT32_C (0x3ff1e524), UINT32_C (0x4112d96c),
UINT32_C (0x02c9b944), UINT32_C (0xd5990dfb),
UINT32_C (0xe7e26581), UINT32_C (0x0d9c7e7e),
UINT32_C (0x826dfa89), UINT32_C (0x66f1e0ab),
UINT32_C (0x30bcc764), UINT32_C (0xeadebeac),
UINT32_C (0xed35e5ee), UINT32_C (0x0c571a7d),
UINT32_C (0xe4f3a26a), UINT32_C (0xf7f58f7b),
UINT32_C (0xadf6bc23), UINT32_C (0x5d023e65),
UINT32_C (0x1ed3ff4e), UINT32_C (0xec46b0b6),
UINT32_C (0xd2a93b51), UINT32_C (0xe75b41c9),
UINT32_C (0x7e315aeb), UINT32_C (0x61119a5a),
UINT32_C (0x53245b79), UINT32_C (0x33f6d7b1),
UINT32_C (0xcae8deba), UINT32_C (0x50fc8194),
UINT32_C (0xafa92a6d), UINT32_C (0xc87c8006),
UINT32_C (0x4188bfcd), UINT32_C (0x8bace62e),
UINT32_C (0x78ffa568), UINT32_C (0x5597ec0f),
UINT32_C (0xb4415f7d), UINT32_C (0x08294766),
UINT32_C (0xad567643), UINT32_C (0x09c36f90),
UINT32_C (0x3dde9f39), UINT32_C (0x4a0a283c),
UINT32_C (0x18080c8e), UINT32_C (0x080c79ec),
UINT32_C (0x79ae4c10), UINT32_C (0xcb9e1563),
UINT32_C (0x7cdd662f), UINT32_C (0x62d31911),
UINT32_C (0xa4ca0cf1), UINT32_C (0x5cf824cd),
UINT32_C (0x3b708f99), UINT32_C (0x1e16614c),
UINT32_C (0xb6b9d766), UINT32_C (0x5de87abb),
UINT32_C (0x7229ea81), UINT32_C (0xd5b2d750),
UINT32_C (0x56e6cd21), UINT32_C (0xfe1e42d5),
UINT32_C (0x96da2655), UINT32_C (0xc2b9aa36),
UINT32_C (0xb8f6fd4a), UINT32_C (0x6a158d10),
UINT32_C (0x01913fd3), UINT32_C (0xaf7d1fb8),
UINT32_C (0x0b5e435f), UINT32_C (0x90c10757),
UINT32_C (0x6554abda), UINT32_C (0x7a68710f)
},
{
UINT32_C (0x82ac484f), UINT32_C (0xd7e1c7be),
UINT32_C (0x95c85eaa), UINT32_C (0x94a302f4),
UINT32_C (0x4d3cfbda), UINT32_C (0x786b2908),
UINT32_C (0x1010b275), UINT32_C (0x82d53d12),
UINT32_C (0x21e2a51c), UINT32_C (0x3d1e9150),
UINT32_C (0xb059261d), UINT32_C (0xd0638e1a),
UINT32_C (0x31860f05), UINT32_C (0x81f2864d),
UINT32_C (0xff4cfc35), UINT32_C (0x0451516d),
UINT32_C (0xbd086f26), UINT32_C (0xbc5654c1),
UINT32_C (0x65dfa427), UINT32_C (0xa82427f5),
UINT32_C (0x582e3014), UINT32_C (0xb8d2486d),
UINT32_C (0xc79a1749), UINT32_C (0x9a1d7745),
UINT32_C (0x8766bb54), UINT32_C (0x1e04a7f7),
UINT32_C (0x3d3dff8a), UINT32_C (0xd5ec6bf4),
UINT32_C (0xdbef7d9f), UINT32_C (0x36ec0ea3),
UINT32_C (0x1feb2e4f), UINT32_C (0x15cfcc5c),
UINT32_C (0xd8c423fb), UINT32_C (0xd0ef3cc9),
UINT32_C (0xeb244925), UINT32_C (0xba5590c8),
UINT32_C (0xa5f48ac4), UINT32_C (0x33c5321c),
UINT32_C (0x613b67b2), UINT32_C (0x479c3a22),
UINT32_C (0xe21339cc), UINT32_C (0x10d210aa),
UINT32_C (0x931dd7e2), UINT32_C (0xef05ee06),
UINT32_C (0xb82f2703), UINT32_C (0xa385cb2c),
UINT32_C (0x5d67133c), UINT32_C (0x877eb7b4),
UINT32_C (0x1e3437f7), UINT32_C (0x5afb43ae),
UINT32_C (0x53c078f3), UINT32_C (0x94d90481),
UINT32_C (0x1d964589), UINT32_C (0x08063a85),
UINT32_C (0xe1322228), UINT32_C (0x1956b1e5),
UINT32_C (0x31860f13), UINT32_C (0x2e7b022f),
UINT32_C (0x21182ca3), UINT32_C (0x96f703ac),
UINT32_C (0x46819e2e), UINT32_C (0x0d28fe52),
UINT32_C (0x3724d4dc), UINT32_C (0xa0eabe6b),
UINT32_C (0xc66699fd), UINT32_C (0xc6112fdd),
UINT32_C (0x19c1e69c), UINT32_C (0x04d3658a),
UINT32_C (0x4b55dd99), UINT32_C (0x31907d62),
UINT32_C (0xf854b522), UINT32_C (0x4d678f26),
UINT32_C (0x22ae0582), UINT32_C (0xeafed133),
UINT32_C (0xe4a51d21), UINT32_C (0x84bd6dd6),
UINT32_C (0xc1a51375), UINT32_C (0x3f28ee63),
UINT32_C (0xfb737b1a), UINT32_C (0x70a1660e),
UINT32_C (0x8a8dfaa3), UINT32_C (0x1be79937),
UINT32_C (0xf7476978), UINT32_C (0x513c1764),
UINT32_C (0x531ac6bf), UINT32_C (0x12c06908),
UINT32_C (0x001cdb95), UINT32_C (0x1a4b6a53),
UINT32_C (0xd067fce5), UINT32_C (0x12b2cfb6),
UINT32_C (0x9ddb477f), UINT32_C (0x740e0066),
UINT32_C (0x39ddf25a), UINT32_C (0xcc8bfa2d),
UINT32_C (0xf1b20eaf), UINT32_C (0x64f2632c),
UINT32_C (0x9783cdee), UINT32_C (0x63bfd4d8),
UINT32_C (0x0084cfe5), UINT32_C (0x75f4e9e2),
UINT32_C (0x19b48fd0), UINT32_C (0x6c48ddd8),
UINT32_C (0x7a36af93), UINT32_C (0x71865c4c),
UINT32_C (0x9ce0199d), UINT32_C (0x867027d7),
UINT32_C (0x2cb7b77f), UINT32_C (0x84ef01da),
UINT32_C (0x72f5972f), UINT32_C (0x040f7074),
UINT32_C (0xdf9afa29), UINT32_C (0xc921f94e),
UINT32_C (0x75c08a36), UINT32_C (0x18c1ef9a),
UINT32_C (0xd649a428), UINT32_C (0xc5b71937),
UINT32_C (0x8a30738a), UINT32_C (0xd97cd348),
UINT32_C (0x858129a6), UINT32_C (0x239e3b0a),
UINT32_C (0xbbb8abc4), UINT32_C (0x80fac4c2),
UINT32_C (0xecfcf20b), UINT32_C (0xd9d711f9),
UINT32_C (0xe2a4ef71), UINT32_C (0xb5fe87c0),
UINT32_C (0xbe8b06b2), UINT32_C (0xaafef5a7),
UINT32_C (0x9c15db3b), UINT32_C (0x0aeb8165),
UINT32_C (0x4389a84a), UINT32_C (0x253b1d7a),
UINT32_C (0x19047c79), UINT32_C (0x7cdc78a2),
UINT32_C (0xd20adf03), UINT32_C (0x56f55a71),
UINT32_C (0x3e730fa8), UINT32_C (0xfd8650d8),
UINT32_C (0x959e234e), UINT32_C (0xb7546681),
UINT32_C (0xdad1b22a), UINT32_C (0x142a6e85),
UINT32_C (0x8ef4bce6), UINT32_C (0x68235b9d),
UINT32_C (0x85a13f85), UINT32_C (0x74096ae7),
UINT32_C (0xa949bea2), UINT32_C (0x29322d0d),
UINT32_C (0xd5683858), UINT32_C (0x82846526),
UINT32_C (0x403dae08), UINT32_C (0x6dd1943a),
UINT32_C (0xe1279bff), UINT32_C (0x9e7e4f04),
UINT32_C (0x1c3a4524), UINT32_C (0x484525e4),
UINT32_C (0x81d4cc5f), UINT32_C (0xe24124c0),
UINT32_C (0x037464c0), UINT32_C (0xbf1bd691),
UINT32_C (0x26ceb003), UINT32_C (0x275ead3a),
UINT32_C (0xc5bde908), UINT32_C (0x26414ff3),
UINT32_C (0xa30519ad), UINT32_C (0xd7b43abe),
UINT32_C (0x2ce5d3d5), UINT32_C (0x88412761),
UINT32_C (0x97ca2070), UINT32_C (0xe5fbb9c7),
UINT32_C (0x276df0b4), UINT32_C (0x308f751f),
UINT32_C (0x37a97df6), UINT32_C (0xc9cd808c),
UINT32_C (0xfe4cb380), UINT32_C (0x3d469303),
UINT32_C (0xaee19096), UINT32_C (0xc0d5d42a),
UINT32_C (0x4e823ad3), UINT32_C (0xf5f9cc3b),
UINT32_C (0x4286619c), UINT32_C (0x9ca45e1c),
UINT32_C (0x66c97340), UINT32_C (0x891aec49),
UINT32_C (0x45bae606), UINT32_C (0xc798f047),
UINT32_C (0x52649d6c), UINT32_C (0xce86fdfc),
UINT32_C (0x80c6e402), UINT32_C (0xd6ec2f2b),
UINT32_C (0x27c82282), UINT32_C (0x1fe26ce0),
UINT32_C (0x92f57ea7), UINT32_C (0xde462f4d),
UINT32_C (0x07497cae), UINT32_C (0x5a48755c),
UINT32_C (0x721502dd), UINT32_C (0x6cbe7935),
UINT32_C (0x836d8003), UINT32_C (0x9ead7f70),
UINT32_C (0x9ab3a42f), UINT32_C (0x4c8652d6),
UINT32_C (0x32e39273), UINT32_C (0xe8fa3860),
UINT32_C (0x1da4f25a), UINT32_C (0x0cd6ef81),
UINT32_C (0x02503f7d), UINT32_C (0x8854a0a1),
UINT32_C (0x9a30c4e8), UINT32_C (0x88157153),
UINT32_C (0x05efe294), UINT32_C (0x57c4c925),
UINT32_C (0x2887d96f), UINT32_C (0xc1a71e3c),
UINT32_C (0xe9f84163), UINT32_C (0x2d0985de),
UINT32_C (0xd21e796c), UINT32_C (0x6fb5ce56),
UINT32_C (0x02614abf), UINT32_C (0xc3c7be2c),
UINT32_C (0xb54fed6f), UINT32_C (0xa617a083),
UINT32_C (0xc3142d8f), UINT32_C (0x6079e4ce),
UINT32_C (0xceffc147), UINT32_C (0x1d0cb81b),
UINT32_C (0xdc153e5f), UINT32_C (0xe36ef5bb),
UINT32_C (0xd531161a), UINT32_C (0x165b1015),
UINT32_C (0x7aa114ed), UINT32_C (0x3f7579b3),
UINT32_C (0xf7f395f1), UINT32_C (0xbc6172c7),
UINT32_C (0xa86f875e), UINT32_C (0x0e6c51b3),
UINT32_C (0xcdfec2af), UINT32_C (0x73c0e762),
UINT32_C (0x824c2009), UINT32_C (0xc5a87748),
UINT32_C (0x94d40125), UINT32_C (0x8aba3ffb),
UINT32_C (0xd32be060), UINT32_C (0x8c17eff0),
UINT32_C (0x21e2547e), UINT32_C (0x07cffad9),
UINT32_C (0x05340e15), UINT32_C (0xf3310c92),
UINT32_C (0x9d8d1908), UINT32_C (0x86ba527f),
UINT32_C (0xf943f672), UINT32_C (0xef73fbf0),
UINT32_C (0x46d95ca5), UINT32_C (0xc54cd95b),
UINT32_C (0x9d855e89), UINT32_C (0x4bb5af29)
}
#else
{
UINT64_C (0x12a8f216af9418c2), UINT64_C (0xd4490ad526f14431),
UINT64_C (0xb49c3b3995091a36), UINT64_C (0x5b45e522e4b1b4ef),
UINT64_C (0xa1e9300cd8520548), UINT64_C (0x49787fef17af9924),
UINT64_C (0x03219a39ee587a30), UINT64_C (0xebe9ea2adf4321c7),
UINT64_C (0x804456af10f5fb53), UINT64_C (0xd74bbe77e6116ac7),
UINT64_C (0x7c0828dd624ec390), UINT64_C (0x14a195640116f336),
UINT64_C (0x2eab8ca63ce802d7), UINT64_C (0xc6e57a78fbd986e0),
UINT64_C (0x58efc10b06a2068d), UINT64_C (0xabeeddb2dde06ff1),
UINT64_C (0x0b090a7560a968e3), UINT64_C (0x2cf9c8ca052f6e9f),
UINT64_C (0x116d0016cb948f09), UINT64_C (0xa59e0bd101731a28),
UINT64_C (0x63767572ae3d6174), UINT64_C (0xab4f6451cc1d45ec),
UINT64_C (0xc2a1e7b5b459aeb5), UINT64_C (0x2472f6207c2d0484),
UINT64_C (0xe699ed85b0dfb40d), UINT64_C (0xd4347f66ec8941c3),
UINT64_C (0xf4d14597e660f855), UINT64_C (0x8b889d624d44885d),
UINT64_C (0x258e5a80c7204c4b), UINT64_C (0xaf0c317d32adaa8a),
UINT64_C (0x9c4cd6257c5a3603), UINT64_C (0xeb3593803173e0ce),
UINT64_C (0x36f60e2ba4fa6800), UINT64_C (0x38b6525c21a42b0e),
UINT64_C (0xf4f5d05c10cab243), UINT64_C (0xcf3f4688801eb9aa),
UINT64_C (0x1ddc0325259b27de), UINT64_C (0xb9571fa04dc089c8),
UINT64_C (0xd7504dfa8816edbb), UINT64_C (0x1fe2cca76517db90),
UINT64_C (0x261e4e4c0a333a9d), UINT64_C (0x219b97e26ffc81bd),
UINT64_C (0x66b4835d9eafea22), UINT64_C (0x4cc317fb9cddd023),
UINT64_C (0x50b704cab602c329), UINT64_C (0xedb454e7badc0805),
UINT64_C (0x9e17e49642a3e4c1), UINT64_C (0x66c1a2a1a60cd889),
UINT64_C (0x7983eed3740847d5), UINT64_C (0x298af231c85bafab),
UINT64_C (0x2680b122baa28d97), UINT64_C (0x734de8181f6ec39a),
UINT64_C (0x53898e4c3910da55), UINT64_C (0x1761f93a44d5aefe),
UINT64_C (0xe4dbf0634473f5d2), UINT64_C (0x4ed0fe7e9dc91335),
UINT64_C (0xd18d8549d140caea), UINT64_C (0x1cfc8bed0d681639),
UINT64_C (0xca1e3785a9e724e5), UINT64_C (0xb67c1fa481680af8),
UINT64_C (0xdfea21ea9e7557e3), UINT64_C (0xd6b6d0ecc617c699),
UINT64_C (0xfa7e393983325753), UINT64_C (0xa09e8c8c35ab96de),
UINT64_C (0x8fe88b57305e2ab6), UINT64_C (0x89039d79d6fc5c5c),
UINT64_C (0x9bfb227ebdf4c5ce), UINT64_C (0x7f7cc39420a3a545),
UINT64_C (0x3f6c6af859d80055), UINT64_C (0xc8763c5b08d1908c),
UINT64_C (0x469356c504ec9f9d), UINT64_C (0x26e6db8ffdf5adfe),
UINT64_C (0x3a938fee32d29981), UINT64_C (0x2c5e9deb57ef4743),
UINT64_C (0x1e99b96e70a9be8b), UINT64_C (0x764dbeae7fa4f3a6),
UINT64_C (0xaac40a2703d9bea0), UINT64_C (0x1a8c1e992b941148),
UINT64_C (0x73aa8a564fb7ac9e), UINT64_C (0x604d51b25fbf70e2),
UINT64_C (0xdd69a0d8ab3b546d), UINT64_C (0x65ca5b96b7552210),
UINT64_C (0x2fd7e4b9e72cd38c), UINT64_C (0x51d2b1ab2ddfb636),
UINT64_C (0x9d1d84fcce371425), UINT64_C (0xa44cfe79ae538bbe),
UINT64_C (0xde68a2355b93cae6), UINT64_C (0x9fc10d0f989993e0),
UINT64_C (0x94ebc8abcfb56dae), UINT64_C (0xd7a023a73260b45c),
UINT64_C (0x72c8834a5957b511), UINT64_C (0x8f8419a348f296bf),
UINT64_C (0x1e152328f3318dea), UINT64_C (0x4838d65f6ef6748f),
UINT64_C (0xd6bf7baee43cac40), UINT64_C (0x13328503df48229f),
UINT64_C (0x7440fb816508c4fe), UINT64_C (0x9d266d6a1cc0542c),
UINT64_C (0x4dda48153c94938a), UINT64_C (0x74c04bf1790c0efe),
UINT64_C (0xe1925c71285279f5), UINT64_C (0x8a8e849eb32781a5),
UINT64_C (0x073973751f12dd5e), UINT64_C (0xa319ce15b0b4db31),
UINT64_C (0x6dd856d94d259236), UINT64_C (0x67378d8eccef96cb),
UINT64_C (0x9fc477de4ed681da), UINT64_C (0xf3b8b6675a6507ff),
UINT64_C (0xc3a9dc228caac9e9), UINT64_C (0xc37b45b3f8d6f2ba),
UINT64_C (0xb559eb1d04e5e932), UINT64_C (0x1b0cab936e65c744),
UINT64_C (0xaf08da9177dda93d), UINT64_C (0xac12fb171817eee7),
UINT64_C (0x1fff7ac80904bf45), UINT64_C (0xa9119b60369ffebd),
UINT64_C (0xbfced1b0048eac50), UINT64_C (0xb67b7896167b4c84),
UINT64_C (0x9b3cdb65f82ca382), UINT64_C (0xdbc27ab5447822bf),
UINT64_C (0x10dcd78e3851a492), UINT64_C (0xb438c2b67f98e5e9),
UINT64_C (0x43954b3252dc25e5), UINT64_C (0xab9090168dd05f34),
UINT64_C (0xce68341f79893389), UINT64_C (0x36833336d068f707),
UINT64_C (0xdcdd7d20903d0c25), UINT64_C (0xda3a361b1c5157b1),
UINT64_C (0x7f9d1a2e1ebe1327), UINT64_C (0x5d0a12f27ad310d1),
UINT64_C (0x3bc36e078f7515d7), UINT64_C (0x4da8979a0041e8a9),
UINT64_C (0x950113646d1d6e03), UINT64_C (0x7b4a38e32537df62),
UINT64_C (0x8a1b083821f40cb4), UINT64_C (0x3d5774a11d31ab39),
UINT64_C (0x7a76956c3eafb413), UINT64_C (0x7f5126dbba5e0ca7),
UINT64_C (0x12153635b2c0cf57), UINT64_C (0x7b3f0195fc6f290f),
UINT64_C (0x5544f7d774b14aef), UINT64_C (0x56c074a581ea17fe),
UINT64_C (0xe7f28ecd2d49eecd), UINT64_C (0xe479ee5b9930578c),
UINT64_C (0x9ff38fed72e9052f), UINT64_C (0x9f65789a6509a440),
UINT64_C (0x0981dcd296a8736d), UINT64_C (0x5873888850659ae7),
UINT64_C (0xc678b6d860284a1c), UINT64_C (0x63e22c147b9c3403),
UINT64_C (0x92fae24291f2b3f1), UINT64_C (0x829626e3892d95d7),
UINT64_C (0xcffe1939438e9b24), UINT64_C (0x79999cdff70902cb),
UINT64_C (0x8547eddfb81ccb94), UINT64_C (0x7b77497b32503b12),
UINT64_C (0x97fcaacbf030bc24), UINT64_C (0x6ced1983376fa72b),
UINT64_C (0x7e75d99d94a70f4d), UINT64_C (0xd2733c4335c6a72f),
UINT64_C (0xdbc0d2b6ab90a559), UINT64_C (0x94628d38d0c20584),
UINT64_C (0x64972d68dee33360), UINT64_C (0xb9c11d5b1e43a07e),
UINT64_C (0x2de0966daf2f8b1c), UINT64_C (0x2e18bc1ad9704a68),
UINT64_C (0xd4dba84729af48ad), UINT64_C (0xb7a0b174cff6f36e),
UINT64_C (0xe94c39a54a98307f), UINT64_C (0xaa70b5b4f89695a2),
UINT64_C (0x3bdbb92c43b17f26), UINT64_C (0xcccb7005c6b9c28d),
UINT64_C (0x18a6a990c8b35ebd), UINT64_C (0xfc7c95d827357afa),
UINT64_C (0x1fca8a92fd719f85), UINT64_C (0x1dd01aafcd53486a),
UINT64_C (0x49353fea39ba63b1), UINT64_C (0xf85b2b4fbcde44b7),
UINT64_C (0xbe7444e39328a0ac), UINT64_C (0x3e2b8bcbf016d66d),
UINT64_C (0x964e915cd5e2b207), UINT64_C (0x1725cabfcb045b00),
UINT64_C (0x7fbf21ec8a1f45ec), UINT64_C (0x11317ba87905e790),
UINT64_C (0x2fe4b17170e59750), UINT64_C (0xe8d9ecbe2cf3d73f),
UINT64_C (0xb57d2e985e1419c7), UINT64_C (0x0572b974f03ce0bb),
UINT64_C (0xa8d7e4dab780a08d), UINT64_C (0x4715ed43e8a45c0a),
UINT64_C (0xc330de426430f69d), UINT64_C (0x23b70edb1955c4bf),
UINT64_C (0x098954d51fff6580), UINT64_C (0x8107fccf064fcf56),
UINT64_C (0x852f54934da55cc9), UINT64_C (0x09c7e552bc76492f),
UINT64_C (0xe9f6760e32cd8021), UINT64_C (0xa3bc941d0a5061cb),
UINT64_C (0xba89142e007503b8), UINT64_C (0xdc842b7e2819e230),
UINT64_C (0xbbe83f4ecc2bdecb), UINT64_C (0xcd454f8f19c5126a),
UINT64_C (0xc62c58f97dd949bf), UINT64_C (0x693501d628297551),
UINT64_C (0xb9ab4ce57f2d34f3), UINT64_C (0x9255abb50d532280),
UINT64_C (0xebfafa33d7254b59), UINT64_C (0xe9f6082b05542e4e),
UINT64_C (0x35dd37d5871448af), UINT64_C (0xb03031a8b4516e84),
UINT64_C (0xb3f256d8aca0b0b9), UINT64_C (0x0fd22063edc29fca),
UINT64_C (0xd9a11fbb3d9808e4), UINT64_C (0x3a9bf55ba91f81ca),
UINT64_C (0xc8c93882f9475f5f), UINT64_C (0x947ae053ee56e63c),
UINT64_C (0xc7d9f16864a76e94), UINT64_C (0x7bd94e1d8e17debc),
UINT64_C (0xd873db391292ed4f), UINT64_C (0x30f5611484119414),
UINT64_C (0x565c31f7de89ea27), UINT64_C (0xd0e4366228b03343),
UINT64_C (0x325928ee6e6f8794), UINT64_C (0x6f423357e7c6a9f9),
UINT64_C (0x99170a5dc3115544), UINT64_C (0x59b97885e2f2ea28),
UINT64_C (0xbc4097b116c524d2), UINT64_C (0x7a13f18bbedc4ff5),
UINT64_C (0x071582401c38434d), UINT64_C (0xb422061193d6f6a7),
UINT64_C (0xb4b81b3fa97511e2), UINT64_C (0x65d34954daf3cebd),
UINT64_C (0xb344c470397bba52), UINT64_C (0xbac7a9a18531294b),
UINT64_C (0xecb53939887e8175), UINT64_C (0x565601c0364e3228),
UINT64_C (0xef1955914b609f93), UINT64_C (0x16f50edf91e513af),
UINT64_C (0x56963b0dca418fc0), UINT64_C (0xd60f6dcedc314222),
UINT64_C (0x364f6ffa464ee52e), UINT64_C (0x6c3b8e3e336139d3),
UINT64_C (0xf943aee7febf21b8), UINT64_C (0x088e049589c432e0),
UINT64_C (0xd49503536abca345), UINT64_C (0x3a6c27934e31188a),
UINT64_C (0x957baf61700cff4e), UINT64_C (0x37624ae5a48fa6e9),
UINT64_C (0x501f65edb3034d07), UINT64_C (0x907f30421d78c5de),
UINT64_C (0x1a804aadb9cfa741), UINT64_C (0x0ce2a38c344a6eed),
UINT64_C (0xd363eff5f0977996), UINT64_C (0x2cd16e2abd791e33),
UINT64_C (0x58627e1a149bba21), UINT64_C (0x7f9b6af1ebf78baf)
},
{
UINT64_C (0xd20d8c88c8ffe65f), UINT64_C (0x917f1dd5f8886c61),
UINT64_C (0x56986e2ef3ed091b), UINT64_C (0x5fa7867caf35e149),
UINT64_C (0x81a1549fd6573da5), UINT64_C (0x96fbf83a12884624),
UINT64_C (0xe728e8c83c334074), UINT64_C (0xf1bcc3d275afe51a),
UINT64_C (0x71f1ce2490d20b07), UINT64_C (0xe6c42178c4bbb92e),
UINT64_C (0x0a9c32d5eae45305), UINT64_C (0x0c335248857fa9e7),
UINT64_C (0x142de49fff7a7c3d), UINT64_C (0x64a53dc924fe7ac9),
UINT64_C (0x9f6a419d382595f4), UINT64_C (0x150f361dab9dec26),
UINT64_C (0xc61bb3a141e50e8c), UINT64_C (0x2785338347f2ba08),
UINT64_C (0x7ca9723fbb2e8988), UINT64_C (0xce2f8642ca0712dc),
UINT64_C (0x59300222b4561e00), UINT64_C (0xc2b5a03f71471a6f),
UINT64_C (0xd5f9e858292504d5), UINT64_C (0x65fa4f227a2b6d79),
UINT64_C (0x93cbe0b699c2585d), UINT64_C (0x1d95b0a5fcf90bc6),
UINT64_C (0x17efee45b0dee640), UINT64_C (0x9e4c1269baa4bf37),
UINT64_C (0xd79476a84ee20d06), UINT64_C (0x0a56a5f0bfe39272),
UINT64_C (0x7eba726d8c94094b), UINT64_C (0x5e5637885f29bc2b),
UINT64_C (0xd586bd01c5c217f6), UINT64_C (0x233003b5a6cfe6ad),
UINT64_C (0x24c0e332b70019b0), UINT64_C (0x9da058c67844f20c),
UINT64_C (0xe4d9429322cd065a), UINT64_C (0x1fab64ea29a2ddf7),
UINT64_C (0x8af38731c02ba980), UINT64_C (0x7dc7785b8efdfc80),
UINT64_C (0x486289ddcc3d6780), UINT64_C (0x222bbfae61725606),
UINT64_C (0x2bc60a63a6f3b3f2), UINT64_C (0x177e00f9fc32f791),
UINT64_C (0x522e23f3925e319e), UINT64_C (0x9c2ed44081ce5fbd),
UINT64_C (0x964781ce734b3c84), UINT64_C (0xf05d129681949a4c),
UINT64_C (0x046e3ecaaf453ce9), UINT64_C (0x962aceefa82e1c84),
UINT64_C (0xf5b4b0b0d2deeeb4), UINT64_C (0x1af3dbe25d8f45da),
UINT64_C (0xf9f4892ed96bd438), UINT64_C (0xc4c118bfe78feaae),
UINT64_C (0x07a69afdcc42261a), UINT64_C (0xf8549e1a3aa5e00d),
UINT64_C (0x2102ae466ebb1148), UINT64_C (0xe87fbb46217a360e),
UINT64_C (0x310cb380db6f7503), UINT64_C (0xb5fdfc5d3132c498),
UINT64_C (0xdaf8e9829fe96b5f), UINT64_C (0xcac09afbddd2cdb4),
UINT64_C (0xb862225b055b6960), UINT64_C (0x55b6344cf97aafae),
UINT64_C (0xff577222c14f0a3a), UINT64_C (0x4e4b705b92903ba4),
UINT64_C (0x730499af921549ff), UINT64_C (0x13ae978d09fe5557),
UINT64_C (0xd9e92aa246bf719e), UINT64_C (0x7a4c10ec2158c4a6),
UINT64_C (0x49cad48cebf4a71e), UINT64_C (0xcf05daf5ac8d77b0),
UINT64_C (0xabbdcdd7ed5c0860), UINT64_C (0x9853eab63b5e0b35),
UINT64_C (0x352787baa0d7c22f), UINT64_C (0xc7f6aa2de59aea61),
UINT64_C (0x03727073c2e134b1), UINT64_C (0x5a0f544dd2b1fb18),
UINT64_C (0x74f85198b05a2e7d), UINT64_C (0x963ef2c96b33be31),
UINT64_C (0x4659d2b743848a2c), UINT64_C (0x19ebb029435dcb0f),
UINT64_C (0x4e9d2827355fc492), UINT64_C (0xccec0a73b49c9921),
UINT64_C (0x46c9feb55d120902), UINT64_C (0x8d2636b81555a786),
UINT64_C (0x30c05b1ba332f41c), UINT64_C (0xf6f7fd1431714200),
UINT64_C (0x1a4ff12616eefc89), UINT64_C (0x990a98fd5071d263),
UINT64_C (0x84547ddc3e203c94), UINT64_C (0x07a3aec79624c7da),
UINT64_C (0x8a328a1cedfe552c), UINT64_C (0xd1e649de1e7f268b),
UINT64_C (0x2d8d5432157064c8), UINT64_C (0x4ae7d6a36eb5dbcb),
UINT64_C (0x57e3306d881edb4f), UINT64_C (0x0a804d18b7097475),
UINT64_C (0xe74733427b72f0c1), UINT64_C (0x24b33c9d7ed25117),
UINT64_C (0xe805a1e290cf2456), UINT64_C (0x3b544ebe544c19f9),
UINT64_C (0x3e666e6f69ae2c15), UINT64_C (0xfb152fe3ff26da89),
UINT64_C (0xb49b52e587a1ee60), UINT64_C (0xac042e70f8b383f2),
UINT64_C (0x89c350c893ae7dc1), UINT64_C (0xb592bf39b0364963),
UINT64_C (0x190e714fada5156e), UINT64_C (0xec8177f83f900978),
UINT64_C (0x91b534f885818a06), UINT64_C (0x81536d601170fc20),
UINT64_C (0xd4c718bc4ae8ae5f), UINT64_C (0x9eedeca8e272b933),
UINT64_C (0x10e8b35af3eeab37), UINT64_C (0x0e09b88e1914f7af),
UINT64_C (0x3fa9ddfb67e2f199), UINT64_C (0xb10bb459132d0a26),
UINT64_C (0x2c046f22062dc67d), UINT64_C (0x5e90277e7cb39e2d),
UINT64_C (0xd6b04d3b7651dd7e), UINT64_C (0xe34a1d250e7a8d6b),
UINT64_C (0x53c065c6c8e63528), UINT64_C (0x1bdea12e35f6a8c9),
UINT64_C (0x21874b8b4d2dbc4f), UINT64_C (0x3a88a0fbbcb05c63),
UINT64_C (0x43ed7f5a0fae657d), UINT64_C (0x230e343dfba08d33),
UINT64_C (0xb5b4071dbfc73a66), UINT64_C (0x8f9887e6078735a1),
UINT64_C (0x08de8a1c7797da9b), UINT64_C (0xfcb6be43a9f2fe9b),
UINT64_C (0x049a7f41061a9e60), UINT64_C (0x9f91508bffcfc14a),
UINT64_C (0xe3273522064480ca), UINT64_C (0xcd04f3ff001a4778),
UINT64_C (0x6bfa9aae5ec05779), UINT64_C (0x371f77e76bb8417e),
UINT64_C (0x3550c2321fd6109c), UINT64_C (0xfb4a3d794a9a80d2),
UINT64_C (0xf43c732873f24c13), UINT64_C (0xaa9119ff184cccf4),
UINT64_C (0xb69e38a8965c6b65), UINT64_C (0x1f2b1d1f15f6dc9c),
UINT64_C (0x67fef95d92607890), UINT64_C (0x31865ced6120f37d),
UINT64_C (0x3a6853c7e70757a7), UINT64_C (0x32ab0edb696703d3),
UINT64_C (0xee97f453f06791ed), UINT64_C (0x6dc93d9526a50e68),
UINT64_C (0x78edefd694af1eed), UINT64_C (0x9c1169fa2777b874),
UINT64_C (0x50065e535a213cf6), UINT64_C (0xde0c89a556b9ae70),
UINT64_C (0xd1e0ccd25bb9c169), UINT64_C (0x6b17b224bad6bf27),
UINT64_C (0x6b02e63195ad0cf8), UINT64_C (0x455a4b4cfe30e3f5),
UINT64_C (0x9338e69c052b8e7b), UINT64_C (0x5092ef950a16da0b),
UINT64_C (0x7c45d833aff07862), UINT64_C (0xa5b1cfdba0ab4067),
UINT64_C (0x6ad047c430a12104), UINT64_C (0x6c47bec883a7de39),
UINT64_C (0x944f6de09134dfb6), UINT64_C (0x9aeba33ac6ecc6b0),
UINT64_C (0x52e762596bf68235), UINT64_C (0x22af003ab672e811),
UINT64_C (0xb5635c95ff7296e2), UINT64_C (0xed2df21216235097),
UINT64_C (0x4a29c6465a314cd1), UINT64_C (0xd83cc2687a19255f),
UINT64_C (0x506c11b9d90e8b1d), UINT64_C (0x57277707199b8175),
UINT64_C (0xcaf21ecd4377b28c), UINT64_C (0xc0c0f5a60ef4cdcf),
UINT64_C (0x93b633abfa3469f8), UINT64_C (0xe846963877671a17),
UINT64_C (0x59ac2c7873f910a3), UINT64_C (0x660d3257380841ee),
UINT64_C (0xd813f2fab7f5c5ca), UINT64_C (0x4112cf68649a260e),
UINT64_C (0x443f64ec5a371195), UINT64_C (0xb0774d261cc609db),
UINT64_C (0x720bf5f26f4d2eaa), UINT64_C (0x1c2559e30f0946be),
UINT64_C (0xe328e230e3e2b3fb), UINT64_C (0x087e79e5a57d1d13),
UINT64_C (0x08dd9bdfd96b9f63), UINT64_C (0x64d0e29eea8838b3),
UINT64_C (0xddf957bc36d8b9ca), UINT64_C (0x6ffe73e81b637fb3),
UINT64_C (0x1a4e4822eb4d7a59), UINT64_C (0x5d94337fbfaf7f5b),
UINT64_C (0xd30c088ba61ea5ef), UINT64_C (0x9d765e419fb69f6d),
UINT64_C (0x9e21f4f903b33fd9), UINT64_C (0xb4d8f77bc3e56167),
UINT64_C (0x733ea705fae4fa77), UINT64_C (0xa4ec0132764ca04b),
UINT64_C (0x7976033a39f7d952), UINT64_C (0x106f72fe81e2c590),
UINT64_C (0x8c90fd9b083f4558), UINT64_C (0xfd080d236da814ba),
UINT64_C (0x7b64978555326f9f), UINT64_C (0x60e8ed72c0dff5d1),
UINT64_C (0xb063e962e045f54d), UINT64_C (0x959f587d507a8359),
UINT64_C (0x758f450c88572e0b), UINT64_C (0x1b6baca2ae4e125b),
UINT64_C (0x61cf4f94c97df93d), UINT64_C (0x2738259634305c14),
UINT64_C (0xd39bb9c3a48db6cf), UINT64_C (0x8215e577001332c8),
UINT64_C (0xa1082c0466df6c0a), UINT64_C (0xef02cdd06ffdb432),
UINT64_C (0xfc87614baf287e07), UINT64_C (0x240ab57a8b888b20),
UINT64_C (0xbf8d5108e27e0d48), UINT64_C (0x61bdd1307c66e300),
UINT64_C (0xb925a6cd0421aff3), UINT64_C (0x3e003e616a6591e9),
UINT64_C (0x94c3251f06f90cf3), UINT64_C (0xbf84470805e69b5f),
UINT64_C (0x98f076a4f7a2322e), UINT64_C (0x70cb6af7c2d5bcf0),
UINT64_C (0xb64be8d8b25396c1), UINT64_C (0xa9aa4d20db084e9b),
UINT64_C (0x2e6d02c36017f67f), UINT64_C (0xefed53d75fd64e6b),
UINT64_C (0xd9f1f30ccd97fb09), UINT64_C (0xa2ebee47e2fbfce1),
UINT64_C (0xb8d91274b9e9d4fb), UINT64_C (0x1db956e450275779),
UINT64_C (0x4fc8e9560f91b123), UINT64_C (0x63573ff03e224774),
UINT64_C (0x0647dfedcd894a29), UINT64_C (0x7884d9bc6cb569d8),
UINT64_C (0x7fba195410e5ca30), UINT64_C (0x106c09b972d2e822),
UINT64_C (0x241260ed4ad1e87d), UINT64_C (0x64c8e531bff53b55),
UINT64_C (0xca672b91e9e4fa16), UINT64_C (0x3871700761b3f743),
UINT64_C (0xf95cffa23af5f6f4), UINT64_C (0x8d14dedb30be846e),
UINT64_C (0x3b097adaf088f94e), UINT64_C (0x21e0bd5026c619bf),
UINT64_C (0x1bda0492e7e4586e), UINT64_C (0xd23c8e176d113600),
UINT64_C (0x252f59cf0d9f04bb), UINT64_C (0xb3598080ce64a656),
UINT64_C (0x993e1de72d36d310), UINT64_C (0xa2853b80f17f58ee),
UINT64_C (0x1877b51e57a764d5), UINT64_C (0x001f837cc7350524)
}
#endif
};
int
main (int argc, char **argv)
{
unsigned int i;
isaac_word r[ISAAC_WORDS];
int iterations;
/* Seed with zeros, and discard the first buffer of output,
as that's what the standard programs do. */
static struct isaac_state s;
isaac_seed (&s);
isaac_refill (&s, r);
for (i = 0; i < sizeof expected / sizeof expected[0]; i++)
{
isaac_refill (&s, r);
ASSERT (memcmp (r, expected[i], sizeof r) == 0);
}
/* If invoked with a positive argument, run a benchmark;
if with a negative, run a do-nothing benchmark. */
for (iterations = argc <= 1 ? 0 : strtol (argv[1], NULL, 10);
iterations != 0;
iterations += (iterations < 0 ? 1 : -1))
if (0 <= iterations)
isaac_refill (&s, r);
return 0;
}

2
gnulib

Submodule gnulib updated: 10322ac9be...a81348d2e1

View File

@@ -1 +1,20 @@
include gnulib.mk
AM_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS) $(WERROR_CFLAGS)
# A few tests are inherently warning-evoking.
# In the typical case where we use -Werror, exempt the few offenders.
# test-xvasprintf.c: In function 'test_xasprintf':
# test-xvasprintf.c:100: error: format not a string literal and no \
# format arguments [-Wformat-security]
test_xvasprintf_CFLAGS = $(AM_CFLAGS) \
`test -n '$(WERROR_CFLAGS)' && echo ' -Wno-format-security'`
# test-lock.c: In function 'lock_mutator_thread':
# test-lock.c:148: error: cast from function call of type 'pthread_t' to \
# non-matching type 'void *' [-Wbad-function-cast]
test_lock_CFLAGS = $(AM_CFLAGS) \
`test -n '$(WERROR_CFLAGS)' && echo ' -Wno-bad-function-cast'`
test_tls_CFLAGS = $(AM_CFLAGS) \
`test -n '$(WERROR_CFLAGS)' && echo ' -Wno-bad-function-cast'`

View File

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

View File

@@ -1,6 +1,6 @@
## Makefile for gnulib/lib -*-Makefile-*-
# Copyright (C) 1995-2007, 2009 Free Software Foundation, Inc.
# Copyright (C) 1995-2007, 2009-2011 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -17,11 +17,10 @@
include gnulib.mk
AM_CFLAGS += $(WARN_CFLAGS) # $(WERROR_CFLAGS)
AM_CFLAGS += $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
libcoreutils_a_SOURCES += \
buffer-lcm.c buffer-lcm.h \
xmemxfrm.c xmemxfrm.h
buffer-lcm.c buffer-lcm.h
libcoreutils_a_LIBADD += $(LIBOBJS)
libcoreutils_a_DEPENDENCIES += $(LIBOBJS)

View File

@@ -1,6 +1,6 @@
/* buffer-lcm.c - compute a good buffer size for dealing with two files
Copyright (C) 2002, 2005, 2009 Free Software Foundation, Inc.
Copyright (C) 2002, 2005, 2009-2011 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

@@ -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, 2009 Free Software Foundation, Inc.
Copyright (C) 2005-2006, 2009-2011 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"
@@ -137,6 +130,6 @@ main (int argc, char **argv)
ok = euidaccess_stat (&st, mode);
printf ("%s: %s\n", file, ok ? "y" : "n");
exit (0);
return 0;
}
#endif

View File

@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
Copyright (C) 2005, 2006, 2008-2009 Free Software Foundation, Inc.
Copyright (C) 2005-2006, 2008-2011 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, 2009 Free Software Foundation, Inc.
Copyright (C) 2005, 2009-2011 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

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