]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
11 years agoselinux: a new module implementing "restorecon" functionality
Daniel J Walsh [Wed, 27 Nov 2013 12:24:26 +0000 (12:24 +0000)] 
selinux: a new module implementing "restorecon" functionality

* src/selinux.c: A new module implementing "restorecon" functionality.
There are two main functions to adjust the type of the referenced
file system item.  defaultcon() will setup the process context so
that new items will have the required context without races.  This is
the preferred method.  For existing files, the equivalent restorecon()
is available which has two modes.  With the "local" parameter set to
false, restorecon() will adjust the type according to the system
configuration for that file, and set to true will update the context
as per the context for the current process (disregarding type).
* src/selinux.h: Likewise.
* po/POTFILES.in: Reference the new module.

11 years agoshred: provide --remove methods to avoid excessive syncing
Pádraig Brady [Thu, 7 Nov 2013 17:00:56 +0000 (17:00 +0000)] 
shred: provide --remove methods to avoid excessive syncing

A sync operation is very often expensive.  For illustration
I timed the following python script which indicated that
each ext4 dir sync was taking about 2ms and 12ms, on an
SSD and traditional disk respectively.

  import os
  d=os.open(".", os.O_DIRECTORY|os.O_RDONLY)
  for i in range(1000):
     os.fdatasync(d)

So syncing for each character for each file can result
in significant delays.  Often this overhead is redundant,
as only the data is sensitive and not the file name.
Even if the names are sensitive, your file system may
employ synchronous metadata updates, which also makes
explicit syncing redundant.

* tests/misc/shred-remove.sh: Ensure all the new parameters
actually unlink the file.
* doc/coreutils.texi (shred invocation): Describe the new
parameters to the --remove option.
* src/shred.c (Usage): Likewise.
(main): Parse the new options.
(wipename): Inspect the new enum to see which of
the now optional tasks to perform.
* NEWS: Mention the new feature.
* THANKS.in: Add reporter Joseph D. Wagner

11 years agotail: improve inotify handling of symlinks
Pádraig Brady [Fri, 13 Sep 2013 15:31:24 +0000 (17:31 +0200)] 
tail: improve inotify handling of symlinks

Previous behavior failed to read contents of a (re)appearing file,
when symlinked by tail's watched file.  Also we now diagnose other
edge cases when running in inotify mode, where an initially
missing or regular file changes to a symlink.

* src/tail.c (main): If any arg is a symlink, use polling mode.
(recheck): Diagnose the edge case where a symlink appears during
inotify processing.
* tests/tail-2/symlink.sh: Test the fix. Mention the edge cases.
* tests/local.mk: Reference the new test.
* NEWS: Mention the fix.
Reported by: Ondrej Oprala

11 years agodf: add --output=file to directly output specified arguments
Pádraig Brady [Fri, 22 Nov 2013 02:12:34 +0000 (02:12 +0000)] 
df: add --output=file to directly output specified arguments

* src/df.c (usage): Document the new 'file' --output field.
(get_dev): Add a new parameter to pass the specified
argument from the command line through.  Use '-' if a
command line parameter is not being used.
* doc/coreutils.texi (df invocation): Describe the new 'file' field.
* tests/df/df-output.sh: Adjust all fields test, and
add a specific test for --output=file.
* NEWS: Mention the new feature.

11 years agotimeout: avoid unlikely issues with --kill-after
Pádraig Brady [Tue, 26 Nov 2013 14:27:25 +0000 (14:27 +0000)] 
timeout: avoid unlikely issues with --kill-after

* src/timeout.c (cleanup): When calling settimeout() from
this signal handler, ensure we don't call out to error()
or gettext(), which are not async-signal-safe.
Also reset the errno which may be cleared by settimeout().

11 years agotests: ensure factor tests can be regenerated
Pádraig Brady [Tue, 26 Nov 2013 13:37:50 +0000 (13:37 +0000)] 
tests: ensure factor tests can be regenerated

* tests/local.mk (factor-tests:) Add -f to the mv command that
replaces any existing generated tests.  This is required to avoid
prompts when root initially generates the tests, and they subsequently
need to be regenerated by a non root user.

11 years agosort: avoid issues when issuing diagnostics from child processes
Pádraig Brady [Tue, 26 Nov 2013 02:47:36 +0000 (02:47 +0000)] 
sort: avoid issues when issuing diagnostics from child processes

