platform/upstream/coreutils.git
16 years agoDon't use GNU-sed-specific \< \> operators.
Jim Meyering [Mon, 5 Nov 2007 10:03:55 +0000 (11:03 +0100)]
Don't use GNU-sed-specific \< \> operators.

* configure.ac (MAN): Transform ginstall.1 to install.1 using
a loop, rather than sed with \<...\>.
Problem reported by Bruno Haible.
Andreas Schwab reminded me that \< and \> are not portable.

16 years agoGet git-version-gen from gnulib. v6.9.89
Jim Meyering [Mon, 5 Nov 2007 07:31:51 +0000 (08:31 +0100)]
Get git-version-gen from gnulib.

* build-aux/git-version-gen: Remove file.
* build-aux/.gitignore: Add git-version-gen.
* bootstrap.conf (gnulib_modules): Add git-version-gen.

16 years agogit-version-gen: Sync from autoconf's version.
Jim Meyering [Sat, 3 Nov 2007 21:52:33 +0000 (22:52 +0100)]
git-version-gen: Sync from autoconf's version.

* build-aux/git-version-gen: Run git-status

16 years agoSync copyright and scriptversion bits from gnulib.
Jim Meyering [Sat, 3 Nov 2007 17:04:40 +0000 (18:04 +0100)]
Sync copyright and scriptversion bits from gnulib.

* build-aux/git-version-gen: No semantic change.

16 years agoChange the first '-' to '.' in the snapshot version string,
Jim Meyering [Sat, 3 Nov 2007 16:46:42 +0000 (17:46 +0100)]
Change the first '-' to '.' in the snapshot version string,

e.g., 6.9-377-08144 -> 6.9.377-08144
* build-aux/git-version-gen: ... and add comments.

16 years agoseq: add another test for the %% bug
Jim Meyering [Sat, 3 Nov 2007 09:10:38 +0000 (10:10 +0100)]
seq: add another test for the %% bug

* tests/misc/seq (fmt-c): Test the other fixed case, too.

16 years agoFix bug with "seq 10.8 0.1 10.95", plus another bug with %% in format.
Paul Eggert [Sat, 3 Nov 2007 08:10:59 +0000 (01:10 -0700)]
Fix bug with "seq 10.8 0.1 10.95", plus another bug with %% in format.

* NEWS: Mention the %%-in-format bug fix.
* src/seq.c (struct layout): New type.
(long_double_format): New arg LAYOUT.  Fill it in.  Fix mishandling
of %% in formats.
(print_numbers): New arg LAYOUT.  Don't convert LAST to output format
when deciding whether to go slightly past LAST.  Instead, convert
X to output format and back.  This fixes a bug reported by
Andreas Schwab in
<http://lists.gnu.org/archive/html/bug-coreutils/2007-10/msg00237.html>
where "seq 10.8 0.1 10.95" would output 11.0 on platforms where
10.95 rounds to a value that prints as 11.0 when only one digit
past the decimal point is asked for.
(main): Compute layout, for benefit of print_numbers.
* tests/misc/seq (float-3): Undo previous change, since the bug
should be fixed now.
(fmt-b): New test, for the %% bug.

16 years agotests/misc/printf-surprise: Correct sed transform.
Jim Meyering [Thu, 1 Nov 2007 22:39:41 +0000 (23:39 +0100)]
tests/misc/printf-surprise: Correct sed transform.

Reported by Bob Proulx.

16 years agoAdd example inspired by "make dist" running gzip and lzma in sequence.
Jim Meyering [Thu, 1 Nov 2007 21:34:36 +0000 (22:34 +0100)]
Add example inspired by "make dist" running gzip and lzma in sequence.

* doc/coreutils.texi (tee invocation): Show how to run tar just
once, compressing the tee'd output streams in parallel.

16 years agoSay that the first process substitution example is contrived.
Jim Meyering [Thu, 1 Nov 2007 20:25:28 +0000 (21:25 +0100)]
Say that the first process substitution example is contrived.

* doc/coreutils.texi (tee invocation): ... and show how to do
it properly.  Pointed out by James Antill.

16 years agoUse mktemp, not mkdtemp, to create test directories.
Jim Meyering [Thu, 1 Nov 2007 17:58:17 +0000 (18:58 +0100)]
Use mktemp, not mkdtemp, to create test directories.

* tests/test-lib.sh: Use the mktemp binary we've just built,
not the mkdtemp script.
* tests/mkdtemp: Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove mkdtemp.

16 years agoAdjust a seq subtest not to depend on the vagaries of floating point.
Jim Meyering [Thu, 1 Nov 2007 11:10:06 +0000 (12:10 +0100)]
Adjust a seq subtest not to depend on the vagaries of floating point.

* tests/misc/seq (float-3): Use 10.94 as the endpoint, not 10.95,
since 10.95 was precisely in the middle of the interval, and with
a %.1f format could map to either 10.9 or 11.0.
Reported by Mike Frysinger

16 years agoMake the new printf-surprise test more precise.
Jim Meyering [Thu, 1 Nov 2007 11:06:11 +0000 (12:06 +0100)]
Make the new printf-surprise test more precise.

