]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
11 years agoshred: enable direct I/O when possible
Pádraig Brady [Mon, 4 Nov 2013 23:14:10 +0000 (23:14 +0000)] 
shred: enable direct I/O when possible

Commit v5.92-1057-g43d487b introduced a regression
in coreutils 6.0 where it removed the page alignment
of the buffer to write, thus disabling direct I/O.
We want to use direct I/O when possible to avoid
impacting the page cache at least, as we know we don't
want to cache the data we're writing.

* src/shred.c (dopass): Allocate the buffer on the heap,
while using a more general calculation to allow to have
the output size independent from the fillpattern() size
constraint of a multiple of 3.  Also we dispense with the
union as it's no longer needed given we're aligning on
a page boundary and thus don't need to explicitly handle
uint32_t alignment.

11 years agomd5sum, sha*sum: improve help for --check related options
Pádraig Brady [Fri, 1 Nov 2013 10:20:23 +0000 (10:20 +0000)] 
md5sum, sha*sum: improve help for --check related options

* src/md5sum.c (usage): s/three/four/ in the message pertaining
to the --check related options.  Also clarify that --strict
is just significant for the formatting of the checksum lines.
Also since we're changing both strings, move the --strict description
in with the description of the other options and order alphabetically.
* THANKS.in: Added reporter: Daniel Mach

11 years agomaint: simplify printing of md5sum file names
Pádraig Brady [Fri, 1 Nov 2013 16:14:44 +0000 (16:14 +0000)] 
maint: simplify printing of md5sum file names

* src/md5sum.c (main): Add a comment as to why we continue
to escape names that do not have '\n' but do have '\\' chars.
(print_filename): Use the predetermined boolean to decide
whether to escape or not, so that in the common case we
can output the file name directly, rather than inspecting each char.
* tests/misc/md5sum.pl: Add case to show '\\' chars cause escaping.
* tests/misc/sha1sum.pl: Likewise.

11 years agobuild: fix dependencies of man/sha*sum.1
Bernhard Voelker [Fri, 1 Nov 2013 17:59:43 +0000 (18:59 +0100)] 
build: fix dependencies of man/sha*sum.1

Although the above man pages depend on src/md5sum.c as a shared
source, the build of the man pages directly requires their own
executables to exist.

* man/local.mk (man/sha1sum.1): Change the dependency from
'src/md5sum' to 'src/sha1sum'.
(man/sha224sum.1): s/md5sum/sha224sum/
(man/sha256sum.1): s/md5sum/sha256sum/
(man/sha384sum.1): s/md5sum/sha384sum/
(man/sha512sum.1): s/md5sum/sha512sum/

Reported by Pádraig Brady in
http://lists.gnu.org/archive/html/coreutils/2013-11/msg00006.html

11 years agodircolors: add putty-256color terminal type
Mike Frysinger [Tue, 15 Oct 2013 20:04:24 +0000 (16:04 -0400)] 
dircolors: add putty-256color terminal type

* src/dircolors.hin: Add putty-256color
Reported-by: Thomas D. <whissi@whissi.de>, via
http://bugs.gentoo.org/486786
Fixes http://bugs.gnu.org/15624

11 years agomaint: update the instructions for building prerequisites
Pádraig Brady [Tue, 15 Oct 2013 10:05:49 +0000 (11:05 +0100)] 
maint: update the instructions for building prerequisites

* README-prereq: Update as per the latest required versions
in bootstrap.conf.  Also add a missing cd command.
Reported by Aaron Davies
Fixes http://bugs.gnu.org/15612

11 years agocp: correct error message for invalid arguments of '--no-preserve'
Ondřej Vašík [Fri, 11 Oct 2013 16:07:37 +0000 (17:07 +0100)] 
cp: correct error message for invalid arguments of '--no-preserve'

* src/cp.c (decode_preserve_arg):
Correct error message for invalid arguments of '--no-preserve'.
Reported by M.Vadkerti in http://bugzilla.redhat.com/1018206
Fixes http://bugs.gnu.org/15588

11 years agodoc: clarify the example for cp --preserve=links
Pádraig Brady [Thu, 10 Oct 2013 09:13:30 +0000 (10:13 +0100)] 
doc: clarify the example for cp --preserve=links

* doc/coreutils.texi (cp invocation): Give more detail about what's
happening in the example, explicitly calling out the --no-dereference
option required to make the -H and -L options significant.
Also mention the option order significance of the -H and -L options.
Fixes http://bugs.gnu.org/15579

11 years agomktemp: fix incorrect exit status from previous commit
Pádraig Brady [Mon, 7 Oct 2013 10:59:53 +0000 (11:59 +0100)] 
mktemp: fix incorrect exit status from previous commit

* src/mktemp.c (main): Use an exit() strategy consistent with the
previous clauses dealing with optional error messages to ensure
we exit with the correct status in all cases.
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6412979

11 years agomktemp: with --quiet, only suppress I/O errors
Pádraig Brady [Sun, 6 Oct 2013 16:26:51 +0000 (17:26 +0100)] 
mktemp: with --quiet, only suppress I/O errors

The reason for having a --quiet option is to
suppress only some subset of possible errors.
The most useful separation here is with usage/internal errors,
and errors due to file creation etc. (i.e. I/O errors).

* src/mktemp.c (main): Match the --help and info docs and
only suppress the file/dir creation error messages.
* tests/misc/mktemp.pl: Adjust accordingly.

11 years agomktemp: synchronize the -p option with docs
Pádraig Brady [Sat, 21 Sep 2013 02:33:12 +0000 (03:33 +0100)] 
mktemp: synchronize the -p option with docs

* src/mktemp.c (usage): Synchronize the -p option description with
the logic and info docs.  I.E. that -p is just an alias of --tmpdir.
Also for consistency treat --tmpdir='' the same with or without -t.
I.E. always ignore the --tmpdir option if the param is empty.
Fixes http://bugs.gnu.org/15425

11 years agodoc: expand the texinfo examples for the paste command
Karl Berry [Sun, 6 Oct 2013 15:39:58 +0000 (16:39 +0100)] 
doc: expand the texinfo examples for the paste command

* doc/coreutils.texi (paste invocation): Move the synopsis to the top.
Provide examples for the different type of operations possible.
Add a specific common example to join consecutive lines with a space.

11 years agorm: with -I, prompt before deleting a write protected file
Sergio Durigan Junior [Wed, 25 Sep 2013 10:02:08 +0000 (11:02 +0100)] 
rm: with -I, prompt before deleting a write protected file

This regression was introduced in commit v6.7-71-g0928c24

* src/rm.c (main): Make the -I option behave like --interactive=once.
* tests/rm/interactive-once.sh: Add cases for single and multiple files.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/9308

11 years agomaint: move all id(1) tests to the same directory
Pádraig Brady [Sun, 22 Sep 2013 03:15:34 +0000 (04:15 +0100)] 
maint: move all id(1) tests to the same directory

