platform/upstream/coreutils.git
14 years agodoc: mention the texinfo documentation in --help
Pádraig Brady [Fri, 18 Sep 2009 22:06:21 +0000 (23:06 +0100)]
doc: mention the texinfo documentation in --help

* src/system.h: Rename emit_bug_reporting_address() to
emit_ancillary_info() and update it to not print the translation
project address in en_* locales, and _do_ print it in the 'C'
(and other) locales so that it's included in the default man page.
Also mention how to invoke the texinfo documentation for each command.
Also move the "hard-locale.h" include to the 8 files that now use it.
* man/help2man: Strip the newly added texinfo reference from the
--help output as a more verbose version is already added by help2man.
Suggestion from C de-Avillez

14 years agomaint: automate the web-doc updating procedure
Jim Meyering [Mon, 21 Sep 2009 06:56:17 +0000 (08:56 +0200)]
maint: automate the web-doc updating procedure

* gnu-web-doc-update: New script, destined for gnulib.
* README-release: Refer to the new script.

14 years agodircolors: arrange to highlight names with the .lz suffix
Jim Meyering [Sat, 19 Sep 2009 10:26:36 +0000 (12:26 +0200)]
dircolors: arrange to highlight names with the .lz suffix

* src/dircolors.hin: Add .lz, for GNU lzip.
Suggested by Matias A. Fonzo.

14 years agomktemp: adapt to new, 3-argument gen_tempname_len
Jim Meyering [Fri, 18 Sep 2009 21:05:59 +0000 (23:05 +0200)]
mktemp: adapt to new, 3-argument gen_tempname_len

* src/mktemp.c (mkstemp_len, mkdtemp_len): Update callers of
gen_tempname_len.
* gl/lib/tempname.c, gl/lib/tempname.h: Rebase against recently
API-modified copy of tempname module in gnulib.
Reported by Lluís Batlle.

14 years agobuild: merge bootstrap changes from gnulib
Jim Meyering [Thu, 17 Sep 2009 12:30:01 +0000 (14:30 +0200)]
build: merge bootstrap changes from gnulib

* bootstrap: Update from gnulib.

14 years agorm, rmdir: improve cross-compilation support
Eric Blake [Wed, 16 Sep 2009 14:27:07 +0000 (08:27 -0600)]
rm, rmdir: improve cross-compilation support

* bootstrap.conf (gnulib_modules): Drop rmdir-errno.
* src/rmdir.c (errno_rmdir_non_empty): Check both cases allowed by
POSIX, rather than relying on configure-time check that might
fail during cross-compilation.  Reverts commit 9b6eb98d41.

14 years agocp: fix a probably redundant chmod when setting xattrs
Ondřej Vašík [Tue, 15 Sep 2009 09:41:23 +0000 (10:41 +0100)]
cp: fix a probably redundant chmod when setting xattrs

* src/copy.c (copy_reg): Fix initial value of access_changed variable.
This was introduced by Pádraig Brady in commit cca83faf, 2009-09-14,
"cp,mv: preserve extended attributes even for read-only files"

14 years agodoc: NEWS: mention origin of touch -t ....60 bug
Jim Meyering [Mon, 14 Sep 2009 13:57:13 +0000 (15:57 +0200)]
doc: NEWS: mention origin of touch -t ....60 bug

* NEWS: It is an old bug.

14 years agodoc: touch, document that it accepts .60
Jim Meyering [Mon, 14 Sep 2009 13:37:26 +0000 (15:37 +0200)]
doc: touch, document that it accepts .60

* doc/coreutils.texi (touch invocation): Document that SS may be 60.

14 years agotouch: don't reject "60" as number of seconds in a legacy time stamp
Jim Meyering [Sat, 12 Sep 2009 12:00:32 +0000 (14:00 +0200)]
touch: don't reject "60" as number of seconds in a legacy time stamp

A valid command like "touch -t 197101010000.60 F" would fail due
to the suffix of ".60".  This bug is fixed via the latest change
to gnulib's posixtm module.
* tests/touch/60-seconds: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.

14 years agobuild: update gnulib submodule to latest, for fixed posixtm module
Jim Meyering [Mon, 14 Sep 2009 12:54:23 +0000 (14:54 +0200)]
build: update gnulib submodule to latest, for fixed posixtm module

14 years agomaint: use #!/bin/sh consistently in shell-based test scripts
Jim Meyering [Mon, 14 Sep 2009 12:53:24 +0000 (14:53 +0200)]
maint: use #!/bin/sh consistently in shell-based test scripts

* tests/misc/sort-continue: Change first line to standard #!/bin/sh,
not #!/bin/bash (though it doesn't matter, since each is invoked
via $(SHELL) dir/test-name.

14 years agotests: fix dd/skip-seek-past-file to work on ecryptfs
Pádraig Brady [Mon, 14 Sep 2009 00:38:03 +0000 (01:38 +0100)]
tests: fix dd/skip-seek-past-file to work on ecryptfs

* tests/dd/skip-seek-past-file: Require sparse support
to ensure that when we're checking if we can create an
$OFF_T_MAX length file, that we don't actually allocate
any space.  This was an issue on ecryptfs and was reported
by Bert Wesarg.

14 years agocp,mv: preserve extended attributes even for read-only files
Ondřej Vašík [Mon, 14 Sep 2009 13:12:01 +0000 (14:12 +0100)]
cp,mv: preserve extended attributes even for read-only files

