platform/upstream/coreutils.git
13 years agotail: support rechecking currently missing remote dirs
Pádraig Brady [Sun, 24 Oct 2010 13:02:12 +0000 (14:02 +0100)]
tail: support rechecking currently missing remote dirs

src/tail.c (main): As an optimization, don't bother checking
for stdin or remote files, when ---disable-inotify is specified.
To improve the fix in commit 61b77891, set the disable_inotify
flag when we fall back to polling, so that we recheck remote files.
NEWS: Mention the fix

13 years agodu: don't print junk when diagnosing out-of-range time stamps
Paul Eggert [Sun, 24 Oct 2010 00:20:01 +0000 (17:20 -0700)]
du: don't print junk when diagnosing out-of-range time stamps

* src/du.c (show_date): Fix call to fputs with a buffer that
contains some uninitialized data.
* tests/Makefile.am (TESTS): Add du/big-timestamp.
* tests/du/bigtime: New file, which checks for the bug.

13 years agodoc: add a cross reference from cat's man page to "tac"
Rodrigo Campos [Tue, 19 Oct 2010 22:48:46 +0000 (19:48 -0300)]
doc: add a cross reference from cat's man page to "tac"

* man/cat.x: See also "tac".

13 years agotests: trigger and test for md5sum's new diagnostics
Jim Meyering [Tue, 19 Oct 2010 07:19:59 +0000 (09:19 +0200)]
tests: trigger and test for md5sum's new diagnostics

* tests/misc/md5sum: Test for new diagnostics.

13 years agomd5sum: print a summary warning for improperly formatted lines
Benno Schulenberg [Mon, 18 Oct 2010 20:35:39 +0000 (22:35 +0200)]
md5sum: print a summary warning for improperly formatted lines

And remove the now-superfluous totals from the other two warnings,
so the plurals will also work in other languages than English.

* src/md5sum.c (digest_check): Change as above.
* tests/misc/md5sum (check-quiet2): Adjust accordingly.

13 years agobuild: enable -Werror for gnulib-tests, too
Jim Meyering [Sun, 17 Oct 2010 17:08:44 +0000 (19:08 +0200)]
build: enable -Werror for gnulib-tests, too

* gnulib: Update to latest for warning-free tests.
* gnulib-tests/Makefile.am (AM_CFLAGS): Uncomment $(WERROR_CFLAGS),
now that these tests are warning-free.

13 years agomaint: update bootstrap from gnulib
Jim Meyering [Sun, 17 Oct 2010 13:32:03 +0000 (15:32 +0200)]
maint: update bootstrap from gnulib

* bootstrap: Update from gnulib.

13 years ago.gitignore: anchor patterns
Jim Meyering [Sun, 17 Oct 2010 10:47:38 +0000 (12:47 +0200)]
.gitignore: anchor patterns

* .gitignore: Anchor most patterns.  Remove .tarball-version.
* doc/.gitignore: Anchor all patterns.
Remove getdate.texi and get_date.texi.

13 years agotests: sort-float: avoid spurious test failure on ppc/ppc64
Jim Meyering [Sat, 16 Oct 2010 18:18:19 +0000 (20:18 +0200)]
tests: sort-float: avoid spurious test failure on ppc/ppc64

* tests/misc/sort-float: On systems with DBL_MIN < LDBL_MIN,
this test would fail because the expected output was not sorted.
Detect that case, and if needed, reverse those two values.

13 years agofold: fix fadvise hint
Andreas Schwab [Sat, 16 Oct 2010 11:32:04 +0000 (13:32 +0200)]
fold: fix fadvise hint

* src/fold.c (fold_file): Apply fadvise to istream, not stdin.
This bug would have inhibited the fadvise optimization when not
reading from standard input.

13 years agopost-release administrivia
Jim Meyering [Fri, 15 Oct 2010 15:06:56 +0000 (17:06 +0200)]
post-release administrivia

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