* tests/misc/id-context.sh -> tests/id/context.sh
* tests/misc/id-setgid.sh -> tests/id/setgid.sh
* tests/misc/id-uid.sh -> tests/id/uid.sh
* tests/misc/id-zero.sh -> tests/id/zero.sh
* tests/local.mk: Reference the renamed tests

11 years agotests: parameterize the "root" username
Pádraig Brady [Sun, 22 Sep 2013 02:59:58 +0000 (03:59 +0100)] 
tests: parameterize the "root" username

* tests/misc/chroot-credentials.sh: Don't assume uid 0
has the "root" name, nor any name for that matter.

11 years agomaint: remove unused parameters to parse_user_spec()
Pádraig Brady [Sun, 22 Sep 2013 02:36:03 +0000 (03:36 +0100)] 
maint: remove unused parameters to parse_user_spec()

* src/chown.c (main): Since "name" parameters to parse_user_spec()
are now optional, just pass NULL for those unused parameters.
* src/chroot.c (main): Likewise.

11 years agoid: support specifying the user by user ID
Pádraig Brady [Fri, 20 Sep 2013 11:38:00 +0000 (12:38 +0100)] 
id: support specifying the user by user ID

* src/id.c (usage): Remove 'name' from the synopsis,
implying that one can also specify by user ID.
(main): Like chown(1), call parse_user_spec() to implement
user name or ID lookup with appropriate precedence.
* doc/coreutils.texi (id invocation): Mention that
a user ID is supported and how '+' affects lookup order.
* tests/misc/id-groups.sh: Remove test now subsumed into...
* tests/misc/id-uid.sh: New test covering new interface.
* tests/local.mk: Rename the test.
* NEWS: Mention the new feature.
Addresses http://bugs.gnu.org/15421

11 years agobuild: update gnulib submodule to latest; also bootstrap to latest
Pádraig Brady [Sat, 21 Sep 2013 15:51:56 +0000 (16:51 +0100)] 
build: update gnulib submodule to latest; also bootstrap to latest

Notes tests/init.sh is still in sync with gnulib.

* bootstrap: Update to latest.
* gnulib: Sync many fixes/changes, including:
a fix for http://bugs.gnu.org/15066
and preparation for http://bugs.gnu.org/15421

11 years agotests: avoid a failure when there isn't a name for all user IDs
Pádraig Brady [Sun, 22 Sep 2013 01:49:40 +0000 (02:49 +0100)] 
tests: avoid a failure when there isn't a name for all user IDs

* tests/misc/id-zero.sh: Don't check exit status when in -n mode.

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6196762

11 years agoid: add -z, --zero option
Bernhard Voelker [Sat, 21 Sep 2013 12:15:45 +0000 (14:15 +0200)] 
id: add -z, --zero option

* src/group-list.h (print_group_list): Add a parameter for the
delimiter of type char.
* src/group-list.c (print_group_list): Likewise, and use it instead
of a white space character to delimit the group entries.
* src/groups.c (main): Pass white space character to print_group_list().
* src/id.c (longopts):  Add array element for the new long option.
(usage): Document the new option.  While at it, fix the alignment
of the descriptions to match that of HELP_OPTION_DESCRIPTION.
(main): Define the bool flag opt_zero indicating the use of the
new option.  In the getopt_long loop, handle it.
Output an error diagnostic in the case the --zero option has been
specified together with the default format.
In the case of -gG, pass either a NUL or a white space character to
print_group_list() - depending on the above new flag.
Likewise change the printing of the final newline character: output
a NUL instead if the --zero option has been specified.
* doc/coreutils.texi (id invocation): Document the new option.
While at it, move the @exitstatus macro down after the macro
@primaryAndSupplementaryGroups in order to be consistent with
other texinfo documents.
(groups invocation): Move @exitstatus down after the macro
@primaryAndSupplementaryGroups here, too.
* tests/misc/id-zero.sh: Add new test exercising the new option.
* tests/local.mk (all_tests): Reference it.
* NEWS (New features): Mention the new option.
Fixes http://bugs.gnu.org/9987

11 years agomaint: avoid patching help2man
Bernhard Voelker [Wed, 11 Sep 2013 22:02:33 +0000 (00:02 +0200)] 
maint: avoid patching help2man

Commit cde1ea0e separated the coreutils-specific patches from help2man.
Most changes had been made to accommodate to the coreutils style guide,
i.e., to avoid syntax-check failures like sc_long_lines.
Yet 2 changes had to be put into the patch help2man.diff.
But this added the dependency to patch(1) in distribution builds.
Incidentally, the 2 remaining parts of the patch can easily be
done outside of help2man.  Therefore, this commit partly reverts
the recent separation of help2man into 'help2man.in' and
'help2man.diff', and instead uses the original help2man script.

* man/help2man.in: Rename to ...
* man/help2man: ... this file.
* man/help2man.diff: Remove.
* man/local.mk (mandeps): Remove man/help2man.
(man/help2man): Remove recipe.
(.x.1): Add the --info-page option when calling help2man in order
to change the name of the texinfo manual from the default, "info PRG",
to "info coreutils 'PRG invocation'".
Furthermore, use an sed pattern to remove the sentence starting
with "For complete documentation".
* .gitignore (/man/help2man): Remove entry.
* .x-update-copyright: Replace the entries for the files
'man/help2man.diff' and 'man/help2man.in' by 'man/help2man'.
* cfg.mk (sc_long_lines): Instead of 'man/help2man.in', exempt
'man/help2man' from this test.
(sc_po_check): Likewise.
(sc_space_tab): Instead of 'man/help2man.diff', exempt 'man/help2man'
from this test.
(sc_trailing_blank): Likewise.
(sc_prohibit_tab_based_indentation): Instead of 'man/help2man.in' and
'man/help2man.diff', exempt 'man/help2man'.
* man/dummy-man: Recognize the option --info-page=... as no-op.

11 years agomaint: use help2man configured with --disable-nls
Bernhard Voelker [Tue, 10 Sep 2013 05:56:18 +0000 (07:56 +0200)] 
maint: use help2man configured with --disable-nls

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6038769

The previously committed 'help2man' requires a Perl module
which does not seem to be installed everywhere - and which
is not needed for our purposes:

  Can't locate Locale/gettext.pm in @INC
  BEGIN failed--compilation aborted at ./man/help2man line 28.

This module was pulled in automatically by the default configure call.
Use the NLS-disabled version instead.

* man/help2man.in: Use help2man configured with the --disable-nls
option to avoid the dependency to the above Perl module.
* man/help2man.diff: Adapt the line numbers of the hunks in the
coreutils-specific patch for help2man to apply without fuzz.

Reported by Pádraig Brady.

11 years agobuild: fix corrupted patch causing bootstrap failures
Pádraig Brady [Thu, 5 Sep 2013 16:25:34 +0000 (17:25 +0100)] 
build: fix corrupted patch causing bootstrap failures

The patch was corrupted in commit v8.21-50-g7b65f8e

