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

16 years agojoin: new options: --check-order and --nocheck-order.
James Youngman [Tue, 19 Feb 2008 13:13:00 +0000 (14:13 +0100)]
join: new options: --check-order and --nocheck-order.

* src/join.c: Support --check-order and --nocheck-order.
New variables check_input_order, seen_unpairable and
issued_disorder_warning[]. For --check-order, verify that the
input files are in sorted order.  For the default case, check the
order only if there are unpairable lines.
(join): Perform ordering checks after reaching EOF on either
input.
(usage): Mention --check-order and --nocheck-order.
(dupline): Save a copy of the previously-read input line so that
we can detect disorder on the input.
(get_line): Temporarily save a copy of the previous line (by
calling dupline) and check relative ordering (by calling
checkorder) before returning the newly-read line.
(getseq, join): Tell get_line which file we are reading from.
(advance_seq): New function, factoring out some of the code
commonly surrounding calls to getseq.
(checkorder): New function.  Verifies that a pair of consecutive
input lines are in sorted order.
* doc/coreutils.texi (join invocation): Document the new options
--check-order and --nocheck-order.
* tests/join/Test.pm (tv): Added tests for --check-order and
--nocheck-order.
* NEWS: Mention this new feature.

16 years agoFix non-srcdir "make distcheck" failure.
James Youngman [Tue, 19 Feb 2008 12:27:39 +0000 (13:27 +0100)]
Fix non-srcdir "make distcheck" failure.

* Makefile.am (check-ls-dircolors): Look for sources under
$(srcdir), not under ".".

16 years agoseq: give a proper diagnostic for an invalid --format=% option
Jim Meyering [Mon, 18 Feb 2008 17:38:52 +0000 (18:38 +0100)]
seq: give a proper diagnostic for an invalid --format=% option

* src/seq.c (long_double_format): Handle '%' at end of string.
* tests/misc/seq [fmt-eos1, fmt-eos2]: New tests for the bug.
* NEWS: Mention this.
Reported by Pádraig Brady.

16 years ago.gitignore, src/.gitignore: ignore more
Jim Meyering [Sun, 17 Feb 2008 10:12:38 +0000 (11:12 +0100)]
.gitignore, src/.gitignore: ignore more

16 years agoClean up Makefile.maint.
Jim Meyering [Sat, 16 Feb 2008 23:26:03 +0000 (00:26 +0100)]
Clean up Makefile.maint.

* Makefile.maint: Remove obsolete comments.
(local-checks-available): Remove changelog-check.

16 years agoClean up ls.c.
Jim Meyering [Tue, 12 Feb 2008 17:13:09 +0000 (18:13 +0100)]
Clean up ls.c.

* src/ls.c (put_indicator): Use fwrite, not a loop.

16 years agoEnsure that dircolors.c and ls.c remain in sync.
Jim Meyering [Wed, 13 Feb 2008 13:33:02 +0000 (14:33 +0100)]
Ensure that dircolors.c and ls.c remain in sync.

* Makefile.am (check-ls-dircolors): New rule.
(distcheck-hook): Depend on it.

16 years agoExpand "ls --color" tests to also use the dircolors defaults.
Jim Meyering [Sat, 16 Feb 2008 21:57:15 +0000 (22:57 +0100)]
Expand "ls --color" tests to also use the dircolors defaults.

* tests/misc/ls-misc: Adjust this test so each is run twice.  First, as usual,
and the second time with LS_COLORS set using the default settings
produced by running dircolors.
* tests/Coreutils.pm: See below.

This required some changes:
  - save and restore $ENV{LS_COLORS} for each individual test
  that requires a specific value.
  - Since this is the first test to call the run_tests command more
  than once, it has exposed that that function erroneously modifies
  the \@Tests array.  Fix that in tests/Coreutils.pm.

16 years agoAdjust dircolors to match ls.c.
Jim Meyering [Sat, 16 Feb 2008 22:06:12 +0000 (23:06 +0100)]
Adjust dircolors to match ls.c.

* src/dircolors.hin: comment out NORMAL and FILE, define RESET.
* src/dircolors.c (slack_codes) Add "RESET".
(ls_codes): Add "rs".

16 years agols --color no longer outputs unnecessary escape sequences
Ed Avis [Tue, 12 Feb 2008 11:22:35 +0000 (12:22 +0100)]
ls --color no longer outputs unnecessary escape sequences