13 years agoversion 8.6 v8.6
Jim Meyering [Fri, 15 Oct 2010 14:50:15 +0000 (16:50 +0200)]
version 8.6

* NEWS: Record release date.

13 years agobuild: update gnulib for vasnprintf fix
Jim Meyering [Fri, 15 Oct 2010 05:49:54 +0000 (07:49 +0200)]
build: update gnulib for vasnprintf fix

13 years agobug#7213: [PATCH] sort: fix buffer overrun on 32-bit hosts when warning re obsolete...
Paul Eggert [Thu, 14 Oct 2010 07:12:23 +0000 (00:12 -0700)]
bug#7213: [PATCH] sort: fix buffer overrun on 32-bit hosts when warning re obsolete keys

* src/sort.c (key_warnings): Local buffer should be of size
INT_BUFSIZE_BOUND (uintmax_t), not INT_BUFSIZE_BOUND (sword).
This bug was discovered by running 'make check' on a 32-bit
Solaris 8 sparc host, using Sun cc.  I saw several other instances
of invoking umaxtostr on a buffer declared to be of size
INT_BUFSIZE_BOUND (VAR), and these instances should at some point
be replaced by INT_BUFSIZE_BOUND (uintmax_t) too, as that's a
less error-prone style.

13 years agotests: work around portability and clock-skew problems
Paul Eggert [Thu, 14 Oct 2010 06:39:50 +0000 (23:39 -0700)]
tests: work around portability and clock-skew problems

* tests/misc/ls-misc (push_ls_colors): Don't assume LS_COLORS
is set.  This part of the fix is by Jim Meyering.
(sl-dangle2, sl-dangle3, sl-dangle4, sl-dangle5): Don't assume
that newly-created files will have time stamps in the past.  They
might not, due to clock skew, if the file systems are remote.
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/21322/focus=21346

13 years agoinstall: avoid warning with Solaris 10 cc
Paul Eggert [Thu, 14 Oct 2010 03:44:12 +0000 (20:44 -0700)]
install: avoid warning with Solaris 10 cc

* src/install.c (extra_mode): Don't assign ~S_IRWXUGO & ~S_IFMT
to a mode_t variable, as the number might be too big to fit.
Solaris 10 cc warns about this, and the C standard says it
has undefined behavior.

13 years agombsalign: avoid warning with Solaris 10 cc
Paul Eggert [Thu, 14 Oct 2010 03:39:28 +0000 (20:39 -0700)]
mbsalign: avoid warning with Solaris 10 cc

* gl/lib/mbsalign.c: Include <stdint.h> for SIZE_MAX.
Use SIZE_MAX rather than (size_t) -1, to avoid warning for
"size_t x = -1" on Solaris 10 cc.
* gl/modules/mbsalign (Depends-on): Add stdint.

13 years agosort: fix unportable cast of unsigned char * -> char *
Paul Eggert [Thu, 14 Oct 2010 03:35:50 +0000 (20:35 -0700)]
sort: fix unportable cast of unsigned char * -> char *

* src/sort.c (fold_toupper): Change this back from char to
unsigned char, fixing a portability issue introduced in commit
59e2e55d0f154a388adc9bac37d2b45f2ba971f8 dated February 26, as the
C Standard doesn't let you convert from unsigned char * to char *
without a cast, and the (in theory more portable) style here is to
convert char values, not pointer values.
(getmonth): Convert char to unsigned char when needed for
comparison.

13 years agobuild: prepare to enable -Werror also for gnulib-tests/
Jim Meyering [Wed, 13 Oct 2010 09:20:18 +0000 (11:20 +0200)]
build: prepare to enable -Werror also for gnulib-tests/

* configure.ac (GNULIB_WARN_CFLAGS): Define new variable, for use
in gnulib-tests.
* gnulib-tests/Makefile.am: Disable specific -W___ options,
but only for a few specific offending tests:
(test_xvasprintf_CFLAGS): Define.
(test_lock_CFLAGS, test_tls_CFLAGS): Define.