* gl/modules/tempname.diff: Fix the offsets so that the patch
applies cleanly.  Note that this was only apparent with patch < 2.6.
With patch >= 2.6, patch will not indicate an error applying
the second hunk of the patch and silently ignore it.
I double checked that all patches now apply cleanly by adjusting
gnulib-tool to run patch with --fuzz=0 which might be advisable
going forward, even on a per project basis.
The silent ignoring of hunks by newer patch(1) has been reported.
Fixes http://bugs.gnu.org/15255

11 years agomaint: update help2man to 1.43.3
Bernhard Voelker [Fri, 2 Aug 2013 06:28:50 +0000 (08:28 +0200)] 
maint: update help2man to 1.43.3

Instead of diverging further from the upstream GNU help2man project
(http://www.gnu.org/software/help2man/), hold a copy of the original
script and keep track of our changes in a separate patch file.

The man pages created with the new version show the following,
non-invasive differences:
a) command options in the EXAMPLE sections are no longer in bold format,
b) file names are underlined now consistently.

* man/help2man: Rename to ...
* man/help2man.in: ... this file, and update content from the
upstream GNU help2man project.
* man/help2man.diff: Add patch file for help2man to remove the
sentence "For complete documentation ..." (see commit 5d4f09d8),
and to emit "info coreutils 'PROG invocation'" into the man
pages (77abf69a).
* man/local.mk (mandeps): Add help2man to the dependencies of
the man pages.
(man/help2man): Add rule to generate this script from the upstream
help2man.in file and the help2man.diff patch.
* .gitignore: Add man/help2man as it is no longer version controlled.
* cfg.mk (sc_long_lines): Exempt help2man.in from this check.
(sc_po_check): Likewise.
(sc_space_tab): Likewise.
(sc_trailing_blank): Exempt man/help2man.diff from this check.
(sc_prohibit_tab_based_indentation): Instead of help2man, now exempt
both help2man.in and help2man.diff from this test.
* .x-update-copyright: Add new file and add the above new help2man
files as well as the COPYING file.

11 years agols: fix possible incorrect exit status when recursing directories
FUJIWARA Katsunori [Thu, 5 Sep 2013 01:17:56 +0000 (02:17 +0100)] 
ls: fix possible incorrect exit status when recursing directories

If there is an error reading a directory that was referenced
through recursion, rather than directly on the command line,
then exit with the "less serious" exit code, rather than the
"serious" exit code reserved for command line arguments.
This issue was introduced in commit v5.2.1-1908-gb58dea5

* src/ls.c (print_dir): Ensure that the command_line_arg param
is false for directories being recursed into.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/15249

11 years agomaint: update out of date confusing comments
Pádraig Brady [Sun, 1 Sep 2013 17:40:26 +0000 (18:40 +0100)] 
maint: update out of date confusing comments

* src/copy.c (copy_internal): Change mention of the removed --reply=no
option, to the similar in this context --no-clobber.
* src/sort.c: SI and IEC suffixes can now be mixed when --human-numeric.

11 years agodf: fix "blocks" translation in header
Pádraig Brady [Fri, 9 Aug 2013 04:25:18 +0000 (05:25 +0100)] 
df: fix "blocks" translation in header

* src/df.c (get_header): Get the translation of "blocks" here,
rather than just marking the string for translation.
Fixes http://bugs.gnu.org/15054

11 years agodoc: clarify when seq ends
Bernhard Voelker [Sat, 10 Aug 2013 15:19:06 +0000 (17:19 +0200)] 
doc: clarify when seq ends

* doc/coreutils.texi (seq invocation): Add a sentence clarifying
that seq terminates when LAST becomes smaller than the current number
plus INCREMENT.
* src/seq.c (usage): Likewise.
Fixes http://bugs.gnu.org/15068

11 years agodoc: use more modern file system type examples in df description
Bernhard Voelker [Wed, 7 Aug 2013 18:12:37 +0000 (20:12 +0200)] 
doc: use more modern file system type examples in df description

* doc/coreutils.texi (df invocation): In the example list of common
file system types, exchange the entries which are not so common
anymore (4.2, ufs, efs, hsfs, pcfs) by far more prominent ones
(ext2, ext3, ext4, xfs, btrfs, iso9660, ntfs, fat).

11 years agodoc: fix typo in description of df
Filipus Klutiero [Wed, 7 Aug 2013 08:29:48 +0000 (10:29 +0200)] 
doc: fix typo in description of df

* doc/coreutils.texi (df invocation): s/pseude/pseudo/
* THANKS.in (Filipus Klutiero): Remove entry, now that it will be
automatically included in the generated THANKS file.
Fixes http://bugs.gnu.org/15041

12 years agodoc: more semicolons instead of periods in option descriptions
Benno Schulenberg [Sat, 3 Aug 2013 08:38:12 +0000 (10:38 +0200)] 
doc: more semicolons instead of periods in option descriptions

Also slightly rephrase some descriptions for extra clarity, and
add more consistent indentation.

* src/df.c (usage): Semicolon, no final period.
* src/du.c (usage): Likewise, plus indentation and clarifying words.
* src/ls.c (usage): Semicolon, rephrasings, added parentheses for
clarity, indentation.
* src/rm.c (usage): Semicolons.
* src/tail.c (usage): Adjust -f description to prefer explanatory
language instead of option syntax.

12 years agodoc: clarify that uniq -d outputs a single entry per group
Pádraig Brady [Sat, 3 Aug 2013 09:36:39 +0000 (10:36 +0100)] 
doc: clarify that uniq -d outputs a single entry per group

* src/uniq.c (usage): Clarify the -d option.
Fixes http://bugs.gnu.org/14996

12 years agomaint: update copyright year number ranges of numfmt sources
Bernhard Voelker [Thu, 1 Aug 2013 02:18:00 +0000 (04:18 +0200)] 
maint: update copyright year number ranges of numfmt sources

Run "make update-copyright".

* src/numfmt.c: Update copyright year number range.  This file has
obviously been added to coreutils after and without the annual update.
* tests/misc/numfmt.pl: Likewise.

12 years agodoc: use semicolon instead of period in option descriptions
Benno Schulenberg [Sun, 28 Jul 2013 11:54:20 +0000 (13:54 +0200)] 
doc: use semicolon instead of period in option descriptions

Also do not end option descriptions with a period, properly indent
continuation lines, and make some tiny clarifications.

* src/du.c (usage): Lowercase after semicolon.
* src/ls.c (usage): Semicolons instead of periods, small rephrasing
and two hyphens for clarity, proper indentation.
* src/mktemp.c (usage): Semicolons and lowercase.
* src/od.c (usage): Semicolons.
* src/ptx.c (usage): Use the standard phrase, clarify default option.
* src/setuidgid.c (usage): Properly indent continuation line.
* src/split.c (usage): Semicolons, lowercase, no final period.
* src/stat.c (usage): Semicolons, lowercase.
* src/tail.c (usage): Proper indentation, one shorter rephrasing,
semicolons, no final periods.
* src/timeout.c (usage): Properly indent, semicolons, no final periods.
Fixes http://bugs.gnu.org/14976

12 years agodoc: clarify that cp by default doesn't adjust existing file perms
Pádraig Brady [Mon, 29 Jul 2013 08:51:52 +0000 (09:51 +0100)] 
doc: clarify that cp by default doesn't adjust existing file perms