* tests/test-lib.sh (require_ulimit_): New function.
* tests/misc/printf-surprise: Use ulimit -v to trigger the fixed bug,
and rather than checking printf's exit status (which would go wrong
on FreeBSD 6.1, since their printf(3) function doesn't require
lots of memory in this case) simply test whether it outputs
the first 10 bytes.

16 years agoAccommodate FreeBSD 6.1 hard-link-to-symlink differences.
Jim Meyering [Thu, 1 Nov 2007 10:59:08 +0000 (11:59 +0100)]
Accommodate FreeBSD 6.1 hard-link-to-symlink differences.

* tests/cp/same-file: Detect when linking to a symlink links to
the target of the symlink (FreeBSD 6.1 does this, Linux does not),
and skip the few tests that would otherwise fail.
Redirect output of final comparison to stderr, since all stdout
is already redirected.

16 years agoFix a "make distcheck" failure.
Jim Meyering [Wed, 31 Oct 2007 07:42:17 +0000 (08:42 +0100)]
Fix a "make distcheck" failure.

* Makefile.maint (my-distcheck): Don't stub-out dirname,
since build-aux/check.mk now uses it.

16 years ago* bootstrap.conf (gnulib_modules): Add xprintf-posix.
Jim Meyering [Wed, 31 Oct 2007 07:40:51 +0000 (08:40 +0100)]
* bootstrap.conf (gnulib_modules): Add xprintf-posix.

16 years agoAvoid seq floating-point test failure on FreeBSD 6.1.
Jim Meyering [Tue, 30 Oct 2007 10:17:59 +0000 (11:17 +0100)]
Avoid seq floating-point test failure on FreeBSD 6.1.

* tests/misc/seq (float-4): Also accept -0.0.

16 years agoChange a "make dist" diagnostic.
Jim Meyering [Mon, 29 Oct 2007 11:24:39 +0000 (12:24 +0100)]
Change a "make dist" diagnostic.

* GNUmakefile: Don't imply that $(_curr-ver) is the new version string.

16 years agoImprove color terminal escape usage.
Bob Proulx [Mon, 29 Oct 2007 11:10:23 +0000 (05:10 -0600)]
Improve color terminal escape usage.

* build-aux/check.mk (am__tty_colors): Use 'tput' to deduce
terminal color capabilities.

16 years agoDon't try to colorize a dumb terminal.
Jim Meyering [Mon, 29 Oct 2007 09:37:09 +0000 (10:37 +0100)]
Don't try to colorize a dumb terminal.

* build-aux/check.mk (am__tty_colors): Skip colors if $TERM is "dumb".
Thanks to Bob Proulx.

16 years agoRemove gnulib's printf-posix module, for now.
Jim Meyering [Mon, 29 Oct 2007 09:14:58 +0000 (10:14 +0100)]
Remove gnulib's printf-posix module, for now.

* bootstrap.conf (gnulib_modules): It caused too many test failures.

16 years agoRemove spurious semicolon after "else".
Jim Meyering [Mon, 29 Oct 2007 09:01:25 +0000 (10:01 +0100)]
Remove spurious semicolon after "else".

* build-aux/check.mk (am__tty_colors): Fix syntax error.

16 years agoAttribute suggestion for last change.
Jim Meyering [Mon, 29 Oct 2007 08:49:50 +0000 (09:49 +0100)]
Attribute suggestion for last change.

16 years agoIf $TERM is empty, don't use colors. This helps the buildbot,
Jim Meyering [Mon, 29 Oct 2007 08:47:52 +0000 (09:47 +0100)]
If $TERM is empty, don't use colors.  This helps the buildbot,

since it produces its result in an environment with a tty, but
we don't want color codes in that case.
* build-aux/check.mk (am__tty_colors): Test for nonempty $TERM.

16 years agoAlways initialize terminal colorization string variables.
Jim Meyering [Mon, 29 Oct 2007 07:41:08 +0000 (08:41 +0100)]
Always initialize terminal colorization string variables.

* build-aux/check.mk (am__tty_colors): Always initialize red, grn, etc.,
In case they're defined in the environment.

16 years agoAvoid test failure in non-srcdir build vs. the git tree.
Jim Meyering [Mon, 29 Oct 2007 06:47:21 +0000 (07:47 +0100)]
Avoid test failure in non-srcdir build vs. the git tree.

* tests/check.mk (vc_exe_in_TESTS): Run this test only in a
srcdir build directory.  Reported by Andreas Schwab.

16 years agoDefine ENOTSUP, not ENOSYS. Needed on OpenBSD 3.9.
Jim Meyering [Sun, 28 Oct 2007 18:04:59 +0000 (19:04 +0100)]
Define ENOTSUP, not ENOSYS.  Needed on OpenBSD 3.9.

* gl/lib/se-context.in.h (ENOTSUP): Define if missing.
* gl/lib/se-selinux.in.h: Likewise.

16 years agoDefine ENODATA, for FreeBSD 5.0 and 6.1.
Jim Meyering [Sun, 28 Oct 2007 17:16:54 +0000 (18:16 +0100)]
Define ENODATA, for FreeBSD 5.0 and 6.1.