* src/sort.c: (async_safe_die): A new limited version of error(),
that outputs fixed strings and unconverted errnos to stderr.
This is safe to call in the limited context of a signal handler,
or in this particular case, between the fork() and exec() of
a multithreaded process.
(move_fd_or_die): Use the async_safe_die() rather than error().
(maybe_create_temp): Likewise.
(open_temp): Likewise.
Fixes http://bugs.gnu.org/15970

11 years agodoc: clarify the operation of ls -k
Pádraig Brady [Tue, 26 Nov 2013 15:32:39 +0000 (15:32 +0000)] 
doc: clarify the operation of ls -k

* src/ls.c (usage): Mention -k only changes the display
for disk usage (directory total, and ls -s), and imply
that it can be overridden (by --block-size, and -h).
* doc/coreutils.texi (block size): Mention that ls -k
handling is different to other utilities.
Addresses http://bugs.gnu.org/14525

11 years agodircolors: add a new entry to colorize 'lz4' files
John [Sat, 23 Nov 2013 00:01:54 +0000 (00:01 +0000)] 
dircolors: add a new entry to colorize 'lz4' files

* src/dircolors.hin: Add entry for the speed optimized 'lz4' compressor.

11 years agotests: enhance rm test regarding "." and ".."
Bernhard Voelker [Fri, 22 Nov 2013 14:54:06 +0000 (15:54 +0100)] 
tests: enhance rm test regarding "." and ".."

Recent commit 2da7009d changed the error diagnostic of rm(1) trying
to remove "." or "..".  Enhance the corresponding test.

* tests/rm/r-4.sh: Ensure rm(1) outputs the expected error diagnostic.

11 years agomaint: avoid perl warning in sc_check-AUTHORS
Bernhard Voelker [Thu, 21 Nov 2013 11:11:01 +0000 (12:11 +0100)] 
maint: avoid perl warning in sc_check-AUTHORS

With newer perl, "make syntax-check" issues many warnings like:
  -i used with no filenames on the command line, reading from STDIN.

* cfg.mk (sc_check-AUTHORS): Remove the -i flag in the perl
invocation as it is reading from a pipe.

11 years agodoc: enhance diagnostic when rm skips "." or ".." arguments
Bernhard Voelker [Thu, 21 Nov 2013 00:03:15 +0000 (01:03 +0100)] 
doc: enhance diagnostic when rm skips "." or ".." arguments

The error diagnostic
  "rm: cannot remove directory: '.'"
does not give the user a hint for the reason.
Issue a clearer error message.

* src/remove.c (rm_fts): Enhance the error diagnostic in the above
case to emphasize that skipping is done deliberately.
In the corresponding comment, mention that POSIX mandates this
behavior.  Likewise in the subsequent comment for skipping "/".
* doc/coreutils.texi (rm invocation): In the paragraph describing
the above behavior, mention that POSIX mandates it.

11 years agotests: fix false rm -I test failure when run as root
Pádraig Brady [Fri, 15 Nov 2013 18:16:54 +0000 (18:16 +0000)] 
tests: fix false rm -I test failure when run as root

Fix a recent regression introduced in commit v8.21-127-g5ee7d8f

Also related to this is the recent query about root run `rm -I`
ignoring the mode bits of a file: https://bugzilla.redhat.com/1013171

* tests/rm/interactive-once.sh: Avoid the messages and
corresponding file presence checks with write protected files
when running as root.

11 years agostty: add support for mark/space parity
Colin Leitner [Sat, 16 Nov 2013 11:14:18 +0000 (12:14 +0100)] 
stty: add support for mark/space parity

This adds support for using a constant or "stick" parity bit.

* src/stty.c (usage): Mention the new flag.
* tests/misc/stty.sh: Adjust for the new flag.
* NEWS: Mention the improvement.
* docs/coreutils.texi (stty invocation): Mention the new flag.

11 years agobase64: improve encoding I/O efficiency
Pádraig Brady [Mon, 11 Nov 2013 02:51:17 +0000 (02:51 +0000)] 
base64: improve encoding I/O efficiency

Since the I/O overhead is significant to the relatively
simple processing done by this utility, use fputs() rather
than fputc() to output '\n'.
Time to process a 100MiB file was measured to
decrease from 0.417s to 0.383s, i.e. an 8% improvement.

Related to these changes, is a processing improvement in
gnulib, which increases throughput by 60% when processing
full buffers, which improves processing of a 100MiB file
with standard wrapped output, down to 0.256s.
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=43fd1e7b

