Jim Meyering [Wed, 2 Mar 2011 17:54:43 +0000 (18:54 +0100)]
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.
Pádraig Brady [Thu, 24 Feb 2011 10:25:52 +0000 (10:25 +0000)]
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.
Gilles Espinasse [Sat, 19 Feb 2011 23:09:09 +0000 (23:09 +0000)]
maint: replace spaces with tab in tests/Makefile.am
* tests/Makefile.am: Replace spaces with tabs for consistency
Jim Meyering [Fri, 18 Feb 2011 22:29:14 +0000 (23:29 +0100)]
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".
Gilles Espinasse [Fri, 18 Feb 2011 12:52:21 +0000 (13:52 +0100)]
tests: correct racy sparse-to-pipe test
* tests/cp/sparse-to-pipe: Wait for backgrounded "cat" to complete
before comparing the results.
Paul Eggert [Tue, 15 Feb 2011 05:05:18 +0000 (21:05 -0800)]
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.
Pádraig Brady [Sun, 13 Feb 2011 18:56:10 +0000 (18:56 +0000)]
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.
Pádraig Brady [Thu, 10 Feb 2011 17:47:21 +0000 (17:47 +0000)]
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.
Pádraig Brady [Tue, 8 Feb 2011 19:16:55 +0000 (19:16 +0000)]
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.
Jim Meyering [Thu, 10 Feb 2011 09:01:23 +0000 (10:01 +0100)]
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.
Jim Meyering [Wed, 9 Feb 2011 07:29:38 +0000 (08:29 +0100)]
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.
Jim Meyering [Wed, 9 Feb 2011 16:08:58 +0000 (17:08 +0100)]
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.
Pádraig Brady [Fri, 4 Feb 2011 22:05:20 +0000 (22:05 +0000)]
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.
Jim Meyering [Tue, 8 Feb 2011 07:25:46 +0000 (08:25 +0100)]
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.
Jim Meyering [Mon, 7 Feb 2011 15:24:10 +0000 (16:24 +0100)]
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.
Jim Meyering [Mon, 7 Feb 2011 14:46:09 +0000 (15:46 +0100)]
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.
Jim Meyering [Mon, 7 Feb 2011 07:29:33 +0000 (08:29 +0100)]
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.
Jim Meyering [Sat, 5 Feb 2011 21:40:57 +0000 (22:40 +0100)]
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.
Jim Meyering [Fri, 4 Feb 2011 17:19:36 +0000 (18:19 +0100)]
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
Jim Meyering [Fri, 4 Feb 2011 17:08:12 +0000 (18:08 +0100)]
version 8.10
* NEWS: Record release date.
Jim Meyering [Fri, 4 Feb 2011 14:01:39 +0000 (15:01 +0100)]
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.
Jim Meyering [Fri, 4 Feb 2011 13:59:03 +0000 (14:59 +0100)]
tests: skip mv/i-3 on FreeBSD to avoid spurious failure
* tests/mv/i-3: Skip when uname -s reports FreeBSD.
Pádraig Brady [Wed, 2 Feb 2011 23:08:42 +0000 (23:08 +0000)]
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.
Jim Meyering [Wed, 2 Feb 2011 11:02:22 +0000 (12:02 +0100)]
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".
Jim Meyering [Wed, 2 Feb 2011 08:40:55 +0000 (09:40 +0100)]
build: update gnulib submodule to latest
Pádraig Brady [Mon, 31 Jan 2011 22:04:35 +0000 (22:04 +0000)]
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.
Jim Meyering [Mon, 31 Jan 2011 19:55:34 +0000 (20:55 +0100)]
cp: always initialize extent_copy's output parameter
* src/copy.c (extent_copy): Otherwise it would be used uninitialized.
Jim Meyering [Mon, 31 Jan 2011 16:18:13 +0000 (17:18 +0100)]
tests: exercise a rarely-used corner of copy.c
* tests/cp/sparse-to-pipe: New test.
* tests/Makefile.am (TESTS): Add it.
Jim Meyering [Mon, 31 Jan 2011 17:25:58 +0000 (18:25 +0100)]
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.
Jim Meyering [Mon, 31 Jan 2011 14:20:29 +0000 (15:20 +0100)]
tests: gfs2 also supports FIEMAP
* tests/init.cfg (fiemap_capable_): Add gfs2.
Clarify comment.
Jim Meyering [Mon, 31 Jan 2011 14:17:12 +0000 (15:17 +0100)]
maint: remove unused inclusion of "fiemap.h"
* src/copy.c: Don't include "fiemap.h".
Jim Meyering [Mon, 31 Jan 2011 13:44:15 +0000 (14:44 +0100)]
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.
Jim Meyering [Mon, 31 Jan 2011 12:42:49 +0000 (13:42 +0100)]
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.
Jim Meyering [Mon, 31 Jan 2011 12:40:26 +0000 (13:40 +0100)]
tests: modernize sparse-fiemap test
* tests/cp/sparse-fiemap: Use print_ver_, not open-coded VERBOSE test.
Jim Meyering [Mon, 31 Jan 2011 12:35:55 +0000 (13:35 +0100)]
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.
Jim Meyering [Sun, 30 Jan 2011 20:27:12 +0000 (21:27 +0100)]
doc: NEWS: mention cp's improvement
* NEWS (New Features): cp now copies sparse files efficiently.
Jim Meyering [Sun, 30 Jan 2011 08:21:57 +0000 (09:21 +0100)]
build: update gnulib submodule to latest
Jim Meyering [Sun, 30 Jan 2011 15:12:56 +0000 (16:12 +0100)]
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
Jim Meyering [Thu, 27 Jan 2011 14:17:42 +0000 (15:17 +0100)]
tests: cp/fiemap: exercise previously-failing parts
* tests/cp/fiemap-2: New test.
* tests/Makefile.am (TESTS): Add it.
Jim Meyering [Fri, 28 Jan 2011 20:19:50 +0000 (21:19 +0100)]
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.
Jim Meyering [Thu, 27 Jan 2011 20:01:07 +0000 (21:01 +0100)]
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.
Jim Meyering [Thu, 27 Jan 2011 19:57:17 +0000 (20:57 +0100)]
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.
Jim Meyering [Thu, 27 Jan 2011 16:49:04 +0000 (17:49 +0100)]
fiemap copy: avoid leak-on-error
* src/copy.c (extent_copy): Don't leak an extent_scan buffer on
failed lseek, read, or write.
Jim Meyering [Thu, 27 Jan 2011 16:30:08 +0000 (17:30 +0100)]
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.
Jim Meyering [Thu, 27 Jan 2011 18:00:48 +0000 (19:00 +0100)]
fiemap copy: simplify post-loop logic; improve comments
* src/copy.c (extent_copy): Avoid duplication in post-loop
extend-to-desired-length code.
Jim Meyering [Thu, 27 Jan 2011 17:28:25 +0000 (18:28 +0100)]
fiemap copy: rename some locals
(extent_copy): Rename locals: s/*ext_logical/*ext_start/
Jim Meyering [Fri, 28 Jan 2011 21:31:23 +0000 (22:31 +0100)]
tests: ensure that FIEMAP-enabled cp copies a sparse file efficiently
* tests/cp/fiemap-perf: New file.
* tests/Makefile.am (TESTS): Add it.
Jim Meyering [Sat, 22 Jan 2011 12:09:08 +0000 (13:09 +0100)]
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.
Jim Meyering [Sat, 22 Jan 2011 11:55:58 +0000 (12:55 +0100)]
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.
Jim Meyering [Sat, 22 Jan 2011 11:36:03 +0000 (12:36 +0100)]
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?
Jim Meyering [Sat, 22 Jan 2011 11:30:21 +0000 (12:30 +0100)]
copy: remove else-after-goto and adjust indentation
* src/copy.c (copy_reg): Remove useless else-after-goto.
Jim Meyering [Mon, 11 Oct 2010 09:19:02 +0000 (11:19 +0200)]
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.
Jim Meyering [Mon, 11 Oct 2010 08:39:50 +0000 (10:39 +0200)]
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.
jeff.liu [Wed, 29 Sep 2010 08:11:41 +0000 (16:11 +0800)]
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.
Jim Meyering [Sun, 13 Jun 2010 14:34:42 +0000 (16:34 +0200)]
build: distribute new test script, filefrag-extent-compare
* tests/Makefile.am (EXTRA_DIST): Add filefrag-extent-compare.
Jim Meyering [Sun, 13 Jun 2010 14:19:29 +0000 (16:19 +0200)]
build: distribute new file, fiemap.h
* src/Makefile.am (noinst_HEADERS): Add fiemap.h.
Jie Liu [Fri, 11 Jun 2010 08:29:02 +0000 (16:29 +0800)]
copy.c: add FIEMAP_FLAG_SYNC to fiemap ioctl
* src/copy.c (fiemap_copy): Force kernel to sync the source
file before mapping.
Jim Meyering [Wed, 9 Jun 2010 06:42:30 +0000 (08:42 +0200)]
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.
Paul Eggert [Wed, 9 Jun 2010 06:15:07 +0000 (08:15 +0200)]
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.
Jim Meyering [Sat, 5 Jun 2010 08:17:48 +0000 (10:17 +0200)]
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.
Jim Meyering [Sat, 29 May 2010 19:22:40 +0000 (21:22 +0200)]
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.
Jim Meyering [Fri, 11 Jun 2010 12:34:03 +0000 (14:34 +0200)]
tests: accommodate varying filefrag -v "flags" output
* tests/cp/sparse-fiemap: Accommodate values other than "eof"
in the "flags" column of filefrag -v output
Jim Meyering [Fri, 21 May 2010 16:28:42 +0000 (18:28 +0200)]
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.
Jie Liu [Thu, 13 May 2010 14:17:53 +0000 (22:17 +0800)]
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.
Jie Liu [Thu, 13 May 2010 14:09:30 +0000 (22:09 +0800)]
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.
Pádraig Brady [Wed, 24 Nov 2010 08:37:23 +0000 (08:37 +0000)]
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.
Pádraig Brady [Thu, 27 Jan 2011 07:17:16 +0000 (07:17 +0000)]
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.
Pádraig Brady [Fri, 14 Jan 2011 08:46:21 +0000 (08:46 +0000)]
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
Pádraig Brady [Wed, 5 Jan 2011 11:52:54 +0000 (11:52 +0000)]
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
Jim Meyering [Fri, 28 Jan 2011 18:23:21 +0000 (19:23 +0100)]
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.
Jim Meyering [Tue, 25 Jan 2011 13:29:07 +0000 (14:29 +0100)]
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.
Andreas Schwab [Tue, 25 Jan 2011 17:29:07 +0000 (18:29 +0100)]
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.
Jim Meyering [Tue, 25 Jan 2011 11:36:22 +0000 (12:36 +0100)]
tests: avoid FP failure due to suspension
* tests/du/move-dir-while-traversing: Prohibit suspension,
to avoid false-positive failure.
Jim Meyering [Tue, 25 Jan 2011 10:09:27 +0000 (11:09 +0100)]
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.
Jim Meyering [Mon, 24 Jan 2011 08:38:40 +0000 (09:38 +0100)]
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.
Jim Meyering [Mon, 24 Jan 2011 08:37:10 +0000 (09:37 +0100)]
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.
Jim Meyering [Fri, 21 Jan 2011 13:02:27 +0000 (14:02 +0100)]
doc: fix wording in warning about potential conflict with built-in
* doc/coreutils.texi (mayConflictWithShellBuiltIn): Fix wording.
Paul Eggert [Fri, 21 Jan 2011 18:59:32 +0000 (10:59 -0800)]
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>.
Jim Meyering [Thu, 20 Jan 2011 09:50:11 +0000 (10:50 +0100)]
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.
Jim Meyering [Thu, 20 Jan 2011 09:00:42 +0000 (10:00 +0100)]
build: update gnulib submodule to latest
The previous gnulib submodule reference was to a non-public commit.
Reported by Rob Vermaas.
Jim Meyering [Tue, 4 Jan 2011 11:47:24 +0000 (12:47 +0100)]
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.
Jim Meyering [Tue, 18 Jan 2011 21:32:33 +0000 (22:32 +0100)]
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.
Jim Meyering [Tue, 18 Jan 2011 20:07:57 +0000 (21:07 +0100)]
build: update gnulib submodule to latest
Jim Meyering [Tue, 18 Jan 2011 08:45:00 +0000 (09:45 +0100)]
doc: update NEWS
* NEWS: Note when the uniq bug was introduced.
It was mine, commit
1d9b3de9, "uniq: remove redundant test".
Jim Meyering [Mon, 17 Jan 2011 10:32:35 +0000 (11:32 +0100)]
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.
Jim Meyering [Mon, 17 Jan 2011 11:36:58 +0000 (12:36 +0100)]
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.
Jim Meyering [Mon, 17 Jan 2011 11:27:55 +0000 (12:27 +0100)]
tests: add a test for today's uniq bug
* tests/misc/uniq-perf: New file.
* tests/Makefile.am (TESTS): Add it.
Sami Kerola [Sun, 16 Jan 2011 23:27:06 +0000 (00:27 +0100)]
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.
Ondřej Vašík [Fri, 14 Jan 2011 15:38:57 +0000 (16:38 +0100)]
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)
Pádraig Brady [Tue, 11 Jan 2011 19:30:28 +0000 (19:30 +0000)]
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.
Pádraig Brady [Thu, 13 Jan 2011 09:36:38 +0000 (09:36 +0000)]
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.
Jim Meyering [Wed, 12 Jan 2011 20:20:34 +0000 (21:20 +0100)]
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.
Paul Eggert [Wed, 12 Jan 2011 02:07:15 +0000 (18:07 -0800)]
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.
Paul Eggert [Wed, 12 Jan 2011 01:52:40 +0000 (17:52 -0800)]
build: update gnulib submodule to latest
Nadav Har'El [Tue, 11 Jan 2011 14:53:07 +0000 (07:53 -0700)]
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.
Jim Meyering [Mon, 10 Jan 2011 06:59:00 +0000 (07:59 +0100)]
build: update gnulib submodule to latest
Jim Meyering [Sat, 8 Jan 2011 16:44:55 +0000 (17:44 +0100)]
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.
Pádraig Brady [Sat, 18 Dec 2010 23:06:10 +0000 (23:06 +0000)]
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.
Pádraig Brady [Wed, 5 Jan 2011 12:01:14 +0000 (12:01 +0000)]
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.
Jim Meyering [Tue, 4 Jan 2011 11:56:30 +0000 (12:56 +0100)]
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.