platform/upstream/coreutils.git
13 years agomaint: remove unneeded includes
Pádraig Brady [Fri, 3 Jun 2011 09:27:16 +0000 (10:27 +0100)]
maint: remove unneeded includes

Remove unneeded includes as reported by:
http://code.google.com/p/include-what-you-use/

* src/cp-hash.c: Remove unused include.
* src/dd.c: Likewise.
* src/du.c: Likewise.
* src/head.c: Likewise.
* src/kill.c: Likewise.
* src/ls.c: Likewise.
* src/stdbuf.c: Likewise.
* src/timeout.c: Likewise.
* src/truncate.c: Likewise.

13 years agodoc: add examples to date --help
Pádraig Brady [Thu, 2 Jun 2011 12:00:18 +0000 (13:00 +0100)]
doc: add examples to date --help

* src/date.c (usage): Add examples for TZ handling,
and "seconds since epoch" parsing, neither of which
was mentioned in the man page until now.
* THANKS.in: Add Rick.
Suggested by Rick Stanley.

13 years agobuild: require at least 2-year old autoconf-2.64 (was 2.62)
Jim Meyering [Fri, 3 Jun 2011 11:28:15 +0000 (13:28 +0200)]
build: require at least 2-year old autoconf-2.64 (was 2.62)

* configure.ac: Require autoconf-2.64, which is nearly two years old.
* src/system.h (emit_ancillary_info): Use PACKAGE_URL, now that we
require autoconf-2.64.

13 years agomaint: remove now-spurious curly braces
Jim Meyering [Fri, 3 Jun 2011 11:29:15 +0000 (13:29 +0200)]
maint: remove now-spurious curly braces

* src/chown-core.c (restricted_chown): Remove FIXME comment and
superfluous curly braces.

13 years agotests: stat-free-color: accommodate stat of /selinux on rawhide
Jim Meyering [Wed, 1 Jun 2011 14:08:21 +0000 (16:08 +0200)]
tests: stat-free-color: accommodate stat of /selinux on rawhide

* tests/ls/stat-free-color: This test recently began to fail on
rawhide because dynamic library start-up code now stats "/selinux",
making the total number of calls 2 rather than the prior 1.
Create two more dangling symlinks, so that any erroneous stat-
or lstat-calling code will get at least those three.

13 years agoyes.c: do not use exit after error
Marek Polacek [Fri, 27 May 2011 07:25:11 +0000 (09:25 +0200)]
yes.c: do not use exit after error

I think it would be better to exit through the error() and not
to call the exit() after the error().  This way we can get rid of
one function call (and curly brackets).

* src/yes.c (main): Exit through the error(), remove exit() call
after error().

13 years agotail: fix an inconsequential bug spotted by coverity
Jim Meyering [Wed, 1 Jun 2011 11:48:12 +0000 (13:48 +0200)]
tail: fix an inconsequential bug spotted by coverity

* src/tail.c (start_bytes): Increase *READ_POS (not READ_POS)
by the number of bytes read.  This is a real bug that happens
to have no consequence in practice.  First, this code is exercised
only when tailing-forever a non-regular file by bytes, and with a
start-relative offset, e.g., "mkfifo f; tail -f -c +3 f", but even
then, the invalid READ_POS value does not influence how tail works.
It is stored in the File_spec.size member, but that member is not
used at all in tail_forever_inotify, and in tail_forever, it is
used only when the File_spec refers to a regular file.