* src/system.h (ENODATA): Define, if missing.

16 years agoRun autoreconf, not just autoconf, to avoid warnings.
Jim Meyering [Sun, 28 Oct 2007 14:53:59 +0000 (15:53 +0100)]
Run autoreconf, not just autoconf, to avoid warnings.

* GNUmakefile (dummy): Otherwise, we'd sometimes get a warning
about autoconf version mismatch between what was used to generate
aclocal.m4 and the currently-running autoconf.

16 years agoRequire gnulib's printf-posix module, to support Interix.
Jim Meyering [Sun, 28 Oct 2007 14:38:17 +0000 (15:38 +0100)]
Require gnulib's printf-posix module, to support Interix.

* bootstrap.conf (gnulib_modules): Add printf-posix.

16 years agoHelp xgettext recognize more printf-style format strings.
Jim Meyering [Sun, 28 Oct 2007 14:37:56 +0000 (15:37 +0100)]
Help xgettext recognize more printf-style format strings.

* bootstrap.conf (XGETTEXT_OPTIONS): Add directives for
error, error_at_line, xasprintf, xfprintf and xprintf.

16 years agoAdjust format string so msgfmt doesn't object.
Jim Meyering [Sat, 27 Oct 2007 07:42:27 +0000 (09:42 +0200)]
Adjust format string so msgfmt doesn't object.

* src/df.c (main): Use "%s%s" (not %smsg) to print "msg" with or
without a "Warning: " prefix.  Reported by Clytie Siddall.

16 years agoClean up tests/Makefile.am.
Jim Meyering [Sat, 27 Oct 2007 07:06:11 +0000 (09:06 +0200)]
Clean up tests/Makefile.am.

* tests/Makefile.am (EXTRA_DIST): Remove $(TESTS).  No longer defined.
(TESTS_ENVIRONMENT): Remove definition.

16 years ago* build-aux/check.mk: Merge with latest from Akim.
Jim Meyering [Sat, 27 Oct 2007 07:04:47 +0000 (09:04 +0200)]
* build-aux/check.mk: Merge with latest from Akim.

16 years agoAdd a test for the printf fix of 2007-10-21.
Jim Meyering [Fri, 26 Oct 2007 21:59:43 +0000 (23:59 +0200)]
Add a test for the printf fix of 2007-10-21.

* tests/misc/printf-surprise: New file.  Test for 2007-10-21's fix.
* tests/misc/Makefile.am (TESTS): Add printf-surprise.

16 years agoAdd attribution for the expr.c-vs-xgettext report.
Jim Meyering [Thu, 25 Oct 2007 07:20:44 +0000 (09:20 +0200)]
Add attribution for the expr.c-vs-xgettext report.

16 years agoRemove vestiges of cvs-gnulib-checkout process. Now we use git.
Jim Meyering [Thu, 25 Oct 2007 07:06:29 +0000 (09:06 +0200)]
Remove vestiges of cvs-gnulib-checkout process.  Now we use git.

* bootstrap: Remove support for now-unnecessary option, --cvs-user,
and envvars CVS_USER, CVS_RSH.

2007-10-24  Micah Cowan  <micah@cowan.name>

16 years agoTell xgettext that "ARG1 % ARG2" is not a C format string.
Micah Cowan [Thu, 25 Oct 2007 06:59:30 +0000 (08:59 +0200)]
Tell xgettext that "ARG1 % ARG2" is not a C format string.

* src/expr.c (usage): Add a comment to override xgettext's default
behavior, which would classify "ARG1 % ARG2" as a fprintf-style
format string.

16 years agoAvoid diagnostics from sha1sum when there is no cached checksum.
Jim Meyering [Wed, 24 Oct 2007 20:31:35 +0000 (22:31 +0200)]
Avoid diagnostics from sha1sum when there is no cached checksum.

* bootstrap (update_po_files): Skip the sha1sum check if the po.s1
file hasn't been created yet.

16 years agoGet gnulib from the git repository, not from an obsolete cvs one.
Jim Meyering [Wed, 24 Oct 2007 20:09:57 +0000 (22:09 +0200)]
Get gnulib from the git repository, not from an obsolete cvs one.

* bootstrap: Suggestion from Micah Cowan.

16 years agoDoc improvements.
Jim Meyering [Wed, 24 Oct 2007 07:13:59 +0000 (09:13 +0200)]
Doc improvements.

* README-hacking: Prefer the no-hyphen variant of git commands,
e.g., use "git pull" not "git-pull".
Don't presume that the only way to read this document is via a
prior git clone: provide instructions for cloning coreutils, too.

* README-hacking: Add "cd automake" in build instructions.
From Bob Proulx.

16 years agoDon't fail part 2 of tests/rm/unreadable when run as root.
Jim Meyering [Wed, 24 Oct 2007 06:50:09 +0000 (08:50 +0200)]
Don't fail part 2 of tests/rm/unreadable when run as root.

* tests/rm/unreadable: With UID == 0, expect different results.
Reported by Mike Frysinger.

16 years ago* README-hacking: Refer to LZMA Utils <http://tukaani.org/lzma/>.
Jim Meyering [Tue, 23 Oct 2007 13:44:58 +0000 (15:44 +0200)]
* README-hacking: Refer to LZMA Utils <tukaani.org/lzma/>.

