platform/upstream/coreutils.git
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

14 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

14 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.

14 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.

14 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.

14 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.

14 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.

14 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.

14 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.

14 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

14 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.

14 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.

14 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.

14 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

14 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).

14 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.

14 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

14 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.

14 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.

14 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.

14 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.

14 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.

14 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.

14 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.

14 years agomktemp: use more robust means to avoid double-close of stdout
Eric Blake [Thu, 5 Nov 2009 16:05:03 +0000 (09:05 -0700)]
mktemp: use more robust means to avoid double-close of stdout

Reverts earlier patch - fflush() can succeed but fclose() fail for
some cases of write failures, and we want to catch those.

* src/mktemp.c (stdout_closed): New variable.
(maybe_close_stdout): New function, borrowed from dd.c.
(main): Track whether stdout has been closed.

14 years agomktemp: enhance test to catch just-fixed typo behavior
Eric Blake [Thu, 5 Nov 2009 15:36:09 +0000 (08:36 -0700)]
mktemp: enhance test to catch just-fixed typo behavior

Penance for botching the conflict resolution while rebasing my series.

* tests/misc/mktemp (check_tmp): Test for the bug when wrong parameter
is used.

14 years agomktemp: don't try to close stdout twice
Jim Meyering [Thu, 5 Nov 2009 15:26:19 +0000 (16:26 +0100)]
mktemp: don't try to close stdout twice

* src/mktemp.c (main): Rather than calling close_stream (which would
make atexit-called close_stdout try to close it a second time),
check for write failure via ferror and fflush.

14 years agomktemp: don't use suff_len in place of #-of-`X's variable
Jim Meyering [Thu, 5 Nov 2009 15:23:59 +0000 (16:23 +0100)]
mktemp: don't use suff_len in place of #-of-`X's variable

* src/mktemp.c (mkstemp_len, mkdtemp_len): Pass x_len as final
argument, and not suff_len.

14 years agomktemp: add suffix handling
Eric Blake [Wed, 4 Nov 2009 18:13:39 +0000 (11:13 -0700)]
mktemp: add suffix handling

Now that mkstemps is supported, we might as well use it.

* src/mktemp.c (TMPDIR_OPTION): New enum value.
(longopts): Add new option.
(usage): Document it.
(count_trailing_X_s): Rename...
(count_consecutive_X_s): ...to this, and add parameter.
(mkstemp_len, mkdtemp_len): Add parameter.
(main): Implement new option.
(AUTHORS): Add myself.
* AUTHORS (mktemp): Likewise.
* tests/misc/mktemp: Test new option.
* doc/coreutils.texi (mktemp invocation): Document it.
* NEWS: Likewise.
Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548316.

14 years agobuild: reflect gnulib changes to tempname
Eric Blake [Tue, 3 Nov 2009 15:51:31 +0000 (08:51 -0700)]
build: reflect gnulib changes to tempname

In glibc 2.11 and gnulib, gen_tempname added a parameter
suffixlen (unfortunately, it is typed as int rather than
size_t, for historical compatibility to a poor choice by BSD).

* gnulib: Import latest changes.
* gl/lib/tempname.h.diff: Accommodate new suffixlen parameter.
* gl/lib/tempname.c.diff (check_x_suffix): Allow for X in suffix
beyond x_suffix_len.
(gen_tempname_len): Add suffixlen parameter.
(__gen_tempname): Update caller.
* src/mktemp.c (mkstemp_len, mkdtemp_len): Update callers.

14 years agobuild: override gnulib tempname via diff
Eric Blake [Thu, 5 Nov 2009 02:25:47 +0000 (19:25 -0700)]
build: override gnulib tempname via diff

Diffs are more robust than wholesale replacement, because bootstrap
will inform us of any incompatible changes made in upstream gnulib.

* gl/lib/tempname.h: Change...
* gl/lib/tempname.h.diff: ...to diff.
* gl/lib/tempname.c: Change...
* gl/lib/tempname.c.diff: ...to diff.