13 years ago* doc/coreutils.texi (sort invocation): I/0 -> I/O (sr#107504)
Paul Eggert [Tue, 31 May 2011 16:58:59 +0000 (09:58 -0700)]
* doc/coreutils.texi (sort invocation): I/0 -> I/O (sr#107504)

13 years agomaint: remove unnecessary gnulib .diff file
Jim Meyering [Sun, 29 May 2011 12:29:13 +0000 (14:29 +0200)]
maint: remove unnecessary gnulib .diff file

* gl/modules/getloadavg.diff: Remove file.  It stopped being
useful back in February.
* Makefile.am (EXTRA_DIST): Remove it.

13 years agomaint: placate -Wsign-compare when it's non-invasive
Jim Meyering [Sun, 29 May 2011 09:28:29 +0000 (11:28 +0200)]
maint: placate -Wsign-compare when it's non-invasive

* src/stdbuf.c: Declare loop index to be unsigned.

13 years agols: placate gcc-4.7.0's -Wstrict-overflow
Jim Meyering [Sat, 28 May 2011 20:10:00 +0000 (22:10 +0200)]
ls: placate gcc-4.7.0's -Wstrict-overflow

* src/ls.c (enum parse_state): Define.
(parse_ls_color): Use enum names in place of constants,
thus avoiding the offending -1.

13 years agomaint: remove useless (off_t) cast of lseek arg
Jim Meyering [Sat, 28 May 2011 11:52:13 +0000 (13:52 +0200)]
maint: remove useless (off_t) cast of lseek arg

* src/wc.c (wc): Remove unnecessary cast.
* src/head.c (elide_tail_bytes_file, elide_tail_lines_file): Likewise.
* src/tac.c (tac_seekable, tac_file): Likewise.

13 years agotests: move tests/misc/split-* into tests/split/...
Jim Meyering [Thu, 26 May 2011 22:54:53 +0000 (00:54 +0200)]
tests: move tests/misc/split-* into tests/split/...

* tests/split/suffix-length: Rename from tests/misc/split-a.
* tests/split/b-chunk: Rename from misc/split-bchunk.
* tests/split/fail: Rename from tests/misc/split-fail.
* tests/split/lines: Rename from tests/misc/split-l.
* tests/split/l-chunk: Rename from tests/misc/split-lchunk.
* tests/split/r-chunk: Rename from tests/misc/split-rchunk.
* tests/Makefile.am (TESTS): Reflect renaming.

13 years agochown,chgrp: output the original ownership in -v messages
Pádraig Brady [Fri, 27 May 2011 22:07:08 +0000 (23:07 +0100)]
chown,chgrp: output the original ownership in -v messages

* src/chown-core.c (describe_change): Output the
original owner if possible.
(user_group_str): Handle the case when neither
owner or group are passed.
* NEWS: Mention the change in behavior.

13 years agochown,chgrp: output the correct ownership in -v messages
Pádraig Brady [Thu, 26 May 2011 10:15:11 +0000 (11:15 +0100)]
chown,chgrp: output the correct ownership in -v messages

* src/chown_core.c (describe_change): Accept the ownership of
the original file and output that when not changing.
This is significant when --from is specified as then
the original and specified ownership may be different.
(user_group_str): A new helper function refactored from
describe_change().
(change_file_owner): Pass the original user and group
strings to describe_change().
* test/chown/basic: Add a test case.
* NEWS: Mention the fix.

13 years agomaint: fix a -Wstrict-overflow build failure with gcc 4.5
Pádraig Brady [Thu, 26 May 2011 23:39:55 +0000 (00:39 +0100)]
maint: fix a -Wstrict-overflow build failure with gcc 4.5

* src/ls.c (print_color_indicator): Avoid the warning by
not decrementing the integer.

13 years agobuild: --enable-gcc-warnings: enable -Wstrict-overflow in src/
Jim Meyering [Wed, 25 May 2011 12:34:13 +0000 (14:34 +0200)]
build: --enable-gcc-warnings: enable -Wstrict-overflow in src/

* configure.ac (WARN_CFLAGS): Don't turn off -Wstrict-overflow.
(GNULIB_WARN_CFLAGS): Remove -Wstrict-overflow from the list of
warning options used in lib/.
Normally I find that -Wstrict-overflow produces too many false
positives, but considering that it warns of the bug reported in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498, I now think
it is worthwhile.  The lesser of two evils.
Thanks to Daniel Veillard for showing me the gcc bug report.

13 years agomaint: accommodate gcc's -Wstrict-overflow option
Jim Meyering [Wed, 25 May 2011 10:29:18 +0000 (12:29 +0200)]
maint: accommodate gcc's -Wstrict-overflow option

* src/factor.c (factor_using_pollard_rho): Change type of "i"
to unsigned to avoid warning from gcc's -Wstrict-overflow.
* src/expr.c: Use an unsigned intermediate.
* src/dircolors.c (main): Reorder operations to avoid the risk of
pointer overflow.
* src/tr.c (squeeze_filter): Change NOT_A_CHAR from an anonymous
"enum" to an "int", to avoid this warning:
tr.c:1624:10: error: assuming signed overflow does not occur when
  simplifying conditional to constant [-Werror=strict-overflow]
* src/pr.c (main): Make index "i" unsigned.

13 years agomaint: enforce cpp indentation policy
Jim Meyering [Wed, 25 May 2011 10:31:15 +0000 (12:31 +0200)]
maint: enforce cpp indentation policy

* cfg.mk (sc_preprocessor_indentation): New test, from libvirt.
Exempt 3 files from new cppi test.
* gl/lib/randread.c: Adjust cpp indentation to comply.
* src/extent-scan.c (extent_need_sync): Likewise.

13 years agomaint: env.c: remove unnecessary use of strchr
Jim Meyering [Wed, 25 May 2011 20:27:53 +0000 (22:27 +0200)]
maint: env.c: remove unnecessary use of strchr

* src/env.c (main): Remove excess (and confusing to static analyzers)
use of strchr.

13 years agoshred: placate coverity and fix a comment
Jim Meyering [Wed, 25 May 2011 19:35:50 +0000 (21:35 +0200)]
shred: placate coverity and fix a comment

* src/shred.c (incname): Add an assertion to tell static analyzers
that we know this particular use of strchr never returns NULL.
Finish incomplete sentence in function-describing comment.

13 years agomaint: split: remove --filter specific code from other paths
Pádraig Brady [Fri, 20 May 2011 00:10:58 +0000 (01:10 +0100)]
maint: split: remove --filter specific code from other paths

* src/split.c (lines_chunk_split): Don't use ignore_error() which
is redundant and confusing when not running with --filter.
(lines_rr): Likewise.
(ofile_open): Likewise. Add a comment to clarify that
filters aren't restarted under file descriptor pressure.

13 years agosplit: diagnose when --filter is used with a chunk number
Pádraig Brady [Fri, 20 May 2011 00:18:28 +0000 (01:18 +0100)]
split: diagnose when --filter is used with a chunk number

* src/split.c (main): Exit with a diagnostic if --filter
is specified along with a specific chunk number.
* test/split/filter: Ensure this combination fails.

13 years agosplit: exit when we can no longer write to a --filter
Pádraig Brady [Fri, 20 May 2011 00:26:41 +0000 (01:26 +0100)]
split: exit when we can no longer write to a --filter

* src/split.c (bytes_split): Stop reading when we
can no longer write to a child process.
(lines_rr): Likewise.
(lines_bytes_split): No change is made here since
input is bounded by the original file size.
* test/split/filter: Add test cases.

13 years agosplit: return success even if a --filter exits
Pádraig Brady [Thu, 19 May 2011 22:23:23 +0000 (23:23 +0100)]
split: return success even if a --filter exits

src/split.c (main): Don't unblock SIGPIPE before cleanup,
as then any pending signals will be sent and cause
the main split process to exit with a non zero status (141).
* test/split/filter: Add a test for this case.

13 years agosplit: fix an edge case where -n l/... creates an extra file
Pádraig Brady [Wed, 25 May 2011 12:05:37 +0000 (13:05 +0100)]
split: fix an edge case where -n l/... creates an extra file

* src/split.c (lines_bytes_chunk): Handle the edge case
where the file is truncated as we read.
* tests/misc/split-lchunk: Cleanup; no functional change.

13 years agochmod: output the original mode in verbose mode
Bernhard Voelker [Wed, 25 May 2011 21:11:08 +0000 (22:11 +0100)]
chmod: output the original mode in verbose mode

* src/chmod.c (describe_change): Pass in the original mode,
and output this in the messages.
* tests/chmod/c-option: Adjust as per the new message.
* THANKS.in: Remove the now auto-generated name.
* NEWS: Mention the change in behavior.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
13 years agotests: ls/stat-free-color: fix unwarranted failure on a 32-bit system
Jim Meyering [Wed, 25 May 2011 05:35:59 +0000 (07:35 +0200)]
tests: ls/stat-free-color: fix unwarranted failure on a 32-bit system

* tests/ls/stat-free-color: Also check for stat64 and lstat64 syscalls.
This fixes a test failure reported by Stefano Lattarini.

13 years agomaint: accommodate gnulib's newer tight_scope rule
Jim Meyering [Tue, 24 May 2011 18:40:16 +0000 (20:40 +0200)]
maint: accommodate gnulib's newer tight_scope rule

* cfg.mk: Include via "-include", to accommodate new tight-scope rule.
(sc_check-AUTHORS): Change the name of the rule in src/Makefile.am
to _sc_check-AUTHORS, so it doesn't conflict with this one when
this file is included into the sub-make's context.
* src/Makefile.am (_sc_check-AUTHORS): Rename from sc_check-AUTHORS.
* gnulib: Update to latest.

13 years agodoc: make README-hacking slightly more generic
Jim Meyering [Tue, 24 May 2011 18:35:52 +0000 (20:35 +0200)]
doc: make README-hacking slightly more generic

* README-hacking: Remove a reference to "coreutils".

13 years agotouch: placate static analyzers: no NULL-deref is possible
Jim Meyering [Tue, 24 May 2011 18:33:27 +0000 (20:33 +0200)]
touch: placate static analyzers: no NULL-deref is possible

* src/touch.c (main): Avoid even the hint of possibility that
we'd dereference NULL upon localtime failure.  Coverity reported
the potential, but it appears not to be possible, since posixtime
rejects any time for which the subsequent localtime would return NULL.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1253

13 years agosplit: fix cases where -n l/... creates extraneous files
Pádraig Brady [Tue, 24 May 2011 08:59:08 +0000 (09:59 +0100)]
split: fix cases where -n l/... creates extraneous files

* src/split.c (lines_chunk_split): Ensure that data is only
written to stdout when k specified.  Also ensure that
extra files are not created when there is more data available
than reported in the file size.
* tests/misc/split-lchunk: Verify that split -n l/k/n doesn't
generate any files, and that -n l/n always generates n files.
* NEWS: Mention the fix.

13 years agodoc: add a missing space in timeout --help
Stéphane Raimbault [Tue, 24 May 2011 15:17:02 +0000 (16:17 +0100)]
doc: add a missing space in timeout --help

* src/timeout.c (usage): Add a space to be consistent
with other uses of "(the default)" in the documentation.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
13 years agodoc: improve tail -f vs. inotify description and advice
Pádraig Brady [Tue, 24 May 2011 04:44:24 +0000 (06:44 +0200)]
doc: improve tail -f vs. inotify description and advice

* doc/coreutils.texi (tail invocation): Adjust, and add an example.

13 years agomaint: avoid trivial syntax-check failure
Jim Meyering [Mon, 23 May 2011 18:03:58 +0000 (20:03 +0200)]
maint: avoid trivial syntax-check failure

* doc/coreutils.texi (tail invocation): Use @var{n}, not @var{N}.

13 years agomaint: README-hacking clarifications
Karl Berry [Mon, 23 May 2011 16:45:39 +0000 (09:45 -0700)]
maint: README-hacking clarifications

* README-hacking: Small getting-started clarifications.

13 years agodoc: describe how kernel inotify support affects tail -f
Jim Meyering [Mon, 23 May 2011 14:09:42 +0000 (16:09 +0200)]
doc: describe how kernel inotify support affects tail -f

* doc/coreutils.texi (tail invocation) [-f]: Mention how inotify
kernel support makes a difference.
Prompted by http://bugzilla.redhat.com/662900

13 years agotests: fix typo in tac-continue
Jim Meyering [Sun, 22 May 2011 15:09:04 +0000 (17:09 +0200)]
tests: fix typo in tac-continue

* tests/misc/tac-continue: Fix typo in usually-skipped test:
s/mkfifo_or_skip/mkfifo_or_skip_/ (i.e., append "_").
This test is usually skipped, because I'm probably the only
one to set the FULL_PARTITION_TMPDIR envvar, and recently the
one I'd been using ceased to exist, so this test was skipped
even for me.  Good argument for making this a root-only test
and creating a full partition just for this test case.

13 years agodoc: fix a formatting nit in od's texinfo documentation
Jim Meyering [Sun, 22 May 2011 07:11:19 +0000 (09:11 +0200)]
doc: fix a formatting nit in od's texinfo documentation

* doc/coreutils.texi (od invocation): Typesetting of "bytes" was wrong.
Fix it via s/@code/@var/ so it's consistent.

13 years agomaint: fix comment typos in df.c
Ivan Sichmann Freitas [Sat, 21 May 2011 08:39:48 +0000 (10:39 +0200)]
maint: fix comment typos in df.c

* src/df.c: s/Optain/Obtain/

13 years agomaint: correct typos involving misuse of "a" and "an"
Jim Meyering [Thu, 19 May 2011 19:36:33 +0000 (21:36 +0200)]
maint: correct typos involving misuse of "a" and "an"

* NEWS: "an misleading"
* src/expr.c: "a integer
* src/ptx.c (find_occurs_in_text): "a end"
* src/shred.c (do_wipefd): "a infinite"
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): "an dual-core"
(compare_random): "an checksum"
* cfg.mk (old_NEWS_hash): Update, since the typo was in old news.

13 years agoprintf: fix an out-of-bounds memory access
Pádraig Brady [Tue, 17 May 2011 23:01:55 +0000 (00:01 +0100)]
printf: fix an out-of-bounds memory access

* src/printf.c (STRTOX): Don't access memory after a
string containing a single quote character.
* tests/misc/printf: Add tests for various combinations
of single quote characters combined with a numeric format.
* THANKS.in: Add bug reporter.
* NEWS: Mention the fix.

Reported-by: Paul Marinescu <paul.marinescu@imperial.ac.uk>
13 years agodoc: mention that ls time ordering is newest first
Pádraig Brady [Tue, 17 May 2011 06:51:44 +0000 (07:51 +0100)]
doc: mention that ls time ordering is newest first

* src/ls.c (usage): Add the "newest first" info to
the -t and -c options

13 years agotests: refactor more tests to use mkfifo_or_skip_
Pádraig Brady [Tue, 10 May 2011 07:14:16 +0000 (08:14 +0100)]
tests: refactor more tests to use mkfifo_or_skip_

* tests/cp/existing-perm-race: s/mkfifo/mkfifo_or_skip_/
* tests/cp/file-perm-race: Likewise.
* tests/cp/parent-perm-race: Likewise.
* tests/cp/special-f: Likewise.
* tests/dd/reblock: Likewise.
* tests/ls/file-type: Likewise.
* tests/misc/cat-buf: Likewise.
* tests/misc/mknod: Likewise.
* tests/misc/printf-surprise: Likewise.
* tests/misc/selinux: Likewise.
* tests/misc/sort-spinlock-abuse: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/init.cfg: Improve the error message when skipping.

13 years agoshuf: use memory more efficiently when returning a subset
Pádraig Brady [Fri, 13 May 2011 17:41:42 +0000 (18:41 +0100)]
shuf: use memory more efficiently when returning a subset

* gl/lib/randperm.c (randperm_new): When the number of items
to return H, is much smaller than the total number of items N,
use a hash to represent the sparse permutations of the set N.
This is currently enabled for N > 128K and N/H > 32.
* tests/misc/shuf: Ensure shuf can quickly return 2 numbers
from a large range.
* gl/modules/randperm: Depend on hash.
* NEWS: Mention the change.

13 years agomaint: avoid syntax-check failure due to long line
Jim Meyering [Fri, 13 May 2011 21:37:23 +0000 (23:37 +0200)]
maint: avoid syntax-check failure due to long line

* tests/du/bigtime (future_time): Split long line.

13 years agomaint: add new syntax-check rule to prohibit use of skip_
Jim Meyering [Fri, 13 May 2011 16:57:31 +0000 (18:57 +0200)]
maint: add new syntax-check rule to prohibit use of skip_

* cfg.mk (sc_prohibit_skip_): New rule.
* tests/init.cfg (skip_test_): Add a comment.

13 years agotests: use skip_test_, not skip_
Jim Meyering [Fri, 13 May 2011 16:36:29 +0000 (18:36 +0200)]
tests: use skip_test_, not skip_

skip_test_ emits its diagnostic both to FD 9 (tty), and to
FD 2 (usually the log file), whereas init.sh's skip_ emits
only to FD 9.  Without that, the log is slightly less useful.
* tests/cp/fiemap-2: Use skip_test_, not skip_.
* tests/cp/fiemap-perf: Likewise.
* tests/du/bigtime: Likewise.
* tests/du/files0-from-dir: Likewise.
* tests/du/move-dir-while-traversing: Likewise.
* tests/init.sh: Likewise.
* tests/misc/sort-stale-thread-mem: Likewise.
* tests/misc/stat-nanoseconds: Likewise.
* tests/mv/i-3: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/split/filter: Likewise.
Prompted by a report from Pádraig Brady.

13 years agols: allow stat-free use of --color
Jim Meyering [Wed, 11 May 2011 15:13:53 +0000 (17:13 +0200)]
ls: allow stat-free use of --color

Even on a system with d_type support, the default use of --color
makes ls stat every file in order to be able to honor settings like
EXEC, STICKY, ORPHAN, SETUID, etc., because those settings require
information that is not provided by dirent.d_type.  However, if
for a potentially large performance gain, you are willing to disable
those settings, you can now make ls --color give type-related coloring
and perform no stat calls at all (other than the unavoidable call-per-
command-line argument).  Before this change, even with all of those
attributes disabled, ls --color would still stat every directory.
Now, we're down to the minimum of one stat call per command-line arg.
* src/ls.c (gobble_file): With --color, don't stat a
non-command-line-specified directory when no directory-coloring
attribute is enabled.
* tests/init.cfg (require_dirent_d_type_): New function.
* tests/d_type-check: New script, mostly from Pádraig Brady.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ls/stat-free-color: New test.
* tests/Makefile.am (TESTS): Add it.
* doc/coreutils.texi (General output formatting): Describe how
to use dircolors to make ls --color refrain from calling stat
on a d_type-enabled file system.
Prompted by a query from Josef Bacik.

13 years agomaint: use <unistd.h>, not "group-member.h"
Jim Meyering [Thu, 12 May 2011 06:23:02 +0000 (08:23 +0200)]
maint: use <unistd.h>, not "group-member.h"

gnulib's group-member module now ensures that the group_member
function is declared in <unistd.h>, just like it is glibc.
* lib/euidaccess-stat.c: Remove inclusion of "group-member.h".
* src/chgrp.c: Likewise.

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 11 May 2011 15:55:02 +0000 (17:55 +0200)]
build: update gnulib submodule to latest

