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

16 years agoptx: avoid heap overrun for backslash at end of optarg string
Jim Meyering [Fri, 21 Mar 2008 09:37:26 +0000 (10:37 +0100)]
ptx: avoid heap overrun for backslash at end of optarg string

* src/ptx.c (copy_unescaped_string): Ignore a lone backslash
at end of string.  Reported by Cristian Cadar, Daniel Dunbar
and Dawson Engler.  Details here:
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13005>.
* tests/misc/Makefile.am (TESTS): Add ptx-overrun.
* tests/misc/ptx-overrun: New file.  Test for the above fix.
* NEWS: Mention the fix.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoptx.c readability
Jim Meyering [Fri, 21 Mar 2008 08:41:54 +0000 (09:41 +0100)]
ptx.c readability

* src/ptx.c (copy_unescaped_string): Add braces around 80+-line
single-stmt while-loop body.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoWrite NEWS and update c99-to-c89 patch for today's rm improvement.
Jim Meyering [Fri, 21 Mar 2008 13:15:54 +0000 (14:15 +0100)]
Write NEWS and update c99-to-c89 patch for today's rm improvement.

* NEWS: call this a "portability improvement" ;-)
* src/c99-to-c89.diff: Adjust remove.c offsets.

16 years agoremove.c: Accommodate systems with negative errno values.
Ingo Weinhold [Fri, 21 Mar 2008 13:10:27 +0000 (14:10 +0100)]
remove.c: Accommodate systems with negative errno values.

* src/remove.c (cache_fstatat): Store errno value directly in
the st_ino field, rather than trying to shoehorn it into st_size.
This is required at least on BeOS and Haiku.

16 years ago* src/seq.c (long_double_format): Add a comment.
Jim Meyering [Sun, 2 Mar 2008 09:14:18 +0000 (10:14 +0100)]
* src/seq.c (long_double_format): Add a comment.

16 years ago* GNUmakefile: Update from gnulib.
Jim Meyering [Thu, 20 Mar 2008 23:33:26 +0000 (00:33 +0100)]
* GNUmakefile: Update from gnulib.

16 years agoRemove today's automake kludge, altogether. Fix properly.
Jim Meyering [Thu, 20 Mar 2008 18:03:51 +0000 (19:03 +0100)]
Remove today's automake kludge, altogether.  Fix properly.

* man/Makefile.am: Use dist_man1_MANS instead of dist_man_MANS.
Suggestion from Ralf Wildenhues.

16 years agoAdd a check to detect this problem, in case it reappears.
Jim Meyering [Thu, 20 Mar 2008 17:43:03 +0000 (18:43 +0100)]
Add a check to detect this problem, in case it reappears.

* maint.mk (my-distcheck): Run "make install", and then ensure
that ls.1 is installed.

16 years agoKludge to make automake generate install-man rules
Jim Meyering [Thu, 20 Mar 2008 17:01:35 +0000 (18:01 +0100)]
Kludge to make automake generate install-man rules

* man/Makefile.am (dist_man_MANS): Add a literal, rm.1.
Without this, "make install" would not install man pages.
However, with this kludge, the rm.1 man page is installed
even when you configure with --enable-no-install-program=rm.

16 years agoRevert recent man/Makefile.am change.
Jim Meyering [Thu, 20 Mar 2008 16:49:30 +0000 (17:49 +0100)]
Revert recent man/Makefile.am change.

Revert 4b544e447eb78fd1f031a026a499f6aed177808a.
* man/Makefile.am: That change was only a band-aid.  It solved
the stated problem, but not a deeper one: that "make install"
would no longer man pages.  Reported by Dmitry V. Levin.
The latter problem arose in
167b8025aca487de001da2448c1aebc2747bc1d3 with the removal of
the sole literal from the definition of dist_man_MANS.  When
automake perceives dist_man_MANS as empty, it no longer emits
the install-man* rules.

16 years agoSync GNUmakefile with gnulib.
Eric Blake [Thu, 20 Mar 2008 13:19:56 +0000 (07:19 -0600)]
Sync GNUmakefile with gnulib.