In --color mode, plain files do not get any color, not even white.
When no highlighting is required, ls outputs no escape sequence at all.
* src/ls.c (print_with_color):
(used_color): New global.
(indicator_no) [C_RESET]: New enum value.
(indicator_name) ["rs"]: Corresponding new string.
(color_indicator): Make the 'normal' and 'file' markers be NULL.
Use "rs" (C_RESET) to reset to ordinary colors.
(process_signals): Restore default colors only if necessary.
(main): Don't call prep_non_filename_text here.
(print_name_with_quoting): Call it here, instead.
(prep_non_filename_text): Use C_RESET, not C_NORM.
(print_color_indicator): Return bool, not void.
Print nothing, when possible.
(put_indicator): Call prep_non_filename_text the first time.
* tests/misc/ls-misc: Test for above.
* tests/ls/color-dtype-dir: Adapt: no escapes around regular file name.
* TODO: Remove item.
* NEWS: Mention this.

16 years agols: Improve description of --group-directories-first.
Dan Jacobson [Tue, 12 Feb 2008 08:18:11 +0000 (09:18 +0100)]
ls: Improve description of --group-directories-first.

* src/ls.c (usage) [--group-directories-first]: Improve description.
* doc/coreutils.texi (Which files are listed): Likewise.

16 years agoAvoid tests/cp/acl test failure.
Jim Meyering [Sat, 16 Feb 2008 22:10:15 +0000 (23:10 +0100)]
Avoid tests/cp/acl test failure.

* tests/check.mk (TESTS_ENVIRONMENT) [CONFIG_HEADER]: Define
to an absolute name, so it can be used from any point in the
test hierarchy.  Reported by James Youngman.

16 years agoUse the gettime module in ls.c.
James Youngman [Sat, 16 Feb 2008 18:29:52 +0000 (19:29 +0100)]
Use the gettime module in ls.c.

Implement TODO list item to make ls.c use the gettime module.
* TODO (ls): Now that we use gettime, remove the TODO entry.
* src/ls.c: Use timespec.h and the gettime module.
(current_time): Change type from time_t to struct timespec.
(current_time_ns): Removed.
(get_current_time): Removed.
(print_long_format): Remove when and when_ns, since we have
when_timespec anyway.  Change type of variable six_months_ago from
time_t to struct timespec.

16 years agogroups: don't test printf and putchar calls for failure
Jim Meyering [Sun, 27 Jan 2008 23:08:32 +0000 (00:08 +0100)]
groups: don't test printf and putchar calls for failure

They are unnecessary, since we use gnulib's closeout module.
* src/group-list.c (print_group): Remove explicit error tests.
* src/groups.c (main): Likewise.
(write_error): Remove function.

16 years agoReplace groups.sh with groups.c.
James Youngman [Fri, 25 Jan 2008 16:05:52 +0000 (16:05 +0000)]
Replace groups.sh with groups.c.

* src/groups.c (main): New file, replacing groups.sh.
* src/group-list.c, src/group-list.h: New files, factored out of id.c,
implementing the functionality that "id" and "groups" have in common.
* src/id.c (print_full_info): Avoid a segfault when trying to print
an error message if getgroups fails.
(print_group_list): Move to group-list.c.
(print_group): Likewise.
* man/Makefile.am: When building groups.1, obtain the help text
from src/groups.c, not src/groups.sh.
(noinst_HEADERS): Add group-list.h.
(group): Remove rule.
(dist_man_MANS): Remove groups.1.
* doc/coreutils.texi (groups: Print group names a user is in):
Explain why "groups" and "groups $(id -un)" give different results
in existing login sessions after you change the group database.
(id: Print user identity): Likewise for "id".
* po/POTFILES.in: Add src/group-list.c and src/groups.c.
* NEWS: mention this.
* AUTHORS: Update.

16 years agoMove more test_skip_-using code to follow ". test-lib.sh".
Jim Meyering [Tue, 12 Feb 2008 17:45:54 +0000 (18:45 +0100)]
Move more test_skip_-using code to follow ". test-lib.sh".

* tests/mv/acl: Likewise.
* tests/cp/acl: Likewise.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agotests/touch/not-owner: Source test-lib.sh before using skip_test_.
Peter Fales [Tue, 12 Feb 2008 17:15:29 +0000 (18:15 +0100)]
tests/touch/not-owner: Source test-lib.sh before using skip_test_.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years ago* tests/Makefile.am (EXTRA_DIST): Remove strace.
Jim Meyering [Mon, 11 Feb 2008 23:10:06 +0000 (00:10 +0100)]
* tests/Makefile.am (EXTRA_DIST): Remove strace.

