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

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

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

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

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

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

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

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

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

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

15 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

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

15 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/

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

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

15 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:

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

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

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

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

15 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

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

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

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

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

15 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/

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

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

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

15 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"

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

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

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

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

15 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 =.

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

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

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

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

15 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

15 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 ".".

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

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

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

15 years agotests: test recent status changes
Eric Blake [Fri, 23 Oct 2009 17:01:25 +0000 (11:01 -0600)]
tests: test recent status changes

* tests/misc/nice: Enhance test.
* tests/misc/chroot-fail: New test.
* tests/misc/env: Likewise.
* tests/misc/nice-fail: Likewise.
* tests/misc/su-fail: Likewise.
* tests/Makefile.am (TESTS): Run new tests.

15 years agomaint: move chroot test
Eric Blake [Fri, 23 Oct 2009 14:12:29 +0000 (08:12 -0600)]
maint: move chroot test

* tests/chroot/credentials: Move...
* tests/misc/chroot-credentials: ...here, to reduce number of
directories.
* tests/Makefile.am (root_tests): Reflect rename.

15 years agotests: enhance stdbuf and timeout tests
Eric Blake [Fri, 23 Oct 2009 14:54:53 +0000 (08:54 -0600)]
tests: enhance stdbuf and timeout tests

* tests/misc/timeout-parameters: Validate exact exit status.
* tests/misc/stdbuf: Likewise.
* tests/misc/timeout: Likewise.  Use require_built_.
* tests/misc/arch: Likewise.

15 years agonohup: use EXIT_CANCELED if not POSIXLY_CORRECT
Eric Blake [Fri, 23 Oct 2009 12:59:23 +0000 (06:59 -0600)]
nohup: use EXIT_CANCELED if not POSIXLY_CORRECT

* src/nohup.c (NOHUP_FAILURE): Rename...
(POSIX_NOHUP_FAILURE): ...to this.
(main): Pay attention to POSIXLY_CORRECT, to determine whether to
use status 125 or 127.
* doc/coreutils.texi (nohup invocation): Document this.
* NEWS: Likewise.
* tests/misc/invalid-opt (exit_status): Adjust expected results.
* tests/misc/help-version (expected_failure_status): Likewise.
* tests/misc/nohup: Likewise.

15 years agochroot, env, nice, su: use EXIT_CANCELED for internal failure
Eric Blake [Fri, 23 Oct 2009 12:59:02 +0000 (06:59 -0600)]
chroot, env, nice, su: use EXIT_CANCELED for internal failure

* src/chroot.c (main): Use EXIT_CANCELED, not EXIT_FAILURE.
* src/env.c (main): Likewise.
* src/nice.c (main): Likewise.
* src/su.c (change_identity, main): Likewise.
* doc/coreutils.texi (chroot invocation, env invocation)
(nice invocation, su invocation): Document this.
* NEWS: Likewise.
* tests/misc/invalid-opt (exit_status): Adjust expected results.
* tests/misc/help-version (expected_failure_status): Likewise.

15 years agotests: accommodate BSD getopt
Eric Blake [Fri, 23 Oct 2009 21:35:41 +0000 (15:35 -0600)]
tests: accommodate BSD getopt

* tests/misc/invalid-opt (err_subst): Support alternate spelling.

15 years agobuild: prohibit improper use of stat and lstat
Eric Blake [Fri, 23 Oct 2009 12:06:46 +0000 (06:06 -0600)]
build: prohibit improper use of stat and lstat

* cfg.mk (sc_prohibit_stat_macro_address): New rule.
* src/ln.c (do_link): Adjust comment to avoid false positive.
* src/stat.c (do_stat): Likewise.
* src/touch.c (main): Likewise.

15 years agobuild: update gnulib submodule to latest, for test cleanups
Eric Blake [Fri, 23 Oct 2009 03:25:39 +0000 (21:25 -0600)]
build: update gnulib submodule to latest, for test cleanups