* GNUmakefile (Makefile.cfg): Rename...
(cfg.mk): ...to this, and make optional.
(GNUmakefile.cfg): Delete, redundant with cfg.mk.
(Makefile.maint): Rename...
(maint.mk): ...to this.
(all) [!_have-Makefile]: Rename...
(abort-due-to-no-makefile): ...to this, and invoke via
.DEFAULT_GOAL to pick up all targets.
* Makefile.cfg: Rename...
* cfg.mk: ...to this.
* Makefile.maint: Rename...
* maint.mk ...to this.
(ME): Reflect rename.
(makefile-check, m4-check, author_mark_check, msg): Use $(ME)
rather than hard-coded name.
* Makefile.am (EXTRA_DIST): Distribute renamed files.
* .x-sc_file_system: Remove Makefile.maint along with others. No longer needed.
* .x-sc_obsolete_symbols: Likewise.
* .x-sc_prohibit_atoi_atof: Reflect renaming and remove no-longer-VC'd names.
* TODO: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
16 years agomake check: Remove /tmp/ls-creating debug code.
Bob Proulx [Wed, 19 Mar 2008 21:51:26 +0000 (15:51 -0600)]
make check: Remove /tmp/ls-creating debug code.

* tests/misc/ls-misc: Remove debug code creating /tmp/ls.

16 years agobootstrap: restore kludge removed on 2008-03-12: it's still necessary.
Jim Meyering [Wed, 19 Mar 2008 22:32:21 +0000 (23:32 +0100)]
bootstrap: restore kludge removed on 2008-03-12: it's still necessary.

* bootstrap: Make the gnulib-tests/test-*.sh scripts executable.
This restores code removed by dec8bb25bb6da2fe9fe6dd63c0fbbd593a0e94cb.
Reported by Bob Proulx.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoCheck for -- and remove -- some unnecessarily included header files.
Jim Meyering [Wed, 19 Mar 2008 14:52:26 +0000 (15:52 +0100)]
Check for -- and remove -- some unnecessarily included header files.

* Makefile.maint: Add checks for a handful of additional header files.
* src/mktemp.c: Don't include "long-options.h".  Not used.
* src/pr.c: Don't include "inttostr.h".  Not used.
* src/printenv.c: Don't include "error.h".  Not used.
* src/test.c: Don't include "error.h".  Not used.
* src/touch.c: Don't include "safe-read.h".  Not used.

16 years agoRemove more vestiges of CVS.
Jim Meyering [Wed, 19 Mar 2008 13:29:50 +0000 (14:29 +0100)]
Remove more vestiges of CVS.

* Makefile.maint (VC_LIST): Rename from CVS_LIST.
(VC_LIST_EXCEPT): Rename from CVS_LIST_EXCEPT.

16 years agomv: never unlink a destination file before calling rename
Jim Meyering [Wed, 19 Mar 2008 12:37:04 +0000 (13:37 +0100)]
mv: never unlink a destination file before calling rename

While cp --preserve=links must unlink certain destination files,
mv must never do that.
* src/copy.c (copy_internal): Pull the '! x->move_mode' test "up",
so it affects the entire condition, and not just DEREF_NEVER mode.
Reported by James Ralston in <http://bugzilla.redhat.com/438076>.
* tests/mv/atomic2: New file.  Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add atomic2.
* NEWS: Mention the bug-fix.
[Bug introduced in 367719ba5f1dbd5e2f7fa2466c441f23f66a7c9e]

