platform/upstream/coreutils.git
13 years agobuild: support fully excluding stdbuf from the build
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.

13 years agorandread: use /dev/urandom to seed, not just getpid etc
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.

13 years agosort: -R no longer disables multithreading
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.

13 years agorandread: don't require -lrt
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.

13 years agosort: add a test case for the sort -u bug
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.

13 years agosort: fix a bug with sort -u and xmemcoll0, and tune keycompare
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.

13 years agosort: fix a bug when sorting unterminated lines
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.

13 years agosort: speed up default full line sorting
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().

13 years agoheap_alloc: avoid integer overflow
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.

13 years agomaint: omit $(POW_LIB) when linking, as this is no longer needed
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

13 years agobuild: update gnulib submodule to latest; update bootstrap, too
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

13 years agomaint: reorganize latest NEWS
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.

13 years agomaint: heap.c: simplify dynamic allocations
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.

13 years agosort: parallelize internal sort
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>
13 years agodi-set, ino-map: adjust a type, improve readability
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.

13 years agodd: also spell out size on memory exhaustion
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.

13 years agochcon, chmod, chown, du: don't translate "%s"
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.

13 years agodu: avoid spurious warnings with 64-bit gcc -W
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.

13 years agodu: Hash with a mechanism that's simpler and takes less memory.
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.

13 years agostat: getfilecon failure now evokes nonzero exit status
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.

13 years agosystem.h: define 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.

13 years agotests: make tests requiring a delay to pass, more robust
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.

13 years agodoc: Add advice about ChangeLogs and synchronizing submodules
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.

13 years agodu: increase the initial dev-inode set size
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.

13 years agodu: use less than half as much memory when tracking hard links
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.

13 years agodi-set: manipulate sets of dev/inode pairs efficiently
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.

13 years agodev-map: map device number to small non-negative
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.

13 years agodu: don't miscount duplicate directories or link-count-1 files
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.

13 years agobuild: update gnulib submodule to latest; update bootstrap, too
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.

13 years agocp: add an option to only copy the file attributes
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

13 years agols: use the POSIX date style when the locale does not specify one
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

13 years agotests: fail rather than infloop in tail's inotify-rotate test
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".

13 years agotests: move most helper functions from test-lib.sh to new init.cfg
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.

13 years agotests: sync tests/init.sh from gnulib
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.

13 years agodoc: df, du, ls: improve --blocksize description in --help
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.

13 years agodoc: reference POS syntax in --help for sort --key
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.

13 years agoln: print a clearer error message when linking fails
Benno Schulenberg [Sat, 26 Jun 2010 10:00:42 +0000 (12:00 +0200)]
ln: print a clearer error message when linking fails

13 years agostat: remove support for deprecated --context (-Z) option
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.

13 years agodoc: fix comm's --help output so we generate a better man page
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.

13 years agomaint: ignore another gnulib generated file
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.

13 years agocat: improve documentation
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.

13 years agodoc: dd: discourage use of very large block sizes
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.

13 years agodd: print a better diagnostic for an invalid block size
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

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 11 Jun 2010 09:32:31 +0000 (11:32 +0200)]
build: update gnulib submodule to latest

14 years agobuild: don't let a large sparse temporary file cause "make dist" to fail
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.

14 years agols: avoid just-introduced buffer overrun
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.

14 years agomaint: adjust INT_BUFSIZE_BOUND usage for maintainability
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.]

14 years agosort: avoid unnecessary use of sprintf
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.

14 years agodirname: tweak summary wording
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.

14 years agodoc: mention the new coreutils@ mailing lists
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.

14 years agotouch: remove support for --file=REF_FILE option
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.

14 years agomaint: make spacing around "=" consistent, even in IF_LINT
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 = /'

14 years agomaint: replace each "for (;;)" with "while (true)"
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.

14 years agomaint: correct indentation of case_GETOPT_* macro uses
Jim Meyering [Sat, 1 May 2010 11:53:46 +0000 (13:53 +0200)]
maint: correct indentation of case_GETOPT_* macro uses

* src/base64.c (main): Correct indentation of syntactically
questionable case_GETOPT_HELP_CHAR and case_GETOPT_VERSION_CHAR macros.
* src/who.c (main): Likewise.

14 years agostat: use gnulib's alignof module
Jim Meyering [Sat, 1 May 2010 09:29:39 +0000 (11:29 +0200)]
stat: use gnulib's alignof module