16 years agotests: Migrate sourced strace file into a function, require_strace_.
Jim Meyering [Mon, 11 Feb 2008 19:54:38 +0000 (20:54 +0100)]
tests: Migrate sourced strace file into a function, require_strace_.

* tests/strace: Remove file.
* tests/test-lib.sh (require_strace_): New function.
* tests/mv/atomic: Use require_strace_, rather than ". strace".
* tests/ls/stat-free-symlinks: Likewise.
Peter Fales reported that stat-free-symlinks failed without strace.

16 years ago* tests/rm/inaccessible: Source test-lib.sh *before* using skip_test_.
Jim Meyering [Mon, 11 Feb 2008 19:47:26 +0000 (20:47 +0100)]
* tests/rm/inaccessible: Source test-lib.sh *before* using skip_test_.

Reported by Peter Fales.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoEnsure there are no removable (useless) if-before-free tests.
Jim Meyering [Sun, 10 Feb 2008 16:18:03 +0000 (17:18 +0100)]
Ensure there are no removable (useless) if-before-free tests.

* bootstrap.conf (gnulib_modules): Add useless-if-before-free.
* Makefile.maint (sc_avoid_if_before_free): New rule.

16 years agoUse a better dirname emulation.
Jim Meyering [Sun, 10 Feb 2008 12:52:47 +0000 (13:52 +0100)]
Use a better dirname emulation.

* build-aux/check.mk (_dirname): Define.
(am__check_pre): Use it.

16 years agoAvoid test failure when run with risky PATH ("." before /usr/bin).
Jim Meyering [Sun, 10 Feb 2008 10:26:57 +0000 (11:26 +0100)]
Avoid test failure when run with risky PATH ("." before /usr/bin).

* build-aux/check.mk (approx_dirname_filter): Define.
(am__check_pre): Emulate dirname using sed.
Report and suggested fix from Bruno Haible in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12587/focus=12590

16 years ago* build-aux/.gitignore: Remove file from version control. It's generated.
Jim Meyering [Sun, 10 Feb 2008 09:34:31 +0000 (10:34 +0100)]
* build-aux/.gitignore: Remove file from version control. It's generated.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoGenerate ChangeLog from git log.
Jim Meyering [Sun, 10 Feb 2008 09:27:42 +0000 (10:27 +0100)]
Generate ChangeLog from git log.

* bootstrap.conf (gnulib_modules): Add gitlog-to-changelog.
Ensure that ChangeLog exists, for automake.
* Makefile.am (gen-ChangeLog): New rule.
(dist-hook): Depend on it.
(EXTRA_DIST): Add ChangeLog-2006, ChangeLog-2007, ChangeLog-2008.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoRemove ChangeLog, dividing its content into ChangeLog-200?
Jim Meyering [Sun, 10 Feb 2008 09:23:46 +0000 (10:23 +0100)]
Remove ChangeLog, dividing its content into ChangeLog-200?

* ChangeLog: Remove file.
* ChangeLog-2005: Prepend the 2005 entries.
* ChangeLog-2006: New file.
* ChangeLog-2007: New file.
* ChangeLog-2008: New file.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years ago* ChangeLog: Manually update copyright notice at *bottom*.
Jim Meyering [Sun, 10 Feb 2008 09:07:52 +0000 (10:07 +0100)]
* ChangeLog: Manually update copyright notice at *bottom*.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agotests: rm/fail-eperm: require-non-root in perl, not sh
Jim Meyering [Tue, 11 Dec 2007 14:06:29 +0000 (15:06 +0100)]
tests: rm/fail-eperm: require-non-root in perl, not sh

Since it creates no temporaries and since it requires non-root,
do the require-non-root bit in perl, rather than using test-lib.sh.

16 years agotests: Remove priv-check. Use new require_root_ function instead.
Jim Meyering [Sat, 8 Dec 2007 11:29:25 +0000 (12:29 +0100)]
tests: Remove priv-check.  Use new require_root_ function instead.