13 years agomaint: remove syntax-checking sc_tight_scope rule
Jim Meyering [Wed, 11 May 2011 15:17:42 +0000 (17:17 +0200)]
maint: remove syntax-checking sc_tight_scope rule

* src/Makefile.am (sc_tight_scope): Remove rule.
Now it's provided via gnulib's maint.mk.
* cfg.mk (sc_tight_scope): Likewise.

13 years agomaint: tail: mark a global variable as static
Jim Meyering [Sun, 8 May 2011 13:50:52 +0000 (15:50 +0200)]
maint: tail: mark a global variable as static

* src/tail.c [HAVE_INOTIFY] (inotify_wd_mask): Declare static.

13 years agomaint: remove -Wmissing-field-initializers workarounds
Pádraig Brady [Tue, 26 Apr 2011 09:30:05 +0000 (10:30 +0100)]
maint: remove -Wmissing-field-initializers workarounds

* configure.ac: Rather than disabling -Wmissing-field-initializers,
use the fact that gnulib now disables it automatically when required
(on versions of GCC older than 4.7).
* src/system.h: Remove the no longer needed DECLARE_ZEROED_AGGREGATE.
* src/ls.c: Likewise.
* src/pathchk.c: Likewise.
* src/shred.c: Likewise.
* src/stty.c: Likewise.
* src/wc.c: Likewise.