14 years agomktemp: rearrange --help output
Eric Blake [Wed, 4 Nov 2009 23:09:30 +0000 (16:09 -0700)]
mktemp: rearrange --help output

* src/mktemp.c (usage): Align indentation and sort by long
options.  Describe valid templates.
Suggested by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548316.

14 years agotests: enhance mktemp test
Eric Blake [Wed, 4 Nov 2009 16:01:49 +0000 (09:01 -0700)]
tests: enhance mktemp test

* tests/misc/mktemp: Add more coverage.

14 years agodoc: document mktemp
Eric Blake [Tue, 3 Nov 2009 17:47:42 +0000 (10:47 -0700)]
doc: document mktemp

* doc/coreutils.texi (mktemp invocation): New node.
* TODO: Delete completed task.

14 years agomktemp: don't leave file behind on write failure
Eric Blake [Wed, 4 Nov 2009 21:02:20 +0000 (14:02 -0700)]
mktemp: don't leave file behind on write failure

* src/mktemp.c (main): Remove just-created file if stdout had
problems.
* bootstrap.conf (gnulib_modules): Add remove.
* tests/misc/close-stdout: Test it.
* NEWS: Document it.

14 years agodu: cleanup: remove dead-code vestige of already-removed option
Jim Meyering [Thu, 5 Nov 2009 07:37:12 +0000 (08:37 +0100)]
du: cleanup: remove dead-code vestige of already-removed option

* src/du.c (MEGABYTES_LONG_OPTION, main): Remove vestiges
of already-removed long option, --megabytes.

14 years agodu now diagnoses cycles, rather than ignoring them
Jim Meyering [Wed, 4 Nov 2009 21:01:52 +0000 (22:01 +0100)]
du now diagnoses cycles, rather than ignoring them

* src/du.c (symlink_deref_bits): New global, decl moved from ...
(main): ...here.
(process_file): When fts detects a directory cycle that can't
be due to symlinks, report it and arrange to exit nonzero.
* NEWS (Bug fixes): Mention it.

14 years agomaint: factor out cycle warning, now that du will use it, too
Jim Meyering [Thu, 5 Nov 2009 07:32:09 +0000 (08:32 +0100)]
maint: factor out cycle warning, now that du will use it, too

* src/system.h (emit_cycle_warning): Define.  Factored out of...
* src/remove.c (rm_fts): ...here.  Use the new macro.

14 years agotests: rm: add test for today's change in behavior
Jim Meyering [Tue, 3 Nov 2009 13:30:56 +0000 (14:30 +0100)]
tests: rm: add test for today's change in behavior

* tests/Makefile.am (root_tests): Add rm/read-only to the list.
* tests/rm/read-only: New file.

14 years agorm -f: ignore EROFS when it's really ENOENT
Jim Meyering [Tue, 3 Nov 2009 11:01:40 +0000 (12:01 +0100)]
rm -f: ignore EROFS when it's really ENOENT

rm -f must not print a diagnostic for a nonexistent file.  However,
most linux-based kernel unlinkat functions set errno to EROFS when
the named file (regardless of whether it exists) would lie on a
read-only file system.  remove.c now performs an extra fstatat call
in that case, to determine whether the file exists.
* src/remove.c (excise): Map EROFS to ENOENT, if a file is nonexistent.
Reported by Steven Drake in <http://savannah.gnu.org/bugs/?27923>.
* NEWS (Changes in behavior): Mention it.

14 years agotests: inotify-race: don't let malfunctioning gdb hang the test
Jim Meyering [Sat, 31 Oct 2009 10:54:35 +0000 (11:54 +0100)]
tests: inotify-race: don't let malfunctioning gdb hang the test

* tests/tail-2/inotify-race: Apply timeout to each gdb invocation.

14 years agobuild: avoid some warnings
Eric Blake [Sat, 31 Oct 2009 00:58:58 +0000 (18:58 -0600)]
build: avoid some warnings