* src/stat.c (alignof): Remove definition.
Instead, include "alignof.h", and sort the #include directives.
And get its definition from the gnulib module by that name:
* bootstrap.conf (gnulib_modules): Add alignof.

14 years agotests: remove unnecessary single quotes in perl hash use: ->{'SYM'}
Jim Meyering [Sat, 15 May 2010 15:58:52 +0000 (17:58 +0200)]
tests: remove unnecessary single quotes in perl hash use: ->{'SYM'}

Run this command:
  git grep -l "limits->{'" \
    | xargs perl -pi -e "s/limits->{'(.*?)'}/limits->{\$1}/g"
* cfg.mk (sc_prohibit_perl_hash_quotes): New rule to match.
* tests/misc/join: Remove quotes.
* tests/misc/sort: Likewise.
* tests/misc/sort-merge: Likewise.
* tests/misc/test: Likewise.
* tests/misc/unexpand: Likewise.
* tests/misc/uniq: Likewise.

14 years agotruncate: improve handling of non regular files
Pádraig Brady [Fri, 28 May 2010 18:25:23 +0000 (19:25 +0100)]
truncate: improve handling of non regular files

Previously we copied `dd` and suppressed error messages
when truncating neither regular files or shared mem objects.
This was valid for `dd`, as truncation is ancillary to copying
it may also do, but for `truncate` we should display all errors.
Also we used the st_size from non regular files which is undefined,
so we display an error when the user tries this.

* src/truncate (do_truncate):  Error when referencing the size
of non regular files or non shared memory objects.  Display all
errors returned by ftruncate().
(main): Error when referencing the size of non regular files or
non shared memory objects.  Don't suppress error messages for
any file types that can't be opened for writing.
* tests/misc/truncate-dir-fail: Check that referencing the
size of a directory is not supported.
* tests/misc/truncate-fifo: Ensure the test doesn't hang
by using the `timeout` command.  Don't test the return from
running ftruncate on the fifo as it's system dependent as
to whether this fails or not.
NEWS: Mention the change in behavior.
Reported by Jim Meyering.

14 years agotruncate: support sizes relative to an existing file
Pádraig Brady [Wed, 26 May 2010 08:27:53 +0000 (09:27 +0100)]
truncate: support sizes relative to an existing file

* doc/coreutils.texi (truncate invocation): Mention that --reference
bases the --size rather than just setting it.
* src/truncate.c (usage): Likewise. Also remove the clause
describing --size and --reference as being mutually exclusive.
(do_truncate): Add an extra parameter to hold the size
of a referenced file, and use it if positive.
(main): Pass the size of a referenced file to do_truncate().
* tests/misc/truncate-parameters: Adjust for the new combinations.
* NEWS: Mention the change
Suggested by Richard W.M. Jones

14 years agotests: update help-version to work with parted, too
Jim Meyering [Wed, 26 May 2010 09:33:53 +0000 (11:33 +0200)]
tests: update help-version to work with parted, too

* tests/misc/help-version: Add init code for GNU Parted.

14 years agomaint: don't emit an extra newline in each of two diagnostics
Jim Meyering [Tue, 25 May 2010 16:05:29 +0000 (18:05 +0200)]
maint: don't emit an extra newline in each of two diagnostics

* src/shuf.c (main): Remove a stray newline in a diagnostic.
* src/od.c (main): Likewise.
Detected via these:
  git grep -A1 'error *(.*,$' | grep -C1 '\\n"[,)]'
  git grep 'error *(.*;$' | grep '\\n"[,)]'

14 years agomaint: remove unneeded double quotes on RHS of shell assignments
Jim Meyering [Tue, 25 May 2010 10:32:03 +0000 (12:32 +0200)]
maint: remove unneeded double quotes on RHS of shell assignments

Run this command:
  git grep -l 'LC_[A-Z]*="' \
    | xargs perl -pi -e 's/(LC_[A-Z]*)="(.*?)"/$1=$2/'
* src/Makefile.am: Write LC_ALL=$$locale, not LC_ALL="$$locale".
* src/date.c (main): Similar, in a comment.
* tests/misc/sort-month: Write LC_ALL=$LOC, not LC_ALL="$LOC".