* tests/priv-check: Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove priv-check.
* tests/test-lib.sh (require_root_): New function.
Use this function rather than sourcing the priv-check file.
* tests/sample-test: Use require_root_ rather than priv-check.
* tests/chown/basic: Likewise.
* tests/cp/cp-a-selinux: Likewise.
* tests/cp/preserve-gid: Likewise.
* tests/cp/special-bits: Likewise.
* tests/ls/nameless-uid: Likewise.
* tests/misc/chcon: Likewise.
* tests/mkdir/writable-under-readonly: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/rm/no-give-up: Likewise.
* tests/rm/one-file-system: Likewise.
* tests/tail-2/append-only: Likewise.
* tests/touch/now-owned-by-other: Likewise.
* tests/rm/fail-eperm: Use skip_if_root_ rather than priv-check.
* Makefile.maint (sc_root_tests): Reflect this change:
search for the new function name.

16 years agotests: factor out the perl-requiring code in many test scripts
Jim Meyering [Thu, 6 Dec 2007 13:21:51 +0000 (14:21 +0100)]
tests: factor out the perl-requiring code in many test scripts

* tests/require-perl: New file.
* tests/Makefile.am (EXTRA_DIST): Add require-perl.
* tests/dd/skip-seek: Use it, and remove manual tests.
* tests/du/files0-from: Likewise.
* tests/ls/nameless-uid: Likewise.
* tests/misc/base64: Likewise.
* tests/misc/basename: Likewise.
* tests/misc/cut: Likewise.
* tests/misc/date: Likewise.
* tests/misc/dircolors: Likewise.
* tests/misc/dirname: Likewise.
* tests/misc/expand: Likewise.
* tests/misc/expr: Likewise.
* tests/misc/factor: Likewise.
* tests/misc/fmt: Likewise.
* tests/misc/fold: Likewise.
* tests/misc/head-elide-tail: Likewise.
* tests/misc/ls-misc: Likewise.
* tests/misc/md5sum: Likewise.
* tests/misc/md5sum-newline: Likewise.
* tests/misc/mktemp: Likewise.
* tests/misc/od: Likewise.
* tests/misc/paste-no-nl: Likewise.
* tests/misc/pr: Likewise.
* tests/misc/pwd-long: Likewise.
* tests/misc/seq: Likewise.
* tests/misc/sha1sum: Likewise.
* tests/misc/sha1sum-vec: Likewise.
* tests/misc/sha224sum: Likewise.
* tests/misc/sha256sum: Likewise.
* tests/misc/sha384sum: Likewise.
* tests/misc/sha512sum: Likewise.
* tests/misc/sort-merge: Likewise.
* tests/misc/stat-printf: Likewise.
* tests/misc/sum: Likewise.
* tests/misc/sum-sysv: Likewise.
* tests/misc/test-diag: Likewise.
* tests/misc/tsort: Likewise.
* tests/misc/tty-eof: Likewise.
* tests/misc/unexpand: Likewise.
* tests/misc/wc-files0-from: Likewise.
* tests/misc/xstrtol: Likewise.
* tests/mv/i-1: Likewise.
* tests/rm/empty-name: Likewise.
* tests/rm/fail-eperm: Likewise.
* tests/rm/unreadable: Likewise.

(EXTRA_DIST): *do* require require-perl as a stand-alone, 'source'able script.

16 years agotests: call skip_test_ in place of echo+exit 77
Jim Meyering [Thu, 29 Nov 2007 08:21:22 +0000 (09:21 +0100)]
tests: call skip_test_ in place of echo+exit 77

* tests/mv/no-target-dir: Likewise.
* tests/other-fs-tmpdir: Likewise.
* tests/rm/empty-name: Likewise.
* tests/rm/fail-eperm: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/isatty: Likewise.
* tests/rm/unreadable: Likewise.
* tests/setgid-check: Likewise.
* tests/sparse-file: Likewise.
* tests/strace: Likewise.
* tests/tail-2/append-only: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/tail-2/tail-n0f: Likewise.
* tests/touch/dangling-symlink: Likewise.
* tests/touch/fifo: Likewise.
* tests/touch/not-owner: Likewise.
* tests/mv/i-3: Likewise.
* tests/umask-check: Likewise.
* tests/mv/acl: Likewise.
* tests/cp/acl: Likewise.
* tests/chgrp/deref: Likewise.
* tests/chmod/setgid: Likewise.
* tests/cp/existing-perm-race: Likewise.
* tests/cp/file-perm-race: Likewise.
* tests/cp/parent-perm-race: Likewise.
* tests/du/2g: Likewise.
* tests/du/8gb: Likewise.
* tests/du/long-from-unreadable: Likewise.
* tests/du/long-sloop: Likewise.
* tests/du/slink: Likewise.
* tests/ls/nameless-uid: Likewise.
* tests/ls/stat-dtype: Likewise.
* tests/misc/cat-proc: Likewise.
* tests/misc/md5sum-newline: Likewise.
* tests/misc/nice: Likewise.
* tests/misc/od-x8: Likewise.
* tests/misc/pwd-unreadable-parent: Likewise.
* tests/misc/selinux: Likewise.
* tests/misc/stty-row-col: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/misc/arch: Likewise, and source $srcdir/../test-lib.sh *before*
the use of skip_test_.