13 years agotests: don't fail the split --filter=CMD test if xz is not available
Jim Meyering [Sat, 7 May 2011 05:48:00 +0000 (07:48 +0200)]
tests: don't fail the split --filter=CMD test if xz is not available

* tests/split/filter: Skip if xz is not installed.

13 years agodoc: document split's new --filter=CMD option
Jim Meyering [Sat, 30 Apr 2011 07:52:20 +0000 (09:52 +0200)]
doc: document split's new --filter=CMD option

* doc/coreutils.texi (split invocation): Describe --filter=CMD.
* NEWS (New feature): Mention it.

13 years agotests: test split's new --filter=CMD option
Jim Meyering [Fri, 29 Apr 2011 11:41:19 +0000 (13:41 +0200)]
tests: test split's new --filter=CMD option

* tests/Makefile.am (TESTS): Add split/filter.
* tests/split/filter: New file.

13 years agosplit: accept new output --filter=CMD option
Karl Heuer [Fri, 29 Apr 2011 10:23:27 +0000 (12:23 +0200)]
split: accept new output --filter=CMD option

* src/split.c: Include <signal.h>, <sys/wait.h> and "sig2str.h".
(FILTER_OPTION): New anonymous enum member.
(filter_command, filter_pid): New globals.
(open_pipes, open_pipes_alloc, n_open_pipes): Likewise.
(oldblocked, newblocked): Likewise.
(longopts): Add "filter".
(usage): Document --filter.
(create): Extend to create a pipe and fork "sh -c CMD".
(closeout): Adapt to close a pipe and wait for child process.
(cwrite): Call closeout, not just close.
(lines_chunk_split): FIXME
(bytes_chunk_extract): FIXME
(opid, ofile_open, lines_rr, main): FIXME
(ignorable): New function, to encapsulate EPIPE test.

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Thu, 5 May 2011 08:54:03 +0000 (10:54 +0200)]
build: update gnulib submodule to latest