15 years agomaint: turn on compiler warnings for gnulib tests
Eric Blake [Wed, 21 Oct 2009 17:27:29 +0000 (11:27 -0600)]
maint: turn on compiler warnings for gnulib tests

* gnulib-tests/Makefile.am (AM_CFLAGS): Add WARN_CFLAGS.
* configure.ac (enable-gcc-warnings): Also use -funit-at-a-time,
to silence gcc 4.3.4 -Wdisabled-optimization.
* .gitignore: Ignore some more files.

15 years agobuild: prohibit direct use of readlink or readlinkat
Jim Meyering [Thu, 22 Oct 2009 10:12:24 +0000 (12:12 +0200)]
build: prohibit direct use of readlink or readlinkat

* cfg.mk (sc_prohibit_readlink): New rule.
Suggested by Eric Blake.

15 years agotests: add a test for the `tail -f' race condition bug
Giuseppe Scrivano [Tue, 20 Oct 2009 08:49:17 +0000 (10:49 +0200)]
tests: add a test for the `tail -f' race condition bug

If new data becomes available between the initial read and when tail
registers the inotify watch descriptors, ensure that it is read
before a new event happens on the file.
* tests/Makefile.am (TESTS): Add tail-2/inotify-race.
* tests/tail-2/inotify-race: New file.

15 years agotail -f: avoid a race condition
Giuseppe Scrivano [Mon, 12 Oct 2009 20:16:03 +0000 (22:16 +0200)]
tail -f: avoid a race condition

* NEWS (Bug fixes): Mention it.
* src/tail.c (check_fspec): New function.
(tail_forever_inotify): Ensure there is no new data before entering the
inotify events wait loop.

15 years agobuild: update gnulib submodule to latest, for utimens enhancements
Eric Blake [Thu, 22 Oct 2009 01:59:38 +0000 (19:59 -0600)]
build: update gnulib submodule to latest, for utimens enhancements

15 years agotests: ensure touch honors trailing slash
Eric Blake [Wed, 21 Oct 2009 12:23:28 +0000 (06:23 -0600)]
tests: ensure touch honors trailing slash

* tests/touch/trailing-slash: New test.
* tests/Makefile.am (TESTS): Run it.

15 years agomd5sum, sha*sum, sum: line-buffer the printed checksums
Pádraig Brady [Tue, 20 Oct 2009 18:19:58 +0000 (19:19 +0100)]
md5sum, sha*sum, sum: line-buffer the printed checksums

* src/md5sum.c (main): Set stdout to line buffered mode
to ensure parallel running instances don't intersperse
their output.  This adds 5% to the run time in the worst case
of many zero length files, or 2% with standard file sizes.
* src/sum.c (main): Likewise.
* tests/misc/md5sum-parallel: New test for atomic output.
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix

15 years agomaint: issue warnings for more missing optional libraries
Pádraig Brady [Mon, 19 Oct 2009 10:12:40 +0000 (11:12 +0100)]
maint: issue warnings for more missing optional libraries

* README-hacking: Suggest to use ./configure --quiet so that
any warnings are easily noticed.
* m4/gmp.m4 (cu_GMP): Warn if libgmp is not available.
* m4/jm-macros.m4 (coreutils_MACROS): Normalize the libcap warning.
* m4/xattr.m4 (gl_FUNC_XATTR): Warn if libattr is not available.

15 years agobuild: use gnulib's isblank module
Jim Meyering [Mon, 19 Oct 2009 05:55:42 +0000 (07:55 +0200)]
build: use gnulib's isblank module

* bootstrap.conf (gnulib_modules): Add isblank.
* src/system.h (isblank): Don't define.
* m4/check-decl.m4: Don't check for isblank declaration.
* gnulib: Update submodule to latest.

15 years agomaint: factor out duplication in currently unused rules
Jim Meyering [Sun, 18 Oct 2009 08:26:15 +0000 (10:26 +0200)]
maint: factor out duplication in currently unused rules