16 years agotests: move the very-expensive file into test-lib.sh
Jim Meyering [Fri, 30 Nov 2007 22:22:21 +0000 (23:22 +0100)]
tests: move the very-expensive file into test-lib.sh

* tests/very-expensive: Remove file.
* tests/test-lib.sh (very_expensive_): New function.
* tests/Makefile.am (EXTRA_DIST): Remove very-expensive.
* tests/cp/perm: Call the new function, rather than sourcing the file.
* tests/tail-2/assert: Likewise.
* tests/tail-2/assert-2: Likewise.
* tests/du/2g: Likewise.

16 years agotests: start migrating sourced-file function-like tests into test-lib.sh.
Jim Meyering [Thu, 29 Nov 2007 07:55:47 +0000 (08:55 +0100)]
tests: start migrating sourced-file function-like tests into test-lib.sh.

* tests/acl: Remove file.
* tests/test-lib.sh (require_acl_): New function.
* tests/cp/acl: Use require_acl_ instead.
* tests/mv/acl: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove acl.

16 years agotests: mv/acl: Don't mention "yes" as a partition name in diagnostic.
Jim Meyering [Thu, 29 Nov 2007 08:05:17 +0000 (09:05 +0100)]
tests: mv/acl: Don't mention "yes" as a partition name in diagnostic.

16 years agoWe *do* need two different version files.
Jim Meyering [Thu, 7 Feb 2008 22:30:07 +0000 (23:30 +0100)]
We *do* need two different version files.

One for tarball-only, the other to be updated any time we
get a new value of $(VERSION).
* Makefile.am (dist-hook): Create .tarball-version in dist tarball.
* GNUmakefile (_curr-ver): Make git-version-gen use it.
* .gitignore: Ignore it.

16 years agoFix a typo in description of size suffixes: s/GB/G/.
Jim Meyering [Thu, 7 Feb 2008 22:05:00 +0000 (23:05 +0100)]
Fix a typo in description of size suffixes: s/GB/G/.

* doc/coreutils.texi (od invocation, head invocation, tail invocation):
Spotted by Bert Wesarg.

16 years agoNEWS [6.9.90]: head, od, split and tail accept the standard size suffixes
Jim Meyering [Thu, 7 Feb 2008 21:57:50 +0000 (22:57 +0100)]
NEWS [6.9.90]: head, od, split and tail accept the standard size suffixes

16 years agomkdir, split: write --verbose output to stdout, not stderr.
Steven Schubiger [Wed, 6 Feb 2008 07:25:24 +0000 (08:25 +0100)]
mkdir, split: write --verbose output to stdout, not stderr.

* src/mkdir.c (verbose_output): New function.
(announce_mkdir): Use it.
* src/split.c (usage): Update.
* src/split.c (cwrite): Write to stdout, not stderr.
* doc/coreutils.texi (split invocation): Remove the mention
of --verbose output being printed to stderr.
* tests/mkdir/p-v: Redirect stdout, not stderr.
* tests/misc/split-a: Likewise.
* NEWS: Mention this change.
* TODO: Remove this item.

16 years agoMakefile.maint (announcement): Remove stale comment.
Jim Meyering [Mon, 4 Feb 2008 12:23:56 +0000 (13:23 +0100)]
Makefile.maint (announcement): Remove stale comment.

16 years agoClarify a comment.
Jim Meyering [Sat, 2 Feb 2008 08:04:24 +0000 (09:04 +0100)]
Clarify a comment.

* tests/sort/Test.pm: Replace a vague ChangeLog reference with a URL.

16 years agoImprove wording of date and time man page.
Bob Proulx [Wed, 30 Jan 2008 22:31:37 +0000 (15:31 -0700)]
Improve wording of date and time man page.

* man/date.x: Improve compact description of the --date=STRING.
* man/touch.x: Likewise.
Suggested by A. Costa.