Pádraig Brady [Tue, 7 Sep 2010 13:02:56 +0000 (14:02 +0100)]
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.
Pádraig Brady [Thu, 2 Sep 2010 12:22:41 +0000 (13:22 +0100)]
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/.
Jim Meyering [Sat, 4 Sep 2010 12:25:11 +0000 (14:25 +0200)]
build: update gnulib submodule to latest
Jim Meyering [Fri, 3 Sep 2010 11:11:33 +0000 (13:11 +0200)]
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]...
Jim Meyering [Sat, 28 Aug 2010 19:54:17 +0000 (21:54 +0200)]
tac: suppress technically unneeded "free"
* src/tac.c (main): Guard final free with #ifdef lint.
Suggested by Paul Eggert.
Pádraig Brady [Tue, 31 Aug 2010 07:38:34 +0000 (08:38 +0100)]
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.
Jim Meyering [Sat, 28 Aug 2010 15:45:29 +0000 (17:45 +0200)]
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>.
Pádraig Brady [Fri, 27 Aug 2010 07:39:48 +0000 (08:39 +0100)]
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.
Aaron Burgemeister [Fri, 16 Jul 2010 01:54:49 +0000 (19:54 -0600)]
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>
Eric Blake [Thu, 26 Aug 2010 22:26:06 +0000 (16:26 -0600)]
maint: update to latest gnulib
* gnulib: Update to latest, to avoid warnings with latest autoconf.git.
Eric Blake [Tue, 10 Aug 2010 17:03:09 +0000 (11:03 -0600)]
maint: avoid a hung 'make syntax-check' in VPATH build
* cfg.mk (sc_system_h_headers): Look for files in correct location.
Pádraig Brady [Tue, 24 Aug 2010 07:13:33 +0000 (08:13 +0100)]
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.
Pádraig Brady [Wed, 18 Aug 2010 23:53:39 +0000 (00:53 +0100)]
stat: fix a small memory leak with %N
* src/stat.c (print_stat): Free the buffer returned
from areadlink_with_size().
Pádraig Brady [Wed, 11 Aug 2010 09:49:22 +0000 (10:49 +0100)]
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
Ralf Wildenhues [Sat, 14 Aug 2010 12:07:56 +0000 (13:07 +0100)]
doc: avoid a warning from newer texinfo
* doc/coreutils.texi (sort invocation): Use @pxref inside parentheses.
Bruno Haible [Tue, 10 Aug 2010 00:56:36 +0000 (01:56 +0100)]
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
Paul Eggert [Fri, 13 Aug 2010 22:57:01 +0000 (15:57 -0700)]
* tests/misc/sort (use-nl): Fix comment to match the test case.
Paul Eggert [Wed, 11 Aug 2010 03:25:20 +0000 (20:25 -0700)]
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.
Paul Eggert [Tue, 10 Aug 2010 20:49:41 +0000 (13:49 -0700)]
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.
Eric Blake [Mon, 9 Aug 2010 20:37:07 +0000 (14:37 -0600)]
build: update to latest gnulib
Fixes bug 6053 for NFS on HP-UX not recognizing ACL operations.
* gnulib: Update to latest version.
Jim Meyering [Tue, 10 Aug 2010 15:11:15 +0000 (08:11 -0700)]
sort: avoid gcc warning: explicitly ignore strtold result
* src/sort.c: Include "ignore-value.h".
(debug_key): Use ignore_value.
Eric Blake [Mon, 9 Aug 2010 20:56:02 +0000 (14:56 -0600)]
tests: silence 'make syntax-check'
* gl/tests/test-rand-isaac.c (main): Avoid warnings from
syntax-check.
Mike Frysinger [Wed, 4 Aug 2010 02:15:55 +0000 (22:15 -0400)]
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>
Dan Hipschman [Sat, 31 Jul 2010 01:49:02 +0000 (18:49 -0700)]
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.
Paul Eggert [Mon, 9 Aug 2010 06:14:38 +0000 (23:14 -0700)]
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.
Paul Eggert [Sat, 7 Aug 2010 04:30:17 +0000 (21:30 -0700)]
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.
Paul Eggert [Thu, 5 Aug 2010 20:28:35 +0000 (13:28 -0700)]
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.
Paul Eggert [Wed, 4 Aug 2010 23:10:10 +0000 (16:10 -0700)]
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.
Paul Eggert [Tue, 3 Aug 2010 20:01:16 +0000 (13:01 -0700)]
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.
Paul Eggert [Tue, 3 Aug 2010 17:24:11 +0000 (10:24 -0700)]
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.
Paul Eggert [Tue, 3 Aug 2010 02:18:01 +0000 (19:18 -0700)]
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.
Paul Eggert [Fri, 30 Jul 2010 07:52:59 +0000 (01:52 -0600)]
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.
Paul Eggert [Tue, 27 Jul 2010 18:01:10 +0000 (11:01 -0700)]
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.
Paul Eggert [Tue, 27 Jul 2010 03:51:02 +0000 (20:51 -0700)]
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
aadc67dfdb47f28bb8d1fa5e0fe0f52e2a8c51bf commit (dated July 15).
* tests/misc/sort (realloc-buf-2): New test, which catches this
bug on 64-bit hosts.
Paul Eggert [Tue, 27 Jul 2010 01:38:19 +0000 (18:38 -0700)]
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.
Paul Eggert [Mon, 26 Jul 2010 19:12:25 +0000 (12:12 -0700)]
sort: don't assume ASCII when parsing K, M, G suffixes
* src/sort.c (find_unit_order): Don't assume ASCII.
Paul R. Eggert [Mon, 26 Jul 2010 04:18:14 +0000 (21:18 -0700)]
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.
Paul R. Eggert [Mon, 26 Jul 2010 03:54:55 +0000 (20:54 -0700)]
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.
Paul R. Eggert [Mon, 26 Jul 2010 03:25:31 +0000 (20:25 -0700)]
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.
Paul R. Eggert [Mon, 26 Jul 2010 02:58:32 +0000 (19:58 -0700)]
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.
Paul R. Eggert [Mon, 26 Jul 2010 02:24:33 +0000 (19:24 -0700)]
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.
Paul Eggert [Sun, 25 Jul 2010 17:53:42 +0000 (10:53 -0700)]
du: add NEWS entry for recent du -L fixes
Paul R. Eggert [Sat, 24 Jul 2010 07:19:33 +0000 (00:19 -0700)]
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.
Paul R. Eggert [Fri, 16 Jul 2010 18:27:42 +0000 (11:27 -0700)]
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.
Paul R. Eggert [Fri, 23 Jul 2010 22:07:27 +0000 (15:07 -0700)]
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.
Pádraig Brady [Tue, 20 Jul 2010 17:51:01 +0000 (18:51 +0100)]
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().
Pádraig Brady [Wed, 14 Jul 2010 08:49:16 +0000 (09:49 +0100)]
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.
Mike Frysinger [Tue, 20 Jul 2010 18:13:40 +0000 (19:13 +0100)]
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.
Paul R. Eggert [Tue, 20 Jul 2010 16:50:37 +0000 (09:50 -0700)]
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.
Paul R. Eggert [Mon, 19 Jul 2010 17:46:41 +0000 (10:46 -0700)]
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.
Paul R. Eggert [Fri, 16 Jul 2010 21:02:08 +0000 (14:02 -0700)]
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.
Paul R. Eggert [Fri, 16 Jul 2010 01:13:08 +0000 (18:13 -0700)]
sort: add a test case for the sort -u bug
* tests/Makefile.am (TESTS): Add misc/sort-unique.
* tests/misc/sort-unique: New file.
Paul R. Eggert [Thu, 15 Jul 2010 23:24:03 +0000 (16:24 -0700)]
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.
Pádraig Brady [Thu, 15 Jul 2010 11:06:04 +0000 (12:06 +0100)]
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.
Chen Guo [Wed, 14 Jul 2010 06:41:05 +0000 (07:41 +0100)]
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().
Jim Meyering [Wed, 14 Jul 2010 16:05:50 +0000 (11:05 -0500)]
heap_alloc: avoid integer overflow
* gl/lib/heap.c (heap_alloc): Use xnmalloc rather than xmalloc,
to avoid pathological overflow.
Paul R. Eggert [Tue, 13 Jul 2010 23:29:37 +0000 (16:29 -0700)]
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
Pádraig Brady [Wed, 14 Jul 2010 11:16:48 +0000 (12:16 +0100)]
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
Pádraig Brady [Tue, 13 Jul 2010 17:56:14 +0000 (18:56 +0100)]
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.
Pádraig Brady [Tue, 13 Jul 2010 07:23:52 +0000 (08:23 +0100)]
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.
Chen Guo [Fri, 9 Jul 2010 07:03:50 +0000 (08:03 +0100)]
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>
Jim Meyering [Wed, 7 Jul 2010 09:57:26 +0000 (11:57 +0200)]
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.
Paul R. Eggert [Tue, 13 Jul 2010 00:12:43 +0000 (17:12 -0700)]
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.
Paul Eggert [Fri, 9 Jul 2010 18:11:05 +0000 (11:11 -0700)]
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.
Paul Eggert [Tue, 6 Jul 2010 23:16:20 +0000 (16:16 -0700)]
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.
Paul Eggert [Tue, 6 Jul 2010 21:53:14 +0000 (14:53 -0700)]
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.
Jim Meyering [Mon, 5 Jul 2010 15:18:29 +0000 (17:18 +0200)]
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.
Jim Meyering [Mon, 5 Jul 2010 15:16:23 +0000 (17:16 +0200)]
system.h: define ATTRIBUTE_WARN_UNUSED_RESULT
* src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define.
Pádraig Brady [Mon, 5 Jul 2010 07:53:10 +0000 (08:53 +0100)]
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.
Paul Eggert [Sun, 4 Jul 2010 22:40:49 +0000 (15:40 -0700)]
doc: Add advice about ChangeLogs and synchronizing submodules
* README-hacking: Update accordingly.
Jim Meyering [Fri, 4 Jun 2010 13:30:47 +0000 (15:30 +0200)]
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.
Jim Meyering [Tue, 9 Dec 2008 07:49:41 +0000 (08:49 +0100)]
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.
Jim Meyering [Sun, 27 Jun 2010 21:29:07 +0000 (23:29 +0200)]
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.
Jim Meyering [Sun, 27 Jun 2010 21:26:46 +0000 (23:26 +0200)]
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.
Paul Eggert [Sat, 3 Jul 2010 06:41:08 +0000 (23:41 -0700)]
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.
Jim Meyering [Thu, 1 Jul 2010 21:43:55 +0000 (23:43 +0200)]
build: update gnulib submodule to latest; update bootstrap, too
* gnulib: Update to latest, for hash.c improvement.
* bootstrap: Update from gnulib, too.
Pádraig Brady [Mon, 21 Sep 2009 07:43:03 +0000 (08:43 +0100)]
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
Pádraig Brady [Mon, 28 Sep 2009 16:32:15 +0000 (17:32 +0100)]
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
Jim Meyering [Wed, 30 Jun 2010 15:10:07 +0000 (17:10 +0200)]
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".
Jim Meyering [Wed, 30 Jun 2010 15:06:53 +0000 (17:06 +0200)]
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.
Jim Meyering [Wed, 30 Jun 2010 12:34:23 +0000 (14:34 +0200)]
tests: sync tests/init.sh from gnulib
* tests/init.sh: Update from gnulib.
Jim Meyering [Mon, 28 Jun 2010 11:48:38 +0000 (13:48 +0200)]
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.
Pádraig Brady [Tue, 29 Jun 2010 00:20:23 +0000 (01:20 +0100)]
doc: reference POS syntax in --help for sort --key
* src/sort.c (usage): Reference the additional description
of the POS syntax.
Benno Schulenberg [Sat, 26 Jun 2010 10:00:42 +0000 (12:00 +0200)]
ln: print a clearer error message when linking fails
Jim Meyering [Tue, 22 Jun 2010 09:41:22 +0000 (11:41 +0200)]
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.
Jim Meyering [Mon, 21 Jun 2010 06:55:22 +0000 (08:55 +0200)]
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.
Eric Blake [Mon, 14 Jun 2010 21:49:46 +0000 (15:49 -0600)]
maint: ignore another gnulib generated file
* .gnulib: Exclude lib/c++defs.h.
Eric Blake [Wed, 9 Jun 2010 17:13:13 +0000 (11:13 -0600)]
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.
Jim Meyering [Mon, 14 Jun 2010 08:15:57 +0000 (10:15 +0200)]
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.
Jim Meyering [Sun, 13 Jun 2010 15:34:45 +0000 (17:34 +0200)]
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
Jim Meyering [Fri, 11 Jun 2010 09:32:31 +0000 (11:32 +0200)]
build: update gnulib submodule to latest
Jim Meyering [Thu, 10 Jun 2010 21:33:17 +0000 (23:33 +0200)]
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.
Jim Meyering [Thu, 10 Jun 2010 15:49:30 +0000 (17:49 +0200)]
ls: avoid just-introduced buffer overrun
* src/ls.c (gobble_file): Revert part of my preceding change,
to avoid clobbering stack.
Jim Meyering [Mon, 7 Jun 2010 05:15:15 +0000 (07:15 +0200)]
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.]
Jim Meyering [Sun, 6 Jun 2010 16:51:42 +0000 (18:51 +0200)]
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.
Eric Blake [Mon, 7 Jun 2010 15:42:09 +0000 (09:42 -0600)]
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.
Jim Meyering [Wed, 2 Jun 2010 15:41:52 +0000 (17:41 +0200)]
doc: mention the new coreutils@ mailing lists
* README-package-renamed-to-coreutils: Mention the new mailing list
and a mirror.
Jim Meyering [Wed, 2 Jun 2010 14:23:41 +0000 (16:23 +0200)]
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.
Jim Meyering [Sat, 15 May 2010 17:36:56 +0000 (19:36 +0200)]
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 = /'
Jim Meyering [Sat, 1 May 2010 12:24:35 +0000 (14:24 +0200)]
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.