* gl/lib/mbsalign.c (mbsalign): Mark unused parameter.
* bootstrap.conf (gnulib_modules): Remove obsolete
rename-dest-slash.
* gnulib-tests/Makefile.am (AM_CFLAGS): Reduce set of warnings for
gnulib tests.
* gl/modules/rename-tests.diff (Makefile.am): New file, to add
LIBINTL to LDADD, since we avoid canonicalize-lgpl module.
* gl/lib/regcomp.c.diff (regerror, calc_next)
(build_collating_symbol, parse_bracket_element, build_equiv_class)
(free_tree): Mark unused parameters.
* gl/lib/regex_internal.h.diff (re_string_elem_size_at): New file,
to mark unused parameters.
* gl/lib/printf-args.c.diff (PRINTF_FETCHARGS): New file, to avoid
type mismatch.
* gl/lib/vasnprintf.c (VASNPRINTF): New file, to avoid shadowing
local variable name.
* .gitignore: Ignore temporary build artifacts.

14 years agobuild: update gnulib submodule to latest, for fewer compiler warnings
Eric Blake [Fri, 30 Oct 2009 12:55:55 +0000 (06:55 -0600)]
build: update gnulib submodule to latest, for fewer compiler warnings

14 years agoadmin: automate one more part of the release process
Jim Meyering [Sat, 31 Oct 2009 10:08:03 +0000 (11:08 +0100)]
admin: automate one more part of the release process

This script automates the process of updating NEWS, performs
the resulting final commit (thus with a consistent log message),
and applies a signed tag (v$VERSION) to the result.
* build-aux/do-release-commit-and-tag: New script.
* README-release: Document it.

14 years agoadmin: fix typo in release procedure
Jim Meyering [Sat, 31 Oct 2009 07:49:46 +0000 (08:49 +0100)]
admin: fix typo in release procedure

* README-release: s/gzip/coreutils/

14 years agotests: prohibit fail=0 initialization
Jim Meyering [Fri, 30 Oct 2009 10:09:50 +0000 (11:09 +0100)]
tests: prohibit fail=0 initialization

* cfg.mk (sc_prohibit_fail_0): New rule.
* .x-sc_prohibit_fail_0: New file.
* Makefile.am (syntax_check_exceptions): Distribute the new file.

14 years agotests: factor 350 fail=0 initializations into test-lib.sh
Jim Meyering [Fri, 30 Oct 2009 09:50:21 +0000 (10:50 +0100)]
tests: factor 350 fail=0 initializations into test-lib.sh

Run this command to remove the factored-out "fail=0" lines.
perl -ni -e '/^fail=0$/ or print' $(g grep -l '^fail=0$')
* tests/test-lib.sh: Initialize fail=0 here, not in 300+ scripts.
* tests/...: nearly all bourne shell scripts
Suggested by Eric Blake.

14 years agotests: remove the less-regular fail=0 assignments manually
Jim Meyering [Fri, 30 Oct 2009 09:49:22 +0000 (10:49 +0100)]
tests: remove the less-regular fail=0 assignments manually

* tests/tail-2/assert-2:
* tests/tail-2/assert:
* tests/cp/file-perm-race:
* tests/misc/df:
* tests/misc/truncate-dir-fail:

14 years agotests: don't let a fail=1 env. setting induce unwarranted test failure
Jim Meyering [Thu, 29 Oct 2009 13:40:40 +0000 (14:40 +0100)]
tests: don't let a fail=1 env. setting induce unwarranted test failure

* cfg.mk (sc_fail_is_initialized): New rule.
Fix the offenders:
* tests/cp/acl: Set fail=0
* tests/cp/backup-is-src: Likewise.
* tests/cp/file-perm-race: Likewise.
* tests/cp/reflink-auto: Likewise.
* tests/cp/same-file: Likewise.
* tests/ln/backup-1: Likewise.
* tests/misc/su-fail: Likewise.
* tests/misc/truncate-owned-by-other: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mkdir/special-1: Likewise.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/force: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/into-self-3: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/touch/now-owned-by-other: Likewise.