13 years agotests: fix rand-isaac test
Paul Eggert [Wed, 13 Oct 2010 07:03:41 +0000 (09:03 +0200)]
tests: fix rand-isaac test

* gl/tests/test-rand-isaac.c (main): Fix swapped arguments to strtol.

13 years agotail: fix checking of currently unavailable directories
Pádraig Brady [Tue, 12 Oct 2010 00:39:58 +0000 (01:39 +0100)]
tail: fix checking of currently unavailable directories

* src/tail.c (tail_forever_inotify): Handle the case where
tail --follow=name with inotify, is not able to add a watch on
a specified directory.  This may happen due to inotify resource
limits or if the directory is currently missing or inaccessible.
In all these cases, revert to polling which will try to reopen
the file later.  Note inotify returns ENOSPC when it runs out
of resources, and instead we report a particular error message,
lest users think one of their file systems is full.
(main): Document another caveat with using inotify, where we
currently don't recheck directories recreated after the
initial watch is setup.
* tests/tail-2/F-vs-rename: Fix the endless loop triggered by
the above issue.
* tests/tail-2/inotify-hash-abuse: Likewise.
* tests/tail-2/wait: Don't fail in the resource exhaustion case.
* tests/tail-2/F-vs-missing: A new test for this failure mode
which was until now just triggered on older buggy linux kernels
which returned ENOSPC constantly from inotify_add_watch().
* NEWS: Mention the fix.

13 years agobuild: update gnulib to latest; to fix failing Solaris 5.11 test
Jim Meyering [Mon, 11 Oct 2010 20:41:12 +0000 (22:41 +0200)]
build: update gnulib to latest; to fix failing Solaris 5.11 test

13 years agomaint: add new file: .mailmap
Jim Meyering [Mon, 11 Oct 2010 17:50:44 +0000 (19:50 +0200)]
maint: add new file: .mailmap

* .mailmap: Map git author names and email addresses to
canonical/preferred form.  This file is used e.g., by "git shortlog".

13 years agobuild: update gnulib, to fix OpenBSD test failures
Jim Meyering [Fri, 8 Oct 2010 20:15:15 +0000 (22:15 +0200)]
build: update gnulib, to fix OpenBSD test failures

13 years agobuild: update gnulib to latest; for parse-datetime.y fix
Jim Meyering [Fri, 8 Oct 2010 06:08:39 +0000 (08:08 +0200)]
build: update gnulib to latest; for parse-datetime.y fix

13 years agobuild: update gnulib to latest, to avoid FreeBSD compilation failure:
Jim Meyering [Thu, 7 Oct 2010 06:57:26 +0000 (08:57 +0200)]
build: update gnulib to latest, to avoid FreeBSD compilation failure:

http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/23501

13 years agosplit: fix reporting of read errors
Pádraig Brady [Thu, 7 Oct 2010 12:12:36 +0000 (13:12 +0100)]
split: fix reporting of read errors

The bug was introduced with commit 23f6d41f, 19-02-2003.

* src/split.c (bytes_split, lines_split, line_bytes_split):
Correctly check the return from full_read().
* tests/misc/split-fail: Ensure split fails when
it can't read its input.
* NEWS: Mention the fix.

13 years agobuild: update gnulib to latest, for memmem/strstr fix
Jim Meyering [Wed, 6 Oct 2010 07:31:21 +0000 (09:31 +0200)]
build: update gnulib to latest, for memmem/strstr fix

13 years agomaint: describe coreutils' policy on copyright year number ranges
Jim Meyering [Tue, 5 Oct 2010 08:50:48 +0000 (10:50 +0200)]
maint: describe coreutils' policy on copyright year number ranges

* README: Mention coreutils' long-standing policy on use of M-N
ranges in copyright year lists.  Requested by Richard Stallman.

13 years agobuild: complete the rename of get_date
Eric Blake [Tue, 5 Oct 2010 17:47:21 +0000 (11:47 -0600)]
build: complete the rename of get_date