* src/Makefile.am (fs_normalize_perl_subst): Define.
(fs-magic, fs-kernel-magic): Use it.

15 years agotouch: add -h to change symlink timestamps, where supported
Eric Blake [Sat, 17 Oct 2009 13:55:05 +0000 (07:55 -0600)]
touch: add -h to change symlink timestamps, where supported

* src/touch.c (no_dereference): New flag variable.
(longopts): Add -h/--no-dereference.
(touch): Add symlink handling.
(usage): Document new option.
(main): Accept new option.
* NEWS: Document it.
* doc/coreutils.texi (touch invocation): Likewise.  Also mention
birthtime.
* tests/touch/no-dereference: New test.
* tests/Makefile.am (TESTS): Run it.

15 years agotests: abmon-align: avoid test failure
Jim Meyering [Sat, 17 Oct 2009 10:18:54 +0000 (12:18 +0200)]
tests: abmon-align: avoid test failure

* tests/ls/abmon-align: Don't remove (1d;) the first line of output.
That was making the test consider only 11 of 12 month names.
Rewrite not to use \(.*\), as that provoked a malfunction in GNU sed
on powerpc Mac OS X (though we don't know yet whether this is due to a
sed bug, or to miscompilation).  Nelson Beebe reported the test failure.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Thu, 15 Oct 2009 20:13:10 +0000 (22:13 +0200)]
build: update gnulib submodule to latest

15 years agobuild: don't let environment settings perturb build
Jim Meyering [Thu, 15 Oct 2009 18:54:02 +0000 (20:54 +0200)]
build: don't let environment settings perturb build

Setting the envvars, LIB_FDATASYNC, LIB_XATTR or LIB_CRYPT
could cause a configure-time and/or build-time malfunction.
Typically, a configure-time function-in-library test is performed
via code like this:

  LIB_VAR=
  AC_SUBST([LIB_VAR])
  prefix_saved_LIBS=$LIBS
    AC_SEARCH_LIBS([FUNC], [LIB_NAME],
                   [test "$ac_cv_search_FUNC" = "none required" ||
                    LIB_VAR=$ac_cv_search_FUNC])
  LIBS=$prefix_saved_LIBS

However, in each of the files affected by this change, the LIB_VAR=
initialization was omitted.  Thus, when set in the environment, its
value would propagate into generated Makefiles when FUNC is not found
in LIB_NAME.
* m4/jm-macros.m4 (coreutils_MACROS): Initialize AC_SUBST'd var
* m4/lib-check.m4 (cu_LIB_CHECK): Likewise.
* m4/xattr.m4 (gl_FUNC_XATTR): Likewise.

15 years agotail: add add missing backslash at the end of a line in usage
C de-Avillez [Tue, 13 Oct 2009 07:58:25 +0000 (02:58 -0500)]
tail: add add missing backslash at the end of a line in usage

* src/tail.c (usage): Add missing backslash at the end of a line.

15 years agotail: tweak usage for more clarity
Eric Blake [Mon, 12 Oct 2009 13:00:12 +0000 (07:00 -0600)]
tail: tweak usage for more clarity

* src/tail.c (usage): Spell out -n +K.
* THANKS: Update.
Reported by Jan-Pawel Wrozstinski.

15 years agotouch: optimize use of utimens
Eric Blake [Fri, 9 Oct 2009 12:56:03 +0000 (06:56 -0600)]
touch: optimize use of utimens

* src/touch.c (main): Use UTIME_NOW rather than calling gettime.
(touch): Use UTIME_OMIT rather than stat.

15 years agocopy: allow symlink timestamp preservation on more systems
Eric Blake [Thu, 8 Oct 2009 21:57:06 +0000 (15:57 -0600)]
copy: allow symlink timestamp preservation on more systems

* src/copy.c (utimens_symlink): Simplify by using lutimens.
* m4/jm-macros.m4 (coreutils_MACROS): Drop utimensat; gnulib does
this for us.
* tests/cp/preserve-slink-time: Recognize lutimes support.