16 years ago* README-hacking: Describe how to build with LZMA.
Paul Eggert [Mon, 22 Oct 2007 21:29:40 +0000 (23:29 +0200)]
* README-hacking: Describe how to build with LZMA.

16 years agoRemove git-version-gen's first parameter.
Jim Meyering [Mon, 22 Oct 2007 19:43:12 +0000 (21:43 +0200)]
Remove git-version-gen's first parameter.

* build-aux/git-version-gen: Add comments.
Remove first command-line parameter.
* configure.ac: Remove corresponding first argument.
* GNUmakefile (_curr-ver): Likewise.

16 years agoAttribute the printf bug report.
Jim Meyering [Sun, 21 Oct 2007 16:19:54 +0000 (18:19 +0200)]
Attribute the printf bug report.

16 years ago* NEWS: Mention the printf fix.
Jim Meyering [Sun, 21 Oct 2007 16:17:30 +0000 (18:17 +0200)]
* NEWS: Mention the printf fix.

16 years agoReorder tests to run more basic ones earlier.
Jim Meyering [Sun, 21 Oct 2007 10:44:32 +0000 (12:44 +0200)]
Reorder tests to run more basic ones earlier.

* tests/misc/Makefile.am (TESTS): Reorder.
* tests/Makefile.am (SUBDIRS): Reorder.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agotr: do not reject an unmatched [:lower:] or [:upper:] in SET1.
Jim Meyering [Sun, 21 Oct 2007 10:38:33 +0000 (12:38 +0200)]
tr: do not reject an unmatched [:lower:] or [:upper:] in SET1.

* NEWS: Mention this.
* src/tr.c (get_next) [RE_CHAR_CLASS]: Don't skip the loop when
processing [:lower:] and [:upper:].
(main): Require [:lower:] or [:upper:] in SET1 only when
when one of those is specified in SET2.
* tests/tr/Test.pm: Add tests for this fix.
Reported by Per Starbäck.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years ago* tests/misc/help-version: Add a comment.
Jim Meyering [Sat, 20 Oct 2007 19:50:43 +0000 (21:50 +0200)]
* tests/misc/help-version: Add a comment.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoDetect printf(3) failure due to ENOMEM.
Jim Meyering [Sat, 20 Oct 2007 12:48:29 +0000 (14:48 +0200)]
Detect printf(3) failure due to ENOMEM.

* src/printf.c: Include "xprintf.h"
(print_direc): Use xprintf, rather than printf.
* bootstrap.conf (gnulib_modules): Add xprintf.
* po/POTFILES.in: Add lib/xprintf.c.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoPut always-failing programs first in PATH, so tests cannot mistakenly run installed...
Jim Meyering [Sat, 20 Oct 2007 12:41:50 +0000 (14:41 +0200)]
Put always-failing programs first in PATH, so tests cannot mistakenly run installed versions.

* Makefile.maint (my-distcheck): Set up a bogus bin/ dir, to be used
for "make check".

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years ago* doc/coreutils.texi: Add a cross-reference to bashref's Process Substitution node.
Jim Meyering [Sat, 20 Oct 2007 11:53:45 +0000 (13:53 +0200)]
* doc/coreutils.texi: Add a cross-reference to bashref's Process Substitution node.

16 years ago* doc/coreutils.texi (tee invocation): Fix typo. Add a little.
Jim Meyering [Sat, 20 Oct 2007 10:00:54 +0000 (12:00 +0200)]
* doc/coreutils.texi (tee invocation): Fix typo.  Add a little.

16 years agoAdjust tests to pass, now that Test.pm ones use check.mk.
Jim Meyering [Sat, 20 Oct 2007 08:07:12 +0000 (10:07 +0200)]
Adjust tests to pass, now that Test.pm ones use check.mk.

* tests/check.mk (vc_exe_in_TESTS): Adjust regexp not to match the
"TESTS = $x-tests" line in each Test.pm-derived Makefile.am file.
* tests/sort/main: Remove this unused file.

16 years agoEnsure that Test.pm-derived tests use the right $PATH.
Jim Meyering [Sat, 20 Oct 2007 07:06:39 +0000 (09:06 +0200)]
Ensure that Test.pm-derived tests use the right $PATH.

* tests/Makefile.am.in: Include $(top_srcdir)/tests/check.mk.

16 years agoPrevent "make check" from leaving mktemp /tmp/tmp.* files behind.
Bob Proulx [Sat, 20 Oct 2007 06:26:57 +0000 (08:26 +0200)]
Prevent "make check" from leaving mktemp /tmp/tmp.* files behind.

* tests/misc/help-version (mktemp_args): Tell mktemp to create
its temporary file in the current directory.

16 years agoShow how to make tee redirect to multiple processes.
Jim Meyering [Tue, 9 Oct 2007 10:24:14 +0000 (12:24 +0200)]
Show how to make tee redirect to multiple processes.

16 years agoPull all TESTS_ENVIRONMENT settings "up" into tests/check.mk.
Jim Meyering [Sun, 14 Oct 2007 19:47:08 +0000 (21:47 +0200)]
Pull all TESTS_ENVIRONMENT settings "up" into tests/check.mk.