14 years agomaint: remove a redundant sort parameter from a test
Pádraig Brady [Mon, 24 May 2010 12:00:35 +0000 (13:00 +0100)]
maint: remove a redundant sort parameter from a test

* tests/misc/sort-month: Remove the -b option which
is redundant and ignored.

14 years agosort: adjust the leading blanks --debug warning
Pádraig Brady [Sat, 22 May 2010 13:19:50 +0000 (14:19 +0100)]
sort: adjust the leading blanks --debug warning

* src/sort.c (key_warnings): Always warn about significant leading
blanks when character offsets are specified, unless they key is
possibly a line offset, i.e. of the form -k1.x,1.y.  Also suppress
this warning if the user could be sorting right aligned indexes.

14 years agomaint: make copyright comment consistent with all others
Jim Meyering [Sun, 23 May 2010 16:10:28 +0000 (18:10 +0200)]
maint: make copyright comment consistent with all others

* tests/misc/mktemp: Change punctuation to make copyright
paragraph consistent with all of the others.

14 years agotests: fix cp-a-selinux to skip cleanly upon mkfs failure
Jim Meyering [Fri, 21 May 2010 12:55:36 +0000 (14:55 +0200)]
tests: fix cp-a-selinux to skip cleanly upon mkfs failure

* tests/cp/cp-a-selinux: Initialize skip, to avoid a syntax error
in subsequent "test".
Remove redirect-to-/dev/null, now that output is always to a log file.

14 years agodu: recognize -d N as equivalent to --max-depth=N
Jon Ringuette [Tue, 18 May 2010 06:26:11 +0000 (08:26 +0200)]
du: recognize -d N as equivalent to --max-depth=N

* NEWS (New features): Mention it.
* src/du.c (DEBUG_OPT): Remove.  Use long-named ---debug instead.
Commented out.
(MAX_DEPTH_OPTION): Remove.  Use 'd' instead.
(main): Insert literal "d:"; remove DEBUG_OPT.
* doc/coreutils.texi (du invocation): Add -d to indices.
* tests/du/max-depth: Exercise -d, too.

14 years agotests: exercise du's --max-depth option
Jim Meyering [Tue, 18 May 2010 06:39:40 +0000 (08:39 +0200)]
tests: exercise du's --max-depth option

* tests/Makefile.am (TESTS): Add du/max-depth.
* tests/du/max-depth: New file.

14 years agotests: fix sort-debug-keys when fr_FR.utf8 not available
Pádraig Brady [Tue, 18 May 2010 22:42:36 +0000 (23:42 +0100)]
tests: fix sort-debug-keys when fr_FR.utf8 not available

* tests/misc/sort-debug-keys: Correctly check for the absence
of the French UTF8 locale.

14 years agomaint: fix the fs-magic-compare rule
Jim Meyering [Mon, 17 May 2010 14:10:24 +0000 (16:10 +0200)]
maint: fix the fs-magic-compare rule

* src/Makefile.am (fs-def): Sort definitions.
This is required by fs-magic-compare's use of join.

14 years agotests: update init.sh from gnulib
Jim Meyering [Mon, 17 May 2010 07:12:22 +0000 (09:12 +0200)]
tests: update init.sh from gnulib

* tests/init.sh: Update from gnulib.

14 years agobuild: avoid a new -Wformat-induced warning
Jim Meyering [Mon, 17 May 2010 07:09:28 +0000 (09:09 +0200)]
build: avoid a new -Wformat-induced warning

* src/sort.c (mark_key): Add a cast-to-int of a printf field width,
to placate -Wformat.

14 years agodoc: fix sort info about version sort skipping blanks
Pádraig Brady [Sun, 16 May 2010 00:14:51 +0000 (01:14 +0100)]
doc: fix sort info about version sort skipping blanks

* doc/coreutils.text (sort invocation): leading blanks are
significant for 'V'.

14 years agosort: --debug: output data independent warnings and info
Pádraig Brady [Tue, 11 May 2010 17:46:21 +0000 (18:46 +0100)]
sort: --debug: output data independent warnings and info