* doc/coreutils.texi (cp invocation): Mention explicitly what
happens to permissions of existing files when -p is not specified.
Fixes http://bugs.gnu.org/14972

12 years agotests: fix another test failure in test/du/inodes.sh
Bernhard Voelker [Sun, 28 Jul 2013 23:51:55 +0000 (01:51 +0200)] 
tests: fix another test failure in test/du/inodes.sh

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5584121

du(1) uses the first file object of the two test files linked to the
same inode, 'd/f' and 'd/h', whatever the system returns first.
Use 'd/f' in both the expected and the actual output.

* test/du/inodes.sh: Change the expected output as described above
when returning the --all directory entries (without -l).  Also replace
the name of the hardlink 'd/h' by 'd/f' in the actual output.

12 years agodoc: fix typo
Paul Eggert [Sun, 28 Jul 2013 21:51:32 +0000 (23:51 +0200)] 
doc: fix typo

* doc/coreutils.texi (du invocation): @itemx -> @item.

12 years agomaint: cleanup compare calls in test/du/inodes.sh
Bernhard Voelker [Sun, 28 Jul 2013 16:32:22 +0000 (18:32 +0200)] 
maint: cleanup compare calls in test/du/inodes.sh

* test/du/inodes.sh: In the cases where compare() fails, that function
would show the unified diff automatically.  Therefore, remove the
excess "cat out".
In the cases where expecting an empty file, use compare() again
rather than the simpler "test -s" because possible error reports
will then include the file's content for the same reason as above.

12 years agomaint: avoid clang static analysis issues in csplit
Pádraig Brady [Sun, 28 Jul 2013 01:21:07 +0000 (02:21 +0100)] 
maint: avoid clang static analysis issues in csplit

* src/csplit.c (find_lines): Assert that load_buffer() updates the
global buffers, thus "b" will be non NULL, thus suppressing subsequent
NULL pointer derefence warnings.
(process_regexp): Avoid a redundant assignment of the "line" pointer.
(process_line_count): Likewise.  Also reduce the "line" pointer scope.

12 years agotests: fix intermittent failure in test/du/inodes.sh
Pádraig Brady [Sat, 27 Jul 2013 23:19:45 +0000 (00:19 +0100)] 
tests: fix intermittent failure in test/du/inodes.sh

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5582213

* test/du/inodes.sh: Due to undefined order in returned directory
entries, the expected output might not match, so sort both expected
and actual output when returning --all directory entries.
Also use a simpler test for ensuring no errors are output.

12 years agodu: add --inodes option
Bernhard Voelker [Sat, 27 Jul 2013 12:25:28 +0000 (14:25 +0200)] 
du: add --inodes option

This new option can be used to find directories with a huge
amount of files.  The GNU find utility has the printf format
"%h" which prints the number of entries in a directory, but
this is non-cumulative and doesn't handle hard links.

* src/du.c (struct duinfo): Add new member for counting inodes.
(duinfo_init): Initialize inodes member with Zero.
(duinfo_set): Set inodes counter to 1.
(duinfo_add): Sum up the 2 given inodes counters.
(opt_inodes): Add new boolean flag to remember if the --inodes
option has been specified.
(INODES_OPTION): Add new enum value to be used ...
(long_options): ... here.
(usage): Add description of the new option.
(print_size): Pass inodes counter or size to print_only_size,
depending on the inodes mode.
(process_file): Adapt threshold handling: with --inodes, print or
elide the entries according to the struct member inodes.
(main): Add a case for accepting the new INODES_OPTION.
Print a warning diagnostic when --inodes is used together with the
option --apparent-size or -b.
Reset the output_block_size to 1 ... and thus ignoring the
options -m and -k.
* tests/du/inodes.sh: Add a new test.
* tests/local.mk (all_tests): Mention it.
* doc/coreutils.texi (du invocation): Document the new option.
* NEWS: Mention the new option.

12 years agomv: replace empty directories in cross file system move
Ken Booth [Tue, 2 Jul 2013 00:06:32 +0000 (01:06 +0100)] 
mv: replace empty directories in cross file system move

src/copy.c (copy_internal): Use rmdir() rather than unlink()
when the source is a directory, so that empty directories
are replaced in the destination as per POSIX.
* tests/mv/part-rename.sh: Augment with various combinations.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/14763

12 years agomaint: use new gnulib function to free mount entries in du
Bernhard Voelker [Mon, 22 Jul 2013 10:11:32 +0000 (12:11 +0200)] 
maint: use new gnulib function to free mount entries in du

* src/du.c (fill_mount_table): Use free_mount_entry() instead
of freeing struct members manually.

12 years agomaint: make some shell and perl scripts executable in 'tests/'
Bernhard Voelker [Sun, 21 Jul 2013 23:07:52 +0000 (01:07 +0200)] 
maint: make some shell and perl scripts executable in 'tests/'

Some newer test scripts - partially ones from me - are not executable.
It does not seem to be a problem, but for consistency and to avoid
future problems on unusual platforms or shells change the permissions
by adding the executable bit.

* cfg.mk (sc_tests_executable): Add new syntax-check rule to ensure
that all test scripts are executable.
* tests/df/df-output.sh: Change file mode from 644 to 755.
* tests/du/threshold.sh: Likewise.
* tests/factor/run.sh: Likewise.
* tests/init.sh: Likewise.
* tests/misc/csplit-suppress-matched.pl: Likewise.
* tests/misc/numfmt.pl: Likewise.
* tests/tail-2/retry.sh: Likewise.

12 years agorm: output number of arguments at the interactive prompt
Rasmus Villemoes [Thu, 18 Jul 2013 21:53:12 +0000 (21:53 +0000)] 
rm: output number of arguments at the interactive prompt

Include the number of arguments which rm received in the "Remove all
arguments?" prompt.  This is useful in the, presumably, common case
where the arguments were not provided by hand, but instead were the
result of various shell expansions.  A simple, if somewhat contrived,
example (assuming rm is aliased to rm -I) could be:

  rm * .o

where the prompt "Remove 120 arguments?" is more likely to make
the user catch the problem.

* src/rm.c (main): Include correctly pluralized n_files
in the output message.  Also remove the now redudant "all".
* tests/rm/interactive-always.sh: Adjust to the new prompt.
* tests/rm/interactive-once.sh: Likewise.

12 years agodd: make status=none suppress all diagnostics
Pádraig Brady [Thu, 18 Jul 2013 17:39:55 +0000 (18:39 +0100)] 
dd: make status=none suppress all diagnostics

* src/dd.c (STATUS_NONE): Simplify the enum so that
it's more general than just suppressing transfer counts.
Then test this in all locations where non fatal diagnostics
are output.
* tests/dd/misc.sh: Ensure the diagnostic about
being unable to skip past the end of input is suppressed.
* NEWS: Mention the change in behavior.
Fixes http://bugs.gnu.org/14897

12 years agohead: avoid redundant allocations when reading empty files
Pádraig Brady [Tue, 9 Jul 2013 17:45:34 +0000 (18:45 +0100)] 
head: avoid redundant allocations when reading empty files