* tests/Makefile.am.in (TESTS_ENVIRONMENT): Remove definition.
* tests/chgrp/Makefile.am: Likewise.
* tests/chmod/Makefile.am: Likewise.
* tests/chown/Makefile.am: Likewise.
* tests/cp/Makefile.am: Likewise.
* tests/dd/Makefile.am: Likewise.
* tests/du/Makefile.am: Likewise.
* tests/install/Makefile.am: Likewise.
* tests/ln/Makefile.am: Likewise.
* tests/ls/Makefile.am: Likewise.
* tests/misc/Makefile.am: Likewise.
* tests/mkdir/Makefile.am: Likewise.
* tests/mv/Makefile.am: Likewise.
* tests/readlink/Makefile.am: Likewise.
* tests/rm/Makefile.am: Likewise.
* tests/rmdir/Makefile.am: Likewise.
* tests/tail-2/Makefile.am: Likewise.
* tests/touch/Makefile.am: Likewise.
* tests/check.mk (TESTS_ENVIRONMENT) [EXEEXT, EGREP, MAKE, PERL]:
[CONFIG_HEADER, build_programs, host_os, host_triplet, PATH]:
[REPLACE_GETCWD, CU_TEST_NAME]: Add definitions here.
* tests/misc/pwd-long: Use $abs_top_builddir/src, not $BUILD_SRC_DIR.
* tests/dd/skip-seek: Don't use $ENV{PROG}.
* tests/rm/empty-name: Likewise.
* tests/rm/unreadable: Likewise.
* tests/mv/i-1: Likewise.

16 years agoFix a minor typo.
Jim Meyering [Sun, 14 Oct 2007 11:35:34 +0000 (13:35 +0200)]
Fix a minor typo.

* configure.ac (AC_INIT): Fix a typo (s/9.6/6.9/) that makes a
difference only when running "make dist" without a .git/ subdir.

16 years agoMove the help-version test into misc/.
Jim Meyering [Tue, 9 Oct 2007 15:12:45 +0000 (17:12 +0200)]
Move the help-version test into misc/.

* tests/help-version: Move to...
* tests/misc/help-version: ...here.
Source test-lib.sh, as usual.
Use $abs_top_builddir, rather than ".." and "../..".

16 years agoMake the runcon-no-reorder test slightly more general.
Jim Meyering [Tue, 9 Oct 2007 13:48:51 +0000 (15:48 +0200)]
Make the runcon-no-reorder test slightly more general.

* tests/misc/runcon-no-reorder: Don't hard-code "unconstrained_t".
Use slightly more general "runcon $(id -Z)".
Suggestion from Stephen Smalley.

16 years agoSkip the chcon test on a system with no SELinux support.
Jim Meyering [Tue, 9 Oct 2007 07:58:27 +0000 (09:58 +0200)]
Skip the chcon test on a system with no SELinux support.

* tests/test-lib.sh (require_selinux_): New function.
* tests/misc/chcon: Use it.
* tests/misc/selinux: Use it here, too.
* tests/cp/cp-a-selinux: and here.
* tests/selinux: Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove selinux.
Reported by Mike Frysinger and Bauke Jan Douma.

16 years ago* src/dircolors.hin: Recognize .lzma as a compressed-file suffix.
Jim Meyering [Tue, 9 Oct 2007 07:39:13 +0000 (09:39 +0200)]
* src/dircolors.hin: Recognize .lzma as a compressed-file suffix.

16 years ago* configure.ac (AM_INIT_AUTOMAKE): Use dist-lzma, rather than dist-bzip2.
Jim Meyering [Tue, 9 Oct 2007 07:37:43 +0000 (09:37 +0200)]
* configure.ac (AM_INIT_AUTOMAKE): Use dist-lzma, rather than dist-bzip2.

16 years agoNow that we don't install su, don't make misleading suggestions.
Jim Meyering [Tue, 9 Oct 2007 07:33:48 +0000 (09:33 +0200)]
Now that we don't install su, don't make misleading suggestions.

* src/Makefile.am (install-exec-local) [$(INSTALL_SU) != yes]:
Don't suggest running "make install-root".
(uninstall-local) [$(INSTALL_SU) != yes]: Don't even check
the installed binary.

16 years agoWhen forming a truncated name, use the "[...]" prefix even for
Jim Meyering [Mon, 8 Oct 2007 08:34:04 +0000 (10:34 +0200)]
When forming a truncated name, use the "[...]" prefix even for
an extremely long name in the current directory.

* src/remove.c (full_filename_): Rename a local variable.
Use two separate "truncated" variables, in case the second
call to right_justify does not indicate any truncation -- which
would happen only if the single component FILENAME were longer
than 511 bytes and DIR_NAME were empty.

16 years agorm could malfunction under unusual circumstances:
Jim Meyering [Sun, 7 Oct 2007 20:58:29 +0000 (22:58 +0200)]
rm could malfunction under unusual circumstances:

When operating on a relative name longer than 511 bytes,
and (when either processing a directory that is neither writable
nor readable (but still searchable) or when determining whether
to prompt), and encountering an ENOMEM error while forming the
file name, rm would operate on a truncated-to-511-byte name
starting with "[...]" rather than the intended one.
* NEWS: Describe the bugs.
* src/remove.c: Correct two misuses of full_filename:
(full_filename0, xfull_filename): New functions.
(full_filename_): Rewrite to use full_filename0.
(AD_pop_and_chdir): Use xfull_filename, not full_filename.
(write_protected_non_symlink): Likewise.

16 years agoDon't let a helper function modify errno.
Jim Meyering [Sun, 7 Oct 2007 19:55:42 +0000 (21:55 +0200)]
Don't let a helper function modify errno.

* src/remove.c (full_filename_): Save and restore errno.
Spotted by Bruno Haible.

16 years agoReflect 2->3 GPL copyright version update in gnulib.
Jim Meyering [Sun, 7 Oct 2007 19:04:14 +0000 (21:04 +0200)]
Reflect 2->3 GPL copyright version update in gnulib.

* gl/lib/tempname.h: Update copyright from gnulib.
* gl/lib/tempname.c: Likewise.
* .x-sc_GPL_version: Don't make an exception for those two files.

16 years ago* configure.ac (AM_INIT_AUTOMAKE): Don't use dist-lzma just yet.
Jim Meyering [Sun, 7 Oct 2007 18:33:57 +0000 (20:33 +0200)]
* configure.ac (AM_INIT_AUTOMAKE): Don't use dist-lzma just yet.

16 years agoNew program: mktemp.
Jim Meyering [Sat, 2 Jun 2007 21:04:10 +0000 (23:04 +0200)]
New program: mktemp.

* NEWS: Mention this.
* README: Add mktemp to the list.
* AUTHORS: Add this: mktemp: Jim Meyering
* src/mktemp.c: New file.
* src/Makefile.am (bin_PROGRAMS): Add mktemp.
(mktemp_LDADD): Add $(LIB_GETHRXTIME).
* man/mktemp.x: New file.
* man/Makefile.am (dist_man_MANS): Add mktemp.1.
(mktemp.1): New dependency.
* man/.cvsignore: Add mktemp.1.
* man/.gitignore: New file.
* src/.cvsignore, src/.gitignore: Add mktemp.
* tests/misc/mktemp: New file.
* tests/misc/Makefile.am (TESTS): Add mktemp.
* tests/Coreutils.pm (run_tests): Give the POST-test function
access to stdout and stderr contents, so it can verify that
the named-on-stdout file/dir does indeed exist and has proper
permissions, etc.
[po/ChangeLog]
* POTFILES.in: Add src/mktemp.c.

16 years agoMake tempname more random, via the randint module.
Jim Meyering [Sat, 1 Sep 2007 08:33:33 +0000 (10:33 +0200)]
Make tempname more random, via the randint module.

* gl/modules/tempname (Depends-on): Add randint and stdbool.
* gl/lib/tempname.c: Include randint.h and stdbool.h.
(uint64_t): Remove definition.  Not needed.
[_LIBC] (RANDOM_BITS): Remove this block, now that we have proper random bits.
(check_x_suffix): New function.
(gen_tempname_len): Rename from __gen_tempname.
Add a parameter, x_suffix_len, telling how many X's there must be at
the end of the template.
Use pseudo-random numbers all the way, rather than adding 7777
from one iteration to the next.
(__gen_tempname): New function, to call gen_tempname_len, requiring a
suffix length of 6.
* gl/lib/tempname.h: Add prototype for gen_tempname_len.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoConvert coreutils' rand*.{c,h,m4} into modules.
Jim Meyering [Sat, 1 Sep 2007 07:54:45 +0000 (09:54 +0200)]
Convert coreutils' rand*.{c,h,m4} into modules.

First step: move these files to gl/lib:
* lib/rand-isaac.c, lib/rand-isaac.h
* lib/randint.c, lib/randint.h
* lib/randperm.c, lib/randperm.h
* lib/randread.c, lib/randread.h

Step 2: add modules/rand* and remove now-unneeded .m4 files.
* gl/modules/randint: New file.
* gl/modules/randperm: New file.
* gl/modules/randread: New file.
* m4/randint.m4: Remove file.
* m4/randperm.m4: Remove file.
* m4/randread.m4: Remove file.

Step 3: use the new modules
* bootstrap.conf (gnulib_modules): Add randint and randperm.
* m4/prereq.m4 (gl_RANDINT, gl_RANDREAD, gl_RANDPERM): Don't require;
These have been removed.
(gl_ROOT_DEV_INO): Don't require; already handled via bootstrap.conf.

16 years agoCopy from gnulib the parts of tempname that we'll modify.
Jim Meyering [Sat, 1 Sep 2007 09:33:00 +0000 (11:33 +0200)]
Copy from gnulib the parts of tempname that we'll modify.

* gl/lib/tempname.c: Copy from gnulib.
* gl/lib/tempname.h: Likewise.
* gl/modules/tempname: Likewise.

Allow GPLv2 on temporarily(?)-imported file from gnulib/libc.
* .x-sc_GPL_version: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_GPL_version

