Stefano Lattarini [Sun, 22 Apr 2012 22:41:05 +0000 (23:41 +0100)]
maint: sync up required autoconf version in bootstrap.conf
* bootstrap.conf ($buildreq): Require autoconf 2.64, not 2.62. This is
consistent with what is required by AC_PREREQ in configure.ac.
Jim Meyering [Fri, 16 Mar 2012 07:31:28 +0000 (08:31 +0100)]
doc: fix a grammar nit
* doc/coreutils.texi (split invocation): s/are/is/ in "P or Q are".
Bernhard Voelker [Tue, 10 Apr 2012 08:10:50 +0000 (10:10 +0200)]
tests: factor out expensive "pairs" code of misc/stty
* tests/Makefile.am (TESTS): Add misc/stty-pairs.
* tests/init.cfg (stty_reversible_init_): New function.
(stty_reversible_query_): New function.
* tests/misc/stty: Factor out expensive "pairs" code into new test.
Use new stty_reversible_* functions instead of evaluating static
REV_* variables.
* tests/misc/stty-pairs: Add new test. Code added from misc/stty.
Mark this as an expensive test. Skip 'parenb' and 'cread' options,
as these tests are known to fail. Like in misc/stty, also use
the new stty_reversible_* functions.
Bernhard Voelker [Thu, 5 Apr 2012 06:01:43 +0000 (08:01 +0200)]
tests: add iutf8 option to misc/stty
* tests/misc/stty: Add iutf8 to the list of REV_* options.
That option has been implemented in commit v5.2.1-193-g733e79e.
Jim Meyering [Thu, 19 Apr 2012 09:32:04 +0000 (11:32 +0200)]
maint: tac: use memcpy, not strcpy
* src/tac.c (main): Use memcpy, not strcpy, since we know the length.
Jim Meyering [Wed, 18 Apr 2012 12:49:22 +0000 (14:49 +0200)]
maint: ls: use stpncpy/stpcpy, not strncpy/strcpy
* src/ls.c (gobble_file): Move a decl "down".
(make_link_name): Do not hard-code '/'. Use IS_ABSOLUTE_FILE_NAME
and dir_len instead.
Use stpcpy/stpncpy in place of strncpy/strcpy.
Jim Meyering [Wed, 18 Apr 2012 11:36:11 +0000 (13:36 +0200)]
maint: modernize/clean-up a small function in ls.c
* src/ls.c (make_link_name): Adjust comment style to refer to VARIABLE
names, not 'variable'.
Move each of two declarations "down" to first use.
Compare pointer to NULL, not to 0.
Don't reuse local, "linkbuf" for a different purpose.
Jim Meyering [Wed, 18 Apr 2012 18:16:39 +0000 (20:16 +0200)]
doc: tweak README-hacking
* README-hacking: Don't say "...on your hard drive".
That is unnecessary, and now, borderline anachronistic.
Jim Meyering [Mon, 16 Apr 2012 18:26:41 +0000 (20:26 +0200)]
doc: use @xref{... only at start of a sentence
* doc/coreutils.texi: Correct many misuses of @xref.
Jim Meyering [Mon, 16 Apr 2012 13:12:02 +0000 (15:12 +0200)]
maint: replace a use of strcpy in chmod.c with memcpy
* src/chmod.c (main): Use memcpy rather than strcpy,
since we already have the length handy.
Karl Berry [Sat, 14 Apr 2012 08:06:32 +0000 (10:06 +0200)]
doc: remove a little direntry redundancy
* doc/coreutils.texi (Basics direntry): Remove 3rd "Common options."
Bruce Korb [Fri, 6 Apr 2012 00:13:14 +0000 (17:13 -0700)]
fmt: accept new --goal=WIDTH (-g) option
Accept -g for BSD/Plan9 compatibility.
* NEWS (New features): Mention it.
* tests/fmt/goal-option: New test.
* tests/fmt/long-line: Rename from tests/fmt-long-line.
* tests/fmt/base: Rename from tests/misc/fmt.
* doc/coreutils.texi: Document it.
* src/fmt.c (main): Accept the new option
(check_for_goals): new function to implement the operands
Based on BSD's and Plan-9's fmt programs.
Pádraig Brady [Thu, 12 Apr 2012 11:47:30 +0000 (12:47 +0100)]
cp: change --attributes-only to not truncate existing files
* src/copy.c (copy_reg): Don't truncate an existing file,
to support copying attributes between existing files.
The original use case only considered creating new files,
and it would be a very unusual use case to be relying
on the truncating behavior.
* doc/coreutils.texi (cp invocation): Mention the non
truncating behavior.
* tests/cp/attr-existing: A new test to ensure O_TRUNC skipped.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the change in behavior.
Andreas Schwab [Wed, 4 Apr 2012 13:06:17 +0000 (15:06 +0200)]
tests: avoid unnecessary subshells in misc/stty
* tests/misc/stty: Don't waste a subshell to perform this:
eval rev=\$REV_$opt. Fix rev1,rev2 assignments similarly.
Jim Meyering [Wed, 4 Apr 2012 12:05:44 +0000 (14:05 +0200)]
build: update gnulib submodule to latest
Jim Meyering [Wed, 4 Apr 2012 12:29:44 +0000 (14:29 +0200)]
tests: correct reversed args to "compare"
* tests/misc/sort-discrim: Correct reversed args to "compare".
This nit was masked by a bug in maint.mk that effectively disabled
many of the syntax-check rules.
Jim Meyering [Wed, 4 Apr 2012 10:34:22 +0000 (12:34 +0200)]
tests: new syntax-check rule to prohibit use of `...` in tests/
* cfg.mk (sc_prohibit_test_backticks): New rule. Exempt 3 files.
Jim Meyering [Tue, 3 Apr 2012 19:42:48 +0000 (21:42 +0200)]
tests: remove nearly all remaining backticks
* tests/rm/isatty: Remove now-unneeded "# `" line.
* tests/misc/ls-time: Likewise.
* tests/misc/date-sec: Remove stray "`" in comment.
* tests/du/long-sloop: Likewise.
* tests/mv/part-symlink: Replace multi-line `...` by $(...).
* tests/mv/sticky-to-xpart: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/ls/nameless-uid: Likewise.
* tests/cp/perm: Likewise.
* tests/cp/preserve-gid: Likewise.
* tests/cp/same-file: Likewise.
Jim Meyering [Tue, 3 Apr 2012 19:34:57 +0000 (21:34 +0200)]
tests: use perl's qx!...! rather than `...`
* tests/misc/expr: As above.
* tests/misc/ls-misc: Likewise.
* tests/misc/pwd-long: Likewise.
* tests/misc/uniq: Likewise.
Jim Meyering [Tue, 3 Apr 2012 18:32:44 +0000 (20:32 +0200)]
tests: convert nearly all `...` expressions to $(...)
Exempt init.sh because it runs before we're assured to have a
shell that groks $(...). Exempt *.mk because "$" would have to
be doubled, and besides, any `...` expression in a .mk file is
almost certainly evaluated before init.sh is run. Finally, also
exempt the perl-based tests, because perl's `...` cannot be
converted to $(...). Do that by running this command:
git grep -l '`.*`' tests \
| grep -Ev 'init\.sh|\.mk$' | xargs grep -Lw perl \
| xargs perl -pi -e 's/`(.*?)`/\$($1)/g'
One minor fix-up change was required after that, due to how
quoting differs:
diff --git a/tests/chmod/equals b/tests/chmod/equals
- expected_perms=$(eval 'echo \$expected_'$dest)
+ expected_perms=$(eval 'echo $expected_'$dest)
Another was to make these required quoting adjustments:
diff --git a/tests/misc/stty b/tests/misc/stty
...
- rev=$(eval echo "\\\$REV_$opt")
+ rev=$(eval echo "\$REV_$opt")
...
- rev1=$(eval echo "\\\$REV_$opt1")
- rev2=$(eval echo "\\\$REV_$opt2")
+ rev1=$(eval echo "\$REV_$opt1")
+ rev2=$(eval echo "\$REV_$opt2")
Also, transform two files that were needlessly excluded above:
(both use perl, but are mostly bourne shell)
perl -pi -e 's/`(.*?)`/\$($1)/g' \
tests/du/long-from-unreadable tests/init.cfg
Jim Meyering [Tue, 3 Apr 2012 18:04:20 +0000 (20:04 +0200)]
tests: convert one `...` expression manually
* tests/ls/stat-vs-dirent: Manually convert `(...)` to $(...),
to avoid automatically producing an invalid result.
Jim Meyering [Sun, 18 Mar 2012 01:33:53 +0000 (02:33 +0100)]
tests: fix quoting bug in misc/nohup
* tests/misc/nohup: Fix invalid quoting.
Jim Meyering [Tue, 3 Apr 2012 14:14:32 +0000 (16:14 +0200)]
doc: identify/refer to source of each fixed bug in log and in NEWS
* HACKING (Commit log requirements): Describe our policy: when you
fix a bug, put the "git describe" string of the bug-introducing commit
in your commit log and put the "fixed-in-release version number"
in the NEWS blurb.
Jim Meyering [Mon, 2 Apr 2012 20:32:57 +0000 (22:32 +0200)]
tests: avoid spurious misc/expr failure on AIX 6.1
* tests/misc/expr: Avoid spurious failure on AIX 6.1 due to
differing regexp diagnostic. Reported by Michael Felt.
Paul Eggert [Wed, 28 Mar 2012 20:26:12 +0000 (13:26 -0700)]
chmod: undo previous change
It's not portable; see <http://bugs.gnu.org/11108#17>.
* src/chmod.c, NEWS: Undo previous change.
Paul Eggert [Tue, 27 Mar 2012 17:02:59 +0000 (10:02 -0700)]
chmod: fix symlink race condition
* NEWS: Document this.
* src/chmod.c (process_file): Don't follow symlink if we
think the file is not a symlink.
Jim Meyering [Mon, 26 Mar 2012 18:56:44 +0000 (20:56 +0200)]
tests: remove temporary skip for sort-stale-thread-mem failure
* tests/misc/sort-stale-thread-mem: Invoke framework_failure_, now,
hoping that valgrind is fixed (or we add exclusions) before the
next release.
Jim Meyering [Mon, 26 Mar 2012 12:15:35 +0000 (14:15 +0200)]
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
Jim Meyering [Mon, 26 Mar 2012 12:06:43 +0000 (14:06 +0200)]
version 8.16
* NEWS: Record release date.
Jim Meyering [Mon, 26 Mar 2012 11:52:58 +0000 (13:52 +0200)]
tests: work around F17-valgrind sort-stale-thread-mem failure
* tests/misc/sort-stale-thread-mem: Skip upon known failure.
Jim Meyering [Mon, 26 Mar 2012 05:38:27 +0000 (07:38 +0200)]
doc: use $(...), not `...` in documentation and comments
* doc/coreutils.texi (dircolors invocation, Examples of expr):
(shred invocation, seq invocation): Use $(...), not `...`.
* src/mv.c (do_move): Likewise, in a comment.
Jim Meyering [Fri, 23 Mar 2012 17:39:11 +0000 (18:39 +0100)]
tests: skip ls/stat-free-color on XFS, rather than always failing
* tests/init.cfg (require_dirent_d_type_): Manually skip when
"." is an xfs file system.
Jim Meyering [Fri, 23 Mar 2012 09:53:56 +0000 (10:53 +0100)]
tests: skip part of dd/sparse on some file systems
* tests/dd/sparse: The last two parts of this test would fail due to
the underlying file system at least on Solaris 10 with NFS. That file
system would report that a 3MiB file was occupying <= 1KiB of space
for nearly 50 seconds after creation.
Improved-by: Bernhard Voelker
Pádraig Brady [Thu, 22 Mar 2012 21:22:20 +0000 (21:22 +0000)]
maint: avoid a doc syntax check failure
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/2315847
* doc/coreutils.texi (ln invocation): s/path/file name/
Harald Hoyer [Thu, 22 Mar 2012 20:51:20 +0000 (20:51 +0000)]
ln: add the --relative option
With the "--relative --symbolic" options, ln computes the relative
symbolic link for the user.
So, ln works just as cp, but creates relative symbolic links instead
of copying the file.
I miss this feature since the beginning of using ln.
$ tree ./
/
`-- usr
|-- bin
`-- lib
`-- foo
`-- foo
4 directories, 1 file
$ ln -s -v --relative usr/lib/foo/foo usr/bin/foo
‘usr/bin/foo’ -> ‘../lib/foo/foo’
$ tree ./
/
`-- usr
|-- bin
| `-- foo -> ../lib/foo/foo
`-- lib
`-- foo
`-- foo
4 directories, 2 files
$ ln -s -v --relative usr/bin/foo usr/lib/foo/link-to-foo
‘usr/lib/foo/link-to-foo’ -> ‘foo’
$ tree ./
/
`-- usr
|-- bin
| `-- foo -> ../lib/foo/foo
`-- lib
`-- foo
|-- link-to-foo -> foo
`-- foo
4 directories, 3 files
* src/Makefile.am: Reference the relpath module.
* src/ln.c (usage): Mention the new option.
(do_link): Call the relative conversion if specified.
(convert_abs_rel): Perform the relative conversion
using the relpath module.
* tests/ln/relative: Add a new test.
* tests/Makefile.am: Reference the new test.
* doc/coreutils.texi: Document the new feature.
* NEWS: Mention the new feature.
Pádraig Brady [Thu, 22 Mar 2012 20:34:57 +0000 (20:34 +0000)]
maint: refactor relpath() from `realpath` for use by `ln`
* src/relpath.c: Refactored from realpath.c and adjusted
to support returning the relative path rather than just
printing to stdout.
* src/relpath.h: Export the relpath function.
* src/Makefile.am: Reference the refactored relpath module.
* po/POTFILES.in: Likewise.
* src/realpath.c: Adjust to the refactored relpath module.
Pádraig Brady [Thu, 22 Mar 2012 04:50:26 +0000 (04:50 +0000)]
maint: ensure PATH_MAX is set correctly
This reverts part of commit v8.12-103-g54cbe6e.
* src/system.h: Include gnulib's pathmax.h to honor
system specific limits, and then we set PATH_MAX only if needed.
Note pathmax.h no longer uses pathconf ("/", _PC_PATH_MAX).
Note I didn't reinstate the comments about limits.h inclusion
order, because pathmax.h includes limits.h anyway.
Jim Meyering [Tue, 20 Mar 2012 18:45:05 +0000 (19:45 +0100)]
build: add numerous gnulib modules, mostly for improved portability
* bootstrap.conf (gnulib_modules): Add numerous modules for
improved portability. Reported by Eric Blake in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2426/focus=2489
* po/POTFILES.in: Add new files.
Jim Meyering [Tue, 20 Mar 2012 20:09:31 +0000 (21:09 +0100)]
build: update gnulib submodule to latest
Jim Meyering [Tue, 20 Mar 2012 18:21:01 +0000 (19:21 +0100)]
maint: use more modern fseeko, rather than fseek
* src/tac.c (temp_stream): Use fseeko, not fseek, on principle:
use the more modern interface. In general it is better to avoid
fseek due to its ABI-imposed 4GiB limit on the "offset", here its
use was fine because the offset was always 0. Using fseeko also
has the advantage of not triggering a GNULIB_POSIXCHECK warning.
Reported by Eric Blake in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2426/focus=2489
Eric Blake [Mon, 24 Jan 2011 18:07:51 +0000 (11:07 -0700)]
build: speed up configure for releases
Since most users won't be building with GNULIB_POSIXCHECK defined in
CFLAGS, and since we can make ./configure 10% (several seconds!) faster
by omitting the framework for a posix check, this patch makes it so
that the framework is omitted by default, while still giving
instructions for maintainers to re-enable it.
It's been a while since we've used GNULIB_POSIXCHECK; see this email:
https://lists.gnu.org/archive/html/coreutils/2012-03/msg00126.html
Some of those failures are because we are intentionally avoiding
specific gnulib modules (that is, we have chosen not to use things
like fprintf-posix), but until we work with gnulib to avoid particular
warnings, wiring up an automatic GNULIB_POSIXCHECK to happen during
'make my-distcheck' is not feasible.
* configure.ac (gl_ASSERT_NO_GNULIB_POSIXCHECK): Conditionally
define, according to whether $GNULIB_POSIXCHECK is in environment.
Jim Meyering [Sat, 17 Mar 2012 16:05:41 +0000 (17:05 +0100)]
tests: avoid spurious misc/factor failure on OpenBSD 5.1
* tests/misc/factor: Map OpenBSD 5.1's "unknown option" to our
expected "invalid option". Reported by Bruno Haible.
Jim Meyering [Sat, 17 Mar 2012 11:06:56 +0000 (12:06 +0100)]
maint: remove now-superfluous coreutils-path-check rule
* dist-check.mk (coreutils-path-check): Now that we set PATH in
TESTS_ENVIRONMENT, it seems like overkill to make "distcheck"
rerun all tests just to check this.
(my-distcheck): Remove sole use.
Eric Blake [Wed, 14 Mar 2012 20:02:59 +0000 (14:02 -0600)]
doc: clarify current realpath --relative-base behavior
For compatibility with MacOS relpath(1), as seen here:
http://opensource.apple.com/source/bootstrap_cmds/\
bootstrap_cmds-79/relpath.tproj/relpath.c
we implemented 'realpath --relative-base=dir1 --relative-to=dir2 file'
in the same way as 'relpath -d dir1 dir2 file'. This can result
in --relative-base rendering --relative-to as a no-op if dir1 is a
child of dir2. Document this.
* doc/coreutils.texi (realpath invocation): Mention restriction.
Pádraig Brady [Sat, 17 Mar 2012 16:04:21 +0000 (17:04 +0100)]
tests: avoid spurious dd/sparse failure
* tests/dd/sparse: Allow for greater variation in sparse-block counts.
Reported by Nelson H. F. Beebe and Bruno Haible.
Pádraig Brady [Fri, 16 Mar 2012 11:23:13 +0000 (11:23 +0000)]
tests: fix sort-discrim to work without GMP
* tests/misc/sort-discrim: The expr limit is intmax_t without GMP.
Pádraig Brady [Fri, 16 Mar 2012 12:51:04 +0000 (12:51 +0000)]
tests: avoid an ls-time false positive on Solaris 10
* tests/misc/ls-time: Force a ctime update as updating
the atime doesn't update ctime on tmpfs on Solaris 10.
Eric Blake [Wed, 14 Mar 2012 19:42:59 +0000 (13:42 -0600)]
realpath: optimize --relative-base usage
There is no need to recompute for every path being visited whether
the base is a prefix of the relative location.
* src/realpath.c (relpath): Hoist base check...
(main): ...here.
Based on a suggestion by Pádraig Brady.
Eric Blake [Wed, 14 Mar 2012 19:42:59 +0000 (13:42 -0600)]
realpath: let --relative-to default to --relative-base
Most of the time, if someone wants to filter which paths are
relative while leaving all others absolute, they also want to
to the filtering based on the same --relative-to directory.
Make this easier to specify.
* src/realpath.c (main): Convert error to default.
* doc/coreutils.texi (realpath invocation): Document this.
* tests/misc/realpath: Adjust test to match.
* NEWS: Document it.
Eric Blake [Wed, 14 Mar 2012 03:51:47 +0000 (21:51 -0600)]
tests: cover more realpath scenarios
'realpath --relative-base --relative-to' is identical to
--relative-base=--relative-to, so the test wasn't covering what
it claimed. Expose recent fixes for handling of // on systems
where // is distinct, and for --relative-base=/. Add test that
exposes our design decision that --relative-base that is not a
prefix of --relative-to is a no-op (if we later change behavior,
we will also have to change that part of the test).
* tests/misc/realpath: Fix typo. Add some tests.
Eric Blake [Sat, 4 Feb 2012 18:50:53 +0000 (11:50 -0700)]
realpath: fix problems with root handling
When --relative-base is /, all other paths should be treated as
relative (except for // where it matters).
Also, on platforms like Cygwin where / and // are distinct, realpath
was incorrectly collapsing // into /. http://debbugs.gnu.org/10472.
* src/realpath.c (path_prefix, path_common_prefix): Treat /
and // as having no common match.
(relpath): Allow for no match even without --relative-base.
* NEWS: Document this.
Eric Blake [Mon, 6 Feb 2012 23:27:48 +0000 (16:27 -0700)]
test: expose recent gnulib canonicalize bug
https://lists.gnu.org/archive/html/bug-gnulib/2012-02/msg00038.html
detailed a couple of bugs in gnulib's canonicalize that were visible
through coreutils' readlink, but only on systems where // is distinct
from /. This particular test assumes the POSIX fix which requires
canonicalization of a symlink containing just slashes to behave as
if slashes separating the symlink from the rest of the name are
elided (see http://austingroupbugs.net/view.php?id=541), as that is
the only useful (and current) behavior on Cygwin. That is,
ln -s / root
ls root/dev
must list the contents of /dev, not //dev.
* tests/misc/readlink-root: New test.
* tests/Makefile.am (TESTS): Run it.
Paul Eggert [Sun, 11 Mar 2012 23:30:22 +0000 (16:30 -0700)]
tests: new discriminator-based test for sort -n and -h
* tests/Makefile.am (TESTS): Add misc/sort-discrim.
* tests/misc/sort-discrim: New file, which tests a discriminator-based
implementation of 'sort'. Coreutils doesn't use this implementation
yet, but the test is useful anyway.
Co-authored-by: Drew Kutilek <dkutilek@ucla.edu>
Co-authored-by: James Wendt <jwendt@cs.ucla.edu>
Jérémy Compostella [Fri, 9 Mar 2012 18:21:42 +0000 (19:21 +0100)]
dirname: support more than one argument
* src/dirname.c (main): Handle new -z option and manage more than one
argument.
* doc/coreutils.texi (dirname invocation): Mention it.
* NEWS (New features): Mention it.
* tests/misc/dirname: Add a two arguments test.
Jérémy Compostella [Thu, 1 Mar 2012 19:37:41 +0000 (20:37 +0100)]
split: support an arbitrary number of split files by default
* src/split.c (next_file_name): If `suffix_auto' is true and the first
suffix character is 'z', generate a new file file name adding `z' to
the prefix and increasing the suffix length by one.
(set_suffix_length): Disable auto suffix width in various cases.
* tests/split/suffix-auto-length: Test it.
* doc/coreutils.texi (split invocation): Mention it.
* NEWS (Improvements): Likewise.
Jérémy Compostella [Fri, 9 Mar 2012 15:05:20 +0000 (16:05 +0100)]
doc: add missing documentation for basename -z
doc/coreutils.texi (basename invocation): Add -z option documentation.
Bernhard Voelker [Fri, 9 Mar 2012 06:33:54 +0000 (07:33 +0100)]
maint: fix a version number typo in NEWS
* NEWS: s/8.14/8.15/
Paul Eggert [Fri, 9 Mar 2012 03:00:27 +0000 (19:00 -0800)]
chmod: add notations +40, 00440, etc.
* NEWS: Document this.
* doc/perm.texi (Operator Numeric Modes): New section.
(Numeric Modes, Directory Setuid and Setgid): Document new behavior.
* src/chmod.c (usage): Document new behavior.
(main): Support new options -0, -1, etc.
* tests/chmod/setgid: Test these new features.
Paul Eggert [Fri, 9 Mar 2012 02:47:44 +0000 (18:47 -0800)]
build: update gnulib submodule to latest
Jim Meyering [Thu, 8 Mar 2012 09:33:50 +0000 (10:33 +0100)]
du: fix -x: don't ignore non-directory arguments
Surprise! "du -x non-DIR" would print nothing.
Note that the problem arises only when processing a non-directory
specified on the command line. Not surprisingly, "du -x" still
works as expected for any directory argument.
When performing its same-file-system check, du may skip an entry
only if it is at fts_level 1 or greater. Command-line arguments
are at fts_level == 0 (FTS_ROOTLEVEL).
* src/du.c (process_file): Don't use the top-level FTS->fts_dev
when testing for --one-file-system (-x). It happens to be valid
for directories, but it is always 0 for a non-directory.
* tests/du/one-file-system: Add tests for this.
* NEWS (Bug fixes): Mention it.
Reported by Daniel Stavrovski in http://bugs.gnu.org/10967.
Introduced by commit v8.14-95-gcfe1040.
Jim Meyering [Sat, 3 Mar 2012 08:41:31 +0000 (09:41 +0100)]
maint: use an optimal-for-coreutils xz compression setting
* cfg.mk: Set XZ_OPT = -8e (determined empirically).
This sacrifices 8 KiB of compressed tarball size for a 32-MiB
decrease in the memory required during decompression. I.e.,
using -9e would shave off only 8 KiB from the tar.xz file, yet
would force every decompression process to use 32 MiB more memory.
Jérémy Compostella [Sun, 4 Mar 2012 19:00:36 +0000 (20:00 +0100)]
basename: support more than one argument
* src/basename.c (perform_basename): New function refactored from
main() that performs the basename work on a STRING, optionally
removes a trailing SUFFIX and outputs the result.
(main): Handle new options.
* doc/coreutils.texi (basename invocation): Mention new options.
* test/misc/basename: Add new options test cases.
* NEWS (New features): Mention it.
Pádraig Brady [Thu, 1 Mar 2012 11:56:41 +0000 (11:56 +0000)]
maint: refactor copy to use is_nul()
* src/dd.c: Move is_nul() from here to ...
* src/system.h: ... here
* src/copy.c (sparse_copy): Adjust to use the refactored is_nul()
Pádraig Brady [Fri, 2 Mar 2012 10:53:48 +0000 (10:53 +0000)]
tests: work around a block alignment issue in dd/sparse
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/2188210 (which uses XFS).
* tests/dd/sparse (alloc_equal): Add a block allocation
comparison function that accounts for variations due
to alignment.
Rodrigo Campos [Wed, 29 Feb 2012 14:36:18 +0000 (11:36 -0300)]
doc: timeout: document the exit status when run with "-s KILL"
* src/timeout.c (usage): Document the exit status for this case,
in --help and thus in the man page. Word so that it covers
both the -s9 and -k options.
* doc/coreutils.texi (timeout invocation): Document the exit
status for this case.
Bernhard Voelker [Mon, 27 Feb 2012 20:13:10 +0000 (21:13 +0100)]
tests: compile and link shared object with $CC to make LD_PRELOAD work
* tests/ls/getxattr-speedup: Compile and link in one step with $CC.
If the shared object file is created by ld (binutils), then the
destructor print_call_count() may not run (seen on OpenSuSE 12.1).
See http://lists.opensuse.org/opensuse/2012-02/msg01342.html
Thanks to Cristian Rodríguez.
Roman Rybalko [Mon, 27 Feb 2012 13:53:07 +0000 (13:53 +0000)]
dd: add support for the conv=sparse option
Notes:
Small seeks are not coalesced to larger ones,
like is done in cache_round() for example.
conv= is used rather then oflag= for FreeBSD compatibility.
* src/dd.c (final_op_was_seek): A new global boolean to flag
whether the final "write" was converted to a seek.
(usage): Describe the new conf=sparse option.
(iwrite): Convert a write of a NUL block to a seek if requested.
(do_copy): Initialize the output buffer to have a sentinel,
to allow for efficient testing for NUL output blocks.
If the last block in the file was converted to a seek,
then convert back to a write so the size is updated.
* NEWS: Mention the new feature.
* tests/dd/sparse: A new test for the feature.
* tests/Makefile.am: Reference the new test.
Jérémy Compostella [Sun, 26 Feb 2012 14:05:36 +0000 (15:05 +0100)]
doc: fix a wrong option reference in split invocation
* doc/coreutils.texi (split invocation): replace `-r' reference with
`-nr/n'.
Jim Meyering [Sun, 19 Feb 2012 17:32:54 +0000 (18:32 +0100)]
tests: fix help-version on cygwin, where $EXEEXT is nonempty
* tests/misc/help-version: Remove the $EXEEXT suffix from each
program name before comparing with a literal.
Bernhard Voelker [Fri, 24 Feb 2012 11:22:20 +0000 (12:22 +0100)]
tests: remove unnecessary use of -lc
* tests/ls/getxattr-speedup: Remove unneeded use of -lc.
Paul Eggert [Sat, 25 Feb 2012 18:32:52 +0000 (10:32 -0800)]
sort: default to physmem/8, not physmem/16
* src/sort.c (default_sort_size): Don't divide advice by 2.
Just divide the hard limits by 2. This matches the comments.
Reported by Rogier Wolff in http://bugs.gnu.org/10877
Jim Meyering [Fri, 24 Feb 2012 09:02:18 +0000 (10:02 +0100)]
doc: clarify a comment in system.h
* src/system.h (STRNCMP_LIT): Clarify comment.
Suggested by Bruno Haible.
Jérémy Compostella [Sun, 19 Feb 2012 12:52:47 +0000 (13:52 +0100)]
split: add the --additional-suffix option
Add the --additional-suffix option, to append an
additional static suffix to output file names.
* src/split.c (next_file_name): Append suffix to output file names.
(main): Handle new --additional-suffix option.
* NEWS (New features): Mention it.
* doc/coreutils.texi (split invocation): Mention it.
* tests/split/additional-suffix: New file. Test --additional-suffix.
* tests/Makefile.am (TESTS): Add it.
Requested by Peng Yu, in bug 6554
Pádraig Brady [Mon, 20 Feb 2012 12:33:17 +0000 (12:33 +0000)]
ls: adjust errnos indicating device non support for xattrs
* src/ls.c (errno_unsupported): Remove EBUSY, as this caters for
the case where ACLs can't be accessed because the _file_ is locked.
http://lists.gnu.org/archive/html/bug-coreutils/2005-06/msg00191.html
Also ENOENT is not safe to include as you get that if the _file_
is removed between the stat() and subsequent querying of xattrs.
Jérémy Compostella [Sun, 19 Feb 2012 14:38:15 +0000 (15:38 +0100)]
tests: ls/getxattr-speedup: include <sys/types.h> for older headers
Modern <stdio.h> provides ssize_t, but the one from Debian's
libc6-dev 2.11.2-10 apparently does not.
* tests/ls/getxattr-speedup: Also include <sys/types.h>.
Jérémy Compostella [Sat, 18 Feb 2012 18:59:52 +0000 (19:59 +0100)]
doc: fix file names in split --filter=command example
* doc/coreutils.texi (split invocation): Output file names should be
prefixed with `big-' not `big-x'.
Jim Meyering [Mon, 13 Feb 2012 11:52:19 +0000 (12:52 +0100)]
tests: test for ls speed-up
* tests/ls/getxattr-speedup: New test.
* tests/Makefile.am (TESTS): Add it.
Improved-by: Bernhard Voelker
Jim Meyering [Mon, 13 Feb 2012 11:05:40 +0000 (12:05 +0100)]
ls: cache ACL- and CAP-querying syscall failures
Like the optimization to avoid always-failing getfilecon calls,
this change avoids always-failing queries for whether a file has
a nontrivial ACL and for whether a file has certain "capabilities".
When such a query fails for one file (indicating no support), we know it
will always fail that way for the affected device. With this change, we
have thus eliminated nearly all failing-unsupported getxattr syscalls.
* src/ls.c (has_capability) [!HAVE_CAP]: Set errno to ENOTSUP.
(errno_unsupported): Expand the list of E* errno values to match
that of lib/acl-internal.h's ACL_NOT_WELL_SUPPORTED macro.
(file_has_acl_cache, has_capability_cache): New functions.
(gobble_file): Use them in place of non-caching ones.
* NEWS (Improvements): Mention it.
Suggested by Sven Breuner in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2187
While eliminating most getfilecon calls saved about 33%,
eliminating these other calls can save almost all of the
remaining ~67% cost, on some remote file systems.
Jim Meyering [Sat, 11 Feb 2012 11:36:57 +0000 (12:36 +0100)]
ls: optimize for when getfilecon would often fail (~33% perf. gain)
On systems or file systems without SELinux support, all getfilecon
and lgetfilecon calls would fail due to lack of support. We can non-
invasively cache such failure (on most recently accessed device) and
avoid the vast majority of the failing underlying getxattr syscalls.
* src/ls.c (errno_unsupported): New function.
(selinux_challenged_device): New file-scoped global.
(getfilecon_cache, lgetfilecon_cache): New error-caching wrapper
functions.
(gobble_file): Use the caching wrappers, for when many *getfilecon
calls would fail with ENOTSUP or EOPNOTSUPP.
Suggested by Sven Breuner in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2187
Improved-by: Pádraig Brady.
Jérémy Compostella [Sun, 29 Jan 2012 14:20:31 +0000 (15:20 +0100)]
split: support optional start value for --numeric-suffixes
Allow changing the --numeric-suffixes start number
from the default of 0.
* src/split.c (next_file_name): Initialize the suffix index
and the output filename according to start value.
(main): Check that the suffix length is large enough for the
numerical suffix start value.
* doc/coreutils.texi (split invocation): Mention it.
* NEWS (New features): Mention it.
* tests/split/numeric: New file. Test --numeric-suffixes[=FROM].
* tests/Makefile.am (TESTS): Reference the new test.
Pádraig Brady [Fri, 17 Feb 2012 11:28:01 +0000 (11:28 +0000)]
doc: fix a typo about seek_bytes in NEWS
* NEWS: s/count_bytes/seek_bytes/2
Bernhard Voelker [Thu, 16 Feb 2012 12:29:44 +0000 (13:29 +0100)]
doc: improve 'rm -f' description
* doc/coreutils.texi (rm invocation): Mention that the -f option also
silences the message for missing operands, which is useful in scripts
e.g., for "rm -f $file_list" when $file_list is empty.
* src/rm.c (usage): Likewise.
Reported by Jérémy Magrin in http://bugs.gnu.org/10819
Pádraig Brady [Mon, 13 Feb 2012 21:47:28 +0000 (21:47 +0000)]
dd: fix issues in the count_bytes and seek_bytes flags change
These edge cases were missed in the previous commit
140eca15c.
* src/dd.c (main): Include the bytes slop when truncating
without further I/O. Don't invalidate the whole file cache
in the case where 0 < count < ibs.
* tests/dd/bytes: Change to using the independent truncate
command to generate the file for comparison. Remove a redundant
test case and replace with one testing the truncation only logic.
Jérémy Compostella [Sat, 4 Feb 2012 14:25:54 +0000 (15:25 +0100)]
dd: add count_bytes, skip_bytes and seek_bytes flags
dd now accepts the count_bytes and skip_bytes input flag and the
seek_bytes output flag, to more easily allow processing portions of a
file.
* src/dd.c (scanargs): Compute skip_records and skip_bytes when
'skip_bytes' iflag is used. Compute max_records and max_bytes when
'count_bytes' iflag is used. Compute seek_records and seek_bytes
when 'seek_bytes' oflag is used.
(skip_via_lseek): Use new 'bytes' parameter and handle potential
'records' equals to zero. Update the bytes parameter when called with
'fdesc' equal to STDOUT_FILENO. Update the header comments.
(dd_copy): Skip accordingly to skip_records AND skip_bytes. Count
accordingly to max_records AND max_bytes. Seek on output accordingly
to seek_records AND seek_bytes.
* NEWS (New features): Mention it.
* doc/coreutils.texi (dd invocation): Detail new flags and behaviors.
* tests/dd/bytes: New file. Tests for these new flags.
* tests/Makefile.am (TESTS): Add it.
Jim Meyering [Sun, 12 Feb 2012 13:37:00 +0000 (14:37 +0100)]
build: correct @@-,length values in last hunk of regcomp.c.diff
* gl/lib/regcomp.c.diff: Correct invalid hunk lengths (s/1/7/g)
in the last hunk's @@-line.
Jim Meyering [Sat, 11 Feb 2012 09:43:50 +0000 (10:43 +0100)]
build: update gnulib, bootstrap, gl/lib/regcomp.c.diff
* gnulib: Update submodule to latest.
* bootstrap: Update from gnulib.
* gl/lib/regcomp.c.diff: Adapt to gnulib changes.
Jim Meyering [Wed, 1 Feb 2012 20:42:45 +0000 (21:42 +0100)]
mv: "mv A B" would sometimes succeed, yet A would remain, ...
But only when both A and B were hard links to the same symlink.
* src/copy.c (same_file_ok): Handle another special case: the one
in which we are moving a symlink onto a hard link to itself.
In this case, we must explicitly tell the caller to unlink the
source file. Otherwise, at least the linux-3.x kernel rename
function would do nothing, as mandated by POSIX 2008.
* tests/mv/symlink-onto-hardlink-to-self: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Bernhard Voelker in http://bugs.gnu.org/10686
Jérémy Compostella [Sun, 5 Feb 2012 16:53:55 +0000 (17:53 +0100)]
maint: add braces as requested by HACKING coding standard
* src/dd.c (dd_copy): Braces were missing for this do/while statement.
Pádraig Brady [Mon, 30 Jan 2012 11:59:04 +0000 (11:59 +0000)]
doc: clarify --help output for some optional arguments
* src/pr.c (usage): Fix the -S description to indicate
that the argument is optional for the short option.
* doc/coreutils.texi (pr invocation): Likewise.
* src/od.c (usage): Fix the -S description to indicate
that the argument is required for the short option.
Clarify -w takes an argument and that it is optional.
Jim Meyering [Mon, 30 Jan 2012 11:48:20 +0000 (12:48 +0100)]
maint: sort: remove the last uses of "'%s'" in diagnostics
* src/sort.c (key_warnings): Use quote (quote_n, since there are two)
rather than literal single quotes ('%s') in diagnostic.
Jim Meyering [Thu, 5 Jan 2012 10:45:50 +0000 (11:45 +0100)]
mv: allow moving symlink onto same-inode dest with >= 2 hard links
Normally, mv detects a few subtle cases in which proceeding with a
same-file rename would, with very high probability, cause data loss.
Here, we have found a corner case in which one of these same-inode
tests makes mv refuse to perform a useful operation. Permit that
corner case.
* src/copy.c (same_file_ok): Detect/exempt this case.
* tests/mv/symlink-onto-hardlink: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Initially reported by: Matt McCutchen in http://bugs.gnu.org/6960.
Raised again by Anders Kaseorg due to http://bugs.debian.org/654596.
Improved-by: Paul Eggert.
Jim Meyering [Mon, 30 Jan 2012 07:36:11 +0000 (08:36 +0100)]
build: update gnulib, for syntax-check vs canonicalize fix
Jim Meyering [Fri, 27 Jan 2012 10:35:24 +0000 (11:35 +0100)]
maint: use single copyright year range
Run "make update-copyright".
Jim Meyering [Fri, 27 Jan 2012 10:33:11 +0000 (11:33 +0100)]
maint: make copyright statements more consistent; update gnulib
* cfg.mk (update-copyright-env): Add UPDATE_COPYRIGHT_FORCE=1
to rejoin some split lines, and UPDATE_COPYRIGHT_USE_INTERVALS=2
to make update-copyright use only one year range.
* gnulib: Update to latest, for newer update-copyright script.
Jim Meyering [Fri, 27 Jan 2012 07:47:28 +0000 (08:47 +0100)]
maint: fix copyright in old fileutils ChangeLog
* old/fileutils/ChangeLog-1997: Insert omitted "Free Software" in
the name of the copyright holder. Compress year range.
Pádraig Brady [Thu, 26 Jan 2012 00:00:55 +0000 (00:00 +0000)]
maint: remove some redundant automake _SOURCES
* src/Makefile.am: Remove auto generated entries.
Pádraig Brady [Wed, 25 Jan 2012 23:13:58 +0000 (23:13 +0000)]
maint: cleanup an extraneous version output in a test
* test/misc/stdbuf: Fixup the minor copy & paste issue
introduced in commit
ff7f0ff8
Pádraig Brady [Wed, 25 Jan 2012 19:49:50 +0000 (19:49 +0000)]
realpath: avoid the use of printf
This was seen to give an 11% performance improvement.
* src/realpath.c (relpath): Avoid using printf.
(process_path): Likewise.
Pádraig Brady [Tue, 24 Jan 2012 14:32:42 +0000 (14:32 +0000)]
maint: use the standard require_perl_ function
* tests/cp/sparse-fiemap: Don't use a separate check.
Pádraig Brady [Wed, 25 Jan 2012 16:42:42 +0000 (16:42 +0000)]
realpath: remove extraneous '/' for --relative-to edge cases
* src/realpath.c (path_common_prefix): Be consistent and
always include a leading '/' in the count returned.
(relpath): Account for the change in path_common_prefix()
and avoid outputting extra '/' chars in relative paths that
span the root dir.
* tests/misc/realpath: Add the two reported cases.
Reported by Mike Frysinger