* src/head.c (elide_tail_lines_file): For seekable empty files,
or seekable files where the current offset is after the
end of the file, return immediately.  Previously the short
circuit code could not be reached due to logic error.
Spotted by coverity.

12 years agomaint: avoid a valgrind memory leak warning from pinky
Pádraig Brady [Wed, 10 Jul 2013 00:07:57 +0000 (01:07 +0100)] 
maint: avoid a valgrind memory leak warning from pinky

Similarly to commit v8.21-84-g8d2da3f in src/uptime.c
avoid a "definitely lost" error from valgrind.  Note this
only happens with pinky when compiled without optimization,
in which case certain paths aren't eliminated casuing
valgrind to trigger the message.  Note also that coverity
flags this "resource leak" too.

* src/pinky.c (short_pinky): free utmp_buf for developer builds.

12 years agodf: reduce memory usage when filtering mount entries
Anton Ovchinnikov [Thu, 11 Jul 2013 12:44:24 +0000 (13:44 +0100)] 
df: reduce memory usage when filtering mount entries

Avoid Valgrind reports of "definitely lost" items
and while at it, free all discarded mount entries
to minimize the amount of memory used.

* src/df.c (filter_mount_list): Use the newly exported
free_mount_entry() from gnulib to free all mount entries
as they're discarded.

12 years agobuild: update gnulib submodule to latest
Pádraig Brady [Thu, 11 Jul 2013 11:42:53 +0000 (12:42 +0100)] 
build: update gnulib submodule to latest

12 years agobuild: fix a build warning on 32 bit systems in shuf.c
Pádraig Brady [Thu, 11 Jul 2013 02:20:18 +0000 (03:20 +0100)] 
build: fix a build warning on 32 bit systems in shuf.c

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5508873

* src/shuf.c (write_random_numbers): Convert to an int type
that matches the prinft format spec.

12 years agoshuf: add --repetition to support repetition in output
Assaf Gordon [Thu, 4 Jul 2013 19:26:45 +0000 (13:26 -0600)] 
shuf: add --repetition to support repetition in output

main(): Process new option.  Replace input_numbers_option_used()
with a local variable.  Re-organize argument processing.
usage(): Describe the new option.
(write_random_numbers): A new function to generate a
permutation of the specified input range with repetition.
(write_random_lines): Likewise for stdin and --echo.
(write_permuted_numbers):  New function refactored from
write_permuted_output().
(write_permuted_lines): Likewise.
* tests/misc/shuf.sh: Add tests for --repetitions option.
* doc/coreutils.texi: Mention --repetitions, add examples.
* TODO: Mention an optimization to avoid needing to
read all of the input into memory with --repetitions.
* NEWS: Mention new shuf option.

12 years agotests: add more tests for shuf option combinations
Assaf Gordon [Fri, 5 Jul 2013 20:59:44 +0000 (14:59 -0600)] 
tests: add more tests for shuf option combinations

* test/misc/shuf.sh: Add tests for erroneous conditions
like multiple '-o' and '--random-source'.

12 years agomaint: adjust indentation in df.c
Pádraig Brady [Tue, 9 Jul 2013 01:47:42 +0000 (02:47 +0100)] 
maint: adjust indentation in df.c

* src/df.c: Adjust indentation and spacing with has
gotten quite out of line in a couple of places.

12 years agodf: fix mount list processing with unstatable mount dirs
Pádraig Brady [Mon, 8 Jul 2013 23:46:39 +0000 (00:46 +0100)] 
df: fix mount list processing with unstatable mount dirs

* src/df.c (filter_mount_list): Initialize devlist->dev_num correctly
when unable to stat() a mount point.  This will avoid possible invalid
deduplication done on the list due to use of uninitialized memory.
* tests/df/skip-duplicates.sh: Ensure this code path is exercised.
Also refactor the test to be table driven.
* NEWS: Mention the bug fix.

12 years agomaint: avoid a valgrind memory leak warning from uptime
Anton Ovchinnikov [Sun, 7 Jul 2013 09:29:27 +0000 (10:29 +0100)] 
maint: avoid a valgrind memory leak warning from uptime

* src/uptime.c (uptime): Free utmp_buf returned from read_utmp,
to avoid a "definitely lost" warning from valgrind.

12 years agobuild: update gnulib submodule to latest
Paul Eggert [Sun, 7 Jul 2013 00:15:22 +0000 (17:15 -0700)] 
build: update gnulib submodule to latest

12 years agotests: fix "shuf unreadable" test to work when run as root
Pádraig Brady [Fri, 5 Jul 2013 01:43:22 +0000 (02:43 +0100)] 
tests: fix "shuf unreadable" test to work when run as root

* tests/misc/shuf.sh: Restrict the test to the significant
case where we can't in fact read the "unreadable" file.

12 years agostat: ensure --context emits an "unrecognized option" diagnostic
Pádraig Brady [Tue, 2 Jul 2013 10:46:51 +0000 (11:46 +0100)] 
stat: ensure --context emits an "unrecognized option" diagnostic

* src/stat.c (long_options): Remove the "context" option as it's
no longer referenced since commit v8.5-65-g13f3237

12 years agomkdir,mkfifo,mknod: give scontext-related variable a better scope
Bernhard Voelker [Tue, 2 Jul 2013 09:53:57 +0000 (11:53 +0200)] 
mkdir,mkfifo,mknod: give scontext-related variable a better scope

* src/mkdir.c (main): Move the variable ret and issuing the error
message into the body of the scontext-related if-block.
* src/mkfifo.c (main): Likewise.
* src/mknod.c (main): Likewise.

12 years agomaint: refactor SMACK interface to a separate module
Pádraig Brady [Tue, 2 Jul 2013 02:42:20 +0000 (03:42 +0100)] 
maint: refactor SMACK interface to a separate module

Consolidate all smack routines and checks in a module.
We replace and wrap the most commonly used smack routines,
which allows removing ifdefs throughout the code.

* gl/lib/smack.h: A new header containing the implementation
of the wrapped and replacement routines.  Note the is_smack_enabled()
routine should be optimized out at compile time when compiled
on a system without libsmack.
* gl/modules/smack: Describe the new module and move the
configure time code here from ...
* m4/jm-macros.m4: ... here.
* bootstrap.conf: Reference the new module.
* src/id.c: Use the routines without ifdefs where possible.
* src/ls.c: Likewise.
* src/mkdir.c: Likewise.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.

12 years agoid: don't show SMACK errors unless -Z is specified
Pádraig Brady [Tue, 2 Jul 2013 01:40:35 +0000 (02:40 +0100)] 
id: don't show SMACK errors unless -Z is specified

* src/id.c (main): Be consistent with the SELinux case,
and only show errors in getting the security context
when -Z is specified.

12 years agomkdir,mkfifo,mknod: with -Z, create SMACK security context
Jarkko Sakkinen [Wed, 26 Jun 2013 08:48:27 +0000 (11:48 +0300)] 
mkdir,mkfifo,mknod: with -Z, create SMACK security context