* src/copy.c (copy_reg): Temporarily set u+rw on the destination file
to allow GNU/Linux to set xattrs.
* tests/misc/xattr: Test that change.
* NEWS (Bug fixes): Mention it.
Reported by Ernest N. Mamikonyan.

14 years agodoc: improve timeout's --help message
Jim Meyering [Mon, 14 Sep 2009 07:18:30 +0000 (09:18 +0200)]
doc: improve timeout's --help message

* src/timeout.c (usage): Improve --help description.

14 years agomaint: use consistent cpp indentation in all .c files
Jim Meyering [Sun, 13 Sep 2009 20:05:37 +0000 (22:05 +0200)]
maint: use consistent cpp indentation in all .c files

* src/stty.c: Make cpp indentation reflect nesting.
* src/factor.c: Likewise.

14 years agodoc: NEWS: say quadratic and linear, rather than O(N^2) and O(N)
Jim Meyering [Sun, 13 Sep 2009 10:11:57 +0000 (12:11 +0200)]
doc: NEWS: say quadratic and linear, rather than O(N^2) and O(N)

* NEWS: Use a slightly less technical description.
Suggested by Andreas Schwab.

14 years agodoc: improve NEWS
Jim Meyering [Sun, 13 Sep 2009 09:48:03 +0000 (11:48 +0200)]
doc: improve NEWS

* NEWS (rm -r, without -f): Mention that the N in "O(N)" represents
hierarchy depth.  Suggested by Ralf Wildenhues.
(rm -r, standards conformance): Make wording more accurate.

14 years agoid: don't print context=... when POSIXLY_CORRECT is set
Jim Meyering [Fri, 11 Sep 2009 14:30:27 +0000 (16:30 +0200)]
id: don't print context=... when POSIXLY_CORRECT is set

* src/id.c (print_full_info) [POSIXLY_CORRECT]: Don't print context.
Reported by Ulrich Drepper.
* NEWS (Changes in behavior): Mention it.
* doc/coreutils.texi (id invocation): Document that id also prints the
security context, when possible, and when POSIXLY_CORRECT is not set.
* tests/id/no-context: New file.  Test for this.
* tests/Makefile.am (TESTS): Add it.

14 years agorm: avoid compiler warning
Eric Blake [Fri, 4 Sep 2009 04:45:36 +0000 (22:45 -0600)]
rm: avoid compiler warning

* src/remove.c (rm_fts): Don't allow fall-through when assertions
are disabled.

14 years agoeuidaccess-stat: remove unnecessary macros
Eric Blake [Fri, 4 Sep 2009 04:07:39 +0000 (22:07 -0600)]
euidaccess-stat: remove unnecessary macros

* lib/euidaccess-stat.c (F_OK, R_OK, W_OK, X_OK): Delete; now
guaranteed by gnulib.

14 years agorm: use gnulib faccessat
Eric Blake [Fri, 4 Sep 2009 03:59:54 +0000 (21:59 -0600)]
rm: use gnulib faccessat

* bootstrap.conf (gnulib_modules): Add faccessat.  Replace strdup
with strdup-posix.
* m4/jm-macros.m4 (coreutils_MACROS): Revert previous change, now
that gnulib does it for us.
* src/remove.c (write_protected_non_symlink): Use faccessat in
more situations.

14 years agorm: improve efficiency of rm -r (without -f) from O(N^2) to O(N)
Jim Meyering [Thu, 3 Sep 2009 13:15:09 +0000 (15:15 +0200)]
rm: improve efficiency of rm -r (without -f) from O(N^2) to O(N)

where N is the depth of the deepest hierarchy rm is processing.
* src/remove.c (write_protected_non_symlink): Use faccessat to
avoid O(N)-per-entry cost of calling euidaccess.
* m4/jm-macros.m4 (coreutils_MACROS): Check for faccessat.
* NEWS (Improvements): Mention it.

14 years agobuild: placate gcc's new -Wskip-jump-init
Jim Meyering [Sat, 15 Aug 2009 15:22:01 +0000 (17:22 +0200)]
build: placate gcc's new -Wskip-jump-init

* remove.c (rm_fts): Put braces around each of the two offending blocks.
* configure.ac: Don't turn off -Wjump-misses-init.
With the rewrite of remove.c, it is no longer needed.

14 years agorm: rewrite to use fts
Jim Meyering [Sun, 12 Jul 2009 16:15:23 +0000 (18:15 +0200)]
rm: rewrite to use fts

