platform/upstream/coreutils.git
14 years agotail: add a test to exercise abort-inducing flaw in tail -F
Jim Meyering [Mon, 28 Dec 2009 14:42:10 +0000 (15:42 +0100)]
tail: add a test to exercise abort-inducing flaw in tail -F

* tests/tail-2/inotify-hash-abuse: New file, derived from
a report by Rob Wortman.
* tests/Makefile.am (TESTS): Add it.
Improved by: Pádraig Brady.

14 years agotail: remove `fdspec' from the hash table before changing its key
Giuseppe Scrivano [Tue, 29 Dec 2009 13:59:24 +0000 (14:59 +0100)]
tail: remove `fdspec' from the hash table before changing its key

* src/tail.c (tail_forever_inotify): Avoid modifying fdspec->wd while
it is in the wd_to_name hash table.  Once it is removed, it can be
added using the new `wd' as key for the hash table.  This fixes the
abort-inducing bug reported by Rob Wortman in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/19372

14 years agomaint: quiet "make" in doc/
Jim Meyering [Tue, 29 Dec 2009 13:31:56 +0000 (14:31 +0100)]
maint: quiet "make" in doc/

* doc/Makefile.am (constants.texi): Add a use of AM_V_GEN.

14 years agotail: rename an internal variable
Jim Meyering [Tue, 29 Dec 2009 13:26:05 +0000 (14:26 +0100)]
tail: rename an internal variable

* src/tail.c (tail_forever_inotify): s/wd_table/wd_to_name/

14 years agotail: avoid read-beyond-end-of-buffer error
Jim Meyering [Tue, 29 Dec 2009 13:24:01 +0000 (14:24 +0100)]
tail: avoid read-beyond-end-of-buffer error

* src/tail.c (tail_forever_inotify): Do not use f[i] in a context
where i may be larger than the largest valid index.  In the final
"if" clause in which we'd remove an inotify watch, we might have
used f[n_files].  Use fspec instead, since it is guaranteed to
be defined.

14 years agomaint: ignore more built files
Eric Blake [Sat, 26 Dec 2009 17:41:20 +0000 (10:41 -0700)]
maint: ignore more built files

Recent gnulib changes added new built files.

* .gitignore: Add arg-nonnull.h, link-warning.h,
unused-parameter.h.

14 years agotac: supply link dependency
Eric Blake [Sat, 26 Dec 2009 17:37:44 +0000 (10:37 -0700)]
tac: supply link dependency

* src/Makefile.am (tac_LDADD): Add LIB_GETHRXTIME.
* THANKS: Update.
Reported by Robert Schwebel.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 25 Dec 2009 11:32:12 +0000 (12:32 +0100)]
build: update gnulib submodule to latest

14 years agotail: shrink internal struct by 8 bytes
Jim Meyering [Fri, 25 Dec 2009 11:08:51 +0000 (12:08 +0100)]
tail: shrink internal struct by 8 bytes

* tail.c (struct File_spec): Rearrange struct members to decrease
size by 8 bytes to 76,96 on i686,x86_64 respectively.

14 years agomaint: tail: avoid in-function #if directives
Jim Meyering [Thu, 24 Dec 2009 11:42:43 +0000 (12:42 +0100)]
maint: tail: avoid in-function #if directives

* src/tail.c (fremote): Add a comment.
Move definition "up" to precede first use, so we can
remove its prototype and the #if..#endif around each use.
(any_remote_file): Rename from any_remote_files.

14 years agotail: fix --follow to not use inotify on remote files
Pádraig Brady [Mon, 14 Dec 2009 22:45:34 +0000 (22:45 +0000)]
tail: fix --follow to not use inotify on remote files

* src/tail.c (struct File_spec): Add a flag to record if file is remote.
(recheck): If we're using inotify then check if the file has gone remote
and if so, drop it with a warning.
(any_remote_files): A new function to check for any open remote files.
(tailable_stdin): A new function to refactor the check for whether
a tailable file was specified through stdin.
(fremote): A new function to check if a file descriptor
refers to a remote file.
(tail_forever_inotify): Add some comments.
(tail_file): Record if a file is remote when initially opened.
(main): Disable inotify if any remote files specified.
Also document the caveat about remounted files not
being noticed by inotify.
* NEWS: Mention the fix.

14 years agowc: line-buffer the printed counts
Pádraig Brady [Tue, 22 Dec 2009 07:36:12 +0000 (07:36 +0000)]
wc: line-buffer the printed counts

* src/wc.c (main): Set stdout to line buffered mode
to ensure parallel running instances don't intersperse
their output.  This adds 6.5% to the run time in the worst case
of many zero length files, but has neglible impact for
standard sized files.
* tests/misc/wc-parallel: New test for atomic output.
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix
This is similar to commit 710fe413, 20-10-2009,
"md5sum, sha*sum, sum: line-buffer the printed checksums"

14 years agostat: Recognize k-afs, gfs, ocfs2 file system types
Pádraig Brady [Tue, 22 Dec 2009 12:21:45 +0000 (12:21 +0000)]
stat: Recognize k-afs, gfs, ocfs2 file system types

* src/stat.c (human_fstype): Add k-afs, gfs/gfs2 and ocfs2.
* NEWS: Update the stat -f entry.

14 years agostat: add support for more file system types
Pádraig Brady [Mon, 21 Dec 2009 18:43:02 +0000 (18:43 +0000)]
stat: add support for more file system types

* src/stat.c (human_fstype): Add the following FS types:
fuseblk, rpc_pipefs.  Also fix a typo of minux3 to minix3,
and mention the fs-magic-compare make target to help update the list.
* NEWS: Mention the fix.

14 years agobuild: correct coreutils-specific distcheck rules
Jim Meyering [Sun, 20 Dec 2009 09:50:29 +0000 (10:50 +0100)]
build: correct coreutils-specific distcheck rules

* dist-check.mk (built_programs): Use $(bin_PROGRAMS), not $(PROGRAMS).
Otherwise, my-instcheck would fail due to non-installation of e.g.,
the noinst_PROGRAMS, setuidgid and getlimits.
(taint-distcheck): Correct the grep command that checks for libtool
traces in configure.

14 years agotouch: fix ctime regression in 'touch -a'
Eric Blake [Sun, 20 Dec 2009 00:29:40 +0000 (17:29 -0700)]
touch: fix ctime regression in 'touch -a'

Regression introduced in coreutils 8.1 due to a bug in the Linux
kernel implementation of utimensat with mtime of UTIME_OMIT.

* gnulib: Update to latest, to pick up utimensat fix.
* NEWS: Mention the change.
* THANKS: Update.
Reported by John Stanley.

14 years agomaint: don't include the strverscmp gnulib module
Pádraig Brady [Sat, 19 Dec 2009 01:25:29 +0000 (01:25 +0000)]
maint: don't include the strverscmp gnulib module

* bootstrap.conf (gnulib_modules): Remove the strverscmp module
which is not used since commit e505736f, on 03-10-2008,
"ls and sort: use filevercmp instead of strverscmp"

14 years agodoc: enhance and reference info about version comparison
Pádraig Brady [Thu, 17 Dec 2009 10:48:54 +0000 (10:48 +0000)]
doc: enhance and reference info about version comparison

* doc/coreutils.texi (sort invocation): Reference the additional
info about filevercmp rather than the unused strverscmp.
(Details about version sort): Add some examples that are not
handled well by fileversmp.
* src/ls.c: Change a comment referencing the now unused strverscmp.

14 years agorm: fix --one-file-system regression due to fts conversion
Pádraig Brady [Fri, 18 Dec 2009 12:26:04 +0000 (12:26 +0000)]
rm: fix --one-file-system regression due to fts conversion

* src/remove.c (rm_fts): Fix incorrect comparison of
device and inode numbers.
* tests/rm/one-file-system2: Add a separate test so
that it can be run as a normal user (It doesn't need to mount).
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix.
Reported by Jan Larres.

14 years agomaint: improve dist-check.mk rules
Jim Meyering [Mon, 14 Dec 2009 10:33:03 +0000 (11:33 +0100)]
maint: improve dist-check.mk rules

* dist-check.mk (null_AM_MAKEFLAGS): Remove LIBTOOL.  Adding it was
erroneous, since it is required when building from a distribution
tarball of a libtool-using project.  Reported by Ralf Wildenhues.
(my-distcheck): Reorganize to use a subshell and set -e, so that
failures propagate "out".  Without this change, setting LIBTOOL=false
would cause a failure that would then be ignored, probably due to a
problem in $(install-transform-check).

14 years agobase64: use *_OPTION_DESCRIPTION macros instead of hard-coded strings
Thiago Farina [Sun, 13 Dec 2009 19:27:59 +0000 (14:27 -0500)]
base64: use *_OPTION_DESCRIPTION macros instead of hard-coded strings

* src/base64 (usage): Use HELP_OPTION_DESCRIPTION and
VERSION_OPTION_DESCRIPTION macros, not literal strings.

14 years agotests: unpack xz-compressed tarballs when possible, not always *.gz
Jim Meyering [Sun, 13 Dec 2009 16:55:13 +0000 (17:55 +0100)]
tests: unpack xz-compressed tarballs when possible, not always *.gz

* dist-check.mk: Unpack compressed tarball using xz when possible,
since that's faster.

14 years agomaint: make dist-check.mk more easily shared
Jim Meyering [Sun, 13 Dec 2009 15:58:10 +0000 (16:58 +0100)]
maint: make dist-check.mk more easily shared

* dist-check.mk (built_programs): More generic, but still assumes src/.
Don't set GZIP in environment when untarring.
(my-distcheck): Use $(DIST_ARCHIVES), rather than assuming that
there is always a .tar.gz file.

14 years agonohup: if fd_repoen fails (redirecting stdin), report it
Jim Meyering [Sun, 13 Dec 2009 11:23:25 +0000 (12:23 +0100)]
nohup: if fd_repoen fails (redirecting stdin), report it

* src/nohup.c (main): Don't ignore fd_reopen failure.

14 years agotests: make the taint-distcheck rule easier to share with other projects
Jim Meyering [Wed, 9 Dec 2009 09:26:21 +0000 (10:26 +0100)]
tests: make the taint-distcheck rule easier to share with other projects

* dist-check.mk (taint-distcheck): Skip this test in a project
that uses libtool.

14 years agostat: recognize "sockfs" file system type, ...
Jim Meyering [Sun, 13 Dec 2009 10:00:41 +0000 (11:00 +0100)]
stat: recognize "sockfs" file system type, ...

... now that its magic number appears in <linux/magic.h>.
* src/stat.c (human_fstype) [S_MAGIC_SOCKFS]: Add case.

14 years agomaint: move definitions from maint.mk to dist-check.mk
Jim Meyering [Sun, 13 Dec 2009 09:35:49 +0000 (10:35 +0100)]
maint: move definitions from maint.mk to dist-check.mk

* dist-check.mk (null_AM_MAKEFLAGS): Define here, not in maint.mk.
(built_programs): Likewise.
(my-distcheck): Move comments to...
(coreutils-path-check): ...the code they refer to.
Remove obsolete comments.
(null_AM_MAKEFLAGS): Add gperf, even though it's not used here.
* gnulib: Update to latest, for fixed maint.mk.

14 years agotests: tail-without-inotify: avoid spurious test failure
Jim Meyering [Sat, 12 Dec 2009 13:44:46 +0000 (14:44 +0100)]
tests: tail-without-inotify: avoid spurious test failure

* tests/tail-2/wait: Account for the possibility that the kernel
lacks inotify support.  Reported by Chris Clayton.

14 years agofactor: add a missing va_end
Jim Meyering [Sat, 12 Dec 2009 07:10:07 +0000 (08:10 +0100)]
factor: add a missing va_end

* src/factor.c (debug): Add missing va_end.

14 years agobuild: update gnulib submodule to latest; adapt a patch
Jim Meyering [Fri, 11 Dec 2009 18:18:04 +0000 (19:18 +0100)]
build: update gnulib submodule to latest; adapt a patch

* gl/lib/tempname.c.diff: Adjust patch to apply to gnulib, now that
most TABs in indentation have been converted to spaces by running
this command: f=tempname.c.diff; patch-xform $f > k && mv k $f

14 years agopost-release administrivia
Jim Meyering [Fri, 11 Dec 2009 13:43:13 +0000 (14:43 +0100)]
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 8.2 v8.2
Jim Meyering [Fri, 11 Dec 2009 13:00:40 +0000 (14:00 +0100)]
version 8.2

* NEWS: Record release date.

14 years agotests: use a slightly better CU_TEST_NAME setting
Jim Meyering [Fri, 11 Dec 2009 12:59:57 +0000 (13:59 +0100)]
tests: use a slightly better CU_TEST_NAME setting

* tests/check.mk (CU_TEST_NAME): Better test names.

14 years agotail: don't call fstat on an uninitialized FD
Jim Meyering [Fri, 11 Dec 2009 11:15:13 +0000 (12:15 +0100)]
tail: don't call fstat on an uninitialized FD

This bug showed up via valgrind as a "Conditional jump or move
depends on uninitialized value(s)" error.
* src/tail.c (ignore_fifo_and_pipe): New function.
(main): Use it only when tailing forever.
The code to compute n_viable and mark some F[i] as ignored would call
isapipe on an uninitialized file descriptor.  But n_viable and those
.ignored marks are useful/used only when tailing forever.  This bug
was introduced via commit f0ff8c73 (7.6), "tail: make the new
piped-stdin test as portable as the old one".
* NEWS (Bug fixes): Mention it.

14 years agodoc: NEWS: mention that gnulib's mgetgroups fix affects id
Jim Meyering [Fri, 11 Dec 2009 07:51:28 +0000 (08:51 +0100)]
doc: NEWS: mention that gnulib's mgetgroups fix affects id

* NEWS (Bug fixes): Mention the "id" bug fix inherited via this gnulib
change: "mgetgroups: do not write bytes beyond end of malloc'd buffer"
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=51d5e813e9ee6cf23

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Thu, 10 Dec 2009 15:50:27 +0000 (16:50 +0100)]
build: update gnulib submodule to latest

14 years agotests: avoid spurious failure when run via valgrind
Jim Meyering [Thu, 10 Dec 2009 07:17:02 +0000 (08:17 +0100)]
tests: avoid spurious failure when run via valgrind

* tests/misc/printenv: Ignore LD_PRELOAD differences.

14 years agodoc: NEWS: the "make distcheck" vulnerability dates back to 5.0
Jim Meyering [Wed, 9 Dec 2009 12:58:12 +0000 (13:58 +0100)]
doc: NEWS: the "make distcheck" vulnerability dates back to 5.0

* NEWS (Bug fixes): Correct the introduced-in version number.
This was introduced on 2003-04-02 by commit 722a49ea.

14 years agodoc: NEWS: mention the "make distcheck" vulnerability
Jim Meyering [Wed, 9 Dec 2009 12:04:46 +0000 (13:04 +0100)]
doc: NEWS: mention the "make distcheck" vulnerability

* NEWS (Bug fixes): Mention implications of the "make distcheck" change.
This was introduced on 2008-07-22 by commit 9bb0d576, "tests: ensure
"make check" w/tainted build dir no longer impacts $HOME".

14 years agotests: don't let "umask 077" cause root-only cp/preserve-gid failure
Jim Meyering [Wed, 9 Dec 2009 07:45:30 +0000 (08:45 +0100)]
tests: don't let "umask 077" cause root-only cp/preserve-gid failure

* tests/cp/preserve-gid: Use working_umask_or_skip_ to set umask to 022.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 8 Dec 2009 20:34:00 +0000 (21:34 +0100)]
build: update gnulib submodule to latest

14 years agomaint: remove an erroneous comment
Pádraig Brady [Tue, 8 Dec 2009 15:33:18 +0000 (15:33 +0000)]
maint: remove an erroneous comment

* tests/misc/timeout: Remove an erroneous comment
introduced through copy and paste.

14 years agosort: fix failure if sort's parent has ignored SIGCHLD
Pádraig Brady [Tue, 8 Dec 2009 08:48:34 +0000 (08:48 +0000)]
sort: fix failure if sort's parent has ignored SIGCHLD

* src/sort.c (main): Reset the SIGCHLD handler to the default
as otherwise wait() could return an error.
* tests/misc/sort-compress: Set the CHLD handler in a subshell
to SIG_IGN to ensure the sort command resets it to SIG_DFL.
* NEWS: Mention the fix.

14 years agotimeout: fix failure if timeout's parent has ignored SIGCHLD
Pádraig Brady [Mon, 7 Dec 2009 19:00:04 +0000 (19:00 +0000)]
timeout: fix failure if timeout's parent has ignored SIGCHLD

* src/timeout.c (main): Reset the SIGCHLD handler to the default
as otherwise wait() could return -1 and set errno to ECHILD.
This condition was ignored until commit 0b1dcf33, on 31-08-2009,
"timeout: defensive handling of all wait() errors"
but subsequently timeout would run the command correctly
but then fail with an error message.
* tests/misc/timeout: In a subshell set the CHLD handler to
SIG_IGN to ensure the timeout command resets it to SIG_DFL.
* NEWS: Mention the fix.

14 years agotests: fix stty-row-col failure on small fixed terminals
Pádraig Brady [Tue, 8 Dec 2009 08:00:37 +0000 (08:00 +0000)]
tests: fix stty-row-col failure on small fixed terminals

* tests/misc/stty-row-col: Linux virtual consoles at least,
issue an error if you try to increase their size, so skip the
test if we can't increase the dimensions of the tty by 1 cell.
Reported by Matthew Burgess.

14 years agotests: fix stty failure with serial control settings
Pádraig Brady [Mon, 7 Dec 2009 07:39:32 +0000 (07:39 +0000)]
tests: fix stty failure with serial control settings

* tests/misc/stty: Don't check the serial control settings as
these are ignored by various Linux kernels.
Reported by Matthew Burgess.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Mon, 7 Dec 2009 17:56:07 +0000 (18:56 +0100)]
build: update gnulib submodule to latest

14 years agobuild: distcheck: do not leave a $TMPDIR/coreutils directory behind
Jim Meyering [Sat, 5 Dec 2009 21:16:32 +0000 (22:16 +0100)]
build: distcheck: do not leave a $TMPDIR/coreutils directory behind

* dist-check.mk (tmpdir): Rename from TMPDIR.  Use ./tests/torture
unconditionally, rather than $TMPDIR-with-default-to-/tmp.
Otherwise, running "make distcheck" could leave an empty /tmp/coreutils
directory behind.
(tp): Simplify, now that it's always in the build-dir.
(taint-distcheck): Set HOME earlier, in case $(MAKE) misbehaves.
(my-instcheck, coreutils-path-check): Add diagnostics, so it's easier
to diagnose when each runs.
(coreutils-path-check): Run configure with --quiet, to reduce output.
Inspired by Ralf Wildenhues' report of /tmp/coreutils being left behind.

14 years agotests: readdir-mountpoint-inode avoid false-positive w/virtualbox
Jim Meyering [Sat, 5 Dec 2009 16:41:28 +0000 (17:41 +0100)]
tests: readdir-mountpoint-inode avoid false-positive w/virtualbox

* tests/ls/readdir-mountpoint-inode: With some systems, stat can
succeed on a mount point and report that the inode number is 0.
Since ls displays "?" for those, that would otherwise show up as a
difference.  Skip such mount points.  Reported by Sergei Steshenko
in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/19142

14 years agotests: don't run tail-2/inotify-race by default
Pádraig Brady [Sun, 6 Dec 2009 00:42:42 +0000 (00:42 +0000)]
tests: don't run tail-2/inotify-race by default

* tests/tail-2/inotify-race: Note the caveats of the test.
I.E. the intermittent skips and the gdb hang reported
by Alan Curry.  Add extra info to the log on why the test
is skipped as it may be due to multiple reasons.  Mark
the test as very expensive so that it's not normally run.

14 years agoid: handle systems without getgroups support
Eric Blake [Fri, 4 Dec 2009 15:06:55 +0000 (08:06 -0700)]
id: handle systems without getgroups support

If getgroups failed with ENOSYS, mgetgroups would unnecessarily
fail, and that provoked id into freeing an uninitialized pointer.
Meanwhile, we were not using xalloc_die properly.  Both issues
are better solved in gnulib, by introducing xgetgroups; this
patch uses the new interface.

Regression introduced by commit 6a31fd8d7.

* gnulib: Update, for mgetgroups improvments.
* src/id.c (print_full_info): Adjust caller to die on allocation
failure, and no longer worry about ENOSYS.
* src/group-list.c (print_group_list): Likewise.
* src/setuidgid.c (main): Likewise.
* NEWS: Mention the fix.
* THANKS: Update.
Reported by Scott Harrison.

14 years agotests: fix a bug in sanitize_path_ that inhibited verbose output
Jim Meyering [Thu, 3 Dec 2009 16:04:16 +0000 (17:04 +0100)]
tests: fix a bug in sanitize_path_ that inhibited verbose output

* tests/test-lib.sh (sanitize_path_): Use "set -- ...", not "set - ...",
since the latter turns off the -x setting we rely on for VERBOSE=yes
output.

14 years agosort: fix link failure on Solaris
Eric Blake [Tue, 1 Dec 2009 15:18:28 +0000 (08:18 -0700)]
sort: fix link failure on Solaris

Commit f9d0bb8481 made sort depend on xnanosleep.

* src/Makefile.am (sort_LDADD): Add LIB_NANOSLEEP.

14 years agorm: fix empty-name bug introduced with conversion to use fts
Jim Meyering [Tue, 1 Dec 2009 11:02:11 +0000 (12:02 +0100)]
rm: fix empty-name bug introduced with conversion to use fts

While "rm ''" would properly fail, "rm F1 '' F2" would fail
to remove F1 and F2, due to the empty string argument.
This bug was introduced on 2009-07-12, via commit 4f73ecaf,
"rm: rewrite to use fts".
* gnulib: Update to latest, for fixed fts.c.
* NEWS (Bug fixes): Describe it.
* tests/rm/empty-name: Adjust for changed diagnostic.
(mk_file): Define, copied from misc/ls-misc.
(empty-name-2): New test, for today's fix.
* lib/xfts.c (xfts_open): Reflect the change in fts_open, now that
it no longer fails immediately when one argument is the empty string.
Assert that the bit flags were not the cause of failure.
* po/POTFILES.in: Remove xfts.c.
* THANKS: Update.
Reported by Ladislav Hagara.

14 years agobootstrap: fix handling of various perl --version formats
Pádraig Brady [Mon, 30 Nov 2009 13:01:44 +0000 (14:01 +0100)]
bootstrap: fix handling of various perl --version formats

* bootstrap (get_version): Don't use perl's $] special
variable, as that requires updating all bootstrap.conf files to
use perl's x.yyyzzz version format.  Instead make the regular
expression more general to support version formats from older
perl-5.005_002 (5.5.2) and perl-5.11 which has other numbers
in the version line.

14 years agobootstrap: update from gnulib, for perl-5.11.x support
Jim Meyering [Sun, 29 Nov 2009 13:04:09 +0000 (14:04 +0100)]
bootstrap: update from gnulib, for perl-5.11.x support

* bootstrap (get_version): Handle perl separately,
since perl-5.11's --version output is different.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Sun, 29 Nov 2009 09:56:57 +0000 (10:56 +0100)]
build: update gnulib submodule to latest

14 years agomaint: chown.c: remove a comment
Jim Meyering [Sat, 28 Nov 2009 05:48:03 +0000 (06:48 +0100)]
maint: chown.c: remove a comment

* src/chown.c: Remove old spec-like comment.

14 years agotests: fix link failure on cygwin
Eric Blake [Mon, 23 Nov 2009 22:23:39 +0000 (15:23 -0700)]
tests: fix link failure on cygwin

Counterpart to commit 8fe40b84bd8, since test-link.c uses rename,
and we override gnulib with a rename() replacement that can xalloc_die.

* gl/modules/link-tests.diff: New file.

14 years agobuild: fix link failure on cygwin
Eric Blake [Mon, 23 Nov 2009 21:59:18 +0000 (14:59 -0700)]
build: fix link failure on cygwin

Cygwin 1.5 has a broken sleep, and the gnulib tests dragged in
rpl_sleep which then caused a link failure because it wasn't in
libcoreutils.a.  We could solve it by using the gnulib sleep module.
However, sleep and usleep may interact poorly with SIGALRM, and they
have less granularity; so it is better to adopt a policy that if we
must sleep, prefer xnanosleep.

* src/sort.c (pipe_fork): Use xnanosleep, to avoid the need for
rpl_sleep on cygwin, and to reduce granularity.
(MAX_FORK_TRIES_COMPRESS, MAX_FORK_TRIES_DECOMPRESS): Increase,
to account for reduction in granularity.
* src/tail.c (tail_file): Use xnanosleep in debug code.
* cfg.mk (sc_prohibit_sleep): New rule.

14 years agotests: avoid test failures when PATH contains an unsearchable directory
Jim Meyering [Mon, 23 Nov 2009 16:35:20 +0000 (17:35 +0100)]
tests: avoid test failures when PATH contains an unsearchable directory

* tests/test-lib.sh (sanitize_path_): New function.
Always call it.

14 years agotests: do not fail on read-only root file system
Dmitry V. Levin [Sun, 22 Nov 2009 15:37:34 +0000 (18:37 +0300)]
tests: do not fail on read-only root file system

* tests/touch/not-owner: Handle the case when the root file system is
mounted read-only.
Reported by Solar Designer.

14 years agomaint: cfg.mk: remove factored-out ftp host/dir definitions
Jim Meyering [Fri, 20 Nov 2009 15:39:19 +0000 (16:39 +0100)]
maint: cfg.mk: remove factored-out ftp host/dir definitions

* cfg.mk (gnu_ftp_host-alpha, gnu_ftp_host-beta gnu_ftp_host-stable):
(gnu_rel_host, url_dir_list): Remove definitions.  The defaults,
now provided by maint.mk, are the same.
* gnulib: Update for latest, including those maint.mk additions.

14 years agomaint: correct comments in test scripts
Jim Meyering [Fri, 20 Nov 2009 11:58:51 +0000 (12:58 +0100)]
maint: correct comments in test scripts

* tests/misc/pwd-long: Fix spelling of cygwin1.dll in comment.
* tests/rm/fail-eperm: Likewise.
Reported by Eric Blake.

14 years agomaint: don't list "warnings" module explicitly
Jim Meyering [Fri, 20 Nov 2009 07:17:24 +0000 (08:17 +0100)]
maint: don't list "warnings" module explicitly

* bootstrap.conf (gnulib_modules): Remove "warnings", now that
it's pulled in automatically via "manywarnings".

14 years agomaint: move xfreopen module to gnulib
Jim Meyering [Fri, 20 Nov 2009 06:37:16 +0000 (07:37 +0100)]
maint: move xfreopen module to gnulib

* gl/lib/xfreopen.c: Remove file.
* gl/lib/xfreopen.h: Likewise.
* gl/modules/xfreopen: Likewise.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 20 Nov 2009 06:37:47 +0000 (07:37 +0100)]
build: update gnulib submodule to latest

14 years agotests: avoid spurious failures due to insecure directory in PATH
Jim Meyering [Thu, 19 Nov 2009 09:13:22 +0000 (10:13 +0100)]
tests: avoid spurious failures due to insecure directory in PATH

These tests perform no PATH search, and used to simply delete PATH from
the environment.  However, that is not portable, as seen on Cygwin,
where cygwin.dll must be resolvable via PATH when starting a sub-shell.
With commit 0cc04241, we took the alternate approach of untainting the
incoming $ENV{PATH}, but that fails when it contains an other-writable
directory.  Instead, now we hard code it to '/bin:/usr/bin'.

* tests/misc/pwd-long: Hard code $ENV{PATH} to a safe value.
* tests/rm/fail-eperm: Likewise.
Reported by Gilles Espinasse, Andreas Schwab, and Bauke Jan Douma.

14 years agobuild: "make stable" emitted an invalid gnupload command
Jim Meyering [Wed, 18 Nov 2009 20:04:52 +0000 (21:04 +0100)]
build: "make stable" emitted an invalid gnupload command

* cfg.mk (gnu_ftp_host-stable): Rename from gnu_ftp_host-major.
* README-release: Change another s/major/stable/.

14 years agopost-release administrivia
Jim Meyering [Wed, 18 Nov 2009 18:56:25 +0000 (19:56 +0100)]
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 8.1 v8.1
Jim Meyering [Wed, 18 Nov 2009 18:38:50 +0000 (19:38 +0100)]
version 8.1

* NEWS: Record release date.

14 years agobuild: update gnulib for Solaris utimens workaround
Jim Meyering [Wed, 18 Nov 2009 14:58:20 +0000 (15:58 +0100)]
build: update gnulib for Solaris utimens workaround

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 18 Nov 2009 06:33:02 +0000 (07:33 +0100)]
build: update gnulib submodule to latest

14 years agomaint: remove local gnulib-related patches
Jim Meyering [Tue, 17 Nov 2009 14:33:00 +0000 (15:33 +0100)]
maint: remove local gnulib-related patches

* gl/lib/printf-args.c.diff: Remove file.  No longer needed.
* gl/lib/vasnprintf.c.diff: Likewise.

14 years agobuild: update gnulib for Solaris 10 unsetenv work-around
Jim Meyering [Tue, 17 Nov 2009 13:42:27 +0000 (14:42 +0100)]
build: update gnulib for Solaris 10 unsetenv work-around

14 years agodoc: mention the du/fts vs. NFSv4 mount-point work-around
Jim Meyering [Tue, 17 Nov 2009 07:56:12 +0000 (08:56 +0100)]
doc: mention the du/fts vs. NFSv4 mount-point work-around

* NEWS (Changes in behavior): Mention it.

14 years agobuild: update from gnulib for (un)setenv fixes
Jim Meyering [Tue, 17 Nov 2009 06:56:50 +0000 (07:56 +0100)]
build: update from gnulib for (un)setenv fixes

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Mon, 16 Nov 2009 08:19:23 +0000 (09:19 +0100)]
build: update gnulib submodule to latest

15 years agotrue, false: perform initialization only when argc == 2
Jim Meyering [Sun, 15 Nov 2009 21:23:01 +0000 (22:23 +0100)]
true, false: perform initialization only when argc == 2

* src/true.c (main): There is no reason to examine argv[0],
call atexit, etc., in the usual case in which we're about to exit.
This has the side effect of making it so that these programs
no longer segfault when subjected to execve abuse.
Before this change, these commands would make "true" segfault:
  printf '%s\n' '#include <unistd.h>' 'int main(int c, char**v)' \
    '{ execve (v[1], 0, 0); }' > k.c && gcc k.c && ./a.out $PWD/true
Now it succeeds.  Reported by Tetsuo Handa and Bart Van Assche
via Ondřej Vašík in http://bugzilla.redhat.com/537684.

15 years agotail -F can fail to track a file after it's been rotated
Jim Meyering [Sun, 15 Nov 2009 08:25:29 +0000 (09:25 +0100)]
tail -F can fail to track a file after it's been rotated

Tailing forever and by-name (--follow=name, -F), tail would
sometimes fail to follow a file that had been removed via rename.
If you can't apply this patch and have tail 7.6 or newer, you can
work around the bug via the undocumented --disable-inotify option.
* src/tail.c (tail_forever_inotify): When tailing by name (-F),
do not un-watch a file upon receipt of the IN_MOVE_SELF event.
Reported by Arjan Opmeer in http://bugs.debian.org/548439.
* NEWS (Bug fixes): Mention it.
Also see http://marc.info/?l=coreutils-bug&m=125829031916515
* tests/Makefile.am (TESTS): Add tail-2/inotify-rotate.
* tests/tail-2/inotify-rotate: New test.

15 years agotests: help-version: exit nonzero when $built_programs is empty
Jim Meyering [Fri, 13 Nov 2009 20:01:02 +0000 (21:01 +0100)]
tests: help-version: exit nonzero when $built_programs is empty

* tests/misc/help-version: Use "Exit 1", rather than "Exit $fail"
with fail defined to 0 when $built_programs is empty.

15 years agobuild: do use AM_GNU_GETTEXT's "need-formatstring-macros" option
Jim Meyering [Fri, 13 Nov 2009 19:35:58 +0000 (20:35 +0100)]
build: do use AM_GNU_GETTEXT's "need-formatstring-macros" option

* configure.ac: Revert commit 49741b61 and add a comment.
Reported by Eric Blake.

15 years agotests: avoid a spurious failure on a loaded system
Pádraig Brady [Fri, 13 Nov 2009 22:52:14 +0000 (22:52 +0000)]
tests: avoid a spurious failure on a loaded system

* tests/misc/timeout-parameters: This test could fail due to
the 1-second timeout expiring before a command of "no_such"
could be exec'd and fail.  Increase to 10 seconds.

15 years agobuild: require gettext-0.17
Jim Meyering [Fri, 13 Nov 2009 16:53:06 +0000 (17:53 +0100)]
build: require gettext-0.17

* configure.ac: Require gettext-0.17; it was released two years ago.

15 years agobuild: correct gettext configure-time support
Jim Meyering [Fri, 13 Nov 2009 16:51:21 +0000 (17:51 +0100)]
build: correct gettext configure-time support

* configure.ac: Use AM_GNU_GETTEXT([external], [need-ngettext]),
rather than AM_GNU_GETTEXT([external], [need-formatstring-macros]).
Reported by Martin Jacobs in
http://thread.gmane.org/gmane.comp.parsers.bison.bugs/3181
* THANKS: Add his name.

15 years agobuild: update gnulib to latest, for fixed test-getgroups.c
Jim Meyering [Fri, 13 Nov 2009 15:39:03 +0000 (16:39 +0100)]
build: update gnulib to latest, for fixed test-getgroups.c

15 years agotests: avoid a spurious timeout on a heavily-loaded system
Jim Meyering [Fri, 13 Nov 2009 15:38:20 +0000 (16:38 +0100)]
tests: avoid a spurious timeout on a heavily-loaded system

* tests/misc/timeout-parameters: This test would fail due to
the 1-second timeout expiring before a command of "." could
be exec'd and fail.  Increase to 10 seconds.

15 years agobuild: update gnulib, for getgroups improvements
Eric Blake [Thu, 12 Nov 2009 18:59:09 +0000 (11:59 -0700)]
build: update gnulib, for getgroups improvements

A replacement getgroups is now guaranteed to exist, but it may
fail with ENOSYS.  mgetgroups is moved to gnulib, and now takes
gid_t instead of GETGROUPS_T (but setgroups still needs GETGROUPS_T).

* gnulib: Update to latest.
* gl/modules/mgetgroups: Delete, moved to gnulib.
* gl/m4/mgetgroups.m4: Likewise.
* gl/lib/mgetgroups.h: Likewise.
* gl/lib/mgetgroups.c: Likewise.
* src/group-list.c (print_group_list): Adjust callers.
* src/id.c (print_full_info): Likewise.

15 years agobuild: bootstrap: add a comment; generalize autoheader check
Jim Meyering [Thu, 12 Nov 2009 08:51:54 +0000 (09:51 +0100)]
build: bootstrap: add a comment; generalize autoheader check

* bootstrap: Sync from gnulib and diff.

15 years agobuild: update gnulib to latest; more *BSD and Solaris work-arounds
Jim Meyering [Mon, 9 Nov 2009 13:59:26 +0000 (14:59 +0100)]
build: update gnulib to latest; more *BSD and Solaris work-arounds

15 years agobootstrap: use git_modules_config in one more place
Jim Meyering [Wed, 11 Nov 2009 18:07:00 +0000 (19:07 +0100)]
bootstrap: use git_modules_config in one more place

* bootstrap: Make bootstrap's --gnulib-srcdir more useful (for testing).

15 years agodoc: fix typo
Eric Blake [Mon, 9 Nov 2009 22:49:44 +0000 (15:49 -0700)]
doc: fix typo

* doc/coreutils.texi (mktemp invocation): Quote shell variable.

15 years agobuild: update gnulib submodule to latest for its FreeBSD fixes
Jim Meyering [Sun, 8 Nov 2009 08:19:12 +0000 (09:19 +0100)]
build: update gnulib submodule to latest for its FreeBSD fixes

15 years agols: fix capability coloring
Pádraig Brady [Sun, 8 Nov 2009 03:45:27 +0000 (03:45 +0000)]
ls: fix capability coloring

Capability checking was incorrectly done on just the base name
rather than on the whole path.  Consequently there could be both
false positives and negatives when coloring files with capabilities.
Also capability checking was not done at all in certain cases for
non executable files.  Note passing absolute rather than relative
names to cap_get_file() reduces the has_capability() overhead
from around 33% to 30%.  I.E. ls --color is now around 3% faster.

* src/ls.c (struct fileinfo): Add a has_capability member.
(print_color_indicator): Refactor to pass just a fileinfo pointer
and a flag to say if we're dealing with a symlink target.
(print_name_with_quoting): Likewise.
(gobble_file): Set has_capability in the fileinfo struct.  Also do
a capability check even if executable coloring is disabled.
Ditto for SETUID and SETUID coloring.
Comment on how expensive has_capability() is.
(print_long_format): Adjust to refactored print_name_with_quoting.
(quote_name): Likewise.
(print_file_name_and_frills): Likewise.
* tests/ls/capability: Test the various false positive and negatives.
* THANKS: Add reporter (Ivan Labath).
* NEWS: Mention the fix.

15 years agobuild: consistently use freopen-safer
Eric Blake [Thu, 5 Nov 2009 23:48:09 +0000 (16:48 -0700)]
build: consistently use freopen-safer

cat, head, ptx, shuf, tac, tail, tee, tr, and uniq used freopen
on stdout, and were potentially vulnerable.  dircolors, du, and
tsort only used it on stdin, which is unaffected by freopen_safer,
but this covers all uses for consistency.

* cfg.mk (sc_require_stdio_safer): New rule.
* gl/modules/xfreopen (Depends-on): Add freopen-safer.
* gl/lib/xfreopen.c (includes): Use stdio--.h.
* src/ptx.c (includes): Likewise.
* src/shuf.c (includes): Likewise.
* src/uniq.c (includes): Likewise.
* src/dircolors.c (includes): Likewise.
* src/du.c (includes): Likewise.
* src/tsort.c (includes): Likewise.

15 years agomktemp: fix bug with -q and closed stdout
Eric Blake [Thu, 5 Nov 2009 19:19:45 +0000 (12:19 -0700)]
mktemp: fix bug with -q and closed stdout

If stdin or stdout is closed, then freopen(,stderr) can violate
the premise that STDERR_FILENO==fileno(stderr), which in turn
breaks mktemp -q.

* bootstrap.conf (gnulib_modules): Add freopen-safer.
* src/mktemp.c (includes): Use stdio--.h.
* tests/misc/close-stdout: Enhance test to catch bug.

15 years agomaint: make du's cycle-detection code consistent
Jim Meyering [Sat, 7 Nov 2009 07:17:28 +0000 (08:17 +0100)]
maint: make du's cycle-detection code consistent

* src/du.c (process_file): Revert the du.c-changing part of
commit 8ba5d1a7. Use cycle_warning_required instead.

15 years agochcon, chgrp, chmod and chown now diagnose a directory cycle
Jim Meyering [Sat, 7 Nov 2009 07:09:12 +0000 (08:09 +0100)]
chcon, chgrp, chmod and chown now diagnose a directory cycle

* lib/xfts.c (cycle_warning_required): New function.
* lib/xfts.h: Declare it.
* src/chown-core.c (change_file_owner): Diagnose a cycle.
* src/chmod.c (process_file): Likewise.
* src/chcon.c (process_file): Likewise.
* NEWS (Bug fixes): Mention this.

15 years agonproc: A new program to count the available processors
Giuseppe Scrivano [Sat, 31 Oct 2009 17:59:50 +0000 (18:59 +0100)]
nproc: A new program to count the available processors

* AUTHORS: Add my name.
* NEWS: Mention it.
* README: Likewise.
* bootstrap.conf (gnulib_modules): Add nproc.
* doc/coreutils.texi (nproc invocation): Add nproc info.
* man/Makefile.am (nproc.1): Add dependency.
* man/nproc.x: New template.
* man/.gitignore: Ignore generated man page.
* po/POTFILES.in: Add src/nproc.c.
* src/.gitignore: Exclude nproc.
* src/Makefile.am (EXTRA_PROGRAMS): Add nproc.
* src/nproc.c: New file.
* tests/Makefile.am (TESTS): Add misc/nproc-{avail,positive}.
* tests/misc/nproc-avail: New file.
* tests/misc/nproc-positive: New file.

15 years agobuild: move do-release-commit-and-tag to gnulib
Jim Meyering [Fri, 6 Nov 2009 10:20:08 +0000 (11:20 +0100)]
build: move do-release-commit-and-tag to gnulib

* bootstrap.conf (gnulib_modules): Add do-release-commit-and-tag.
* build-aux/do-release-commit-and-tag: Remove file.  Now it's in gnulib.
* gnulib: Update submodule to the latest, to get the just-moved script.