Enable creation of SMACK security context with -Z command-line switch
if SMACK is enabled.

* mkdir.c (main): Set process security context to given SMACK label.
* mkfifo.c (main): Likewise.
* mknod.c (main): Likewise.
* src/local.mk: link mk{dir, fifo, nod} with libsmack.
* NEWS: Mention the new feature.

12 years agodoc: fix details on the interaction of df with device nodes
D. Hugh Redelmeier [Thu, 27 Jun 2013 11:32:45 +0000 (12:32 +0100)] 
doc: fix details on the interaction of df with device nodes

* man/df.x: Don't say that a dev node is always on the root file system.
* doc/coreutils.texi (df invocation): Likewise.  Also state that the
device node to mounted file system interpretation is only done when
passed absolute paths to device nodes.

12 years agols: with -Z, show SMACK security context
Jarkko Sakkinen [Mon, 24 Jun 2013 11:24:55 +0000 (14:24 +0300)] 
ls: with -Z, show SMACK security context

Enable showing of file SMACK security with '-Z' command-line switch
if SMACK is enabled.  Showing SMACK context of a file does not strictly
require SMACK to be enabled but this required to make choice whether to
show SELinux or SMACK security context.

* src/ls.c (getfilecon_cache): Retrieve SMACK context if available.
(gobble_file): Handle SMACK context similarly to SELinux context.
* src/local.mk: Link lsl with libsmack.
* NEWS: Mention the new feature.
* .mailmap: Merge the Author's 2 email addresses.

12 years agostdbuf: make it mandatory to specify a buffering option
Pádraig Brady [Sat, 22 Jun 2013 02:37:51 +0000 (03:37 +0100)] 
stdbuf: make it mandatory to specify a buffering option

This is consistent with the documented interface and
avoids any ambiguity in a user thinking that stdbuf without options
might reset to a "standard" buffering setup.

* src/stdbuf.c (set_libstdbuf_options): Indicate with the return value
whether any env variables were actually set.
(main): Fail unless some env variables were set.
* tests/misc/stdbuf.sh: Ensure this constraint is enforced.
* NEWS: Mention the small change in behavior.

12 years agodoc: clarify that truncate --size represents bytes by default
Pádraig Brady [Sat, 22 Jun 2013 02:09:01 +0000 (03:09 +0100)] 
doc: clarify that truncate --size represents bytes by default

* src/truncate.c (usage): Mention that --size is in bytes which
is by far the most common usage.
* doc/coreutils.texi (truncate invocation): Likewise. Also cross
reference the --io-blocks option.
Reported in http://bugs.gnu.org/14686

12 years agoid: adjust/restrict smack support to newer versions of libsmack
Jarkko Sakkinen [Thu, 20 Jun 2013 18:21:37 +0000 (21:21 +0300)] 
id: adjust/restrict smack support to newer versions of libsmack

There was slight change to libsmack such that positive values are
reserved for returning length of the label for smack_new_label_from_*
functions.

* m4/jm-macros.m4: Set HAVE_SMACK when both smack_new_label_from_self()
and recently added smack_new_label_from_path() are present.
The latter's presence indicates the newer API of the former.
* src/id.c (main): Check that smack_new_label_from_self() < 0,
and not just non-zero.

12 years agotests: use appropriate precision when printing float limits
Pádraig Brady [Tue, 18 Jun 2013 14:47:35 +0000 (15:47 +0100)] 
tests: use appropriate precision when printing float limits

* src/getlimits.c (print_float): Adjust to use the ftoastr module,
which uses the appropriate precision so that no info is lost.
* cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): Exclude od.c
fixes http://bugs.gnu.org/14650

12 years agomaint: update gitignore entries
Pádraig Brady [Thu, 13 Jun 2013 10:27:29 +0000 (11:27 +0100)] 
maint: update gitignore entries

* .gitignore: Exclude the generated doc/manual directory,
and also the src/fs-latest-magic.h file referenced in README-release.

12 years agodoc: clarify the description of du --separate-dirs
Pádraig Brady [Wed, 12 Jun 2013 10:40:25 +0000 (11:40 +0100)] 
doc: clarify the description of du --separate-dirs

* src/du.c (usage): Clarify that --separate-dirs doesn't exclude
all directories.
* doc/coreutils.texi (du invocation): Avoid implying that -S
excludes the size of any non directory entries for a directory.
Also don't mention st_size as it's dependent on --apparent-size.
Reported by C de-Avillez in <https://launchpad.net/bugs/1187044>

12 years agodoc: mention prior stat change
Eric Blake [Wed, 5 Jun 2013 18:46:17 +0000 (12:46 -0600)] 
doc: mention prior stat change

For a file of size 1234 bytes, commit ca9aa759 had the side effect
of changing 'stat -c "%'s" file' from outputting "?s" to the nicer
"1,234", depending on locale.  This is worth mentioning in the NEWS.

Resolves part of http://bugs.gnu.org/14556.

* NEWS: Mention 8.7 improvement in stat.
* cfg.mk (old_NEWS_hash): Adjust accordingly.

12 years agobuild: update gnulib submodule; also bootstrap to latest
Bernhard Voelker [Wed, 5 Jun 2013 09:41:19 +0000 (11:41 +0200)] 
build: update gnulib submodule; also bootstrap to latest

Notes tests/init.sh is still in sync with gnulib.

* bootstrap: Update to latest.
* gnulib: Update avoiding gnulib-test failures.

12 years agotests: avoid a race in tail --retry testing
Pádraig Brady [Mon, 3 Jun 2013 00:29:17 +0000 (01:29 +0100)] 
tests: avoid a race in tail --retry testing

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5221053

* tests/tail-2/retry.sh: Ensure the 'out' file is truncated,
as it's used to arbitrate the run order of commands.
Relying on the truncation in the background tail command
is racy because the truncation can occur after the fork
of the background shell and thus wait4lines would not wait
for output to occur in 'out', which would mean that the
'missing' file could be populated by the time tail(1)
gets to process it.

12 years agodoc: mention 'UTC' in date --utc help
Andreas Mohr [Sun, 2 Jun 2013 23:37:11 +0000 (00:37 +0100)] 
doc: mention 'UTC' in date --utc help

src/date.c (usage): Make -u apparent in searches for UTC.

12 years agood: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t
Jim Meyering [Sun, 2 Jun 2013 02:20:06 +0000 (19:20 -0700)] 
od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t

* src/od.c (PRINT_FIELDS): Declare "i" to be of type uintmax_t, so that
the numerator in the expression for "next_pad" does not overflow.
(print_named_ascii): Likewise.
(print_ascii): Likewise.
Bug introduced via commit v6.12-42-g20c0b87.
* tests/misc/od.pl: Exercise each of the three affected code paths.
* NEWS (Bug fixes): Mention it.
Reported by Rich Burridge.

12 years agotests: head-c: avoid spurious failure with a 32-bit size_t
Jim Meyering [Tue, 28 May 2013 00:01:14 +0000 (17:01 -0700)] 
tests: head-c: avoid spurious failure with a 32-bit size_t