* remove.c: Don't include "unlinkdir.h"; no longer used.
Do not include <setjmp.h> or "cycle-check.h".  Likewise.
Include "xfts.h".
(dir_name, dir_len): Remove definitions.
(CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Likewise.
(INODE_SORT_DIR_ENTRIES_THRESHOLD, NEED_REWIND, D_TYPE): Likewise.
(struct dirstack_state, Dirstack_state): Likewise.
(g_buf, g_n_allocated): Remove declarations.
(hash_freer, hash_compare_strings, rm_malloc): Remove functions.
(rm_free, push_dir, top_dir, pop_dir, right_justify): Likewise.
(full_filename0, xfull_filename, full_filename_): Likewise.
(AD_stack_height, AD_stack_top, AD_stack_pop, AD_stack_clear): Likewise.
(obstack_init_minimal, ds_init, ds_clear, ds_free): Likewise.
(AD_pop_and_chdir, AD_ensure_initialized, AD_mark_helper): Likewise.
(AD_mark_as_unremovable, AD_mark_current_as_unremovable): Likewise.
(AD_push_initial, AD_push, AD_push, AD_is_removable): Likewise.
(write_protected_non_symlink): Change 3rd parameter from
dirstack_state "ds" to full_name.
(prompt): Adjust parameters.  Now, state comes from FTS/FTSENT pair.
Those replace fd_cwd and "ds".  Remove "filename".  Remove pdirent_type
in favor of new "is_dir" parameter.  Rename is_empty to is_empty_p.
(DO_RMDIR, DO_UNLINK): Remove definitions.
(remove_entry, fd_to_subdirp, compare_ino): Remove functions.
(dirent_count, dirent_inode_sort_may_be_useful): Likewise.
(preprocess_dir): Likewise.
(fts_skip_tree, mark_ancestor_dirs, excise, rm_fts): New functions.
(remove_cwd_entries, remove_dir, rm_1): Remove functions.
(rm): Rewrite as a simple loop calling fts_read and dispatching
each entry via rm_fts.
* src/rm.c (main): Adapt to new signature of rm().
* bootstrap.conf (gnulib_modules): Remove unlinkdir, no longer used.
* src/Makefile.am (sc_tight_scope): Also recognize an extern "enum"
declaration.
* tests/rm/empty-name: Adjust expected output to match new diagnostic.
* NEWS (Improvements): Mention it.

14 years agomaint: doc: adjust README-release
Jim Meyering [Fri, 11 Sep 2009 11:13:45 +0000 (13:13 +0200)]
maint: doc: adjust README-release

* README-release: Remove mention of bootstrap's old
--gnulib-srcdir=/gnulib option.  No longer needed, and its
use can lead to subtle problems.

14 years agopost-release administrivia
Jim Meyering [Fri, 11 Sep 2009 06:16:18 +0000 (08:16 +0200)]
post-release administrivia

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

14 years agoversion 7.6 v7.6
Jim Meyering [Fri, 11 Sep 2009 05:53:16 +0000 (07:53 +0200)]
version 7.6

* NEWS: Record release date.

14 years agolink,ln: use gnulib's link module to work around Solaris 10 deficiency
Jim Meyering [Thu, 10 Sep 2009 15:51:44 +0000 (17:51 +0200)]
link,ln: use gnulib's link module to work around Solaris 10 deficiency

Before this change, :>f; ln -T f no-such/ would succeed on Solaris 10.
After it, ln fails, as it should: ln: accessing `z/': Not a directory
The command, link f no-such/, had the same problem on that system.
* bootstrap.conf (gnulib_modules): Add "link".
* tests/ln/slash-decorated-nonexistent-dest: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Portability): Mention the improvement.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Thu, 10 Sep 2009 14:51:35 +0000 (16:51 +0200)]
build: update gnulib submodule to latest

14 years agodoc: improve various BLOCKSIZE and SIZE help
Ondřej Vašík [Thu, 10 Sep 2009 11:33:41 +0000 (12:33 +0100)]
doc: improve various BLOCKSIZE and SIZE help

* doc/coreutils.texi (multiplierSuffixes): Mention that
the suffix can be specified without a leading number
* src/split.c (usage): Refactor SIZE help to within a function
* src/truncate.c (usage): Likewise
* src/ls.c (usage): Likewise
* src/df.c (usage): Likewise. Also add a function with BLOCKSIZE help
* src/du.c (usage): Likewise.
* src/system.h: Define 2 functions to emit common help text
This was prompted by https://bugzilla.redhat.com/show_bug.cgi?id=511188

14 years agodd conv=unblock: print final newline consistently
Jim Meyering [Wed, 9 Sep 2009 14:48:02 +0000 (16:48 +0200)]
dd conv=unblock: print final newline consistently

* src/dd.c (dd_copy) [C_UNBLOCK]: Always print the final newline for
non-empty output, not just when output size is a multiple of cbs.
* doc/coreutils.texi (dd invocation) [conv=unblock]: Mention that dd
prints a newline after each output record, not just when replacing
trailing spaces.
Reported by Ulrich Drepper.
* tests/dd/unblock: New file.  Test for this.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.

14 years agomaint: make cfg.mk slightly more generic
Jim Meyering [Wed, 9 Sep 2009 14:44:37 +0000 (16:44 +0200)]
maint: make cfg.mk slightly more generic

* cfg.mk (url_dir_list): Don't hard-code "coreutils".  Use $(PACKAGE).

14 years ago* gnulib: Update submodule to latest.
Jim Meyering [Tue, 8 Sep 2009 07:45:44 +0000 (09:45 +0200)]
* gnulib: Update submodule to latest.

14 years agotail: make the new piped-stdin test as portable as the old one
Jim Meyering [Tue, 8 Sep 2009 06:26:22 +0000 (08:26 +0200)]
tail: make the new piped-stdin test as portable as the old one

* src/tail.c (main): Adapt piped-stdin test to use the same isapipe,
test as was used in the preceding POSIXLY_CORRECT condition.
Remove the now-subsumed POSIXLY_CORRECT test.
Reported by Pádraig Brady.
* doc/coreutils.texi (tail invocation): Document this change.
* NEWS (Changes in behavior): Reclassify, clarify.

14 years agotests: tail-2/assert: reduce risk of race condition
Pádraig Brady [Tue, 8 Sep 2009 09:00:01 +0000 (10:00 +0100)]
tests: tail-2/assert: reduce risk of race condition

* tests/tail2/assert: This reverts commit be853120, 25-08-2009,
"tests: tail-2/assert: avoid risk of race condition"
kill -0 doesn't send a signal and so will only confirm that the
background process was forked, which we know already because
we have its pid.

14 years agotests: address a race condition in misc/cat-buf
Pádraig Brady [Mon, 7 Sep 2009 22:50:19 +0000 (23:50 +0100)]
tests: address a race condition in misc/cat-buf

* tests/misc/cat-buf: Increase the delay between writes
to decrease the chance that dd will read both at once.
Since the test is inherently racy, print a warning via
skip_test_ rather than failing outright.
Reported by Jim Meyering.

14 years agotail: syntax-only: use "false", rather than equivalent, 0
Jim Meyering [Mon, 7 Sep 2009 20:36:05 +0000 (22:36 +0200)]
tail: syntax-only: use "false", rather than equivalent, 0

* src/tail.c (record_open_fd): Initialize "->ignore" to false, not 0.

14 years agotail: ignore -f for piped-stdin, as POSIX requires
Jim Meyering [Mon, 7 Sep 2009 20:10:10 +0000 (22:10 +0200)]
tail: ignore -f for piped-stdin, as POSIX requires

* src/tail.c (main): Tailing a pipe "forever" is not useful,
and POSIX specifies that tail ignore the -f when there is no
file argument and stdin is a FIFO or pipe.  So we do that.
In addition, GNU tail excludes "-" arguments from the list of files
to tail forever, when the associated file descriptor is connected
to a FIFO or pipe.  Before this change, ":|tail -f" would hang.
Reported by Ren Yang and Ulrich Drepper.
* tests/tail-2/pipe-f: Test for this.
* tests/tail-2/pipe-f2: Ensure tail doesn't exit early for a fifo.
* tests/Makefile.am (TESTS): Add these tests.
* NEWS (POSIX conformance): Mention it.

14 years agotests: tail-2/flush-initial should not rely on stdbuf
Pádraig Brady [Mon, 7 Sep 2009 16:03:08 +0000 (17:03 +0100)]
tests: tail-2/flush-initial should not rely on stdbuf

* tests/tail-2/flush-initial: stdbuf is not built on all systems.
In any case it's redundant since stdout will automatically be buffered
since we're redirecting to file. So just call tail without using stdbuf.

14 years agotail: don't give up on inotify mode for an already-ignored "-"
Jim Meyering [Mon, 7 Sep 2009 18:56:38 +0000 (20:56 +0200)]
tail: don't give up on inotify mode for an already-ignored "-"

* src/tail.c (main): Adjust today's change to honor the
F[i].ignore flag that may have been set in tail_file.

14 years agotests: misc/cat-buf: clean up syntax
Jim Meyering [Mon, 7 Sep 2009 18:23:03 +0000 (20:23 +0200)]
tests: misc/cat-buf: clean up syntax

* tests/misc/cat-buf: Don't suppress dd's stderr.
Remove useless quotes.

14 years agotests: ls/color-clear-to-eol: append NL to accommodate old sed
Jim Meyering [Mon, 7 Sep 2009 17:36:21 +0000 (19:36 +0200)]
tests: ls/color-clear-to-eol: append NL to accommodate old sed

* tests/ls/color-clear-to-eol: Some vendor sed programs fail
to operate on lines that are not NL-terminated.
This affects at least Solaris 10's /bin/sed.
Reported by Pádraig Brady.

14 years agotests: tail-2/infloop-1: avoid rare test failure on a busy system
Jim Meyering [Mon, 7 Sep 2009 09:39:19 +0000 (11:39 +0200)]
tests: tail-2/infloop-1: avoid rare test failure on a busy system

* tests/tail-2/infloop-1: Sleep 3 seconds, not 1, but in increments
of 0.1 second.  Before, this test would fail ~1 time in 20 via
"make -j9 check" on a quad-core system.
Correct comment.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Mon, 7 Sep 2009 07:23:57 +0000 (09:23 +0200)]
build: update gnulib submodule to latest

14 years agodoc: tweak NEWS
Jim Meyering [Mon, 7 Sep 2009 07:23:19 +0000 (09:23 +0200)]
doc: tweak NEWS

* NEWS (dd): Tweak wording.
Two blank lines between sections.

14 years agotail -f: handle "-"/stdin once again
Jim Meyering [Mon, 7 Sep 2009 06:37:08 +0000 (08:37 +0200)]
tail -f: handle "-"/stdin once again

* src/tail.c (main) [HAVE_INOTIFY]: When stdin (i.e., "-", or no args,
but not /dev/stdin) is specified on the command line, don't use inotify.
Reported by Bill Brelsford in <http://bugs.debian.org/545422>.
* tests/tail-2/follow-stdin: New file.  Test for this.
* tests/Makefile.am (TESTS): Add the test.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".

14 years agotests: tail-2/flush-initial: correct race avoidance code
Jim Meyering [Sun, 6 Sep 2009 18:00:14 +0000 (20:00 +0200)]
tests: tail-2/flush-initial: correct race avoidance code

* tests/tail-2/flush-initial: Wait for the file to be nonempty,
not for the process.  Based on a suggestion from Pádraig Brady.

14 years agotests: ls-misc: don't let a bogus umask cause test failure
Jim Meyering [Sun, 6 Sep 2009 16:35:40 +0000 (18:35 +0200)]
tests: ls-misc: don't let a bogus umask cause test failure

* tests/misc/ls-misc: Set umask to 022.  A umask setting permitting
world-write access, e.g., umask o+w, would cause this test to fail.
Report by Mathias Brodala and analysis by Tom Fitzhenry in
<http://bugs.debian.org/544965>.

14 years agotail: flush initial output before possibly blocking
Jim Meyering [Sun, 6 Sep 2009 07:39:31 +0000 (09:39 +0200)]
tail: flush initial output before possibly blocking

* src/tail.c (main): Flush any output from tail_file,
before calling tail_forever_inotify, which can block.
* tests/tail-2/flush-initial: New file.  Test for the bug.
* tests/Makefile.am (TESTS): Add tail-2/flush-initial.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".

14 years agomaint: remove unused file: lib/fdopendir-glibc.c
Jim Meyering [Sat, 5 Sep 2009 17:52:16 +0000 (19:52 +0200)]
maint: remove unused file: lib/fdopendir-glibc.c

* lib/fdopendir-glibc.c: Remove unused file.

2009-09-05  Jim Meyering  <meyering@redhat.com>

14 years agotests: ls/stat-vs-dirent: avoid spurious test failure
Jim Meyering [Sat, 5 Sep 2009 17:06:31 +0000 (19:06 +0200)]
tests: ls/stat-vs-dirent: avoid spurious test failure

* tests/ls/stat-vs-dirent: Avoid test failure when run from a
directory whose name (or ancestor directory name) starts with ".".

14 years agodoc: make the tail --sleep-interval help less confusing
Pádraig Brady [Fri, 4 Sep 2009 21:50:15 +0000 (22:50 +0100)]
doc: make the tail --sleep-interval help less confusing

* src/tail.c (usage): I read "approximately S seconds"
as "approximately 5 seconds" for approximately 5 seconds.

14 years agomaint: remove some tab indentation from copy.c
Pádraig Brady [Sat, 5 Sep 2009 16:21:17 +0000 (17:21 +0100)]
maint: remove some tab indentation from copy.c

* src/copy.c (copy_internal): Remove tabs erroneously added
in commit 3346c0af.

14 years agotests: test old tail -f method even on systems with inotify
Pádraig Brady [Fri, 4 Sep 2009 20:41:30 +0000 (21:41 +0100)]
tests: test old tail -f method even on systems with inotify

* src/tail.c (main): Add an undocumented ---disable-inotify option
to allow disabling inotify.
* tests/tail-2/pid: Run test in both normal and "disable_inotify" modes.
* tests/tail-2/tail-n0f: Likewise.
* tests/tail-2/wait: Likewise.
* tests/tail-2/append-only: Likewise.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Sat, 5 Sep 2009 14:28:24 +0000 (16:28 +0200)]
build: update gnulib submodule to latest

14 years agostty: use TAB0, TAB1, and TAB2 only if defined
Petr Salinger [Sat, 5 Sep 2009 09:15:29 +0000 (11:15 +0200)]
stty: use TAB0, TAB1, and TAB2 only if defined

* src/stty.c (mode_info) [TAB0, TAB1, TAB2]: Guard each
entry with #ifdef.  Required for GNU/kFreeBSD.
Reported by Petr Salinger in http://bugs.debian.org/520368.

14 years agobuild: update from gnulib
Eric Blake [Sat, 5 Sep 2009 02:46:01 +0000 (20:46 -0600)]
build: update from gnulib

* gnulib: Update submodule to latest.

14 years agoln: add comments related to POSIX 2008
Eric Blake [Fri, 4 Sep 2009 19:56:16 +0000 (13:56 -0600)]
ln: add comments related to POSIX 2008

* src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Delete.
(do_link): Update comments per POSIX; add FIXME for -L, -P.

14 years agomv, cp: tweak LINK_FOLLOWS_SYMLINKS logic
Eric Blake [Fri, 4 Sep 2009 18:40:39 +0000 (12:40 -0600)]
mv, cp: tweak LINK_FOLLOWS_SYMLINKS logic

* gnulib: Update to latest gnulib.
* src/copy.c (copy_internal): Adjust comment in light of POSIX
2008, and deal with macro now being tri-state.

14 years agotests: fix a tail-2/pid failure on GNU/kFreeBSD
Petr Salinger [Fri, 4 Sep 2009 16:58:34 +0000 (17:58 +0100)]
tests: fix a tail-2/pid failure on GNU/kFreeBSD

* tests/tail-2/wait: Increase the file name recheck frequency to
fix a failure on systems without inotify and a file timestamp precision
of 1 second (like GNU/kFreeBSD).

14 years agotests: fix a failure when running tail-2/wait as root
Pádraig Brady [Fri, 4 Sep 2009 13:01:42 +0000 (14:01 +0100)]
tests: fix a failure when running tail-2/wait as root

* tests/tail-2/wait: Silently skip a portion of the test
when running as root, rather than failing the whole test.
This regression was introduced with commit 84b5844d, 2009-09-03,
"tests: simplify and fix a race in 2 tail --follow tests".

14 years agobuild: fix libcap configure flag handling
Mike Frysinger [Thu, 3 Sep 2009 19:31:01 +0000 (15:31 -0400)]
build: fix libcap configure flag handling

* m4/jm-macros.m4 (coreutils_MACROS): The code to handle configure-time
enabling or disabling of libcap support was broken.  It would treat any
libcap configure option as --disable-libcap because it doesn't check
$enableval at all.  This change makes sure we do the sane thing:
  --disable-libcap -> disable and don't run any tests
  --enable-libcap -> run tests and fail if not found
  default -> run tests and warn if not found

14 years agodf: don't fail due to an unreadable argument
Jim Meyering [Thu, 3 Sep 2009 17:36:34 +0000 (19:36 +0200)]
df: don't fail due to an unreadable argument

* src/df.c (main): If open or fstat fails when we're trying to ensure
that all arg-partitions are automounted, fall back on using stat.
Inspired by the report and patch from Olivier Fourdan in
http://bugzilla.redhat.com/520630.
* NEWS (Bug fixes): Mention it.
* tests/df/unreadable: New test for the above.
* tests/Makefile.am (TESTS): Add df/unreadable.
The bug was introduced in coreutils-7.3 via commit dbd17157,
2009-04-28, "df: use open(2), not stat, to trigger automounting".

14 years agodoc: install -C: fix bug in the texi documentation
Kamil Dudka [Thu, 3 Sep 2009 12:08:27 +0000 (14:08 +0200)]
doc: install -C: fix bug in the texi documentation

* doc/coreutils.texi: Move the documentation for install --compare (-C)
from the section on fmt to that for install.
Reported by Florian Schlichting.

14 years agotests: simplify and fix a race in 2 tail --follow tests
Pádraig Brady [Wed, 2 Sep 2009 23:39:17 +0000 (00:39 +0100)]
tests: simplify and fix a race in 2 tail --follow tests

* tests/tail-2/pid: Use the timeout command to determine process
longevity, rather than querying /proc/$pid/status.
The latter was racy in any case when inotify is used, as then
tail wakes up periodically even for unchanging files therefore
causing the check for "S (sleeping)" state to fail intermittently.
* tests/tail-2/wait: Likewise.

14 years agocp: don't leak resources for each xattr preservation failure
Ondřej Vašík [Wed, 2 Sep 2009 09:34:27 +0000 (10:34 +0100)]
cp: don't leak resources for each xattr preservation failure

* src/copy.c (copy_reg): Don't return from the function after an
unsuccessful and required preservation of extended attributes.
This resulted in leaking the copy buffer and file descriptors.
* NEWS (Bug fixes): Mention the fix.
The bug was introduced in coreutils-7.1 via commit 0889381c, 2009-01-23,
"cp/mv: add xattr support".

14 years agochcon, chmod, chgrp, chown, du: report fts_close failure
Pádraig Brady [Tue, 1 Sep 2009 11:02:13 +0000 (13:02 +0200)]
chcon, chmod, chgrp, chown, du: report fts_close failure

* src/du.c (du_files): Don't fail silently upon fts_close failure.
* src/chcon.c (process_files): Likewise.
* src/chmod.c (process_files): Likewise.
* src/chown-core.c (chown_files): Likewise.

14 years agobuild: update from gnulib
Jim Meyering [Tue, 1 Sep 2009 09:58:10 +0000 (11:58 +0200)]
build: update from gnulib

* gnulib: Update submodule to latest.

14 years agochcon, chmod, chgrp, chown, du: do not ignore fts_close failure
Jim Meyering [Tue, 1 Sep 2009 09:31:14 +0000 (11:31 +0200)]
chcon, chmod, chgrp, chown, du: do not ignore fts_close failure

This is probably never visible, but who knows...
* src/chcon.c (process_files): Don't ignore fts_close failure.
* src/chmod.c (process_files): Likewise.
* src/chown-core.c (chown_files): Likewise.
* src/du.c (du_files): Likewise.

14 years agomaint: du: remove unnecessary initialization
Jim Meyering [Mon, 31 Aug 2009 16:39:41 +0000 (18:39 +0200)]
maint: du: remove unnecessary initialization

* src/du.c (main): Don't set "skip_file" unnecessarily.

14 years agomaint: chown, chgrp, chmod, chcon: remove unnecessary initialization
Jim Meyering [Mon, 31 Aug 2009 16:26:16 +0000 (18:26 +0200)]
maint: chown, chgrp, chmod, chcon: remove unnecessary initialization

* src/chown-core.c: Include "ignore-value.h".
(change_file_owner): Don't set "ent" only to ignore it.
* src/chcon.c (process_file): Likewise.
* src/chmod.c: Include "ignore-value.h".
(process_file): Don't set "ent" only to ignore it.
After diagnosing root-dev/ino failure, return false immediately:
Now that we don't set "ent" we must be sure not to use it uninitialized,
and there's no point in issuing --verbose-related output in this case.

14 years agomaint: shred: remove unnecessary initialization
Jim Meyering [Mon, 31 Aug 2009 15:58:53 +0000 (17:58 +0200)]
maint: shred: remove unnecessary initialization

* src/shred.c (genpattern): Value stored to "n" is never used.

14 years agomaint: dd: remove unnecessary initialization
Jim Meyering [Mon, 31 Aug 2009 15:05:46 +0000 (17:05 +0200)]
maint: dd: remove unnecessary initialization

* src/dd.c (skip): Remove set-but-never-used variable, soffset.

14 years agomaint: tail: remove unnecessary initialization
Jim Meyering [Mon, 31 Aug 2009 15:01:26 +0000 (17:01 +0200)]
maint: tail: remove unnecessary initialization

* src/tail.c (tail_bytes): Don't compute "diff" twice.

14 years agomaint: mbsalign.c: remove unnecessary assignment
Jim Meyering [Mon, 31 Aug 2009 14:37:36 +0000 (16:37 +0200)]
maint: mbsalign.c: remove unnecessary assignment

* gl/lib/mbsalign.c (mbsalign): Remove assignment, the result of which
is never used.

14 years agotimeout: remove a redundant assignment
Pádraig Brady [Mon, 31 Aug 2009 18:28:28 +0000 (19:28 +0100)]
timeout: remove a redundant assignment

* src/timeout.c (main): While keeping argc and argv in
sync may be marginally useful, it is redundant to update argc,
so just remove that to suppress the clang warning.

14 years agotimeout: defensive handling of all wait() errors
Pádraig Brady [Mon, 31 Aug 2009 18:18:27 +0000 (19:18 +0100)]
timeout: defensive handling of all wait() errors

* src/timeout.c (main): Handle all possible cases of unexpected
failures from wait().  This was prompted by the clang tool reporting
the possible non-initialization of the status variable.

14 years agols -i: print consistent inode numbers also for mount points
Jim Meyering [Wed, 2 Jul 2008 16:01:43 +0000 (18:01 +0200)]
ls -i: print consistent inode numbers also for mount points

On most unix- and linux-based kernels, ls -i DIR_CONTAINING_MOUNT_POINT
would print the wrong inode number for any entry that is a mount point.
It would do that by relying on readdir's dirent.d_ino values, while
most readdir implementations return the inode number of the underlying,
inaccessible directory.  Thus, it is not consistent with what you'd
get when applying stat to the same entry.  This bug led to surprising
results like "ls -i" and "ls -i --color" printing different numbers (ls
must usually "stat" a file to colorize its name).  This change makes it
so that on offending systems, ls must stat non-command-line-arguments
for which otherwise it would be able to use "for free" dirent.d_ino
values.  Regardless of this change, ls is already required to stat every
command-line argument.  Note: versions of GNU ls prior to coreutils-6.0
did not perform the invalid optimization, and hence always printed
correct inode numbers.  Thus, for the sake of correctness, ls -i is
forgoing the readdir optimization, for any kernel (including linux!)
with POSIX-nonconforming readdir.  Note that currently, only Cygwin has
been agile enough to conform.

* src/ls.c (RELIABLE_D_INO): Define.
(print_dir): Use it.
For plenty of discussion, see this long thread:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14020
This bug was introduced by the 2006-02-26 commit, 33eb3efe:
"In ls, avoid calling stat for --inode (-i), when possible."
* tests/ls/readdir-mountpoint-inode: New test.
* tests/Makefile.am (TESTS): Add it.
* tests/ls/stat-vs-dirent: Don't suppress failure of this test,
now that ls -i is fixed.  Though note that it doesn't test well,
since it compares only the always-stat'd command-line arguments.
* NEWS (Bug fixes): Mention it.

14 years agomaint: revert my stdbuf change: the result didn't even compile
Jim Meyering [Mon, 31 Aug 2009 07:44:30 +0000 (09:44 +0200)]
maint: revert my stdbuf change: the result didn't even compile

This reverts commit c1e158489d88bad418d52ceadf37af0b6f5b2112.

14 years agomaint: stdbuf: move a declaration; no-semantic-change
Jim Meyering [Sun, 30 Aug 2009 20:29:19 +0000 (22:29 +0200)]
maint: stdbuf: move a declaration; no-semantic-change

* src/stdbuf.c (set_program_path): Move a declaration down into
the scope where it's used.

14 years agobuild: quiet "make check" in src/
Jim Meyering [Sun, 30 Aug 2009 10:22:11 +0000 (12:22 +0200)]
build: quiet "make check" in src/

* src/Makefile.am (check-duplicate-no-install): Use $(AM_V_GEN).
(check-README): Likewise.  And $(AM_V_at).

14 years agodoc: cp: update note on preserving symlink time stamps
Jim Meyering [Sat, 29 Aug 2009 20:56:48 +0000 (22:56 +0200)]
doc: cp: update note on preserving symlink time stamps

* doc/coreutils.texi (cp invocation): Now, we *do* preserve time
stamps on symlinks, when possible.

14 years agobuild: update bootstrap from gnulib
Jim Meyering [Sat, 29 Aug 2009 20:18:28 +0000 (22:18 +0200)]
build: update bootstrap from gnulib

* bootstrap: Merge from gnulib.

14 years agotests: don't misbehave if $TMPDIR contains spaces
Pádraig Brady [Sun, 30 Aug 2009 00:27:45 +0000 (01:27 +0100)]
tests: don't misbehave if $TMPDIR contains spaces

* tests/misc/xattr: Add quotes.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/sticky-to-xpart: Likewise.

14 years agotests: other-fs-tmpdir: don't misbehave for quote-unfriendly $TMPDIR
Jim Meyering [Sat, 29 Aug 2009 07:18:45 +0000 (09:18 +0200)]
tests: other-fs-tmpdir: don't misbehave for quote-unfriendly $TMPDIR

* tests/other-fs-tmpdir: Quote uses of variables that might expand
to strings containing e.g., whitespace.

14 years agobuild: update from gnulib
Jim Meyering [Sat, 29 Aug 2009 15:30:14 +0000 (17:30 +0200)]
build: update from gnulib

* gnulib: Update submodule to latest.

14 years agotests: move a coreutils-specific test from maint.mk to Makefile.am
Jim Meyering [Sat, 29 Aug 2009 08:52:33 +0000 (10:52 +0200)]
tests: move a coreutils-specific test from maint.mk to Makefile.am

* Makefile.am (distcheck-hook): Make taint-distcheck here, since it's
no longer done via maint.mk.

14 years agotests: cp/reflink-auto guard against a pathological $TMPDIR
Jim Meyering [Sat, 29 Aug 2009 06:31:26 +0000 (08:31 +0200)]
tests: cp/reflink-auto guard against a pathological $TMPDIR

* tests/cp/reflink-auto: Add quotes.

14 years agocp --reflink: preserve attributes on cloned files if asked
Pádraig Brady [Fri, 28 Aug 2009 23:45:15 +0000 (00:45 +0100)]
cp --reflink: preserve attributes on cloned files if asked

* src/copy.c (copy_reg): When cloning only skip the data copying
* tests/cp/reflink-perm: New test to check times and modes copied
* tests/Makefile.am: Reference the new test
* NEWS: Mention the fix

14 years agocp --reflink: add an "auto" parameter to fall back to a normal copy
Pádraig Brady [Tue, 25 Aug 2009 23:32:43 +0000 (00:32 +0100)]
cp --reflink: add an "auto" parameter to fall back to a normal copy

* doc/coreutils.texi (cp invocation): Document the new
"auto" and "always" options to --reflink.
* src/copy.c (copy_reg): Fall back to a standard copy
when reflink() is not supported and --reflink=auto specified.
* src/copy.h [struct cp_options] (reflink): Change type s/bool/enum/.
* src/cp.c (usage): Describe the --reflink={always,auto} options
and expand a little on what --reflink does.
(main): parse the new parameters to --reflink and allow all
--sparse options with --reflink=auto.
* src/install.c (cp_option_init): Init the enum instead of bool.
* src/mv.c (cp_option_init): Likewise.
* tests/cp/reflink-auto: A new test for falling back to normal copy.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.

14 years agostdbuf: fix a small typo in --help output
Pádraig Brady [Wed, 19 Aug 2009 18:24:05 +0000 (19:24 +0100)]
stdbuf: fix a small typo in --help output

* src/stdbuf.c (usage): s/then/the/

14 years agobuild: avoid unused variable warnings on cygwin
Eric Blake [Fri, 28 Aug 2009 17:03:05 +0000 (11:03 -0600)]
build: avoid unused variable warnings on cygwin

* src/copy.c (clone_file, copy_attr_by_fd, copy_attr_by_name):
Mark up unused variables.
* src/remove.c (dirent_inode_sort_may_be_useful): Likewise.

14 years agodd: detect closed stderr
Eric Blake [Fri, 28 Aug 2009 16:59:16 +0000 (10:59 -0600)]
dd: detect closed stderr

* src/dd.c (maybe_close_stdout): Always flush stderr; regression
introduced in commit 381e69ea.
* tests/misc/close-stdout (p): Use consistent style.
* tests/dd/stderr: New test, borrowing from misc/close-stdout.
* tests/Makefile.am (TESTS): Run it.
* NEWS: Mention this.

14 years agomaint: ignore only man/*.1, not all *.1 files
Jim Meyering [Fri, 28 Aug 2009 12:29:02 +0000 (14:29 +0200)]
maint: ignore only man/*.1, not all *.1 files

* .gitignore: Ignore *.1 only in man/

14 years agobuild: prefix a few rules with $(AM_V_GEN)
Jim Meyering [Thu, 27 Aug 2009 08:17:55 +0000 (10:17 +0200)]
build: prefix a few rules with $(AM_V_GEN)

* Makefile.am (.version, dist-hook, gen-ChangeLog): Use $(AM_V_GEN)
and $(AM_V_at), so that automake's silent-rules option (make V=1/V=0)
now controls whether the commands are printed at build time.
(THANKS-to-translators, check-ls-dircolors): Likewise.

14 years agobuild: stop earlier if touching ChangeLog fails
Jim Meyering [Wed, 26 Aug 2009 16:20:55 +0000 (18:20 +0200)]
build: stop earlier if touching ChangeLog fails

* bootstrap.conf: Exit right away if touching ChangeLog fails.
Otherwise, the touch failure message is buried under configure output.

14 years agotests: mkdir/selinux: avoid spurious failure on some SELinux systems
Jim Meyering [Wed, 26 Aug 2009 08:06:53 +0000 (10:06 +0200)]
tests: mkdir/selinux: avoid spurious failure on some SELinux systems

* tests/test-lib.sh (require_selinux_enforcing_): New function.
* tests/mkdir/selinux: Use it.
Otherwise, this test would fail on Rawhide with SELinux disabled.

14 years agotests: tail-2/assert: avoid risk of race condition
Jim Meyering [Tue, 25 Aug 2009 18:43:13 +0000 (20:43 +0200)]
tests: tail-2/assert: avoid risk of race condition

* tests/tail-2/assert: Avoid spurious failure due to race condition.
Rather than sleeping for 1 second and crossing fingers,
wait explicitly for backgrounded tail process to start.
Otherwise, this test would fail under heavy load.

14 years agomaint: ensure we don't embed Emacs indent-tabs-mode setting lines
Jim Meyering [Sun, 14 Jun 2009 12:21:02 +0000 (14:21 +0200)]
maint: ensure we don't embed Emacs indent-tabs-mode setting lines

Now that we prohibit indentation via TABs, there's no need for
Emacs indent-tabs-mode setting lines, so prohibit those, too.
* cfg.mk (sc_prohibit_emacs__indent_tabs_mode__setting): New rule.