* gnulib: Update to latest.
* src/date.c (includes, batch_convert, main): Track rename.
* src/touch.c (includes, get_reldate): Likewise.
* doc/coreutils.texi (Top, Date input formats): Likewise.
* bootstrap.conf (gnulib_modules): Likewise.
* doc/Makefile.am (EXTRA_DIST): Likewise.
* doc/.gitignore: Likewise.
* bootstrap: Synchronize from upstream.

13 years agostat: drop %C support when printing file system details
Eric Blake [Tue, 5 Oct 2010 15:02:37 +0000 (09:02 -0600)]
stat: drop %C support when printing file system details

* src/stat.c (print_statfs, usage): Drop %C, since it applies to
files, not file systems.
(out_file_context): Match style of other out_* functions.
(print_stat): Update caller.
* doc/coreutils.texi (stat invocation): Document %C.
* NEWS: Document the change.

13 years agobuild: fix build on Solaris 10
Eric Blake [Tue, 5 Oct 2010 14:38:22 +0000 (08:38 -0600)]
build: fix build on Solaris 10

* gnulib: Update to latest, for reduced -lgen scope.
* bootstrap: Synchronize from upstream.
Reported by Clemens Brogi, as bug #7142.

13 years agostat: adjust the printing of SELinux context
Pádraig Brady [Tue, 5 Oct 2010 07:40:17 +0000 (08:40 +0100)]
stat: adjust the printing of SELinux context

* src/stat.c (default_format): Don't print SELinux context
when in file system (-f) mode, as the context is associated
with the file, not the file system.
Fix logic inversion, so that in terse mode, %C is included
only when is_selinux_enabled and not vice versa.

13 years agotests: refactor the stat-birthtime test to use retry_delay_
Pádraig Brady [Mon, 4 Oct 2010 15:54:22 +0000 (16:54 +0100)]
tests: refactor the stat-birthtime test to use retry_delay_

* tests/misc/stat-birthtime: This recently added test
fits the pattern of requiring a delay to pass, so get
it to use retry_delay_()

13 years agomaint: add a release prerequisite: check the NixOS/Hydra autobuilder
Jim Meyering [Sun, 3 Oct 2010 18:48:53 +0000 (20:48 +0200)]
maint: add a release prerequisite: check the NixOS/Hydra autobuilder

* README-release: Add a note to check the autobuilder.

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Sun, 3 Oct 2010 17:24:58 +0000 (19:24 +0200)]
build: update gnulib submodule to latest

13 years agomaint: suppress a bogus used-uninitialized warning in tr.c
Jim Meyering [Fri, 1 Oct 2010 09:07:23 +0000 (11:07 +0200)]
maint: suppress a bogus used-uninitialized warning in tr.c

* src/tr.c (string2_extend): Insert an abort call to tell
gcc that char_to_repeat is not used uninitialized.

13 years agotests: output --version of program under test
Eric Blake [Fri, 1 Oct 2010 21:43:23 +0000 (15:43 -0600)]
tests: output --version of program under test

This touches all new tests added since commit b062bbd9, when
init.cfg was added.  Older tests still exist that could use
conversion, but we can address those later.

* tests/sample-test: Restore hint for --version output.
* tests/misc/stat-birthtime: Include --version if verbose.
* tests/misc/tr-case-class: Likewise.
* tests/misc/stat-mount: Likewise.
* tests/misc/sort-unique: Likewise.
* tests/misc/sort-benchmark-random: Likewise.
Suggested by Jim Meyering.

13 years agostat: print SELinux context when available
Eric Blake [Fri, 1 Oct 2010 17:54:34 +0000 (11:54 -0600)]
stat: print SELinux context when available

* src/stat.c (default_format): Include context when present.
* NEWS: Update blurb explaining the replacement for -Z.