13 years agosort: fix a contradictory --debug warning
Pádraig Brady [Fri, 6 May 2011 07:07:46 +0000 (08:07 +0100)]
sort: fix a contradictory --debug warning

* src/sort.c (key_warn): `sort -k2,1n --debug` would output
warnings about being both "zero width" and "spanning multiple fields".
Suppress the latter one.
* tests/misc/sort-debug-warn: Add a couple of test cases.

13 years agodf: fix crash in mem exhaustion edge case
Pádraig Brady [Thu, 5 May 2011 14:20:13 +0000 (15:20 +0100)]
df: fix crash in mem exhaustion edge case

* src/df.c (print_table): Don't try to output NULL
if ambsalign() can't allocate memory.  Instead just
output the unaligned text.

13 years agomaint: remove use of gnulib's obsolete strtol module
Jim Meyering [Sun, 1 May 2011 12:06:53 +0000 (14:06 +0200)]
maint: remove use of gnulib's obsolete strtol module

* bootstrap.conf (gnulib_modules): Remove now-obsolete "strtol".
Remove use of $obsolete_gnulib_modules: unused since commit edc69f91.

13 years agomaint: remove unnecessary listing of update-copyright in Makefile.am
Jim Meyering [Sun, 1 May 2011 09:25:52 +0000 (11:25 +0200)]
maint: remove unnecessary listing of update-copyright in Makefile.am