16 years ago"make" would not always update man/*.1 files (but "make dist" would)
Jim Meyering [Wed, 19 Mar 2008 07:46:41 +0000 (08:46 +0100)]
"make" would not always update man/*.1 files (but "make dist" would)

* man/Makefile.am (BUILT_SOURCES): Define, so that "make" always
updates man/*.1 files.  Reported by Bob Proulx.

16 years agosyntax-check: Make the space-before-open-paren optional.
Jim Meyering [Tue, 18 Mar 2008 22:51:58 +0000 (23:51 +0100)]
syntax-check: Make the space-before-open-paren optional.

* Makefile.maint (sc_prohibit_assert_without_use): Match also
when there is no space before the opening parenthesis.
(sc_prohibit_getopt_without_use): Likewise.
(sc_prohibit_quotearg_without_use): Likewise.
(sc_prohibit_quote_without_use): Likewise.

16 years ago* Makefile.maint (sc_no_have_config_h): Use a more precise regexp.
Jim Meyering [Tue, 18 Mar 2008 22:44:53 +0000 (23:44 +0100)]
* Makefile.maint (sc_no_have_config_h): Use a more precise regexp.

16 years ago* Makefile.maint (CVS): Remove now-unused definition.
Jim Meyering [Tue, 18 Mar 2008 22:40:41 +0000 (23:40 +0100)]
* Makefile.maint (CVS): Remove now-unused definition.

16 years agoFactor out duplication in sc_prohibit_*_without_use rules.
Jim Meyering [Tue, 18 Mar 2008 20:32:03 +0000 (21:32 +0100)]
Factor out duplication in sc_prohibit_*_without_use rules.

* Makefile.maint (_header_without_use): New "command",
factored out of four sc_prohibit_HEADER_without_use rules.
(sc_prohibit_assert_without_use): Rewrite using $(_header_without_use).
(sc_prohibit_getopt_without_use): Likewise.
(sc_prohibit_quotearg_without_use): Likewise.
(sc_prohibit_quote_without_use): Likewise.

16 years agoCorrect typo in "make syntax-check" diagnostic.
Dmitry V. Levin [Tue, 18 Mar 2008 19:32:03 +0000 (20:32 +0100)]
Correct typo in "make syntax-check" diagnostic.

* Makefile.maint (sc_prohibit_getopt_without_use): s/assert.h/getopt.h/

16 years agoProhibit inclusion of getopt.h without use.
Jim Meyering [Sat, 15 Mar 2008 16:53:00 +0000 (17:53 +0100)]
Prohibit inclusion of getopt.h without use.

* Makefile.maint (sc_prohibit_getopt_without_use): New rule.

16 years agoInclude <getopt.h> only if used.
Jim Meyering [Sat, 15 Mar 2008 16:50:58 +0000 (17:50 +0100)]
Include <getopt.h> only if used.

* src/group-list.c: Don't include <getopt.h>.
* src/printf.c: Likewise.

16 years agosha512_process_bytes: fix a bug in processing a buffer where length&64 != 0
J. Scott Edwards [Sat, 15 Mar 2008 11:25:08 +0000 (12:25 +0100)]
sha512_process_bytes: fix a bug in processing a buffer where length&64 != 0

* gl/lib/sha512.c (sha512_process_bytes): s/63/127/.

16 years agoGeneralize GNUmakefile, ...
Jim Meyering [Wed, 12 Mar 2008 11:34:05 +0000 (12:34 +0100)]
Generalize GNUmakefile, ...

...so that it can be used unmodified by autoconf.
* GNUmakefile: Include optional file, GNUmakefile.cfg.
Autoconf will use this to override _autoreconf and to export PATH.
(_autoreconf): Define.
(_dummy): cd to $(srcdir) before removing autom4te.cache.

16 years ago* bootstrap: Sync from gnulib and remove part of a local kludge.
Jim Meyering [Wed, 12 Mar 2008 10:47:53 +0000 (11:47 +0100)]
* bootstrap: Sync from gnulib and remove part of a local kludge.

16 years agoinstall, rmdir: write --verbose output to stdout, not to stderr.
Ondřej Vašík [Mon, 10 Mar 2008 16:03:41 +0000 (17:03 +0100)]
install, rmdir: write --verbose output to stdout, not to stderr.

* src/install.c (announce_mkdir): Write verbose output to stdout,
not to stderr.
* src/mkdir.c (announce mkdir): Use prog_fprintf for verbose output.
* src/prog-fprintf.c (prog_fprintf): New function and file.
* src/prog-fprintf.h: New file.
* src/rmdir.c (main): Write verbose output to stdout, not to stderr.
Quote directory name in a diagnostic.
* src/rmdir.c (remove_parents): Write verbose output to stdout,
not to stderr.
* doc/coreutils.texi: Mention that shred verbose output is to stderr.
* NEWS: Mention the changes.

Signed-off-by: Ondřej Vašík <ovasik@redhat.com>
16 years agomake syntax-check: also check src/*.h files for extern functions,
Jim Meyering [Mon, 10 Mar 2008 18:23:05 +0000 (19:23 +0100)]
make syntax-check: also check src/*.h files for extern functions,

* src/Makefile.am (sc_tight_scope): ... now that there is one.

16 years agodd: avoid unnecessary, but harmless close_stdout call.
Jim Meyering [Fri, 7 Mar 2008 11:21:37 +0000 (12:21 +0100)]
dd: avoid unnecessary, but harmless close_stdout call.

* src/dd.c (close_stdout_required): New global.
(maybe_close_stdout): New function.
(main): Set the global.
Reported by Ulrich Drepper in http://bugzilla.redhat.com/436368

16 years agoNow that ChangeLog is no longer under version control, ...
Jim Meyering [Thu, 6 Mar 2008 13:33:20 +0000 (14:33 +0100)]
Now that ChangeLog is no longer under version control, ...

* Makefile.maint (alpha beta major): Don't make changelog-check.
(changelog-version-check): Rename from changelog-check.

16 years ago* src/c99-to-c89.diff: Accommodate a C99-ism in id.c.
Jim Meyering [Tue, 4 Mar 2008 19:50:19 +0000 (20:50 +0100)]
* src/c99-to-c89.diff: Accommodate a C99-ism in id.c.

16 years agoWork around AFS bug: id and groups would print invalid group number.
ribalba [Tue, 4 Mar 2008 17:03:35 +0000 (18:03 +0100)]
Work around AFS bug: id and groups would print invalid group number.

* src/id.c (main): Call print_group_list with a user name, if possible.
* src/groups.c (main): Likewise.
* NEWS: Mention this.
For details, see
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12852
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12875

Signed-off-by: ribalba <geerd.dietger.hoffmann@gmail.com>
16 years agoNow that Makefile.maint is used in VPATH builds, too...
Jim Meyering [Wed, 5 Mar 2008 09:35:51 +0000 (10:35 +0100)]
Now that Makefile.maint is used in VPATH builds, too...

* Makefile.maint (prev_version_file): Prefix with $(srcdir)/.
(syntax-check-rules): Prefix $(ME) with $(srcdir)/.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoAvoid new "make distcheck" failure, now that VPATH has GNUmakefile.
Jim Meyering [Wed, 5 Mar 2008 09:33:03 +0000 (10:33 +0100)]
Avoid new "make distcheck" failure, now that VPATH has GNUmakefile.

* GNUmakefile: Remove commands to create ".version".
They were unnecessary, and caused creation of a newer .version
file in a VPATH build, which in turn caused creation of updated
man/*.1 files reflecting the newer time stamp on .version.
Those *.1 files were not removed (since they're distributed), and
the fact that they remained after "distclean" triggered the failure.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoReinstate GNUmakefile patch, but with workaround for automake.
Eric Blake [Tue, 4 Mar 2008 19:54:45 +0000 (20:54 +0100)]
Reinstate GNUmakefile patch, but with workaround for automake.

* configure.ac (AC_CONFIG_LINKS): Use shell variable to bypass
automake distclean rules.
* Makefile.am (distclean-local): Clean GNUmakefile in VPATH builds,
since we are bypassing automake.
* GNUmakefile (_is-dist-target): 'distclean' is not a dist target.

16 years agoClarify comment and attribute preceding change: Reported by Ralf Wildenhues.
Jim Meyering [Tue, 4 Mar 2008 11:59:40 +0000 (12:59 +0100)]
Clarify comment and attribute preceding change: Reported by Ralf Wildenhues.

16 years agoComment out yesterday's VPATH-friendly addition, for now.
Jim Meyering [Tue, 4 Mar 2008 11:56:45 +0000 (12:56 +0100)]
Comment out yesterday's VPATH-friendly addition, for now.

* configure.ac: ...while we wait for a fixed version of automake.

16 years agoUse m4_PACKAGE_VERSION, not AC_AUTOCONF_VERSION.
Eric Blake [Mon, 3 Mar 2008 22:48:54 +0000 (23:48 +0100)]
Use m4_PACKAGE_VERSION, not AC_AUTOCONF_VERSION.

* configure.ac: The latter is only in post-2.61 autoconf.

16 years agoGNUmakefile build tweaks.
Eric Blake [Mon, 3 Mar 2008 17:56:32 +0000 (17:56 +0000)]
GNUmakefile build tweaks.

* GNUmakefile: When Makefile is not present, make common targets depend
on "all" in order to trigger nicer error message.
* configure.ac: If autoconf is new enough, link GNUmakefile into VPATH
builds.
For more details, see
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/12853>.

Signed-off-by: Eric Blake <ebb9@byu.net>
16 years agoDefine SHA*_DIGEST_SIZE symbols.
Simon Josefsson [Mon, 3 Mar 2008 07:52:42 +0000 (08:52 +0100)]
Define SHA*_DIGEST_SIZE symbols.

* gl/lib/sha256.h (SHA224_DIGEST_SIZE, SHA256_DIGEST_SIZE): Define.
* gl/lib/sha512.h (SHA384_DIGEST_SIZE, SHA512_DIGEST_SIZE): Define.

16 years agoFix so that out-of-tree VPATH "make dist" works, too.
Ralf Wildenhues [Sun, 2 Mar 2008 21:17:47 +0000 (22:17 +0100)]
Fix so that out-of-tree VPATH "make dist" works, too.

* GNUmakefile: Add $(srcdir)/ prefix to git-version-gen and argument.

16 years agoOne more for non-srcdir "make dist".
Jim Meyering [Sun, 2 Mar 2008 15:33:53 +0000 (16:33 +0100)]
One more for non-srcdir "make dist".

* GNUmakefile: Also cd $(srcdir) before running autoreconf.

16 years agoAdjust so that non-srcdir "make dist" works, too.
Jim Meyering [Sun, 2 Mar 2008 15:24:52 +0000 (16:24 +0100)]
Adjust so that non-srcdir "make dist" works, too.

* GNUmakefile: Add $(srcdir)/ prefix to git-version-gen and argument.

16 years agoDon't infringe namespace of "sub"-Makefiles.
Jim Meyering [Sun, 2 Mar 2008 15:13:02 +0000 (16:13 +0100)]
Don't infringe namespace of "sub"-Makefiles.

* GNUmakefile (_dummy, _have-Makefile): Add "_" prefix.

16 years agoCreate sha256 and sha512 modules and move files into gl/.
Jim Meyering [Sun, 2 Mar 2008 11:16:49 +0000 (12:16 +0100)]
Create sha256 and sha512 modules and move files into gl/.

* bootstrap.conf (gnulib_modules): Add sha256 and sha512.
* m4/prereq.m4: Don't require gl_SHA256 or gl_SHA512.
* gl/modules/sha512: New file.
* gl/modules/sha256: New file.
* m4/sha256.m4: Move to ...
* gl/m4/sha256.m4: ...here, removing use of AC_SOURCES.
* m4/sha512.m4: Move to ...
* gl/m4/sha512.m4: ...here, removing use of AC_SOURCES.
* lib/sha256.c, lib/sha256.h: Move to ...
* gl/lib/sha256.c, gl/lib/sha256.h: ...here.
* lib/sha512.c, lib/sha512.h: Move to ...
* gl/lib/sha512.c, gl/lib/sha512.h: ...here.
* lib/u64.h: Move to ...
* gl/lib/u64.h: ...here.

16 years ago* bootstrap: Remove only *.m4, and only from $m4_base/. Rewrite the comment.
Jim Meyering [Sun, 2 Mar 2008 09:44:18 +0000 (10:44 +0100)]
* bootstrap: Remove only *.m4, and only from $m4_base/.  Rewrite the comment.

16 years ago* bootstrap: Sync from gnulib.
Jim Meyering [Sun, 2 Mar 2008 09:14:58 +0000 (10:14 +0100)]
* bootstrap: Sync from gnulib.

16 years agoDon't skip the groups-version test.
Jim Meyering [Sat, 1 Mar 2008 09:50:35 +0000 (10:50 +0100)]
Don't skip the groups-version test.

* tests/Makefile.am (built_programs): Remove unused definition.
* src/Makefile.am (built_programs.list): Print a space-separated
list of program names, not NL-separated, since all clients now
expect a space-separated list.

16 years agoDon't exempt "groups" from write-failure test, now that it's a C program.
Jim Meyering [Sat, 1 Mar 2008 09:39:12 +0000 (10:39 +0100)]
Don't exempt "groups" from write-failure test, now that it's a C program.

* tests/misc/help-version: Since groups is no longer a shell
script, a buggy bourne shell can't cause trouble.

16 years ago* configure.ac (AC_INIT): Use .tarball-version, not .version.
Jim Meyering [Fri, 29 Feb 2008 08:36:24 +0000 (09:36 +0100)]
* configure.ac (AC_INIT): Use .tarball-version, not .version.

16 years agoDon't depend on gnulib's deprecated "free" module.
Jim Meyering [Sat, 1 Mar 2008 08:51:48 +0000 (09:51 +0100)]
Don't depend on gnulib's deprecated "free" module.

* bootstrap.conf (obsolete_gnulib_modules): Remove free.
* gl/modules/mgetgroups (Depends-on): Remove free.

16 years agoMerge bootstrap changes from gnulib.
Jim Meyering [Fri, 29 Feb 2008 08:18:43 +0000 (09:18 +0100)]
Merge bootstrap changes from gnulib.

* bootstrap (MSGID_BUGS_ADDRESS): Define and use.
(version_controlled_file): Use "git rm", not "git-rm".

16 years agoUse "git tag", not "git-tag", in preparation for git-1.6.0.
Jim Meyering [Fri, 29 Feb 2008 08:16:59 +0000 (09:16 +0100)]
Use "git tag", not "git-tag", in preparation for git-1.6.0.

* Makefile.maint (VC-tag): Remove '-': s/git-tag/git tag/

16 years agoMake copyright comments consistent.
Jim Meyering [Sun, 24 Feb 2008 14:29:40 +0000 (15:29 +0100)]
Make copyright comments consistent.

* src/mktemp.c: Update copyright to use newer form.

Make first copyright lines consistent. Some did not end in ", Inc.".
Due to that missing ", Inc" at end of line, emacs' copyright-updating
code missed some opportunities.  This corrects most of those, and
adds some mistakenly omitted years.
* src/chown-core.c: Adjust.
* src/chown-core.h: Likewise.
* src/copy.c: Likewise.
* src/copy.h: Likewise.
* src/cp-hash.c: Likewise.
* src/cp.c: Likewise.
* src/group-list.h: Likewise.
* src/mktemp.c: Likewise.
* src/stat.c: Likewise.
* tests/chmod/equal-x: Likewise.
* tests/dd/skip-seek: Likewise.
* tests/envvar-check: Likewise.
* tests/mv/into-self-2: Likewise.

16 years agoFix test failure where rm would appear to succeed incorrectly.
Bob Proulx [Mon, 25 Feb 2008 19:38:23 +0000 (20:38 +0100)]
Fix test failure where rm would appear to succeed incorrectly.

* tests/rm/fail-eperm: Ignore files that were opportunistically chosen
to test permission failures but disappear before we can finish the test.

16 years ago* gl/lib/mgetgroups.c (mgetgroups): Parenthesize correctly.
Jim Meyering [Sun, 24 Feb 2008 17:12:15 +0000 (18:12 +0100)]
* gl/lib/mgetgroups.c (mgetgroups): Parenthesize correctly.

16 years ago* gl/lib/mgetgroups.c: Include <stdlib.h>.
Jim Meyering [Sun, 24 Feb 2008 13:56:19 +0000 (14:56 +0100)]
* gl/lib/mgetgroups.c: Include <stdlib.h>.

16 years agoAvoid test failures when root (/) is not readable.
Jim Meyering [Sat, 23 Feb 2008 22:22:58 +0000 (23:22 +0100)]
Avoid test failures when root (/) is not readable.

* tests/test-lib.sh (require_readable_root_): New function.
* tests/misc/pwd-long: Skip this test when / is unreadable.
* tests/du/slash: Likewise.
This is required at least for Mandrake/Mandriva in "secure" mode.
Reported by Theodoros V. Kalamatianos in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12800

16 years agoid: avoid race when a group is added between getgrouplist calls
Jim Meyering [Fri, 22 Feb 2008 09:01:36 +0000 (10:01 +0100)]
id: avoid race when a group is added between getgrouplist calls

* gl/lib/mgetgroups.c (mgetgroups) [N_GROUPS_INIT]: Rename enum.
Use a larger value.
Update *groups only upon success.
Iterate upon failed getgrouplist.

16 years agoid: use getgrouplist when possible
James Youngman [Thu, 21 Feb 2008 14:01:15 +0000 (15:01 +0100)]
id: use getgrouplist when possible

* gl/m4/mgetgroups.m4: Check for getgrouplist.
* gl/lib/mgetgroups.c (mgetgroups): Use getgrouplist, if available.
* TODO: Remove the item about switching to getgrouplist.
* NEWS: mention this

16 years agodu vs. hard links and argument order: improve documentation
Paul Eggert [Wed, 20 Feb 2008 23:45:47 +0000 (15:45 -0800)]
du vs. hard links and argument order: improve documentation

* doc/coreutils.texi (du invocation): Document default behavior on
hard links, and why argument order matters.

16 years agojoin: avoid new leaks
James Youngman [Wed, 20 Feb 2008 20:44:53 +0000 (21:44 +0100)]
join: avoid new leaks

* src/join.c (prevline): Make prevline module-level static, so that
the allocated items can be freed at exit.
(free_prevline): new atexit function; frees items in prevline[].
Use ARRAY_CARDINALITY, so include "argmatch.h" to get that.
(main): Arrange for free_prevline to be called during exit.
(get_line): Free prevline[which - 1] also, as that
will have been allocated by dup_line.

16 years agoRemove xdelta support, clean up distcheck process.
Jim Meyering [Wed, 20 Feb 2008 11:08:53 +0000 (12:08 +0100)]
Remove xdelta support, clean up distcheck process.
* Makefile.maint (writable-files): Don't create $(release_archive_dir).
(my-distcheck): Don't depend on prev-tgz.
Remove xdelta-related variables and uses.
(alpha beta major): Skip steps if $(release_archive_dir) doesn't exist.

16 years ago* bootstrap: Remove dangling symlinks before invoking aclocal.
Jim Meyering [Wed, 20 Feb 2008 07:16:38 +0000 (08:16 +0100)]
* bootstrap: Remove dangling symlinks before invoking aclocal.

16 years agosort: add --sort=... option.
Andreas Schwab [Wed, 20 Feb 2008 07:36:56 +0000 (08:36 +0100)]
sort: add --sort=... option.

* src/sort.c (SORT_OPTION): New enum.
(sort_args, sort_types): Define.
(usage, long_options, main): New option --sort.
* tests/sort/Test.pm: Test it.
* doc/coreutils.texi (sort invocation): Document --sort option.
* NEWS: Mention this.

16 years ago2008-02-19 Jim Meyering <meyering@redhat.com>
Jim Meyering [Tue, 19 Feb 2008 17:20:46 +0000 (18:20 +0100)]
2008-02-19  Jim Meyering  <meyering@redhat.com>

* TODO: Remove final seq-related item.

16 years ago* src/c99-to-c89.diff: Adjust seq.c offsets. Accommodate a new C99-ism.
Jim Meyering [Mon, 18 Feb 2008 22:52:26 +0000 (23:52 +0100)]
* src/c99-to-c89.diff: Adjust seq.c offsets.  Accommodate a new C99-ism.

16 years agoseq: give better diagnostics for invalid formats.
Steven Schubiger [Mon, 18 Feb 2008 21:39:22 +0000 (22:39 +0100)]
seq: give better diagnostics for invalid formats.

* src/seq.c: (validate_format): New function.
(main): Use it.
* tests/misc/seq (fmt-d, fmt-e): Test for expected diagnostics with
invalid formats.
* NEWS: Mention this change.
* TODO: Remove this item.
[jm: src/seq.c: make diagnostics more consistent
 tests/misc/seq (fmt-eos1): adjust the expected diagnostic ]