14 years agoremove stray closing comment delimiter, "*/", in previous change
Jim Meyering [Thu, 29 Oct 2009 11:14:54 +0000 (12:14 +0100)]
remove stray closing comment delimiter, "*/", in previous change

* gl/lib/regexec.c.diff: Fix a typo.

14 years agomaint: avoid exiting with magic number
Eric Blake [Thu, 29 Oct 2009 12:37:38 +0000 (06:37 -0600)]
maint: avoid exiting with magic number

Cope with gnulib's new sc_prohibit_magic_number_exit rule.

* .x-sc_prohibit_magic_number_exit: New file, to add exemptions.
* Makefile.am (syntax_check_exceptions): Distribute it.
* lib/euidaccess-stat.c (main): Fix culprits.
* src/chcon.c (main): Likewise.
* src/runcon.c (main): Likewise.
* src/setuidgid.c (main): Likewise.

14 years agobuild (--enable-gcc-warnings): enable gcc's -Werror also in lib/
Jim Meyering [Tue, 27 Oct 2009 11:06:43 +0000 (12:06 +0100)]
build (--enable-gcc-warnings): enable gcc's -Werror also in lib/

* configure.ac (GNULIB_WARN_CFLAGS): Define.
* lib/Makefile.am (AM_CFLAGS): Use $(GNULIB_WARN_CFLAGS)
rather than $(WARN_CFLAGS) and add $(WERROR_CFLAGS).
* gl/lib/regcomp.c.diff: New file.
* gl/lib/regex_internal.c.diff: New file.
* gl/lib/regexec.c.diff: New file.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 28 Oct 2009 09:37:43 +0000 (10:37 +0100)]
build: update gnulib submodule to latest