* tests/misc/head-c.sh: Don't try to elide 1 exabytes, since on
32-bit systems, that number is not representable as a size_t.
This command would fail on 32-bit systems, where SIZE_MAX < 1E:
  head --bytes=-E < /dev/null
Instead of "E", use $SSIZE_MAX.
For discussion, see http://bugs.gnu.org/13530

12 years agotests: avoid spurious failure when SIZE_MAX is 2^32-1
Jim Meyering [Mon, 27 May 2013 01:56:50 +0000 (18:56 -0700)] 
tests: avoid spurious failure when SIZE_MAX is 2^32-1

* tests/split/line-bytes.sh: Since we've limited virtual memory to
20MB, choose a smaller size, 1GiB (which is <= SIZE_MAX) rather than
1EiB, which is larger than SIZE_MAX on 32-bit systems.
I confirmed that this test still fails when the split.c-modifying
part of v8.21-58-gfec363c is backed out.

12 years agotests: fix an ls test not to fail when user or group name contains SP
Jim Meyering [Sat, 25 May 2013 03:11:37 +0000 (20:11 -0700)] 
tests: fix an ls test not to fail when user or group name contains SP

* tests/ls/block-size.sh (size_etc): The sed expression through which
we filtered the output of "ls -l ..." assumed that the user and group
name components of each line would not contain spaces.  Avoid the
problem by using -og instead of -l, thus not printing either of those
fields.  Adjust the sed expression accordingly.

12 years agotests: numfmt: use the printf program, not the shell builtin
Stefano Lattarini [Sun, 26 May 2013 22:06:00 +0000 (00:06 +0200)] 
tests: numfmt: use the printf program, not the shell builtin

* tests/misc/numfmt.pl: Avoid a spurious failure when
/bin/sh is dash (as can happen on Debian systems).

12 years agostat: tune for large-LDAP case
Paul Eggert [Fri, 24 May 2013 17:21:26 +0000 (10:21 -0700)] 
stat: tune for large-LDAP case

* src/stat.c (print_stat): Omit unnecessary calls to setpwent, setgrent.
Problem reported by Fridolín Pokorný in <http://bugs.gnu.org/14462>.

12 years agosplit: with --line-bytes only allocate memory as needed
Pádraig Brady [Sat, 20 Apr 2013 07:46:43 +0000 (08:46 +0100)] 
split: with --line-bytes only allocate memory as needed

* src/split.c (line_bytes_split): Rewrite to only buffer
when necessary.  I.E. only increase the buffer when we've
already lines output in a split and we encounter a line
larger than the input buffer size, in which case a hold
buffer will be increased in increments of the input buffer size.
(lines_rr): Use the more abstract xalloc_die() just like
we did in line_bytes_split(), rather than explicitly
printing the "memory exhausted" message and exiting.
* tests/split/line-bytes.sh: Add a new test for this
function which previously had no test coverage.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/13537

12 years agomaint: port --enable-gcc-warnings to clang
Paul Eggert [Sun, 19 May 2013 00:49:32 +0000 (17:49 -0700)] 
maint: port --enable-gcc-warnings to clang

* configure.ac: If clang, add -Wno-format-extra-args and
-Wno-tautological-constant-out-of-range-compare.
* gl/lib/rand-isaac.c (ind):
* gl/lib/randread.c (readisaac):
* src/ls.c (dev_ino_push, dev_ino_pop):
* src/sort.c (buffer_linelim):
* src/system.h (is_nul):
* src/tail.c (tail_forever_inotify):
Rewrite to avoid casts that clang dislikes.
It's good to avoid casts anyway.
* src/expr.c (integer_overflow): Declare only if it exists.
(die): Remove; unused.
* src/ls.c (dev_ino_push): New function, replacing ...
(DEV_INO_PUSH): ... this removed macro.  All uses changed.
(decode_switches): Rewrite "str"+i to &str[i].

12 years agobuild: update gnulib submodule to latest
Paul Eggert [Sat, 18 May 2013 19:47:53 +0000 (12:47 -0700)] 
build: update gnulib submodule to latest

12 years agotests: don't assume expr was built with GMP
Paul Eggert [Sat, 18 May 2013 23:26:39 +0000 (16:26 -0700)] 
tests: don't assume expr was built with GMP

* tests/misc/cut-huge-range.sh (subtract_one): New string.
(CUT_MAX): Don't pass a too-large integer to 'expr'.

12 years agodoc: link to the list of rejected feature requests
Pádraig Brady [Sun, 12 May 2013 12:04:27 +0000 (13:04 +0100)] 
doc: link to the list of rejected feature requests

* README: Update the email address best suited to discussing
feature requests, and also link to the list of previously
discussed and rejected requests.

12 years agobuild: avoid new syntax-check failure
Jim Meyering [Sat, 11 May 2013 16:28:32 +0000 (18:28 +0200)] 
build: avoid new syntax-check failure

* po/POTFILES.in: Reflect renaming.

12 years agomaint: add FIXME comment
Paul Eggert [Sun, 12 May 2013 02:21:06 +0000 (19:21 -0700)] 
maint: add FIXME comment

12 years agomkdir: don't assume umask equals POSIX default ACL mask
Paul Eggert [Sun, 12 May 2013 02:17:10 +0000 (19:17 -0700)] 
mkdir: don't assume umask equals POSIX default ACL mask

This fixes Bug#14371, reported by Killer Bassist.
* NEWS: Document this.
* src/mkdir.c (struct mkdir_options): Remove member ancestor_mode.
New member umask_value.  All uses changed.
* src/mkdir.c (make_ancestor): Fix umask assumption.
* src/mkdir.c, src/mkfifo.c, src/mknod.c (main):
Leave umask alone.  This requires invoking lchmod after creating
the file, which introduces a race condition, but this can't be
avoided on hosts with "POSIX" default ACLs, and there's no easy
way with network file systems to tell what kind of host the
directory is on.
* tests/local.mk (all_tests): Add tests/mkdir/p-acl.sh.
* tests/mkdir/p-acl.sh: New file.

12 years agobuild: update gnulib submodule to latest
Paul Eggert [Sun, 12 May 2013 01:29:47 +0000 (18:29 -0700)] 
build: update gnulib submodule to latest

12 years agoid: with -Z, show SMACK security context
Jarkko Sakkinen [Sat, 4 May 2013 17:44:53 +0000 (20:44 +0300)] 
id: with -Z, show SMACK security context

Adds an optional dependency on libsmack.

* m4/jm-macros.m4: Look for the smack library/header.
* src/id.c (main): Output the smack context if available.
* src/local.mk: Link with libsmack if available.
* NEWS: Mention the new feature.

12 years agocut: improve performance, especially with --output-delimiter
Cojocaru Alexandru [Tue, 7 May 2013 12:47:15 +0000 (13:47 +0100)] 
cut: improve performance, especially with --output-delimiter

Use a sentinel value that's checked implicitly, rather than
a bit array, to determine if an item should be output.

Benchmark results for this change are:

$ yes abcdfeg | head -n1MB > big-file