* src/sort.c (usage): Mention --debug can output warnings to stderr.
Also split the translatable string to aid translation.
(default_key_compare): A new function refactored from main(),
and now also called from the new key_warnings() function.
(key_to_opts): A new function refactored from incompatible_options(),
and now also called from the new key_warnings() function.
(key_numeric): A new function refactored to test if key is numeric.
(key_warnings): A new function to output warnings to stderr,
about questionable use of various options.  Currently it warns
about zero length keys and ineffective global options.
(incompatible_options): Refactor out key_to_opts()
(main): Use key_init() to initialize gkey.  Refactor out
default_key_compare().  Call key_warnings() in debug mode.
* doc/coreutils.texi (sort invocation): Mention that warnings
are output by --debug.
* tests/misc/sort-debug-warn: A new test for debug warnings.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature

14 years agotests: fix sort-debug-keys when fr_FR.utf8 not available
Pádraig Brady [Wed, 12 May 2010 13:47:30 +0000 (14:47 +0100)]
tests: fix sort-debug-keys when fr_FR.utf8 not available

* tests/misc/sort-debug-keys: Don't verify (or even run)
the fr_FR tests when that locale is not available on the system.

14 years agosort: add a --debug option to highlight key extents
Pádraig Brady [Tue, 23 Feb 2010 08:43:04 +0000 (08:43 +0000)]
sort: add a --debug option to highlight key extents