* Makefile.am (changelog_etc): Don't list update-copyright here.
It is automatically included via gnulib-tool-generated lib/gnulib.mk.

13 years agodoc: remove a name from THANKS.in that is derived from git log
Jim Meyering [Sun, 1 May 2011 09:12:24 +0000 (11:12 +0200)]
doc: remove a name from THANKS.in that is derived from git log

* THANKS.in: Remove a now-duplicate name.

13 years agocopy: fix my typo
Jim Meyering [Tue, 3 May 2011 08:23:12 +0000 (10:23 +0200)]
copy: fix my typo

* src/copy.c (copy_reg): Fix my typo (mis-applied patch).
The patch by Jeff Liu was fine, but I mis-applied it
and introduced a compilation error in commit efa479c1.

2011-05-03  Jim Meyering  <meyering@redhat.com>

13 years agobuild: avoid bootstrap failure when $GZIP is set
Jim Meyering [Tue, 3 May 2011 08:09:20 +0000 (10:09 +0200)]
build: avoid bootstrap failure when $GZIP is set

Running "GZIP=-9 ./bootstrap" would fail right away, because the
tool-version-checking code would treat the upper-cased program name
as an environment variable name and if that has a value use the
result as the application name.  That works fine for automake,
autoconf, etc. but not for gzip.
* bootstrap (check_versions): Do not treat $GZIP as a program name.
If defined at all, it is supposed to list gzip options.
Reported by Alan Curry in http://debbugs.gnu.org/8609