$ for c in orig sentinel; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done
== orig ==
real    0m0.049s
user    0m0.044s
sys     0m0.005s

== sentinel ==
real    0m0.035s
user    0m0.032s
sys     0m0.002s

 ## Again with --output-delimiter ##
$ for c in orig sentinel; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 --output-delimiter=: big-file > /dev/null
  done
== orig ==
real    0m0.106s
user    0m0.103s
sys     0m0.002s

== sentinel ==
real    0m0.055s
user    0m0.052s
sys     0m0.003s

eol_range_start: Removed. 'n-' is no longer treated specially,
and instead SIZE_MAX is set for the 'hi' limit, and tested implicitly.
complement_rp: Used to complement 'rp' when '--complement' is specified.
ADD_RANGE_PAIR: Macro renamed to 'add_range_pair' function.
* tests/misc/cut-huge-range.sh: Adjust to the SENTINEL value.
Also remove the overlapping range test as this is no longer
dependent on large ranges and also is already handled with
the EOL-subsumed-3 test in cut.pl.

12 years agocut: fix handling of overlapping ranges
Cojocaru Alexandru [Tue, 7 May 2013 12:01:46 +0000 (13:01 +0100)] 
cut: fix handling of overlapping ranges

This issue was introduced in commit v8.21-43-g3e466ad

* src/cut.c (set_fields): Process all range pairs when merging.
* tests/misc/cut-huge-range.sh: Add a test for this edge case.
Also fix an issue where we could miss reported errors due
to truncation of the 'err' file.

12 years agodoc: correct a URL to older textutils source
Pádraig Brady [Tue, 30 Apr 2013 10:50:37 +0000 (11:50 +0100)] 
doc: correct a URL to older textutils source

* doc/coreutils.texi (Putting the tools together): Adjust the
textutils-1.22 URL, and add a URL for newer sources.

12 years agocut: reduce CPU usage for the the common case
Pádraig Brady [Sun, 28 Apr 2013 22:27:12 +0000 (23:27 +0100)] 
cut: reduce CPU usage for the the common case

Ensure appropriate functions are inlined.  This was seen to
be required with gcc 4.6.0 with -O2 on x86_64 at least.
It was reported that gcc 4.8.0 did inline these functions though.

Also reinstate the bit vector for the common case,
to further improve performance.

Benchmark results for both aspects of this change are:

$ yes abcdfeg | head -n1MB > big-file
$ for c in orig inline inline-array; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done

== orig ==
real    0m0.088s
user    0m0.081s
sys     0m0.007s

== inline ==
real    0m0.070s
user    0m0.060s
sys     0m0.009s

== inline-array ==
real    0m0.049s
user    0m0.044s
sys     0m0.005s

* src/cut.c (set_fields): Set up the printable_field bit vector
for performance, but only when it's appropriate.  I.E. not
when either --output-delimeter or huge ranges are specified.
(next_item): Ensure it's inlined and avoid unnecessary processing.
(print_kth): Ensure it's inlined and add a branch for the fast path.
Related to http://bugs.gnu.org/13127

12 years agocut: reduce CPU overhead in determining item to output
Cojocaru Alexandru [Sun, 28 Apr 2013 02:03:45 +0000 (03:03 +0100)] 
cut: reduce CPU overhead in determining item to output

print_kth() is the central function of cut used to
determine if an item is to be output or not,
so simplify it by moving some logic outside.
Benchmark results for this change are:

$ yes abcdfeg | head -n1MB > big-file
$ for c in orig split; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done

== orig ==
real    0m0.111s
user    0m0.108s
sys     0m0.002s

== split ==
real    0m0.088s
user    0m0.081s
sys     0m0.007s

* src/cut.c (print_kth): Refactor a branch to outside the function.
Related to http://bugs.gnu.org/13127

12 years agocut: make memory allocation independent of range width
Cojocaru Alexandru [Sun, 9 Dec 2012 09:43:10 +0000 (10:43 +0100)] 
cut: make memory allocation independent of range width

The current implementation of cut, uses a bit array,
an array of `struct range_pair's, and (when --output-delimiter
is specified) a hash_table.  The new implementation will use
only an array of `struct range_pair's.
The old implementation is memory inefficient because:
 1. When -b with a big num is specified, it allocates a lot of
    memory for `printable_field'.
 2. When --output-delimiter is specified, it will allocate 31 buckets.
    Even if only a few ranges are specified.

Note CPU overhead is increased to determine if an item is to be printed,
as shown by:

$ yes abcdfeg | head -n1MB > big-file
$ for c in with-bitarray without-bitarray; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done

== with-bitarray ==
real    0m0.084s
user    0m0.078s
sys     0m0.006s

== without-bitarray ==
real    0m0.111s
user    0m0.108s
sys     0m0.002s

Subsequent patches will reduce this overhead.

* src/cut.c (set_fields): Set and initialize RP
instead of printable_field.
* src/cut.c (is_range_start_index): Use CURRENT_RP rather than a hash.
* tests/misc/cut.pl: Check if `eol_range_start' is set correctly.
* tests/misc/cut-huge-range.sh: Rename from cut-huge-to-eol-range.sh,
and add a test to verify large amounts of mem aren't allocated.
Fixes http://bugs.gnu.org/13127

12 years agostat,tail: improve support for snfs
Pádraig Brady [Wed, 24 Apr 2013 21:59:46 +0000 (22:59 +0100)] 
stat,tail: improve support for snfs

The StorNext distributed file system was previously known as CVFS.

* src/stat.c (human_fstype): Add new file system ID definition.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/14251

12 years agotests: fix usage of require_ulimit_
Pádraig Brady [Thu, 25 Apr 2013 10:03:22 +0000 (11:03 +0100)] 
tests: fix usage of require_ulimit_

* init.cfg (require_ulimit_v_): Renamed from require_ulimit_
as this only checks for ulimit -v support.  Other uses of
ulimit -t and ulimit -n in tests shouldn't cause false failures
if not supported.
* cfg.mk (sc_prohibit_test_ulimit_without_require_): A new syntax check
to ensure that require_ulimit_v_() is used iff required.
* tests/misc/head-c.sh: Add missing call to require_ulimit_v_.
* tests/rm/many-dir-entries-vs-OOM.sh: Likewise.
* tests/split/r-chunk.sh: Remove non mandatory require_ulimit_ call.
* tests/misc/sort-merge-fdlimit.sh: Likewise.
* tests/cp/link-heap.sh: Adjust to renamed require_ulimit_v_.
* tests/dd/no-allocate.sh: Likewise.
* tests/misc/csplit-heap.sh: Likewise.
* tests/misc/cut-huge-to-eol-range.sh: Likewise.
* tests/misc/printf-surprise.sh: Likewise.

12 years agoscripts: tweak URLs in autotools-install
Jim Meyering [Wed, 5 Dec 2012 19:11:59 +0000 (11:11 -0800)] 
scripts: tweak URLs in autotools-install

* scripts/autotools-install (tarballs): Use http:// URLs rather
than ftp:// ones.  The former are more likely to work, these days.
Update URLs to point to the latest versions.