* src/sort (usage): Add description for --debug.
(write_bytes): Pass a line structure so it can subsequently
be passed to compare to highlight the keys when in debug mode.
Also transform TAB and NUL characters written to stdout so
that the highlighting in debug mode aligns correctly.
(human_numcompare): Pass an "endptr" so we can record the extent
of the number matched.
(general_numcompare): Likewise.
(find_unit_order): Likewise.
(getmonth): Likewise.
(numcompare): Likewise.  Note we reuse find_unit_order() for this,
which is a good enough approximation, and means we don't need to
change the strnumcmp() interface.
(check_mixed_SI_IEC): Return whether iec_present, so that can be
used to set the "endptr" in find_unit_order.  Also make the key
parameter optional, which will be the case from numcompare().
(count_tabs): A new function to determine how much to adjust
the mbswidth() values by (TABs don't have a width).
(mark_key): A new function to output the key highlighting to stdout.
(debug_key): A new function to determine the offset and width
of the key highlighting.
(key_compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called.  For each key type, set
the length (lena) and whether leading blanks are auto skipped (skipb)
which are then used by debug_key() to highlight the portion of the
key used in the comparison.
(compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called.  Call debug_key() to
highlight the last resort comparison.
(check): Output highlighting for disorder line to stdout.
(main): Process the --debug option and make it mutually exlusive
with the -o option as I don't see it useful there, even potentially
harmful if someone left a --debug in by mistake when updating a file.
Also restricting debug output to stdout, simplifies the logic
for dealing with temporary files.
* doc/coreutils.texi (sort invocation): Describe the --debug option,
and reference it from the --key description.
* tests/misc/sort-debug-keys: A new test for highlighting keys.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.

14 years agobuild: record the gettext-0.18 requirement also in configure.ac
Jim Meyering [Tue, 11 May 2010 08:31:21 +0000 (10:31 +0200)]
build: record the gettext-0.18 requirement also in configure.ac

* configure.ac: Require gettext-0.18 here, too.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 11 May 2010 07:50:29 +0000 (09:50 +0200)]
build: update gnulib submodule to latest

* tests/init.sh: Update from gnulib, to fix typo.

14 years agobuild: record that when building from git, gettext-0.18 is required
Jim Meyering [Mon, 10 May 2010 10:39:37 +0000 (12:39 +0200)]
build: record that when building from git, gettext-0.18 is required

* bootstrap.conf (buildreq): Require gettext-0.18.

14 years agotests: avoid a new syntax-check failure
Jim Meyering [Mon, 10 May 2010 09:47:00 +0000 (11:47 +0200)]
tests: avoid a new syntax-check failure

* .x-sc_prohibit_fail_0: Exempt tests/init.sh.

14 years agotests: provide a definition of gl_trap_ in cfg.mk
Jim Meyering [Mon, 10 May 2010 09:06:37 +0000 (11:06 +0200)]
tests: provide a definition of gl_trap_ in cfg.mk

* cfg.mk (gl_trap_): Define here, now that it's gone from maint.mk.
* gnulib: Update to latest.

14 years agotests: begin using init.sh
Jim Meyering [Mon, 10 May 2010 09:29:27 +0000 (11:29 +0200)]
tests: begin using init.sh

* tests/init.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it here.

14 years agotests: update help-version
Jim Meyering [Sun, 9 May 2010 19:22:21 +0000 (21:22 +0200)]
tests: update help-version

* tests/misc/help-version: Use init.sh, rather than test-lib.sh.
Add idutils' setup.

14 years agotests: move sc_prohibit_always-defined_macros to gnulib's maint.mk
Jim Meyering [Sun, 9 May 2010 16:52:36 +0000 (18:52 +0200)]
tests: move sc_prohibit_always-defined_macros to gnulib's maint.mk

* cfg.mk (sc_prohibit_always-defined_macros): Remove it from here.
* gnulib: Update to latest, for a maint.mk that includes that rule.

14 years agotests: rename a syntax-check
Jim Meyering [Sun, 9 May 2010 16:47:34 +0000 (18:47 +0200)]
tests: rename a syntax-check

* cfg.mk (sc_prohibit_always-defined_macros): Rename from
sc_always_defined_macros.
* .x-sc_prohibit_always-defined_macros: New file, renamed from...
* .x-sc_always_defined_macros: ...removed.
* Makefile.am (syntax_check_exceptions): Rename here, too.

14 years agotests: loosen/tighten the always_defined_macros check
Jim Meyering [Sun, 9 May 2010 16:29:22 +0000 (18:29 +0200)]
tests: loosen/tighten the always_defined_macros check

* cfg.mk (.re-defmac): Generate better regexps: allow white space
before the '#', and append a word-boundary requirement.
Without the latter, #define NULL_DEV ... would evoke a false-positive.

14 years agotests: improve the always_defined_macros check
Jim Meyering [Sun, 9 May 2010 10:08:21 +0000 (12:08 +0200)]
tests: improve the always_defined_macros check

* cfg.mk (sc_always_defined_macros): Adjust its helpers not to depend
on the existence of ./lib.  Instead, extract symbols directly from
gnulib/lib/*.in.h files.

14 years agodoc: factor hard-coded project-specific bits from README-release, ...
Jim Meyering [Mon, 3 May 2010 20:00:30 +0000 (22:00 +0200)]
doc: factor hard-coded project-specific bits from README-release, ...

using the new --mail-headers option to gnulib's announce-gen, and
the updated maint.mk rules to connect the pieces.
* README-release: Remove hard-coded To:, Cc: etc. parts, now
that they're emitted automatically into the announcement template.
* cfg.mk (announcement_Cc_): Override the default.
* gnulib: Update to latest, to get newer announce-gen and maint.mk.

14 years agodoc: update release procedure
Jim Meyering [Mon, 3 May 2010 18:37:13 +0000 (20:37 +0200)]
doc: update release procedure

* README-release: Rearrange slightly: post the announcement to
Savannah first, so you can include a link to that post in the email.

14 years agomaint: factor trap-related code out of two syntax-check rules
Jim Meyering [Mon, 3 May 2010 13:35:56 +0000 (15:35 +0200)]
maint: factor trap-related code out of two syntax-check rules

* cfg.mk (gl_trap_): Define, using a loop and eval'd trap,
rather than repeated "trap" uses.  Also handle "13", SIGPIPE.
(sc_always_defined_macros): Use it.
(sc_system_h_headers): Likewise.

14 years agomaint: extend the always_defined_macros syntax-check
Jim Meyering [Mon, 3 May 2010 10:05:14 +0000 (12:05 +0200)]
maint: extend the always_defined_macros syntax-check

* cfg.mk (gl_generated_headers_): Define.
(headers_with_interesting_macro_defs): Remove headers covered
by the above.
(.re-defmac): Extract symbol names from many more files.
(sc_always_defined_macros): Use VC_LIST_EXCEPT, not VC_LIST, so
that we can use the usual exception mechanism.
Test for $(gnulib_dir), not system.h.
* .x-sc_always_defined_macros: New file.  Exempt src/seq.c.
* Makefile.am (syntax_check_exceptions): Add it here.

14 years agomaint: remove now-redundant definitions provided by signal.h
Jim Meyering [Mon, 3 May 2010 08:50:23 +0000 (10:50 +0200)]
maint: remove now-redundant definitions provided by signal.h

* src/dd.c (SA_NODEFER, SA_RESETHAND): Remove definitions,
now that gnulib guarantees they are defined in <signal.h>.
* src/ls.c (SA_RESTART): Likewise.

14 years agomaint: remove now-redundant definitions provided by sys/wait.h
Jim Meyering [Mon, 3 May 2010 08:45:47 +0000 (10:45 +0200)]
maint: remove now-redundant definitions provided by sys/wait.h

* src/timeout.c (WIFSIGNALED, WTERMSIG): Remove definitions,
now that gnulib guarantees they are defined in <sys/wait.h>.
* src/operand2sig.c: Likewise.
* src/kill.c: Likewise.

14 years agosort: use long doubles only when effective
Paul Eggert [Fri, 30 Apr 2010 22:23:38 +0000 (23:23 +0100)]
sort: use long doubles only when effective

* src/sort.c (general_numcompare): Don't use long double if strtold
is not available, as it may introduce needless overhead.

14 years agobuild: update gnulib submodule to latest; bootstrap, too
Jim Meyering [Fri, 30 Apr 2010 16:27:19 +0000 (18:27 +0200)]
build: update gnulib submodule to latest; bootstrap, too

14 years agosort: use long doubles for general numeric mode
Pádraig Brady [Wed, 28 Apr 2010 22:54:33 +0000 (23:54 +0100)]
sort: use long doubles for general numeric mode

* src/sort.c (general_numcompare): Use long doubles unconditionally,
and strtold when available, to convert numbers with greater range and
precision.  Performance was seen to be on par with standard doubles.
* doc/coreutils.texi (sort invocation): Amend the -g description to
mention long double rather than double, and strtold rather than strtod.
* src/getlimits.c (main): Output floating point limits for use in tests.
* tests/misc/sort-float: A new test to ensure sort is using long
doubles when possible, and that locale specific floats are handled.
* tests/Makefile.am: Reference the new test.
* tests/test-lib.sh (getlimits_): Normalize indenting.
* NEWS: Mention the new behaviour.
Reported by Nelson Beebe.

14 years agobuild: remove now-duplicate use of AC_SYS_LARGEFILE
Jim Meyering [Thu, 29 Apr 2010 10:03:41 +0000 (12:03 +0200)]
build: remove now-duplicate use of AC_SYS_LARGEFILE

* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Don't require AC_SYS_LARGEFILE,
now that gnulib does it.

14 years agobuild: remove now-useless configure-time header checks
Jim Meyering [Thu, 29 Apr 2010 09:32:37 +0000 (11:32 +0200)]
build: remove now-useless configure-time header checks

* m4/jm-macros.m4 (gl_CHECK_ALL_HEADERS): Don't test for headers
that gnulib now provides: sys/ioctl.h, sys/time.h, sys/wait.h.

14 years agodoc: tweak factor-describing wording
Jim Meyering [Sun, 25 Apr 2010 08:35:51 +0000 (10:35 +0200)]
doc: tweak factor-describing wording

* doc/coreutils.texi (factor invocation): Don't say that "factoring
large prime numbers is hard".  A pedant might ding you, since it's
trivial to factor a number that is known to be prime.  Instead, say
that "factoring large numbers... is hard".  Reported by Andreas Eder.

14 years agomaint: remove now-unnecessary #if HAVE_header_H tests.
Jim Meyering [Sat, 24 Apr 2010 15:38:13 +0000 (17:38 +0200)]
maint: remove now-unnecessary #if HAVE_header_H tests.

* .x-sc_prohibit_always_true_header_tests: New file.
* Makefile.am (syntax_check_exceptions): Add it.
* src/cat.c: Remove #if HAVE_SYS_IOCTL_H test.
* src/copy.c: Likewise.
* src/ls.c: Likewise.
* src/stty.c: Likewise.
* src/install.c: Remove #if HAVE_SYS_WAIT_H test.
* src/kill.c: Likewise.
* src/operand2sig.c: Likewise.
* src/timeout.c: Likewise.
* src/pathchk.c: Remove #if HAVE_WCHAR_H test.
* src/stat.c: Remove #if HAVE_NETINET_IN_H test.

14 years agobuild: enable gnulib modules for more replacement headers
Jim Meyering [Sat, 24 Apr 2010 15:16:56 +0000 (17:16 +0200)]
build: enable gnulib modules for more replacement headers

* bootstrap.conf (gnulib_modules): Add the following:
netinet_in, sys_ioctl, sys_wait, so that we can eliminate
the #if HAVE_<header>_H tests guarding their header inclusions.