Also increase the encoding buffer size from 3 to 30KiB.
This was seen to give a further 8% improvement, taking
processing time down to 0.235s in the wrapped output case.
The decoding size buffer is not adjusted,
due to the noted caveat with --ignore-garbage.

* src/base64.c (BLOCKSIZE): Split into ENC_ and DEC_ variants,
with the former increased from 3KiB to 30KiB.
(wrap_write): Use the simpler fputc() rather than fputs()
to output the '\n' character.  Also check against EOF
rather than < 0 for errors.
(do_encode): Likewise.
* NEWS: Mention the large increase in performance, which
with the I/O improvements in coreutils and the processing
improvement in gnulib, amount to about a 60% throughput increase.

11 years agoshred: avoid data write pass with --size=0
Pádraig Brady [Thu, 7 Nov 2013 12:32:29 +0000 (12:32 +0000)] 
shred: avoid data write pass with --size=0

* src/shred.c (dopass): Exit early to avoid redundant heap
allocation, and more importantly avoiding a file sync
when we're writting no data, as this can have side effects.
Also with --verbose, this avoids printing of "pass status"
which could be confusing as to whether data was actually written.
* tests/misc/shred-passes.sh: Ensure the status for data
passes are not written when not doing any data writes.

11 years agoshred: increase I/O block size for periodic pattern case
Pádraig Brady [Thu, 7 Nov 2013 11:57:09 +0000 (11:57 +0000)] 
shred: increase I/O block size for periodic pattern case

* src/shred.c (dopass): In the periodic pattern case increase the
I/O block size from 12KiB to 60KiB (also a multiple of 3 and 4096).
* NEWS: Adjust accordingly.

11 years agoshred: fix direct I/O failures for last write to file
Pádraig Brady [Thu, 7 Nov 2013 13:26:25 +0000 (13:26 +0000)] 
shred: fix direct I/O failures for last write to file

Since direct I/O is now enabled with commit v8.21-139-gebaf961
we must handle the case where we write an odd size at the
end of a file (with --exact), or we specify an odd --size that
is larger than 64KiB, or in the very unlikely case of a device
with an odd size.  This issue was present since direct I/O
support was first added in v5.3.0, but latent since v6.0.
Theoretically this could have also been an issue after that on
systems which didn't have alignment constraints, but did have
size constraints for direct I/O.

* src/shred.c (dopass): On the first pass for a file, always
retry a write that fails with EINVAL, so we handle direct I/O
failure at either the start or end of the file.  Adjust the comment
as the original case is out of date and implicitly handled
by this more general fix.
* tests/misc/shred-exact.sh: Add a test case.
* NEWS: Add a "bug fix" entry for shred since there are
two related issues now fixed.

11 years agocp: fix --link regarding the dereferencing of symbolic links
Gian Piero Carrubba [Thu, 7 Nov 2013 22:35:52 +0000 (23:35 +0100)] 
cp: fix --link regarding the dereferencing of symbolic links

* src/copy.c (create_hard_link): Add a bool 'dereference' parameter,
and pass AT_SYMLINK_FOLLOW as 'flags' to linkat() when dereference
is true.
(should_dereference): Add new 'bool' function to determine if a
file should be dereferenced or not.
(copy_internal): Use the above new should_dereference() and remember
its return value in a new local bool 'dereference' variable.  Use that
in all three calls to create_hard_link().
* src/cp.c (main): after parsing the options, if x.dereference is
still DEFEF_UNDEFINED and the x.recursive is true, then only set
x.dereference to DEREF_NEVER iff --link was not specified.
* doc/coreutils.texi (cp invocation): Mention that cp(1) does not
follow symbolic links in the source when --link is specified.
Likewise in the description of the -R option when used together with
that option.
* tests/cp/same-file.sh: Adapt the expected results for the -fl,
the -bl and the -bfl tests.
* tests/cp/link-deref.sh: Add a new test.
* tests/local.mk (all_tests): Reference the above new test.
* NEWS (Changes in behavior): Mention the change.

This fixes http://bugs.gnu.org/15173

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
11 years agoshred: write larger chunks when possible
Pádraig Brady [Mon, 4 Nov 2013 23:14:11 +0000 (23:14 +0000)] 
shred: write larger chunks when possible

* src/shred.c (dopass): When not needing to write periodic patterns,
use a 64KiB block size to reduce the number of write system calls.

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).