16 years agoAvoid a pseudo-leak in sort.
Jim Meyering [Sun, 7 Oct 2007 16:41:33 +0000 (18:41 +0200)]
Avoid a pseudo-leak in sort.

* src/sort.c (main) [lint]: Avoid a nominal leak.

16 years agoUse puts, rather than printf ("%s\n". Slightly cleaner.
Jim Meyering [Sun, 7 Oct 2007 16:16:00 +0000 (18:16 +0200)]
Use puts, rather than printf ("%s\n".  Slightly cleaner.

* src/tsort.c (tsort): ...and more efficient.

16 years agoAvoid seq malfunction on non-POSIX systems: mingw, BeOS, Interix.
Jim Meyering [Sun, 7 Oct 2007 14:15:49 +0000 (16:15 +0200)]
Avoid seq malfunction on non-POSIX systems: mingw, BeOS, Interix.

* bootstrap.conf (gnulib_modules): Add vasprintf-posix.
Suggestion from Bruno Haible.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoAvoid a used-uninitialized error.
Jim Meyering [Sun, 7 Oct 2007 14:06:59 +0000 (16:06 +0200)]
Avoid a used-uninitialized error.

* src/copy.c (copy_internal): Don't overload "use_stat".

16 years agoMake a failing cross-partition mv give a sensible diagnostic.
Jim Meyering [Fri, 5 Oct 2007 08:55:26 +0000 (10:55 +0200)]
Make a failing cross-partition mv give a sensible diagnostic.

A cross-partition move of a file in a sticky tmpdir and owned by
another user would evoke an invalid diagnostic after copying it:

  mv: cannot remove `x': Operation not permitted

Either of the following (mv.c, remove.c) changes would fix the bug by
itself.  I think it's slightly better to use both; the added cost is
minimal: mv: an extra lstat-per-mv-cmdline-arg-that-goes-cross-partition,
rm: an extra lstat-per-unlink-that-fails-w/EPERM.
* src/remove.c (remove_entry): Also lstat the file upon EPERM.
* src/mv.c (rm_option_init): Initialize root_dev_ino just as is done
in rm, so that a cross-partition invoked remove.c:rm call works the
same way as one invoked from the command-line use of "rm".  That
setting of root_dev_ino makes rm() do the equivalent of an additional
lstat for each argument, which in turn gives rm enough information to
issue the right diagnostic.
* tests/mv/sticky-to-xpart (version): New file.  Test for the above.
* tests/mv/Makefile.am (TESTS): Add sticky-to-xpart.
Arrange for "make check-root" to run the new root-only test.
* tests/Makefile.am (tb): New target, to run the new root-only test.
(all_t): Add tb.
* src/c99-to-c89.diff: Adjust offsets.

16 years agoAdd PACKAGE_VERSION to TESTS_ENVIRONMENT via check.mk.
Jim Meyering [Fri, 5 Oct 2007 10:14:16 +0000 (12:14 +0200)]
Add PACKAGE_VERSION to TESTS_ENVIRONMENT via check.mk.

* tests/check.mk (TESTS_ENVIRONMENT): Add PACKAGE_VERSION here,
rather than in every Makefile.am that needs it.
* tests/rm/Makefile.am (TESTS_ENVIRONMENT): Remove PACKAGE_VERSION.
* tests/misc/Makefile.am (TESTS_ENVIRONMENT): Likewise.

16 years agoList two systems on which chroot works when run by non-root.
Jim Meyering [Fri, 5 Oct 2007 06:58:22 +0000 (08:58 +0200)]
List two systems on which chroot works when run by non-root.

16 years agoAdapt to new gnulib naming scheme.
Jim Meyering [Thu, 4 Oct 2007 10:26:38 +0000 (12:26 +0200)]
Adapt to new gnulib naming scheme.
* gl/lib/se-context.in.h: Rename from gl/lib/se-context_.h.
* gl/lib/se-selinux.in.h: Rename from gl/lib/se-selinux_.h.
* gl/m4/selinux-context-h.m4: Remove use of AC_LIBSOURCES.
* gl/m4/selinux-selinux-h.m4: Likewise.
* gl/modules/selinux-h (Files, Makefile.am): Reflect renaming.
(Makefile.am) [lib_SOURCES]: Add se-context.in.h and se-selinux.in.h.

16 years agolib/search_.h: Remove unused file.
Jim Meyering [Thu, 4 Oct 2007 10:20:27 +0000 (12:20 +0200)]
lib/search_.h: Remove unused file.

16 years ago* bootstrap (update_po_files): Work also when there are no .po files in po/.
Jim Meyering [Thu, 4 Oct 2007 09:55:31 +0000 (11:55 +0200)]
* bootstrap (update_po_files): Work also when there are no .po files in po/.

16 years ago* bootstrap (slurp): Adapt to _.h -> .in.h name change.
Jim Meyering [Thu, 4 Oct 2007 09:41:48 +0000 (11:41 +0200)]
* bootstrap (slurp): Adapt to _.h -> .in.h name change.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoRemove test program: lib/t-fpending.c.
Jim Meyering [Thu, 4 Oct 2007 08:26:05 +0000 (10:26 +0200)]
Remove test program: lib/t-fpending.c.

* lib/t-fpending.c: Remove file.  Now, this test is in gnulib.
* lib/Makefile.am: Remove associated rules.
* .gitignore: Remove lib/t-fpending.

16 years ago* tests/misc/selinux: Skip this test if the initial chcon fails.
Jim Meyering [Wed, 3 Oct 2007 10:56:32 +0000 (12:56 +0200)]
* tests/misc/selinux: Skip this test if the initial chcon fails.

16 years agoNever copy through a symlink that cp has just created.
Jim Meyering [Tue, 2 Oct 2007 09:10:22 +0000 (11:10 +0200)]
Never copy through a symlink that cp has just created.

* src/copy.c (copy_internal): When same-file detection requires
'stat'ing the destination file, also 'lstat' it and ensure that
it wasn't the destination of a preceding copy operation.
This bug was introduced on 2007-06-18.
* tests/cp/abuse: New test for the above.
* tests/cp/Makefile.am (TESTS): Add abuse.

16 years agocp: do not abbreviate in --help output.
Jim Meyering [Sun, 30 Sep 2007 07:05:10 +0000 (09:05 +0200)]
cp: do not abbreviate in --help output.

* src/cp.c (usage): Don't abbreviate: s/=link/=links/.
Reported by Géraud Meyer in <http://bugs.debian.org/444137>.

Signed-off-by: Jim Meyering <jim@meyering.net>
16 years agoFix testsuite on cygwin.
Eric Blake [Sat, 29 Sep 2007 14:56:50 +0000 (08:56 -0600)]
Fix testsuite on cygwin.

* check.mk (%.log): Also allow suffix-less tests, on platforms
where $(EXEEXT) is not empty.

Signed-off-by: Eric Blake <ebb9@byu.net>
16 years agoTest previous patch.
Eric Blake [Sat, 29 Sep 2007 14:49:20 +0000 (08:49 -0600)]
Test previous patch.

* tests/misc/groups-dash: New test.
* tests/misc/Makefile.am (TESTS): Add it.

Signed-off-by: Eric Blake <ebb9@byu.net>
16 years ago* src/groups.sh: Don't ignore first argument if later argument is --.
Eric Blake [Fri, 28 Sep 2007 23:09:30 +0000 (23:09 +0000)]
* src/groups.sh: Don't ignore first argument if later argument is --.

Signed-off-by: Eric Blake <ebb9@byu.net>
16 years agoAvoid spurious test failure when SELinux stats "selinux/class".
Jim Meyering [Thu, 27 Sep 2007 20:37:23 +0000 (22:37 +0200)]
Avoid spurious test failure when SELinux stats "selinux/class".

* tests/ls/stat-free-symlinks: Grep for more precise /^stat("x"/.

16 years agoMove file-set and hash-triple modules to gnulib.
Jim Meyering [Tue, 25 Sep 2007 20:24:21 +0000 (22:24 +0200)]
Move file-set and hash-triple modules to gnulib.

* bootstrap.conf (gnulib_modules): Remove file-set, now that
it's in gnulib, and the canonicalize module requires it there.
* gl/lib/file-set.c, gl/lib/file-set.h, gl/modules/hash-triple: Remove.
* gl/lib/hash-triple.c, gl/lib/hash-triple.h, gl/modules/file-set: Remove.

16 years agoAdd a test to exercise a readlink bug.
Jim Meyering [Mon, 24 Sep 2007 07:53:57 +0000 (09:53 +0200)]
Add a test to exercise a readlink bug.

* tests/misc/readlink-fp-loop: New file.  Test for the readlink bug
fixed through today's change to Gnulib's canonicalize module.
* tests/misc/Makefile.am (TESTS): Add readlink-fp-loop.
Bug report and a test case from mpb.mail@gmail.com.

16 years agoMake "Date input formats" easier to find in info file
Pádraig Brady [Tue, 25 Sep 2007 17:00:04 +0000 (18:00 +0100)]
Make "Date input formats" easier to find in info file

* doc/coreutils.texi (date invocation):
`man date` gives all options for the date command except
the description of the date input formats. Therefore it
should be easy to browse to this info using `info date`.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
16 years agoUse XOR, not OR to combine bits.
Jim Meyering [Tue, 25 Sep 2007 19:27:14 +0000 (21:27 +0200)]
Use XOR, not OR to combine bits.

* gl/lib/hash-triple.c (triple_hash): Use XOR (^), not OR (|), to
combine the bits from hashing the name and those of the inode number.
Add a few comments and remove out-of-context ones.

16 years ago* NEWS: The recent rm-diagnostic fix also affects cross-partition "mv".
Jim Meyering [Mon, 24 Sep 2007 14:33:35 +0000 (16:33 +0200)]
* NEWS: The recent rm-diagnostic fix also affects cross-partition "mv".

16 years agocopy.c: Remove definitions of factored-out functions.
Jim Meyering [Mon, 24 Sep 2007 13:09:17 +0000 (15:09 +0200)]
copy.c: Remove definitions of factored-out functions.

* src/copy.c: Include "file-set.h".
(seen_file, record_file): Remove functions that I factored
out on 2007-08-23.