15 years agobuild: update gnulib submodule to latest, for utimens improvements
Eric Blake [Fri, 9 Oct 2009 19:31:52 +0000 (13:31 -0600)]
build: update gnulib submodule to latest, for utimens improvements

15 years agotests: adjust tail-2/pid to work around FreeBSD 6.1 failure
Jim Meyering [Sat, 10 Oct 2009 13:01:05 +0000 (15:01 +0200)]
tests: adjust tail-2/pid to work around FreeBSD 6.1 failure

* tests/tail-2/pid: Run tail -f --pid=... on an actual file, not on
/dev/null, to avoid this failure on FreeBSD 6.1: tail: /dev/null:
cannot change nonblocking mode: Inappropriate ioctl for device

15 years agomaint: touch up previous LDADD patch
Eric Blake [Sat, 10 Oct 2009 12:21:59 +0000 (06:21 -0600)]
maint: touch up previous LDADD patch

* src/Makefile.am (dir_LDADD): Delete; the ls_LDADD line covers this.

15 years agobuild: build uname(1) unconditionally
Jim Meyering [Sat, 10 Oct 2009 07:02:26 +0000 (09:02 +0200)]
build: build uname(1) unconditionally

Before, on a system without the uname function, the build
system would detect that and not build/install a uname program.
Now that gnulib guarantees a uname function, ...
* configure.ac: Don't check for the uname function.
* src/Makefile.am (build_if_possible__progs): Move uname...
(EXTRA_PROGRAMS): ...to this list.

15 years agomaint: list program names one per line
Jim Meyering [Sat, 10 Oct 2009 06:58:43 +0000 (08:58 +0200)]
maint: list program names one per line

* src/Makefile.am (EXTRA_PROGRAMS): List them one per line.
(build_if_possible__progs): Likewise.

15 years agobuild: ls: fix link failure due to missing -lacl
Jim Meyering [Sat, 10 Oct 2009 06:24:02 +0000 (08:24 +0200)]
build: ls: fix link failure due to missing -lacl

* src/Makefile.am (ls_LDADD): Re-add $(LIB_ACL).
Inadvertently-removed by commit 78c93601.

15 years agomaint: touch up previous LDADD patch
Eric Blake [Sat, 10 Oct 2009 02:08:03 +0000 (20:08 -0600)]
maint: touch up previous LDADD patch

* src/Makefile.am (stdbuf_LDADD): Add missing primer.
(hostname_LDADD, uname_LDADD): Add GETHOSTNAME_LIB.
* bootstrap.conf (gnulib_modules): Add uname.

15 years agomaint: improve additional library tracking
Eric Blake [Fri, 9 Oct 2009 19:57:56 +0000 (13:57 -0600)]
maint: improve additional library tracking

* src/Makefile.am (LDADD): Refactor, to make per-library additions
to individual programs easier to maintain.

15 years agochcon: don't disable just because SELinux is disabled
Jim Meyering [Wed, 7 Oct 2009 13:31:17 +0000 (15:31 +0200)]
chcon: don't disable just because SELinux is disabled

* src/chcon.c (main): Now that gnulib provides getfilecon wrappers,
we can revert most of the 2009-10-05 commit 3a97d664, "chcon: exit
immediately if SELinux is disabled", since chcon is still useful as
long as the file system provides handlers for the security.*
name space.  gnulib's getfilecon wrappers ensure that an offending
context now evokes a return value of -1.
Prompted by comments from Stephen Smalley in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18378/focus=18394
* NEWS (Bug fixes): Mention it.

15 years agols: remove explicit getfilecon work-around
Jim Meyering [Wed, 7 Oct 2009 20:29:12 +0000 (22:29 +0200)]
ls: remove explicit getfilecon work-around

* src/ls.c (gobble_file): Remove l?getfilecon work-around,
now that the gnulib wrappers handle it for us.