13 years agostat: optimize and translate default format strings
Eric Blake [Fri, 1 Oct 2010 17:44:05 +0000 (11:44 -0600)]
stat: optimize and translate default format strings

Yes, this patch intentionally leaks the results of default_format(),
since it is called only twice, and since the results are in scope
until main() exits.  Not worth the extra code to pacify valgrind.

* src/stat.c (main): Hoist default format computation out of loop.
(do_statfs, do_stat): Move default format generation...
(default_format): ...into new function.  Allocate the result in
pieces, rather than repeating mostly-similar chunks.  Allow
translation of verbose format.  Pass a second format to do_stat,
for the one aspect of the default format that is conditional on
file type.
* NEWS: Document the translation aspect.

13 years agostat: print timestamps to full resolution
Eric Blake [Thu, 30 Sep 2010 22:42:13 +0000 (16:42 -0600)]
stat: print timestamps to full resolution

* src/stat.c (epoch_time): New function.
(print_stat): Use it for %[WXYZ].
* NEWS: Document this.
* tests/touch/60-seconds: Adjust test to match.
* tests/misc/stat-birthtime: Likewise.

13 years agostat: support printing birthtime
Eric Blake [Thu, 30 Sep 2010 22:31:50 +0000 (16:31 -0600)]
stat: support printing birthtime

* src/stat.c (print_stat): New %w and %W formats.
(do_stat): Include %w in default format.
(usage): Document new specifiers.
* doc/coreutils.texi (stat invocation): Likewise.
* NEWS: Likewise.

13 years agomaint: update sample test template
Eric Blake [Fri, 1 Oct 2010 15:38:50 +0000 (09:38 -0600)]
maint: update sample test template

* tests/sample-test: Recommend modern idiom.

13 years agomaint: ensure the mbsalign module is C89 compatible
Pádraig Brady [Fri, 1 Oct 2010 13:28:18 +0000 (14:28 +0100)]
maint: ensure the mbsalign module is C89 compatible

This module may be moved to gnulib at some stage,
so keep it C89 compatible.

* gl/lib/mbsalign.c (mbsalign): Declare variables at start of scope
(ambsalign): Likewise
* gl/lib/mbsalign.h: Remove trailing comma from enum
Reported by Andrei Suhan

13 years agomaint: update gnulib
Eric Blake [Thu, 30 Sep 2010 21:57:19 +0000 (15:57 -0600)]
maint: update gnulib

* gnulib: Update to latest.
* doc/coreutils.texi (date): Reflect new module name.
* doc/Makefile.am (EXTRA_DIST): Likewise.
* doc/.gitignore: Likewise.

13 years agomaint: update gnulib
Eric Blake [Thu, 30 Sep 2010 15:44:27 +0000 (09:44 -0600)]
maint: update gnulib

* gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Reflect new module name.
* bootstrap: Resync from upstream.

13 years agomaint: mention the du-exclude--vs--cycle-dir fix
Jim Meyering [Thu, 30 Sep 2010 12:24:42 +0000 (14:24 +0200)]
maint: mention the du-exclude--vs--cycle-dir fix

* NEWS (Bug fixes): Mention the du-exclude--vs--cycle-dir fix.
Reported by Graham Cobb in http://bugs.debian.org/598438,
that bug was fixed by the 2010-07-24 commit, 77428214f,
"du: tune, and fix some -L bugs with dangling or cyclic symlinks"

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 29 Sep 2010 12:34:20 +0000 (14:34 +0200)]
build: update gnulib submodule to latest

13 years agotr: fix various issues with case conversion
Pádraig Brady [Mon, 27 Sep 2010 06:16:44 +0000 (07:16 +0100)]
tr: fix various issues with case conversion

This valid translation spec aborted:
  LC_ALL=en_US.iso-8859-1 tr '[:upper:]- ' '[:lower:]_'
This invalid translation spec aborted:
  LC_ALL=en_US.iso-8859-1 tr '[:upper:] '  '[:lower:]'