13 years agocopy: correct misuse of quote in diagnostic
Jeff Liu [Mon, 2 May 2011 14:26:32 +0000 (16:26 +0200)]
copy: correct misuse of quote in diagnostic

* src/copy.c (copy_reg): Multiple uses of quote (s) in an
argument list is erroneous.  Use quote_n, instead.

13 years agomaint: adjust split.c formatting to conform
Jim Meyering [Sat, 30 Apr 2011 05:48:08 +0000 (07:48 +0200)]
maint: adjust split.c formatting to conform

* src/split.c (usage): Correct indentation.
(ofile_open): Likewise.
(create): "char *name", not "char* name".
(struct of_info) [ofile]: Similar.
(parse_chunk): Add spaces around "+".

13 years agobuild: update to latest gnulib
Eric Blake [Thu, 28 Apr 2011 21:17:15 +0000 (15:17 -0600)]
build: update to latest gnulib

* gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Add xgetgroups.

13 years agotests: distribute new file, CuSkip.pm
Jim Meyering [Fri, 29 Apr 2011 08:31:09 +0000 (10:31 +0200)]
tests: distribute new file, CuSkip.pm

Without this, most perl-based tests would fail in "make distcheck".
* tests/Makefile.am (EXTRA_DIST): Add CuSkip.pm

13 years agotests: remove useless test: misc/pwd-unreadable-parent
Jim Meyering [Thu, 28 Apr 2011 12:18:50 +0000 (14:18 +0200)]
tests: remove useless test: misc/pwd-unreadable-parent

* tests/Makefile.am (TESTS): Remove misc/pwd-unreadable-parent.
This test was misleading and useless (was always skipped).
Inspired by a report from Bruno Haible: http://debbugs.gnu.org/8570
* tests/misc/pwd-unreadable-parent: Remove file.

13 years agotests: write skip explanation from perl scripts also to outer stderr
Jim Meyering [Thu, 28 Apr 2011 09:12:01 +0000 (11:12 +0200)]
tests: write skip explanation from perl scripts also to outer stderr

* tests/CuSkip.pm (skip): New file/module/function, to help
the perl test scripts "skip" a test consistently, emitting
a diagnostic both into the log file and into the outermost
stderr stream that is more likely to be seen by a human.
* tests/check.mk (TESTS_ENVIRONMENT): Add -MCuSkip.
* tests/misc/date-next-dow: Use CuSkip::skip in place of warn+exit-77.
* tests/misc/tty-eof: Likewise.
* tests/misc/uniq: Likewise.
* tests/rm/fail-eperm: Likewise.
* tests/misc/md5sum-newline: Likewise.  Also, s/program_name/ME/.
* tests/misc/ls-misc (setuid_setup, main): Likewise.
* tests/misc/pwd-long: Likewise, and add -I"$abs_srcdir" -MCuSkip
to the $PERL invocation command.
Inspired by a request from Bruno Haible regarding misc/tty-eof:
http://debbugs.gnu.org/8570

13 years agopost-release administrivia
Jim Meyering [Tue, 26 Apr 2011 14:18:02 +0000 (16:18 +0200)]
post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

13 years agoversion 8.12 v8.12
Jim Meyering [Tue, 26 Apr 2011 14:00:50 +0000 (16:00 +0200)]
version 8.12

* NEWS: Record release date.

13 years agomaint: tweak sc_tight_scope rule
Jim Meyering [Tue, 26 Apr 2011 07:27:32 +0000 (09:27 +0200)]
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.

13 years agodd: work around compilation failure on AIX 5.1 and 5.2
Jim Meyering [Tue, 26 Apr 2011 07:09:43 +0000 (09:09 +0200)]
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.

13 years agomaint: move two small functions, so we can remove a fwd decl
Jim Meyering [Tue, 26 Apr 2011 07:02:44 +0000 (09:02 +0200)]
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.