15 years agobuild: update gnulib submodule to latest, for getfilecon wrappers
Jim Meyering [Fri, 9 Oct 2009 11:57:02 +0000 (13:57 +0200)]
build: update gnulib submodule to latest, for getfilecon wrappers

15 years agomaint: use X2NREALLOC in more places
Eric Blake [Thu, 8 Oct 2009 14:35:55 +0000 (08:35 -0600)]
maint: use X2NREALLOC in more places

* src/chroot.c (set_additional_groups): Use X2NREALLOC rather than
x2nrealloc.
* src/factor.c (emit_factor): Likewise.
* src/setuidgid.c (main): Likewise.

15 years agomaint: remove unused macros and declarations
Eric Blake [Thu, 8 Oct 2009 15:35:51 +0000 (09:35 -0600)]
maint: remove unused macros and declarations

* src/system.h (EDQUOT, EISDIR, ENOSYS, EOVERFLOW, F_OK, X_OK)
(W_OK, R_OK): Delete; macros provided by gnulib.
(includes): Gnulib guarantees both <time.h> and <sys/time.h>, in
either order.
(free, malloc, memchr, realloc, getenv, lseek): Delete, gnulib
guarantees these declarations.
* m4/check-decl.m4 (gl_CHECK_DECLS): Delete checks now done by
gnulib.

15 years agomaint: move timeout exit statuses
Eric Blake [Thu, 8 Oct 2009 14:13:02 +0000 (08:13 -0600)]
maint: move timeout exit statuses

* src/timeout.c (EXIT_TIMEDOUT, EXIT_CANCELED): Remove as
macros...
* src/system.h (EXIT_TIMEDOUT, EXIT_CANCELED): ...and provide as
enum values instead.
* src/stdbuf.c (EXIT_CANCELED): Delete.

15 years agostat: test recent patch
Eric Blake [Thu, 8 Oct 2009 14:53:56 +0000 (08:53 -0600)]
stat: test recent patch

* tests/misc/stat-slash: New test.
* tests/Makefile.am (TESTS): Run it.

15 years agostdbuf: improve path search
Eric Blake [Thu, 24 Sep 2009 23:18:47 +0000 (17:18 -0600)]
stdbuf: improve path search

* src/stdbuf.c (set_program_path): Use gnulib methods for better
file name handling.
* bootstrap.conf (gnulib_modules): Add xreadlink.

15 years agostat: work with recent gnulib changes
Eric Blake [Thu, 8 Oct 2009 12:04:09 +0000 (06:04 -0600)]
stat: work with recent gnulib changes

* src/stat.c (do_stat): Don't mask function-like stat macro.

15 years agostat: add support for many more file system types
Jim Meyering [Thu, 8 Oct 2009 08:06:42 +0000 (10:06 +0200)]
stat: add support for many more file system types

* src/stat.c (human_fstype): Add the following FS types,
from <linux/magic.h>: afs, anon-inode FS, btrfs, cgroupfs,
cramfs-wend, debugfs, futexfs, inotifyfs, minux3, securityfs,
selinux, xenfs.
Also add "nilfs".
* src/Makefile.am (fs-kernel-magic): New rule.
* NEWS (Bug fixes): Mention this.

15 years agostat: recognize CIFS and HFS file system types
Jim Meyering [Thu, 8 Oct 2009 07:05:08 +0000 (09:05 +0200)]
stat: recognize CIFS and HFS file system types

* src/stat.c (human_fstype) [CIFS, HFS]: Add new file system types.
Prompted by a report from Stuart Kemp.
Normalize the form of a few hexadecimal magic numbers.
Alphabetize on S_MAGIC_ case names.
* src/Makefile.am (fs-magic-compare, fs-def, fs-magic): New rules, to
automate comparison of our list with that in the Linux statfs man page.
* NEWS (Bug fixes): Mention it.

15 years agomd5sum, sha*sum: also accept openssl checksum syntax
Guenter Knauf [Sat, 3 Oct 2009 21:24:26 +0000 (23:24 +0200)]
md5sum, sha*sum: also accept openssl checksum syntax