This was caused by commit 6efd1046, 05-01-2008,
"Avoid tr case-conversion failure in some locales"

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

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

* src/tr.c (validate_case_classes): A new function to check
alignment of case conversion classes.  Also it adjusts the
length of the sets so that locales with different numbers of
upper and lower case characters, don't cause issues.
(string2_extend): Disallow extending the case conversion
class as in the above example.  That is locale dependent
and most likely not what the user wants.
(validate): Do the simple test for "restricted" char classes
earlier, so we don't redundantly do more expensive validation.
(main): Remove the case class validation, and simplify.
* tests/misc/tr-case-class: A new test to test the various
alignment and locale issues, associated with case conversion.
* tests/misc/tr: Move case conversion tests to new tr-case-class.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fixes.

13 years agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 20 Sep 2010 23:27:11 +0000 (16:27 -0700)]
build: update gnulib submodule to latest

13 years agosort: destroy spin locks portably
Paul Eggert [Mon, 20 Sep 2010 22:44:31 +0000 (15:44 -0700)]
sort: destroy spin locks portably

* src/sort.c (sortlines, sort): Use pthread_spin_destroy when a
spin lock is no longer used.  This isn't needed on GNU/Linux or
Solaris, but POSIX says it may free up resources on some platforms.

13 years agotests: fix a printf portability issue
Pádraig Brady [Mon, 20 Sep 2010 14:23:20 +0000 (15:23 +0100)]
tests: fix a printf portability issue

* tests/misc/sort-debug-keys: Don't depend on
printf supporting \xhh format, which isn't supported
by dash for example.  Also change from double quoted
strings to single quoted, when we don't need any
variable interpolation.

13 years agotests: fix an erroneous stat failure with bind mounts
Pádraig Brady [Mon, 20 Sep 2010 14:07:02 +0000 (15:07 +0100)]
tests: fix an erroneous stat failure with bind mounts

* tests/misc/stat-mount: Don't try to correlate the
mount points output by df and stat, as they're similar,
but sometimes different in the presence of bind mounts.
* doc/coretuils.texi (stat invocation): Clarify the
bind mount difference between stat and df.

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Sat, 18 Sep 2010 20:35:04 +0000 (22:35 +0200)]
build: update gnulib submodule to latest

13 years agotests: sync tests/init.sh from gnulib
Jim Meyering [Sat, 18 Sep 2010 19:22:16 +0000 (21:22 +0200)]
tests: sync tests/init.sh from gnulib

* tests/init.sh: Update from gnulib.

13 years agobuild: use gnulib's new termios module
Jim Meyering [Sat, 18 Sep 2010 18:24:41 +0000 (20:24 +0200)]
build: use gnulib's new termios module

With it, we can remove the two sole tests of HAVE_TERMIOS_H.
* bootstrap.conf (gnulib_modules): Add termios.
* src/ls.c: Don't test HAVE_TERMIOS_H.
* src/stty.c: Likewise.
* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Remove configure-time
test for termios.h.

13 years agomaint: don't use obsolete gnulib modules
Jim Meyering [Mon, 6 Sep 2010 05:49:48 +0000 (07:49 +0200)]
maint: don't use obsolete gnulib modules

* bootstrap.conf (gnulib_modules): Use calloc-gnu, malloc-gnu
and realloc-gnu modules, rather than calloc, malloc and realloc.
The shorter-named modules are now deprecated.
(obsolete_gnulib_modules): Remove.
(gnulib_modules): Remove raise, strbprk; they're obsolete, too.
Move strtod, strtol here, from obsolete_gnulib_modules.

13 years agomaint: update to latest gnulib
Eric Blake [Fri, 17 Sep 2010 21:54:59 +0000 (15:54 -0600)]
maint: update to latest gnulib

* gnulib: Update to latest.
* src/copy.c (copy_reg): Use fdutimens instead of gl_futimens.
* src/touch.c (touch): Adjust parameter order.
* tests/init.sh: Resync from upstream.