14 years agobuild: allow whitespace violations in gl/lib/*.diff files
Jim Meyering [Tue, 27 Oct 2009 11:12:11 +0000 (12:12 +0100)]
build: allow whitespace violations in gl/lib/*.diff files

* .gitattributes: Exempt gl/lib/*.diff.
* .x-sc_prohibit_tab_based_indentation: Likewise.
* .x-sc_space_tab:Likewise.

14 years agonice, nohup, su: detect write failure to stderr
Eric Blake [Wed, 28 Oct 2009 20:36:09 +0000 (14:36 -0600)]
nice, nohup, su: detect write failure to stderr

These programs can print non-fatal diagnostics to stderr prior to
exec'ing a subsidiary program.  However, if we thought the situation
warranted a diagnostic, we insist that the diagnostic be printed
without error, rather than blindly exec, as it may be a security risk.

For an example, try 'nice -n -1 nice 2>/dev/full'.  Failure to raise
priority (by lowering niceness) is not fatal, but failure to inform
the user about failure to change priority is dangerous.

* src/nice.c (main): Declare failure if writing advisory message
to stderr fails.
* src/nohup.c (main): Likewise.
* src/su.c (main): Likewise.
* tests/misc/nice: Test this.
* tests/misc/nohup: Likewise.
* NEWS: Document this.

14 years agodoc: tell --enable-gcc-warnings users where to report problems
Jim Meyering [Wed, 28 Oct 2009 07:49:51 +0000 (08:49 +0100)]
doc: tell --enable-gcc-warnings users where to report problems

* README-hacking: Add a caveat for --enable-gcc-warnings.

14 years agobuild: make doc checks more user-friendly
Jim Meyering [Wed, 28 Oct 2009 07:27:48 +0000 (08:27 +0100)]
build: make doc checks more user-friendly

* doc/Makefile.am (check-texinfo): Begin moving each individual test
into its own rules.
(sc-avoid-builtin, sc-avoid-path): New rules.
Extracted from check-texinfo.
(syntax_checks): Add them.

14 years agodoc: avoid failing "make check"
Jim Meyering [Wed, 28 Oct 2009 07:30:50 +0000 (08:30 +0100)]
doc: avoid failing "make check"

* doc/coreutils.texi (env invocation): s/builtin/built-in/

14 years agodoc: improve the echo and printf help on escapes
Pádraig Brady [Wed, 28 Oct 2009 10:59:05 +0000 (10:59 +0000)]
doc: improve the echo and printf help on escapes

* src/printf.c (usage): Merge strings with echo.c to
aid translators.  Move the description for \NNN beside
the other numeric escape codes.  Don't mention
"character" as that suggests character conversion.
* src/echo.c (usage): Likewise.
Also mention the \xHH escape sequence.

14 years agoecho, printf: interpret \e as the Escape character
Pádraig Brady [Tue, 27 Oct 2009 10:04:34 +0000 (10:04 +0000)]
echo, printf: interpret \e as the Escape character

Match gcc, perl, bash, ksh, tcsh, ... in supporting \e.
* src/printf.c (print_escape_char): Output \x1B when \e encountered.
* src/echo.c (main): Likewise.
* src/stat.c (print_escape_char): Likewise.
* doc/coreutils.texi (echo invocation): Add \e to the list.
* tests/misc/printf: Verify that \e outputs \x1B.
* NEWS: Mention the change in behaviour.

14 years agoprintenv: ignore bogus variable names
Eric Blake [Wed, 28 Oct 2009 12:21:24 +0000 (06:21 -0600)]
printenv: ignore bogus variable names

Exposed by env a=b=c printenv a=b.

* src/printenv.c (main): Silently reject = in names.
* tests/misc/printenv: Test for it.
* NEWS: Document this.

14 years agomaint: avoid "make syntax-check" failure
Pádraig Brady [Wed, 28 Oct 2009 11:50:54 +0000 (11:50 +0000)]
maint: avoid "make syntax-check" failure

* src/printenv.c: Remove unused "long-options.h"

14 years agodoc: turn env comments into documentation
Eric Blake [Tue, 27 Oct 2009 23:20:56 +0000 (17:20 -0600)]
doc: turn env comments into documentation

* src/env.c: Convert introductory comments...
* doc/coreutils.texi (env invocation): ...into documentation.
Suggested by Jim Meyering.

14 years agoenv, printenv: add -0/--null option
Eric Blake [Tue, 27 Oct 2009 12:36:40 +0000 (06:36 -0600)]
env, printenv: add -0/--null option

Allows for unambiguous processing when environment values (or even
non-portable names!) contain newline.

* src/env.c (longopts): Add new option.
(usage): Document it.
(main): Implement it.
* src/printenv.c (longopts): New variable.
(usage): Document new option.
(main): Implement it.
* doc/coreutils.texi (Common options): New macro optNull.
(du invocation, env invocation, printenv invocation): Use it.
* NEWS: Mention this.
* tests/misc/env-null: New test.
* tests/Makefile.am (TESTS): Run it.

14 years agotests: add printenv coverage
Eric Blake [Tue, 27 Oct 2009 04:21:22 +0000 (22:21 -0600)]
tests: add printenv coverage

* tests/misc/printenv: New test.
* tests/Makefile.am (TESTS): Run it.
* .gitignore: Ignore more cruft.

14 years agotests: fix PATH problems on cygwin
Eric Blake [Tue, 27 Oct 2009 20:08:14 +0000 (14:08 -0600)]
tests: fix PATH problems on cygwin

* tests/misc/sort-compress: Remove non-portable over-restriction
of PATH; besides, commit 3ea177e changed sort to no longer default
to gzip.
* tests/rm/fail-eperm: Untaint, rather than clear, PATH.
* tests/misc/pwd-long: Likewise.  Also skip test if long path
cannot be created.
(normalize_to_cwd_relative): Use eq rather than ==, since cygwin
perl doesn't properly handle 64-bit ino_t numerically.

14 years agotests: clean up tests of env -- handling
Eric Blake [Mon, 26 Oct 2009 19:32:49 +0000 (13:32 -0600)]
tests: clean up tests of env -- handling

The comment in env.c about -- handling has not matched the behavior
in the code since the initial commit back in 1992.

* src/env.c: Fix bogus comment.
* tests/misc/env: Further tweaks, avoiding PATH problems inherent
in testing -i, and testing program name containing =.
* doc/coreutils.texi (env invocation): Mention that intermediate
program is needed to invoke program with name containing =.

14 years agodoc: document PATH interactions with env
Eric Blake [Mon, 26 Oct 2009 15:26:00 +0000 (09:26 -0600)]
doc: document PATH interactions with env

* doc/coreutils.texi (env invocation): Mention that PATH is
modified prior to exec.
* tests/misc/env: Test this.

14 years agoenv: reject bogus -u arguments
Eric Blake [Mon, 26 Oct 2009 13:10:51 +0000 (07:10 -0600)]
env: reject bogus -u arguments

* src/env.c (main): Use unsetenv rather than putenv to remove
items from environ, and check for failure.
* bootstrap.conf (gnulib_modules): Add unsetenv.
* tests/misc/env: Test this.
* NEWS: Document it.

14 years agomaint: let gnulib provide environ
Eric Blake [Mon, 26 Oct 2009 20:32:59 +0000 (14:32 -0600)]
maint: let gnulib provide environ

* bootstrap.conf (gnulib_modules): Add environ.
* src/env.c (environ): Delete declaration.
* src/printenv.c (environ): Likewise.
* src/stdbuf.c (environ): Likewise.
* src/su.c (environ): Likewise.

14 years agotests: avoid file name not portable to cygwin
Eric Blake [Mon, 26 Oct 2009 12:05:44 +0000 (06:05 -0600)]
tests: avoid file name not portable to cygwin

* tests/misc/chroot-fail: Use 'no_such', not '...', since cygwin
1.5 silently strips trailing dots.
* tests/misc/nice-fail: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/timeout-parameters: Likewise.

14 years agotests: rm/one-file-system: work around umount failure
Jim Meyering [Mon, 19 Oct 2009 07:11:08 +0000 (09:11 +0200)]
tests: rm/one-file-system: work around umount failure

* tests/rm/one-file-system (cleanup_): Unmount a/b, rather than
"$other_partition_tmpdir", to accommodate those who link /etc/mtab
to /proc/mounts.  Reported by Gilles Espinasse in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18508

14 years agotests: adjust new env test not to fail
Jim Meyering [Sun, 25 Oct 2009 15:21:40 +0000 (16:21 +0100)]
tests: adjust new env test not to fail

* tests/misc/env: Create ./-i as a link to our "echo" binary,
rather than as a bourne shell script, so that env can exec it.
Set PATH to ".".

14 years agotests: nice: adjust new tests to work more portably
Jim Meyering [Sat, 24 Oct 2009 11:53:05 +0000 (13:53 +0200)]
tests: nice: adjust new tests to work more portably

* tests/misc/nice (tests): Accommodate a nice program for which
"nice -n -1 nice" prints nothing.  It should print -1 or (usually) 0.
Otherwise, we'd get syntax errors.

14 years agonice: execute program even when setpriority fails due to EACCES
Jim Meyering [Sat, 24 Oct 2009 11:50:13 +0000 (13:50 +0200)]
nice: execute program even when setpriority fails due to EACCES

* src/nice.c (perm_related_errno): New function.
(main): Use it, rather than testing only errno == EPERM.
* NEWS (Bug fixes): Mention it.

14 years agotimeout: don't orphan monitored programs if they ignore specified signals
Pádraig Brady [Fri, 23 Oct 2009 07:52:25 +0000 (08:52 +0100)]
timeout: don't orphan monitored programs if they ignore specified signals

* src/timeout.c (install_signal_handlers): Handle any user
specified signal, so that if it does not cause the child
to exit then we don't exit and orphan the child. Previously this
for example, would leave an orphan dd process running:
timeout -sUSR1 1s dd if=/dev/zero of=/dev/null
* NEWS: Mention the fix.