platform/upstream/coreutils.git
16 years agotac: avoid segfault for e.g., "echo > x; tac -r x x"
Jim Meyering [Sun, 4 May 2008 22:07:08 +0000 (00:07 +0200)]
tac: avoid segfault for e.g., "echo > x; tac -r x x"

* src/tac.c (tac_seekable): Move local "regs" declaration out
to file scope, so its values aren't clobbered between calls.
Discovered by Cristian Cadar, Daniel Dunbar and Dawson Engler,
reported in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13501
* NEWS: Mention the bug fix.
* tests/Makefile.am (TESTS): Add misc/tac.
* tests/misc/tac: New file.  Test for the above.

16 years agotests: avoid a "make check-root" failure when mcstransd is running
Jim Meyering [Wed, 30 Apr 2008 21:24:41 +0000 (23:24 +0200)]
tests: avoid a "make check-root" failure when mcstransd is running

* tests/misc/chcon: Skip this test if mcstransd seems to be running.

16 years agotests: avoid spurious "make check-root" failure
Jim Meyering [Wed, 30 Apr 2008 20:50:02 +0000 (22:50 +0200)]
tests: avoid spurious "make check-root" failure

* README (Running tests as root): Also set PATH in suggested "sudo"
command.  This avoids failure of at least tests/cp/cp-a-selinux
when the default PATH does not contain /sbin.
* tests/cp/cp-a-selinux: Don't redirect stderr to /dev/null.
"mkfs" was failing due to /sbin not being in PATH.

16 years agoAdd Daniel Dunbar's lcov instructions to HACKING
Bo Borgerson [Wed, 30 Apr 2008 12:49:59 +0000 (08:49 -0400)]
Add Daniel Dunbar's lcov instructions to HACKING