13 years agorm: remove no-op -d option
Eric Blake [Thu, 16 Sep 2010 17:52:27 +0000 (11:52 -0600)]
rm: remove no-op -d option

* src/rm.c (long_opts, main): Resolve a fixme.
* NEWS: Document the change.
Based on a report by William Plusnick.

13 years agomaint: update to latest gnulib
Eric Blake [Thu, 16 Sep 2010 23:38:00 +0000 (17:38 -0600)]
maint: update to latest gnulib

* gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Add fdutimensat.
* src/touch.c (touch): Use fdutimensat instead of gl_futimens.

13 years agodircolors: add rxvt-unicode-256color terminal type
Dmitry V. Levin [Mon, 13 Sep 2010 22:26:08 +0000 (02:26 +0400)]
dircolors: add rxvt-unicode-256color terminal type

rxvt-unicode introduced new terminal type:
http://cvs.schmorp.de/rxvt-unicode/src/rxvt.h?r1=1.398&r2=1.399

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

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
13 years agotests: work around a failure with dash 0.5.4
Pádraig Brady [Tue, 7 Sep 2010 14:53:14 +0000 (15:53 +0100)]
tests: work around a failure with dash 0.5.4

* tests/misc/env: Check that the shell can support
the operation, before filtering through `env`.
Note dash 0.5.5 is unaffected by this issue.

13 years agotests: make various timeouts more robust
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.

13 years agotests: exclude some tests when running on NFS
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/.

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Sat, 4 Sep 2010 12:25:11 +0000 (14:25 +0200)]
build: update gnulib submodule to latest

13 years agobuild: use gettext-h, not gettext
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]...

13 years agotac: suppress technically unneeded "free"
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.

13 years agojoin: improve performance when operating on whole lines
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.

13 years agotac: avoid double free
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>.

13 years agodoc: clarify that stat -f implies -L (follows symlinks)
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.

13 years agostat: add %m to output the mount point for a file
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>
13 years agomaint: update to latest gnulib
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.

13 years agomaint: avoid a hung 'make syntax-check' in VPATH build
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.

13 years agodf: always print the device name for bind mounted files
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.

13 years agostat: fix a small memory leak with %N
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().

13 years agomaint: exclude tests from the set_program_name syntax-check
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

13 years agodoc: avoid a warning from newer texinfo
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.

13 years agodoc: improve the info on md5sum security weaknesses
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

13 years ago* tests/misc/sort (use-nl): Fix comment to match the test case.
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.

13 years agosort, who: prefer free+malloc to realloc when contents are irrelevant
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.

13 years agosort: free/xmalloc rather than xrealloc
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.

13 years agobuild: update to latest gnulib
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.

13 years agosort: avoid gcc warning: explicitly ignore strtold result
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.

13 years agotests: silence 'make syntax-check'
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.

13 years agodircolors: add screen.rxvt & terminator to TERM list
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>
13 years agols: fix a test failure that should have been skipped
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.

13 years agosort: speed up -R with long lines in hard locales
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.

13 years agosort: support all combinations of -d, -f, -i, -R, and -V
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.

13 years agosort: tune and refactor --debug code, and fix minor underlining bug
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.

13 years agosort: -R now uses less memory on long lines with internal NULs
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.

13 years agoinit.sh: work around trap limitation of some shells
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.

13 years agosort: fix bug in --debug when \0 is followed by \t
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.

13 years agosort: revert recent -h changes and use a more-conservative approach
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.

13 years agosort: -h now handles comparisons such as 6000K vs 5M and 5MiB vs 5MB
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.

13 years agosort: fix --debug display with very large offsets
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.

13 years agosort: fix bug with EOF at buffer refill
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.

13 years agosort: omit some "inline"s
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.

13 years agosort: don't assume ASCII when parsing K, M, G suffixes
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.

13 years agosort: make struct heap private
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.

13 years agosort: omit unnecessary mutex unlock+lock; simplify heap access
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.