* src/md5sum.c (split_3): Accept openssl checksum syntax, which
differs only by two spaces from that of the bsd checksum tools:
openssl: MD5(f)= d41d8cd98f00b204e9800998ecf8427e
bsd:     MD5 (f) = d41d8cd98f00b204e9800998ecf8427e

15 years agomaint: make release-making instructions more generic
Jim Meyering [Tue, 6 Oct 2009 14:49:36 +0000 (16:49 +0200)]
maint: make release-making instructions more generic

* README-release: Make instructions more generic.

15 years agopost-release administrivia
Jim Meyering [Tue, 6 Oct 2009 11:20:18 +0000 (13:20 +0200)]
post-release administrivia

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

15 years agoversion 8.0 v8.0
Jim Meyering [Tue, 6 Oct 2009 11:04:16 +0000 (13:04 +0200)]
version 8.0

* NEWS: Record release date.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 6 Oct 2009 09:01:33 +0000 (11:01 +0200)]
build: update gnulib submodule to latest

15 years agochcon: exit immediately if SELinux is disabled
Ondřej Vašík [Mon, 5 Oct 2009 07:20:48 +0000 (09:20 +0200)]
chcon: exit immediately if SELinux is disabled

This change happens to avoid an abort in chcon when SELinux is
disabled while operating on a file with an "unlabeled" context from
back in 2006.  However, that same abort can still be triggered by the
same file when running chcon with SELinux enabled.  This bug in chcon
will be fixed in a subsequent commit via a getfilecon wrapper.  See
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18378/focus=18384
for how to correct your disk attributes to avoid triggering this bug.
* src/chcon.c (main): Exit immediately if SELinux is disabled.
Reported in http://bugzilla.redhat.com/527142 by Yanko Kaneti.
* src/runcon.c (main): Do not hardcode program name in error message.
* THANKS: Update.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Sat, 3 Oct 2009 04:56:55 +0000 (06:56 +0200)]
build: update gnulib submodule to latest

15 years agodircolors: highlight .cgm and .emf as images
James R. Van Zandt [Fri, 2 Oct 2009 16:56:16 +0000 (10:56 -0600)]
dircolors: highlight .cgm and .emf as images

* src/dircolors.hin: Add .cgm, .emf.
* THANKS: Update.

15 years agomaint: remove obsolete syntax-check exclusion
Jim Meyering [Fri, 2 Oct 2009 13:48:08 +0000 (15:48 +0200)]
maint: remove obsolete syntax-check exclusion

* cfg.mk (local-checks-to-skip): Remove strftime-check.

15 years agotail: avoid a race where we could miss new data with --pid
Pádraig Brady [Thu, 1 Oct 2009 07:36:25 +0000 (08:36 +0100)]
tail: avoid a race where we could miss new data with --pid

* src/tail.c (tail_forever, tail_forever_inotify): Close a race in
tail_forever_inotify where new data written after the file check by
a now dead process, but before the pid check, is not output.  We use
the POSIX guarantee that read() and write() are serialized wrt each
other even in separate processes, to assume full file consistency
after exit() and so poll for new data _after_ the writer has exited.
This also allows us to not redundantly _wait_ for new data if the
process is dead.
* tests/tail-2/pid: Remove the now partially invalid sub second sleep
check as we now don't unconditionally wait, and replace it with a check
for the redundant sleep.  Also clarify some of the existing comments.
* NEWS: Mention the fix.

15 years agomaint: move gnu-web-doc-update script to gnulib
Jim Meyering [Fri, 2 Oct 2009 08:52:09 +0000 (10:52 +0200)]
maint: move gnu-web-doc-update script to gnulib

* bootstrap.conf (gnulib_modules): Add gnu-web-doc-update.
Remove gendocs, since gnu-web-doc-update depends on it.
* gnu-web-doc-update: Remove file, now that we get it from gnulib.