13 years agomaint: change some leading 8-space sequences to TABs in a Makefile.am
Jim Meyering [Mon, 25 Apr 2011 12:43:22 +0000 (14:43 +0200)]
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.

13 years agostat: recognize V9FS and ECRYPTFS file systems
Jim Meyering [Mon, 25 Apr 2011 12:40:45 +0000 (14:40 +0200)]
stat: recognize V9FS and ECRYPTFS file systems

* src/stat.c (human_fstype): Add magic numbers for V9FS and ECRYPTFS.

13 years agotail --follow=name no longer implies --retry
Jim Meyering [Sun, 24 Apr 2011 21:20:01 +0000 (23:20 +0200)]
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.

13 years agocopy: include both src and dest names in clone failure diagnostic
Jeff Liu [Sun, 24 Apr 2011 14:25:31 +0000 (16:25 +0200)]
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.

13 years agotests: tail-2/pipe-f2: avoid false-positive failure
Jim Meyering [Sat, 23 Apr 2011 21:54:11 +0000 (23:54 +0200)]
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.

13 years agomaint: explicitly list full-read and full-write module names
Jim Meyering [Sat, 23 Apr 2011 21:47:37 +0000 (23:47 +0200)]
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.

13 years agodoc: tail/inotify does use --sleep-interval=S, with --pid=P
Jim Meyering [Sat, 23 Apr 2011 14:08:08 +0000 (16:08 +0200)]
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.

13 years agotests: sparse-fiemap: adjust syntax to accommodate older awk
Alan Curry [Fri, 22 Apr 2011 09:08:50 +0000 (11:08 +0200)]
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

13 years agotests: sparse-fiemap: with root/ext3, do not create an ext4 FS
Jim Meyering [Thu, 21 Apr 2011 19:01:13 +0000 (21:01 +0200)]
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

13 years agotests: sparse-fiemap: report more detail upon failure; ignore an FP
Jim Meyering [Thu, 21 Apr 2011 16:08:20 +0000 (18:08 +0200)]
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.

13 years agocopy: use FIEMAP (extent_copy) only for apparently-sparse files,
Jim Meyering [Wed, 20 Apr 2011 09:21:09 +0000 (11:21 +0200)]
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.

13 years agocopy: factor out a tiny sparse-testing function
Jim Meyering [Wed, 20 Apr 2011 08:23:32 +0000 (10:23 +0200)]
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.

13 years agocopy: do not treat unwritten extents specially: avoid XFS/ext4 data loss
Jim Meyering [Wed, 20 Apr 2011 08:15:15 +0000 (10:15 +0200)]
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.

13 years agocopy: always use FIEMAP_FLAG_SYNC, for now
Jim Meyering [Wed, 20 Apr 2011 07:49:15 +0000 (09:49 +0200)]
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.

13 years agotests: remove spurious syntax from a perl snippet
Jim Meyering [Wed, 20 Apr 2011 07:46:27 +0000 (09:46 +0200)]
tests: remove spurious syntax from a perl snippet

* tests/cp/sparse-fiemap: Remove spurious BEGIN {...} block.

13 years agodircolors: add .ear, .war, .sar, for Java jar-like archives
Ondřej Vašík [Sun, 17 Apr 2011 09:20:47 +0000 (11:20 +0200)]
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.

13 years agopost-release administrivia
Jim Meyering [Wed, 13 Apr 2011 19:32:49 +0000 (21:32 +0200)]
post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

13 years agoversion 8.11 v8.11
Jim Meyering [Wed, 13 Apr 2011 19:13:50 +0000 (21:13 +0200)]
version 8.11

* NEWS: Record release date.

13 years agomaint: mention dd's new partial read warning in NEWS
Pádraig Brady [Wed, 13 Apr 2011 14:27:13 +0000 (15:27 +0100)]
maint: mention dd's new partial read warning in NEWS

* NEWS: Mention the new feature, from commits e1788d9e and 194c1e89

13 years agotests: fix a false positive fiemap test on some file systems
Pádraig Brady [Wed, 13 Apr 2011 06:58:02 +0000 (07:58 +0100)]
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.

13 years agomaint: correct kernel version in test comment
Pádraig Brady [Tue, 12 Apr 2011 10:30:33 +0000 (11:30 +0100)]
maint: correct kernel version in test comment

13 years agomaint: remove unnecessary inclusion of <stdio.h>
Jim Meyering [Tue, 12 Apr 2011 10:14:26 +0000 (12:14 +0200)]
maint: remove unnecessary inclusion of <stdio.h>

* src/extent-scan.c: Don't include <stdio.h>.  It was not used.

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Mon, 11 Apr 2011 12:33:23 +0000 (14:33 +0200)]
build: update gnulib submodule to latest