* HACKING: New section `Finding things to do', points to TODO file and
gives instructions on generating an html coverage report as provided by
Daniel Dunbar.
* TODO: Add item for improving test coverage.  Point back to HACKING.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
16 years agochcon, runcon: make --help print the bug-reporting address
Jim Meyering [Sat, 26 Apr 2008 07:14:55 +0000 (09:14 +0200)]
chcon, runcon: make --help print the bug-reporting address

* src/chcon.c (usage): Use emit_bug_reporting_address.
* src/runcon.c (usage): Likewise.
* tests/misc/help-version: Don't exempt chcon and runcon.
* NEWS: Mention this.

16 years agotests: don't hard-code coreutils list of tests/ SUBDIRS in bootstrap
Jim Meyering [Mon, 28 Apr 2008 20:59:24 +0000 (22:59 +0200)]
tests: don't hard-code coreutils list of tests/ SUBDIRS in bootstrap

* bootstrap: Extract the list from tests/Makefile.am, and die
when it is empty -- it will be, eventually.

16 years agotests: remove references to tests/wc from bootstrap
Bo Borgerson [Mon, 28 Apr 2008 18:58:51 +0000 (14:58 -0400)]
tests: remove references to tests/wc from bootstrap

* bootstrap: Don't try to initialize anything in tests/wc.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
16 years agotests: slightly relax sc_cast_of_argument_to_free syntax check
Jim Meyering [Mon, 28 Apr 2008 20:44:56 +0000 (22:44 +0200)]
tests: slightly relax sc_cast_of_argument_to_free syntax check

* maint.mk (sc_cast_of_argument_to_free): Relax regexp slightly.
(sc_no_have_config_h): Add a comment.

16 years agotests: don't chmod after a failed chdir in cleanup
Bo Borgerson [Mon, 28 Apr 2008 17:11:26 +0000 (13:11 -0400)]
tests: don't chmod after a failed chdir in cleanup

* tests/CuTmpdir.pm (chmod_tree): Don't chmod if chdir failed.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
16 years agoOnly cleanup test dirs from the process that created them.
Bo Borgerson [Mon, 28 Apr 2008 14:30:22 +0000 (10:30 -0400)]
Only cleanup test dirs from the process that created them.

* tests/CuTmpdir.pm (import): Use closure around current PID to avoid cleanup races.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
16 years agomove wc tests from own subdir into a single script
Jim Meyering [Sat, 26 Apr 2008 21:40:03 +0000 (23:40 +0200)]
move wc tests from own subdir into a single script

* configure.ac (AC_CONFIG_FILES): Remove wc/Makefile from the list.
* tests/Makefile.am (SUBDIRS): Remove wc from the list.
(TESTS): Add misc/wc.
* tests/misc/wc: New file, derived from tests/wc/Tests.pm.
* tests/wc/Test.pm: Remove file.

16 years agotests: remove temporary log file upon catchable signal
Jim Meyering [Fri, 25 Apr 2008 13:20:19 +0000 (15:20 +0200)]
tests: remove temporary log file upon catchable signal

* check.mk (am__check_pre): Add signal handler to remove $@-t.

16 years agotests: don't source envvar-check manually, test-lib.sh does it
Jim Meyering [Fri, 25 Apr 2008 12:39:38 +0000 (14:39 +0200)]
tests: don't source envvar-check manually, test-lib.sh does it

* tests/cp/abuse: Remove ". $top_srcdir/tests/envvar-check".
* tests/cp/parent-perm: Likewise.
* tests/cp/special-f: Likewise.
* tests/ls/proc-selinux-segfault: Likewise.
* tests/misc/help-version: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/touch/now-owned-by-other: Likewise.
* tests/sample-test: Remove commented out suggestion.

16 years agotests: ensure at least one failure when $built_programs is empty
Jim Meyering [Fri, 25 Apr 2008 08:59:47 +0000 (10:59 +0200)]
tests: ensure at least one failure when $built_programs is empty

Before, this test and others would pass with empty $built_programs.
* tests/misc/help-version: Fail if built_programs is empty.

16 years agotests: improve perl-based tempdir handling
Jim Meyering [Fri, 25 Apr 2008 08:41:42 +0000 (10:41 +0200)]
tests: improve perl-based tempdir handling

Before, upon interrupt, directories would be left behind.
* tests/CuTmpdir.pm: Remove temporary directory on interrupt.

16 years agotests: reorder some tests in the long list
Jim Meyering [Fri, 25 Apr 2008 07:36:54 +0000 (09:36 +0200)]
tests: reorder some tests in the long list

* tests/Makefile.am (TESTS): Move some tests that use sleep
"up" in the list so that they don't delay even a little the
completion of "make check".  Also run a chmod test early.

16 years agotests: put root-only (usually skipped) tests at the end
Jim Meyering [Thu, 24 Apr 2008 10:58:24 +0000 (12:58 +0200)]
tests: put root-only (usually skipped) tests at the end

* tests/Makefile.am (TESTS): Don't list root-only tests explicitly.
Instead, just use $(root_tests).
* tests/check.mk (vc_exe_in_TESTS): Now that root_tests are separate,
parse out the union of $(TESTS) and $(root_tests).

16 years agotests: move another file (expensive) into test-lib.sh
Jim Meyering [Thu, 24 Apr 2008 10:50:24 +0000 (12:50 +0200)]
tests: move another file (expensive) into test-lib.sh

* tests/expensive: Remove file.  Move contents into ...
* tests/test-lib.sh (expensive_): ...here.  New function.
* tests/du/fd-leak: Update caller to use the new function.
* tests/mv/leak-fd: Likewise.
* tests/rm/hash: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove its name.

16 years agotests: cp/perm (usually not run) was failing on systems with SELinux
Jim Meyering [Thu, 24 Apr 2008 10:43:20 +0000 (12:43 +0200)]
tests: cp/perm (usually not run) was failing on systems with SELinux

* tests/cp/perm: Use stat to get the permission string, not ls.
This test was run only when RUN_VERY_EXPENSIVE_TESTS=yes was set
in the environment.  It would fail on SELinux-enable systems
because ls-generated permission strings would not match, e.g.,
"test _-rw-r--r--+ = _-rw-r--r--" would fail.

16 years agotweak HACKING advice
Jim Meyering [Sun, 27 Apr 2008 19:31:08 +0000 (21:31 +0200)]
tweak HACKING advice

16 years agotests: do define built_programs
Jim Meyering [Thu, 24 Apr 2008 10:31:13 +0000 (12:31 +0200)]
tests: do define built_programs

* tests/check.mk (built_programs): Define here, where it's used.
This definition was in now-removed tests/misc/Makefile.am.

16 years agotests: update commented-out examples in sample-test, too
Jim Meyering [Wed, 23 Apr 2008 16:57:38 +0000 (18:57 +0200)]
tests: update commented-out examples in sample-test, too

* tests/sample-test: Use $top_srcdir/tests/SCRIPT_NAME, not
$top_srcdir/../SCRIPT_NAME here, too.

16 years agotests: don't fail in a non-English locale
Ondřej Vašík [Wed, 23 Apr 2008 15:24:10 +0000 (17:24 +0200)]
tests: don't fail in a non-English locale

* tests/chmod/thru-dangling: Source lang-default.
* tests/cp/thru-dangling: Likewise.
* tests/misc/printf-surprise: Likewise.

16 years agotests: remove now-unused Makefile.am
Jim Meyering [Wed, 23 Apr 2008 12:49:20 +0000 (14:49 +0200)]
tests: remove now-unused Makefile.am

* tests/misc/Makefile.am: Remove file.

16 years agoid: do not print SELinux context when invoked with a USERNAME argument
Ondřej Vašík [Wed, 23 Apr 2008 10:38:54 +0000 (12:38 +0200)]
id: do not print SELinux context when invoked with a USERNAME argument

* NEWS: Mention new behaviour.
* src/id.c (main): Do not print SELinux context when user is specified.
* tests/Makefile.am: Add the new test.
* tests/misc/id-context: New file.  Test for the fix.
Problem reported by Ronny Buchmann in http://bugzilla.redhat.com/443485.

16 years agoid: do print the AFS-specific nameless group ID (called a PAG)
Jim Meyering [Wed, 23 Apr 2008 09:45:38 +0000 (11:45 +0200)]
id: do print the AFS-specific nameless group ID (called a PAG)

In 6.11, we mistakenly suppressed the printing of certain group IDs,
thinking they were useless AFS-specific artifacts.
This change reverts that, so now they are printed once again.
http://thread.gmane.org/gmane.org.fsf.announce/867/focus=13345
This also reverts the bug-fix that applied solely to the new code
used to avoid printing those IDs

Revert "id bug fix: don't point to potentially clobbered static storage"
This reverts commit f7d1c59c224f81a8bab5fa2afcaf815988f50467.
Revert "Work around AFS bug: id and groups would print invalid group number."
This reverts commit b7a836c0a3524cda8ef79c30c3fe7ea759ae4656.
Revert "* src/c99-to-c89.diff: Accommodate a C99-ism in id.c."
This reverts commit d44893c5dba4150b4ded9cf6aad316c1ef620c9f.

16 years agobuild: move a project-specific definition to cfg.mk
Jim Meyering [Tue, 22 Apr 2008 19:28:33 +0000 (21:28 +0200)]
build: move a project-specific definition to cfg.mk

* cfg.mk (old_NEWS_hash): Define here, ...
* maint.mk: ... not here.
(update-NEWS-hash): Update comment.
Suggestion from Eric Blake.

16 years agoAccommodate building on OS/2 (www.ecomstation.com Ecs v2 rc4)
Jim Meyering [Tue, 22 Apr 2008 08:52:37 +0000 (10:52 +0200)]
Accommodate building on OS/2 (ecomstation.com Ecs v2 rc4)

* configure.ac: Filter out carriage returns in more places.
Reported by Elbert Pol, details here:
http://thread.gmane.org/gmane.org.fsf.announce/867/focus=13332

16 years agoguard against inserting a NEWS entry into a block for a prior release
Jim Meyering [Tue, 22 Apr 2008 08:45:21 +0000 (10:45 +0200)]
guard against inserting a NEWS entry into a block for a prior release

Without a guard like this, it is far too easy to apply a patch
prepared against a preceding release, and not notice that a NEWS
entry is inserted into the wrong block.
* maint.mk (sc_immutable_NEWS): New rule.
(update-NEWS-hash): New rule to update the hard-coded hash.

16 years agotests: ensure that all exec-$PERL lines are the same
Jim Meyering [Tue, 22 Apr 2008 07:33:25 +0000 (09:33 +0200)]
tests: ensure that all exec-$PERL lines are the same

* maint.mk (sc_perl_coreutils_test): New rule.

16 years agotests: skip (don't fail) rm/one-file-system when mount --bind fails
Jim Meyering [Mon, 21 Apr 2008 12:47:56 +0000 (14:47 +0200)]
tests: skip (don't fail) rm/one-file-system when mount --bind fails

* tests/rm/one-file-system: Reported by Allen Hewes.

16 years agotests: convert umask-check to a function
Jim Meyering [Sun, 20 Apr 2008 21:29:19 +0000 (23:29 +0200)]
tests: convert umask-check to a function

* tests/test-lib.sh (working_umask_or_skip_): New function, from...
* tests/umask-check: ...here.  Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove umask-check.
* tests/mkdir/perm: Use the function rather than sourcing the file.
* tests/cp/cp-parents: Likewise.
* tests/cp/parent-perm: Likewise.
Bruno Haible reported that parent-perm was failing to run umask-check.

16 years agotests: adjust perl -I to use $top_srcdir/tests, not $srcdir/..
Jim Meyering [Fri, 18 Apr 2008 14:51:34 +0000 (16:51 +0200)]
tests: adjust perl -I to use $top_srcdir/tests, not $srcdir/..

16 years agotests: clean up root tests; adapt to new layout
Jim Meyering [Fri, 18 Apr 2008 13:51:18 +0000 (15:51 +0200)]
tests: clean up root tests; adapt to new layout

* tests/Makefile.am (root_tests): New list.
(check-root): Add 'SUBDIRS='.
(root-hint): Point to README.
* Makefile.am (check-root): Add 'SUBDIRS=' here, too.
* maint.mk (sc_root_tests): Adapt rule to new syntax used
in tests/Makefile.am.

16 years agoRevamp test-related Makefiles.
Jim Meyering [Thu, 17 Apr 2008 21:34:45 +0000 (23:34 +0200)]
Revamp test-related Makefiles.

One side-effect of this change is that "make check" now works even if
you put "." early in your shell's search PATH (don't do that!).

Remove all test-related Makefile.am files, except those generated
by mk-script.  Instead, tests/Makefile.am now lists not only the
tests directly under tests/, but also those in tests/*/ that are
not generated by mk-script, e.g., cp/abuse, cp/acl, mv/i-1, etc.

A lot of these changes are like this:

-. $srcdir/../lang-default
+. $top_srcdir/tests/lang-default

-. $srcdir/../test-lib.sh
+. $top_srcdir/tests/test-lib.sh

* configure.ac (AC_CONFIG_FILES): Remove corresponding Makefiles.
* tests/check.mk (vc_exe_in_TESTS): Relax syntax requirements.
* tests/rwx-to-mode: Remove file.  Rewritten as...
* tests/test-lib.sh (rwx_to_mode_): ...this new function.
* tests/Makefile.am (EXTRA_DIST): Remove rwx-to-mode.
(SUBDIRS): Remove each dir with a removed Makefile.am.
(EXTRA_DIST): Add $(TESTS).
(TESTS): Add over 300 entries.

16 years ago* tests/misc/Makefile.am (built_programs): Remove. Unused.
Jim Meyering [Thu, 17 Apr 2008 19:58:53 +0000 (21:58 +0200)]
* tests/misc/Makefile.am (built_programs): Remove.  Unused.

16 years agoUse "env" to invoke potential built-ins.
Jim Meyering [Sun, 20 Apr 2008 21:18:48 +0000 (23:18 +0200)]
Use "env" to invoke potential built-ins.

* tests/misc/pwd-unreadable-parent: Invoke pwd via "env -- pwd",
rather than via an absolute name.
* tests/touch/not-owner: Likewise for test.
* tests/chmod/setgid: Likewise.

16 years ago* .prev-version: Record previous version: 6.11.
Jim Meyering [Sat, 19 Apr 2008 15:20:00 +0000 (17:20 +0200)]
* .prev-version: Record previous version: 6.11.

16 years agoVersion 6.11. v6.11
Jim Meyering [Sat, 19 Apr 2008 14:09:36 +0000 (16:09 +0200)]
Version 6.11.

* NEWS: Record release date.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years ago* maint.mk (writable-files): Fix syntax error.
Jim Meyering [Sat, 19 Apr 2008 14:47:26 +0000 (16:47 +0200)]
* maint.mk (writable-files): Fix syntax error.

16 years ago* doc/.gitignore: Add texinfo-related outputs.
Jim Meyering [Sat, 19 Apr 2008 13:23:40 +0000 (15:23 +0200)]
* doc/.gitignore: Add texinfo-related outputs.

16 years ago* THANKS: Update my address, correct encoding for a name.
Sven Joachim [Sat, 19 Apr 2008 11:46:52 +0000 (13:46 +0200)]
* THANKS: Update my address, correct encoding for a name.

16 years agopr -e, with a mix of backspaces and TABs, could corrupt the heap
Jim Meyering [Sat, 19 Apr 2008 10:48:10 +0000 (12:48 +0200)]
pr -e, with a mix of backspaces and TABs, could corrupt the heap

* tests/pr/Test.pm: New tests for the above.
* src/pr.c (char_to_clump): Ensure that "input_position" never
goes below 0.
Also, elide any backspace encountered when input_position is 0,
to be compatible at least with /bin/pr from Solaris 10.
This bug is present in the original version:
b25038ce9a234ea0906ddcbd8a0012e917e6c661
* NEWS [Bug fixes]: Mention this.
Report and diagnosis by Cristian Cadar, Daniel Dunbar and Dawson Engler
in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13272

16 years ago* src/dircolors.hin: Add .flv. Move .svgz to "image formats".
Mike Frysinger [Sat, 19 Apr 2008 06:51:30 +0000 (08:51 +0200)]
* src/dircolors.hin: Add .flv.  Move .svgz to "image formats".

16 years agomd5sum -c: ignore a line with a NUL byte among checksum hex digits
Jim Meyering [Fri, 18 Apr 2008 21:42:40 +0000 (23:42 +0200)]
md5sum -c: ignore a line with a NUL byte among checksum hex digits

* src/md5sum.c (hex_digits): Require that all "digest_hex_bytes"
be hexadecimal digits, not just those before the first NUL byte.
This bug dates back to the original version:
3763a4f24eb21be40674d13ff7b04e078f473e85
* tests/misc/md5sum (nul-in-cksum): Test for the above.
* NEWS [Bug fixes]: Mention this.
Prompted by a report from Flóki Pálsson in
http://bugzilla.redhat.com/439531

16 years agotests: accommodate built-in mknod more cleanly still
Matthew Woehlke [Wed, 16 Apr 2008 17:15:05 +0000 (19:15 +0200)]
tests: accommodate built-in mknod more cleanly still

* tests/mkdir/selinux: Use "env" rather than "nice".

16 years agotests: accommodate built-in mknod more cleanly
Jim Meyering [Wed, 16 Apr 2008 13:28:33 +0000 (15:28 +0200)]
tests: accommodate built-in mknod more cleanly

* tests/mkdir/selinux: Undo most of previous change,
bc22dbbf844f31ddaf2e68b167d0128a985d73ab, and instead
invoke the command via "nice".  Using "exec" should be
enough, but isn't with OpenBSD's PD KSH v5.2.14 99/07/13.2.
Eric Blake suggested using nice.

16 years agomknod --help: note that this command may be a shell built-in
Jim Meyering [Wed, 16 Apr 2008 12:21:40 +0000 (14:21 +0200)]
mknod --help: note that this command may be a shell built-in

* src/mknod.c (usage): Print USAGE_BUILTIN_WARNING.
Suggestion from Eric Blake.

16 years agoavoid "may be used uninitialized" warning from newer gcc
Jim Meyering [Wed, 16 Apr 2008 09:20:28 +0000 (11:20 +0200)]
avoid "may be used uninitialized" warning from newer gcc

* src/md5sum.c (digest_check) [lint]: Initialize local, "filename".

16 years agotests: add a comment explaining the potential failure
Jim Meyering [Wed, 16 Apr 2008 09:17:37 +0000 (11:17 +0200)]
tests: add a comment explaining the potential failure

16 years agotests: avoid mkdir/selinux failure when mknod is a shell built-in
Jim Meyering [Wed, 16 Apr 2008 08:29:10 +0000 (10:29 +0200)]
tests: avoid mkdir/selinux failure when mknod is a shell built-in

* tests/mkdir/selinux: Skip the mknod test if it's a built-in.

16 years agomd5sum, sha1sum, etc: handle invalid input (i.e., don't segfault)
Jim Meyering [Tue, 15 Apr 2008 06:19:11 +0000 (08:19 +0200)]
md5sum, sha1sum, etc: handle invalid input (i.e., don't segfault)

* src/md5sum.c (bsd_split_3): Return right away if s_len == 0.
* tests/misc/md5sum (bsd-segv): New test for the above.
* tests/misc/sha1sum (bsd-segv): Likewise.
* NEWS: Mention the bug fix.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.

16 years agotests: don't fail on systems without a "stat" syscall
Jim Meyering [Mon, 14 Apr 2008 21:33:43 +0000 (23:33 +0200)]
tests: don't fail on systems without a "stat" syscall

* tests/test-lib.sh (require_strace_): Add a syscall parameter.
* tests/ls/stat-free-symlinks: Update caller.
* tests/mv/atomic: Likewise.
* tests/mv/atomic2: Likewise.
Reported by Mike Frysinger in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13222

16 years agotests: accommodate a different errno string on Irix 6.5
Jim Meyering [Mon, 14 Apr 2008 20:17:23 +0000 (22:17 +0200)]
tests: accommodate a different errno string on Irix 6.5

* tests/mkdir/selinux: Also handle "Not supported".
Reported by Peter Fales.

16 years agoseq: work around floating point inaccuracies on more systems
Jim Meyering [Mon, 14 Apr 2008 09:21:26 +0000 (11:21 +0200)]
seq: work around floating point inaccuracies on more systems

* src/seq.c: Include <math.h> for fabs.
Include <float.h> for DBL_EPSILON.
(abs_rel_diff): New function.
(print_numbers): Use abs_rel_diff rather than a strict equality test.
Without this change, Solaris 8 and Irix 6.2 would fail the float-6
test.  Reported by Peter Fales in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13183
* src/c99-to-c89.diff: Adjust seq.c offsets.

16 years agodoc: fix typo
Jim Meyering [Mon, 14 Apr 2008 07:02:20 +0000 (09:02 +0200)]
doc: fix typo

* coreutils.texi (sort invocation): s/Whitespace/White space/

16 years agotests: Accommodate a different errno value on OSF/1 4.0F.
Jim Meyering [Sat, 12 Apr 2008 11:14:29 +0000 (13:14 +0200)]
tests: Accommodate a different errno value on OSF/1 4.0F.

* tests/mkdir/selinux: Also handle "Function not implemented".

16 years agoAvoid link failure when using mkstemp replacement.
Jim Meyering [Sat, 12 Apr 2008 10:43:24 +0000 (12:43 +0200)]
Avoid link failure when using mkstemp replacement.

* src/Makefile.am (tac_LDADD): Add $(LIB_CLOCK_GETTIME).
This is necessary at least on a DEC Alpha OSF/1 4.0F.

16 years agotests: always enable VERBOSE output, now that test framework works better
Jim Meyering [Sat, 12 Apr 2008 07:52:42 +0000 (09:52 +0200)]
tests: always enable VERBOSE output, now that test framework works better

* cfg.mk: Set VERBOSE=yes.
* tests/check.mk: Likewise.

16 years agodoc: avoid "make pdf" failure (due to texi2dvi bug?)
Jim Meyering [Fri, 11 Apr 2008 10:11:06 +0000 (12:11 +0200)]
doc: avoid "make pdf" failure (due to texi2dvi bug?)

* doc/coreutils.texi (filesZeroFromOption):
Comment out @cindex-in-@macro use.

16 years agodoc: use a valid texinfo macro name
Jim Meyering [Fri, 11 Apr 2008 10:08:41 +0000 (12:08 +0200)]
doc: use a valid texinfo macro name

* doc/coreutils.texi (filesZeroFromOption): s/0/Zero/

16 years agotests: accommodate a different errno value on HPUX-10.20
Jim Meyering [Tue, 8 Apr 2008 06:01:00 +0000 (08:01 +0200)]
tests: accommodate a different errno value on HPUX-10.20

* tests/mkdir/selinux: Also handle "Unknown system error".
Reported by Peter Fales.

16 years agodoc: factor out --files0-from duplication
Jim Meyering [Sun, 6 Apr 2008 20:10:18 +0000 (22:10 +0200)]
doc: factor out --files0-from duplication

* coreutils.texi (wc invocation) [files0fromOption]: New macro.  Use it.
(du invocation): Use it here, too.

16 years ago* src/c99-to-c89.diff: Adjust remove.c diffs.
Jim Meyering [Sun, 6 Apr 2008 17:02:02 +0000 (19:02 +0200)]
* src/c99-to-c89.diff: Adjust remove.c diffs.

16 years agoremove.c: accommodate systems with negative errno values
Jim Meyering [Mon, 24 Mar 2008 16:38:27 +0000 (17:38 +0100)]
remove.c: accommodate systems with negative errno values

This is required at least on Haiku and BeOS.
* src/remove.c (write_protected_non_symlink): Return 1 for a write-
protected non-symlink, 0 if we determine it's not, and -1 upon
error (setting errno accordingly only in this final case).
(prompt): Deal with the changed semantics of the above function.
Based on this patch from Axel Dörfler:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13071

16 years agoAccommodate building on OS/2 (www.ecomstation.com Ecs v2 rc4)
Jim Meyering [Wed, 2 Apr 2008 07:03:36 +0000 (09:03 +0200)]
Accommodate building on OS/2 (ecomstation.com Ecs v2 rc4)

* configure.in: Also filter out carriage returns from the value
of $no_install_progs_default.  Reported by Elbert Pol.

16 years ago"touch E; mkfifo F; cp -fR F E" no longer fails due to existing E
Jim Meyering [Wed, 2 Apr 2008 13:07:20 +0000 (15:07 +0200)]
"touch E; mkfifo F; cp -fR F E" no longer fails due to existing E

* src/copy.c (copy_internal): Revert change of 2005-03-01,
4303f0454592421eea48be87777d32a49e1d5e5b
Prompted by Michael Stone, who pointed me to an old bug report from
Ian Jackson: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/7504
* tests/cp/special-f: New file.  Test for the above.
* tests/cp/Makefile.am (TESTS): Add special-f.
* NEWS: mention this bug fix.

16 years agocopy.c: remove an in-function #ifdef
Jim Meyering [Wed, 2 Apr 2008 11:52:04 +0000 (13:52 +0200)]
copy.c: remove an in-function #ifdef

* src/copy.c (rpl_mkfifo) [! HAVE_MKFIFO]: New function.
(mkfifo) [! HAVE_MKFIFO]: Define to rpl_mkfifo.
(copy_internal): Remove #ifdef.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoHACKING: rename README-contribution-guidelines
Jim Meyering [Wed, 2 Apr 2008 07:05:18 +0000 (09:05 +0200)]
HACKING: rename README-contribution-guidelines

README-contribution-guidelines: Rename to ..
HACKING: ...this.

16 years agobootstrap: remove dangling *.[ch] symlinks from lib
Jim Meyering [Tue, 1 Apr 2008 19:18:56 +0000 (21:18 +0200)]
bootstrap: remove dangling *.[ch] symlinks from lib

* bootstrap [dangling symlink removal]: Match *.[ch] files, too.
Suggestion from Eric Blake.

16 years agobootstrap: make find's -depth option be the first.
Jim Meyering [Tue, 1 Apr 2008 15:12:12 +0000 (17:12 +0200)]
bootstrap: make find's -depth option be the first.

* bootstrap [dangling symlink removal]: Move find's -depth
option to precede all others, to avoid a warning.

16 years ago* bootstrap: Remove dangling symlinks from lib (aka $source_base), too.
Jim Meyering [Tue, 1 Apr 2008 15:05:31 +0000 (17:05 +0200)]
* bootstrap: Remove dangling symlinks from lib (aka $source_base), too.

16 years agoAvoid root-only SELinux-related test failures w/o mcstransd.
Jim Meyering [Tue, 1 Apr 2008 14:34:08 +0000 (16:34 +0200)]
Avoid root-only SELinux-related test failures w/o mcstransd.

When mcstransd is not running (i.e., after service mcstrans stop),
"make check" as root would provoke two test failures.
* tests/cp/cp-a-selinux: Use the context, root:object_r:tmp_t:s0,
that works both with and without mcstransd.
Thanks to Eric Paris for the tip and to Ondřej Vašík for alerting
me to the problem.
Reported by Robert Scheck in <http://bugzilla.redhat.com/436717>.

16 years agoroot tests: Set NON_ROOT_USERNAME if not set already.
Jim Meyering [Tue, 1 Apr 2008 14:13:02 +0000 (16:13 +0200)]
root tests: Set NON_ROOT_USERNAME if not set already.

* tests/test-lib.sh (require_root_): This avoids failure of a
couple of root-only tests that require a value for that envvar.

16 years agotexinfo formatting tweaks
Jim Meyering [Tue, 1 Apr 2008 09:58:17 +0000 (11:58 +0200)]
texinfo formatting tweaks

* coreutils.texi: Avoid some overfull hbox warnings.
(Treating / specially): Use @file{/} rather than a bare /.

16 years agoprintf doc: xref print(3) and libc's "Output Conversion Syntax" node
Jim Meyering [Tue, 1 Apr 2008 09:38:02 +0000 (11:38 +0200)]
printf doc: xref print(3) and libc's "Output Conversion Syntax" node

* coreutils.texi (printf invocation): Add xref.
Use "The GNU C Library Reference Manual" as the name of the 'libc'
document consistently.
* man/printf.x: Add See also: printf(3).
Suggested by A. Costa in http://bugs.debian.org/465522

16 years agoEmit "#line 1" right after the two 'read-only/GENERATED' lines.
Jim Meyering [Mon, 31 Mar 2008 20:42:35 +0000 (22:42 +0200)]
Emit "#line 1" right after the two 'read-only/GENERATED' lines.

* bootstrap (cp_mark_as_generated): This preserves line numbering
e.g., in assertions, which is important when correlating between
coreutils test failures and the original files in gnulib/tests.
Suggested by Eric Blake.

16 years ago* README-contribution-guidelines: Mention how to amend a commit.
Jim Meyering [Mon, 31 Mar 2008 15:28:23 +0000 (17:28 +0200)]
* README-contribution-guidelines: Mention how to amend a commit.

Suggestion from Pádraig Brady.

16 years agoBegin documenting contribution guidelines.
Jim Meyering [Mon, 17 Mar 2008 21:24:46 +0000 (22:24 +0100)]
Begin documenting contribution guidelines.

* README-contribution-guidelines: New file.  For now, not distributed.

16 years ago"rm -r DIR" would mistakenly prompt about very long names
Jim Meyering [Mon, 31 Mar 2008 11:40:54 +0000 (13:40 +0200)]
"rm -r DIR" would mistakenly prompt about very long names

* src/remove.c (write_protected_non_symlink): Return 0(-1) when
euidaccess_stat pronounces a writable(not-writable) file, not -1(0).
* tests/rm/deep-2: New file.  Test for the above-fixed bug.
* tests/rm/Makefile.am (TESTS): Add deep-2.
Discovered while reviewing this change:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13071

16 years ago* NEWS: Note the dd bug fix. The bug was introduced over 8 years ago:
Jim Meyering [Mon, 31 Mar 2008 07:11:15 +0000 (09:11 +0200)]
* NEWS: Note the dd bug fix.  The bug was introduced over 8 years ago:

9fca49f67c16c8b42c32e185808fe187cedb0fa7

16 years agodd bug fix: accept e.g., if=/dev/stdin and of=/dev/stdout
Paul Eggert [Mon, 31 Mar 2008 06:37:36 +0000 (08:37 +0200)]
dd bug fix: accept e.g., if=/dev/stdin and of=/dev/stdout

* lib/fd-reopen.c: Work even if FILE is "/dev/stdin".
Problem reported by Geoffrey Lee in <http://bugs.debian.org/290727>.
* tests/dd/misc: Check for this bug.

16 years agoavoid failure of new test on kernel without SELinux support
Jim Meyering [Sat, 29 Mar 2008 18:02:18 +0000 (19:02 +0100)]
avoid failure of new test on kernel without SELinux support

* tests/mkdir/selinux: Also accept ENOENT.
Reported by Sven Joachim.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agotests: accept ENOTSUP message as well as the EINVAL one
Jim Meyering [Sat, 29 Mar 2008 09:00:44 +0000 (10:00 +0100)]
tests: accept ENOTSUP message as well as the EINVAL one

This test would fail on most non-Linux systems because the original
expected an "Invalid argument" diagnostic, yet they all produced
"Operation not supported".
* tests/mkdir/selinux: Accept both strings.  Factor out duplication.

16 years agoWork around a recent glibc/getopt.c diagnostic change.
Jim Meyering [Fri, 28 Mar 2008 23:11:15 +0000 (00:11 +0100)]
Work around a recent glibc/getopt.c diagnostic change.

* tests/misc/factor: Map new "-- '1'" to expected "-- 1".

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agomknod, mkfifo: don't segfault when diagnosing invalid SELinux context
Jim Meyering [Fri, 28 Mar 2008 21:37:19 +0000 (22:37 +0100)]
mknod, mkfifo: don't segfault when diagnosing invalid SELinux context

Identical to the bug fixed by 72d052896a9092b811961a8f3e6ca5d151a59be5.
* src/mkfifo.c (main): Use "scontext", not NULL optarg in diagnostic.
* src/mknod.c (main): Likewise.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/mkdir/selinux: Test for the above fixes.
* NEWS: Mention the fixes.

16 years agoFix typo in old NEWS and ChangeLog: s/commmand/command/.
Jim Meyering [Fri, 28 Mar 2008 19:16:26 +0000 (20:16 +0100)]
Fix typo in old NEWS and ChangeLog: s/commmand/command/.

* ChangeLog-2007: Likewise.
* NEWS: Likewise.
Prompted by http://bugzilla.redhat.com/439410

16 years agotests: Factor out code that's going to be reused.
Pádraig Brady [Fri, 28 Mar 2008 13:32:44 +0000 (14:32 +0100)]
tests: Factor out code that's going to be reused.

* tests/test-lib.sh (mkfifo_or_skip_): New function, factored out of...
* tests/touch/fifo: ...here.

16 years agoRequire that "(exit $fail); exit $fail" be last line of each test.
Jim Meyering [Fri, 28 Mar 2008 13:14:04 +0000 (14:14 +0100)]
Require that "(exit $fail); exit $fail" be last line of each test.

* maint.mk (sc_require_test_exit_idiom): New rule to enforce policy.
* tests/cp/acl: Adhere to the new policy.
* tests/cp/preserve-gid: Likewise.
* tests/dd/misc:
* tests/install/create-leading:
* tests/ln/sf-1:
* tests/ls/symlink-slash:
* tests/misc/help-version:
* tests/misc/ls-time:
* tests/misc/nice:
* tests/misc/shred-remove:
* tests/misc/stty:
* tests/misc/stty-row-col:
* tests/mkdir/p-1:
* tests/mkdir/p-2:
* tests/mkdir/p-3:
* tests/mkdir/p-v:
* tests/mkdir/special-1:
* tests/mkdir/writable-under-readonly:
* tests/mv/acl:
* tests/mv/backup-is-src:
* tests/mv/diag:
* tests/mv/dir-file:
* tests/mv/force:
* tests/mv/hard-link-1:
* tests/mv/i-2:
* tests/mv/i-4:
* tests/mv/into-self:
* tests/mv/into-self-2:
* tests/mv/into-self-3:
* tests/mv/partition-perm:
* tests/mv/to-symlink:
* tests/rmdir/ignore:
* tests/tail-2/assert:
* tests/tail-2/assert-2:
* tests/touch/dangling-symlink:
* tests/touch/dir-1:
* tests/touch/empty-file:
* tests/touch/fifo:
* tests/touch/no-rights: Likewise.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoPerform explicit exit-nonzero if the embedded Perl script fails.
Jim Meyering [Fri, 28 Mar 2008 11:30:26 +0000 (12:30 +0100)]
Perform explicit exit-nonzero if the embedded Perl script fails.

* tests/misc/pwd-long: Add canonical '(exit $fail); exit $fail'.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agopaste -d\\: avoid heap overrun for backslash at end of delim list
Jim Meyering [Thu, 27 Mar 2008 11:18:25 +0000 (12:18 +0100)]
paste -d\\: avoid heap overrun for backslash at end of delim list

* src/paste.c: Include "quotearg.h".
(collapse_escapes): Handle backslash-escaped backslash explicitly.
Handle unescaped backslash at end of string by returning nonzero,
rather than by overrunning memory.
(main): Diagnose an invalid delimiter list -- carefully.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/misc/paste-no-nl (delim-bs): Add a test to demonstrate the
heap-smashing capability.
(delim-bs2): Prior to coreutils-5.1.2, this bug was a little harder
to demonstrate: it would corrupt a first-argument containing e.g., \b
* NEWS: Mention the bug fix.
* tests/misc/Makefile.am (TESTS): Reflect renaming.
* tests/misc/paste: Rename from paste-no-nl.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years ago* src/join.c (keycmp): Document new parameters.
Jim Meyering [Wed, 26 Mar 2008 00:17:15 +0000 (01:17 +0100)]
* src/join.c (keycmp): Document new parameters.

16 years agoTest for mkdir bug fix.
Jim Meyering [Wed, 26 Mar 2008 00:11:16 +0000 (01:11 +0100)]
Test for mkdir bug fix.

* tests/mkdir/selinux: New file: test for today's fix.
* tests/mkdir/Makefile.am (TESTS): Add selinux.

16 years agomkdir -Z x d: don't segfault when diagnosing invalid context "x" (tiny change)
Daniel Dunbar [Tue, 25 Mar 2008 23:51:47 +0000 (00:51 +0100)]
mkdir -Z x d: don't segfault when diagnosing invalid context "x" (tiny change)

* src/mkdir.c (main): Use "scontext", not NULL optarg in diagnostic.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* NEWS: Mention the bug fix.

16 years agoid bug fix: don't point to potentially clobbered static storage
Peter Fales [Tue, 25 Mar 2008 21:44:01 +0000 (22:44 +0100)]
id bug fix: don't point to potentially clobbered static storage

On at least Mac OS, when calling getpwuid twice with the same UID,
the static storage containing results from the first call is
invalidated by the second call.
* src/id.c (main): Point to a copy of the user name string.

16 years agoUse new gnulib gnumakefile module.
Eric Blake [Mon, 24 Mar 2008 11:51:10 +0000 (05:51 -0600)]
Use new gnulib gnumakefile module.

* bootstrap.conf (gnulib_modules): Pull in new module.
* GNUmakefile: Remove from version control.
* .gitignore: Update.
* configure.ac (AC_CONFIG_LINKS): Delete; rely on gnulib to do
this now.
* Makefile.am (EXTRA_DIST, distclean-local): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
16 years agojoin bug fix: adapt keycmp to work with new order-checking feature
Jim Meyering [Sun, 23 Mar 2008 11:31:07 +0000 (12:31 +0100)]
join bug fix: adapt keycmp to work with new order-checking feature

* src/join.c (keycmp): Add two join-field parameters.
(check_order, join): Update callers.
Reported by Dmitry V. Levin in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12731/focus=13017
* tests/join/Test.pm (chkodr-7): New test for this fix.

16 years agojoin.c: syntax/style tweaks
Jim Meyering [Sun, 23 Mar 2008 09:37:21 +0000 (10:37 +0100)]
join.c: syntax/style tweaks

* src/join.c (check_order): Rename from checkorder.
Move definition to precede first use and remove prototype.
Use EXIT_FAILURE, rather than "1".
(key_cmp): Move definition to precede first use.

16 years agoportability: work around a "busybox sed" limitation
Jim Meyering [Sat, 22 Mar 2008 17:33:15 +0000 (18:33 +0100)]
portability: work around a "busybox sed" limitation

* configure.ac: While every other sed tested supports usage like
'/\(re\)/{s//\1/;...<NEWLINE>}', and POSIX appears to requires this,
busybox's sed does not support it.  So duplicate the regexp:
'/\(re\)/{s/\(re\)/\1/;...<NEWLINE>}'.  Reported by Vincent Lefevre:
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13013>.

16 years ago* src/c99-to-c89.diff: Adjust seq.c offsets.
Jim Meyering [Fri, 21 Mar 2008 19:58:01 +0000 (20:58 +0100)]
* src/c99-to-c89.diff: Adjust seq.c offsets.