]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
9 years agoall: quote string arguments in error messages
Pádraig Brady [Tue, 27 Oct 2015 13:13:59 +0000 (13:13 +0000)] 
all: quote string arguments in error messages

These strings are often file names or other user specified
parameters, which can give confusing errors in
the presence of unexpected characters for example.

* cfg.mk (sc_error_quotes): A new syntax check rule.
* src/*.c: Wrap error() string arguments with quote().
* tests/: Adjust accordingly.
* NEWS: Mention the improvement.

9 years agomd5sum: quote all printed file names
Pádraig Brady [Mon, 26 Oct 2015 01:26:04 +0000 (01:26 +0000)] 
md5sum: quote all printed file names

This is especially significant when using --check
with files generated on a windows system, where the \r
characters produce corrupted and confusing error messages.
This also ensures status messages are output on a single line.

* src/md5sum.c: Use quote() for printed file names.
* tests/misc/md5sum.pl: Adjust accordingly.
* NEWS: Mention the change in behavior.
Fixes http://bugs.gnu.org/21757

9 years agols: fix off by one error when determining max display columns
Pádraig Brady [Wed, 21 Oct 2015 12:57:41 +0000 (13:57 +0100)] 
ls: fix off by one error when determining max display columns

* src/ls.c (main): Account for the first column not including
a separator when calculating max_idx.
* tests/ls/w-option.sh: Add a test case.
* NEWS: Mention the bug fix.

9 years agols: allow -w0 to mean no limit on line length
Pádraig Brady [Tue, 20 Oct 2015 13:42:39 +0000 (14:42 +0100)] 
ls: allow -w0 to mean no limit on line length

* src/ls.c (print_with_separator): Renamed from print_with_commas,
and parameterized to accept the separator to print.
Also fix an edge case where '\n' not printed when
the POS variable overflows SIZE_MAX.
(print_current_files): Degenerate -x and -C to using the
cheaper print_with_separator() in the -w0 case.
* doc/coreutils.texi (ls invocation): Document the new feature.
* tests/ls/w-option.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/21325

9 years agols: detect terminal color support using glob patterns
Pádraig Brady [Mon, 19 Oct 2015 11:48:49 +0000 (12:48 +0100)] 
ls: detect terminal color support using glob patterns

* src/ls.c (know_term_type): Corresponding to commit v8.24-48-gc249a5a,
use fnmatch to inspect the dircolors database.  Noticed due to
failing tests/ls/color-{dtype-dir,term}.sh tests.

9 years agotests: adjust recent change to csplit VM limit
Pádraig Brady [Mon, 19 Oct 2015 10:25:42 +0000 (11:25 +0100)] 
tests: adjust recent change to csplit VM limit

* tests/misc/csplit-heap.sh: A little more memory is required
for the full run case.  Noticed with --enable-single-binary.

9 years agomaint: fixes to support improved sc_tight_scope
Pádraig Brady [Sun, 18 Oct 2015 21:09:19 +0000 (22:09 +0100)] 
maint: fixes to support improved sc_tight_scope

The gnulib provided sc_tight_scope target was ineffective,
as it was checking against an invalid blank regular expression,
and thus ignoring any extern function issues.  This is now
fixed up in gnulib, and so we need to fix our scoping issues
before the next gnulib update.

* cfg.mk: Setup and document the tight_scope config variables
appropriately.
* src/selinux.h: Since declared in *_SOURCES, use the two line
form for the extern function declarations.
* src/set-fields.h: Add the extern declarations, and since declared
in noinst_HEADERS use the single line form.

9 years agotests: avoid failure when auto selecting factor tests
Pádraig Brady [Sun, 18 Oct 2015 01:27:22 +0000 (02:27 +0100)] 
tests: avoid failure when auto selecting factor tests

* tests/factor/run.sh: If this template is found through
`grep -El "print_ver_.* factor"` for example, then just skip it.

9 years agofactor: remove unreachable SQUFOF code at compile time
Pádraig Brady [Sat, 17 Oct 2015 10:38:20 +0000 (11:38 +0100)] 
factor: remove unreachable SQUFOF code at compile time

It was a little confusing as to whether the SQUFOF algorithm was
enabled, and in fact there were no options available to enable it.
Therefore clarify the 3 configurable behaviors for the code to
3 defines at the top of the program, and only include the SQUFOF
code if enabled at compile time.

$ size src/factor-before
   text    data     bss
  93997    1412    2504
$ size src/factor-after
   text    data     bss
  87885    1404    2504

* src/factor.c: Only include the SQUFOF factor code
when enabled via the USE_SQUFOF define.
* doc/coreutils.texi (factor invocation): Update note about
factor limits, as we can factor 128 bit numbers without GMP.

9 years agodoc: reference shuf(1) from the sort (-R) man page
Pádraig Brady [Sun, 18 Oct 2015 01:48:05 +0000 (02:48 +0100)] 
doc: reference shuf(1) from the sort (-R) man page

* man/sort.x: Cross reference with shuf(1).
* src/sort.c (usage): Mention shuf(1) with -R option.
Suggested in http://bugs.debian.org/641166

9 years agomaint: avoid duplicate test runs
Bernhard Voelker [Sun, 18 Oct 2015 10:46:05 +0000 (12:46 +0200)] 
maint: avoid duplicate test runs

* tests/local.mk (all_tests): Remove the tests 'tests/id/setgid.sh' and
'tests/mkdir/smack-root.sh' because they are mentioned in the
'all_root_tests' list; these tests are skipped anyway during a non-root
run because flagged with 'require_root_'.

9 years agodoc: remove obsolete performance comment
Paul Eggert [Fri, 16 Oct 2015 19:05:58 +0000 (12:05 -0700)] 
doc: remove obsolete performance comment

sha512sum can be faster than sha256sum.
E.g., ‘dd if=/dev/zero bs=1024k count=1024 | time sha256sum’
reports 8.16 user CPU seconds on my host, whereas sha512sum
consumes 5.45 seconds (Fedora x86-64 on an AMD Phenom II X4 910e).
Although sha512sum is still considerably slower on x86, a good
chunk of uses are on 64-bit hosts and anyway there’s little point
to scaring people away from sha512sum nowadays.
* doc/coreutils.texi (sha2 utilities): Remove obsolete comment.

9 years agomaint: avoid uniq.c warning from bleeding-edge gcc's -Wstrict-overflow
Jim Meyering [Thu, 15 Oct 2015 16:09:18 +0000 (09:09 -0700)] 
maint: avoid uniq.c warning from bleeding-edge gcc's -Wstrict-overflow

* src/uniq.c (main): Make the type of "nfiles" unsigned,
to avoid a brand new warning from a gcc I built from today's
sources (gcc version 6.0.0 20151015 (experimental) (GCC)):
src/uniq.c:523:14: error: assuming signed overflow does not occur \
  when simplifying conditional to constant [-Werror=strict-overflow]
           if (nfiles == 2)
              ^

9 years agodircolors: support globbing of TERM entries
Pádraig Brady [Tue, 13 Oct 2015 11:40:52 +0000 (12:40 +0100)] 
dircolors: support globbing of TERM entries

* src/dircolors.c (dc_parse_stream): Support globbing of
TERM entries, to allow entries like "TERM *256color*" for example.
* src/dircolors.hin: Reduce the internal list with globbing.
* tests/misc/dircolors.pl: New test cases.
* NEWS: Mention the improvement.

9 years agotests: avoid false failure in rm/r-root.sh with gdb warnings
Pádraig Brady [Thu, 15 Oct 2015 09:22:20 +0000 (10:22 +0100)] 
tests: avoid false failure in rm/r-root.sh with gdb warnings

* tests/rm/r-root.sh: Skip the test if there are gdb warnings
that will impact further stderr checks.  For example some
buggy gdb versions may report "Got object file from memory
but can't read symbols: File truncated".  Also fix an incorrect
stderr check from the previous change.
Reported by Bernhard Voelker.

9 years agotests: avoid false failure in rm/r-root.sh under load
Pádraig Brady [Wed, 14 Oct 2015 22:26:22 +0000 (23:26 +0100)] 
tests: avoid false failure in rm/r-root.sh under load

* tests/rm/r-root.sh: Use gdb rather than timeout(1) as the
last resort protection against unlinkat() calls.  The timeout
of 2s was susceptible to false positives under load, and
gdb is stronger protection in any case.  We remove the
"expensive" tag on this test also since it should be robust.
Reported by Jim Meyering.

9 years agotests: avoid false failure in a tail test under load
Pádraig Brady [Thu, 15 Oct 2015 02:16:50 +0000 (03:16 +0100)] 
tests: avoid false failure in a tail test under load

* tests/tail-2/follow-stdin.sh: Use the standard tail
testing framework to avoid the race seen under very high load,
and also test the non inotify case.
Reported by Jim Meyering

9 years agotests: avoid false failures with default ACLs
Pádraig Brady [Wed, 14 Oct 2015 14:18:34 +0000 (15:18 +0100)] 
tests: avoid false failures with default ACLs

To reproduce:
  setfacl -dm group::rx .
  setfacl -dm other::rx .
  make check

* init.cfg (require_no_default_acl_): A new function to skip
when default ACLs are detected, or if the getfacl utility is
not available then skip if any non LSM ACLs detected.
* tests/cp/existing-perm-race.sh: Call require_no_default_acl_.
* tests/mkdir/parents.sh: Likewise.
* tests/mkdir/perm.sh: Likewise.

9 years agotail: no longer warn about unrecognized file systems
Pádraig Brady [Mon, 12 Oct 2015 00:37:44 +0000 (01:37 +0100)] 
tail: no longer warn about unrecognized file systems

* src/tail.c (fremote): No longer prompt the user to email
with the unrecognized file system constant, since we have
process in place to sync periodically with the latest Linux
constants, and the fall back polling mode is still fully functional.

9 years agotests: avoid false failure when restorecon is ineffective
Pádraig Brady [Sat, 10 Oct 2015 15:55:20 +0000 (16:55 +0100)] 
tests: avoid false failure when restorecon is ineffective

* tests/cp/cp-a-selinux.sh: Ensure we skip the portion of the test
depending on restorecon to be effective.  I.E. also skip when restorecon
warns, as it doesn't exit with error status when matchpathcon fails to
find a match for a file.  This is the case in /tmp on Fedora for
example, in which case the new destination that cp creates will have the
default security context of the process, rather than the explicit
context we set on the source file.
Details at: http://bugzilla.redhat.com/1247641

9 years agotests: make a long running test responsive to Ctrl-C
Pádraig Brady [Sat, 10 Oct 2015 02:59:53 +0000 (03:59 +0100)] 
tests: make a long running test responsive to Ctrl-C

* tests/misc/sort-compress-hang.sh: Use --foreground with the
timeout(1) command (noting the caveats), to run the sort command
in the foreground program group, and thus be responsive to Ctrl-C.
This very_expensive_ test takes over a minute on a i3-2310M,
with RAM backed /tmp.

9 years agotests: adjust recent changes to virtual memory limits
Pádraig Brady [Thu, 8 Oct 2015 02:41:07 +0000 (03:41 +0100)] 
tests: adjust recent changes to virtual memory limits

* tests/dd/no-allocate.sh: Account for timeout(1) when
determining the required mem, as timeout has additional shared libs.
This avoids the need for the hardcoded 4M addition to the limit.
* tests/misc/head-c.sh: Increase the base limit, to account for
the fact that head(1) will allocate some additional mem in this case.
* tests/misc/cut-huge-range.sh: Remove mention of specific limits.
* tests/misc/printf-surprise.sh: Likewise.
Reported by Dmitry V. Levin

9 years agocsplit: remove erroneous mention of -m in --help
Pádraig Brady [Tue, 6 Oct 2015 10:22:33 +0000 (11:22 +0100)] 
csplit: remove erroneous mention of -m in --help

* src/csplit.c (usage): -m is not accepted, only --suppress-matched.
* tests/misc/csplit-suppress-matched.pl: Spelling fix.

Reported by Ondrej Oprala

9 years agotee: simplify argv handling
Paul Eggert [Sun, 4 Oct 2015 00:01:32 +0000 (17:01 -0700)] 
tee: simplify argv handling

* src/tee.c (tee_files): Last arg is now char ** instead of char
const **, as that is a bit simpler.  All callers changed.  Modify
files[-1], not files[nfiles], as that is a bit faster and simpler.
Latter problem pointed out by Rainer Deyke in:
http://bugs.gnu.org/21611

9 years agobuild: update gnulib submodule to latest
Paul Eggert [Sat, 3 Oct 2015 07:25:27 +0000 (00:25 -0700)] 
build: update gnulib submodule to latest

9 years agobuild: Pacify GCC 5 on 32-bit hosts
Paul Eggert [Sat, 3 Oct 2015 07:24:43 +0000 (00:24 -0700)] 
build: Pacify GCC 5 on 32-bit hosts

This pacifies GCC 5 in a better way, without disabling diagnostics.
* src/df.c (main): Tell compiler that optind is positive.
* src/shred.c (known): New function.
(dopass): Go back to off_t for file sizes.
Avoid integer overflow if we run off the end of the file.
Tell compiler that a write cannot write more bytes than requested.

9 years agotail: handle kernel dentry unlink race
Pádraig Brady [Thu, 2 Jul 2015 07:41:25 +0000 (08:41 +0100)] 
tail: handle kernel dentry unlink race

Avoid the intermittent loss of "... has become inaccessible" messages.
That would cause tests/tail-2/assert.sh to fail sometimes,
mainly on uniprocessor systems.

* src/tail.c (tail_forever_inotify): Also monitor IN_DELETE
events on the directory, to avoid a dentry unlink()..open() race,
where the open() on the deleted file was seen to succeed after an,
unlink() and a subsequent IN_ATTRIB, was sent to tail.  Note an
IN_ATTRIB is sent on the monitored file to indicate the change in
number of links, and we can't just use a decrease in the number of
links to determine the file being unlinked, due to the possibility
of the file having multiple links.

Reported by Assaf Gordon and Ludovic Courtès.
Fixes http://bugs.gnu.org/21460

9 years agobuild: avoid -Wstrict-overflow warnings with GCC 5.1 on 32 bit
Pádraig Brady [Fri, 2 Oct 2015 19:28:37 +0000 (20:28 +0100)] 
build: avoid -Wstrict-overflow warnings with GCC 5.1 on 32 bit

* src/shred.c (dopass): With -O2, GCC 5.1 gives "assuming signed
overflow does not occur when simplifying conditional to constant"
warnings, in regard to the signed (off_t) variables.  Therefore
use unsigned (uintmax_t) instead, and a separate boolean to cater
for the special meaning of the negative part of the integer range.
Noticed at http://hydra.nixos.org/build/24983447

9 years agobuild: update gnulib submodule to latest
Pádraig Brady [Sat, 3 Oct 2015 01:52:31 +0000 (02:52 +0100)] 
build: update gnulib submodule to latest

Includes a change to xalloc.h to avoid -Wstrict-overflow warnings
with GCC 5.1 on 32 bit with optimization enabled.  A subsequent
commit will fix similar issues in shred.

9 years agodircolors: add xterm-termite entry
Dario Giovannetti [Fri, 2 Oct 2015 15:56:49 +0000 (16:56 +0100)] 
dircolors: add xterm-termite entry

* src/dircolors.hin: Add "xterm-termite" as this VTE based terminal
emulator is quite different from xterm, despite the name.
For example "Termite supports italic text and it won't work if TERM
is set to xterm. Even the backspace key won't work properly anymore
for applications relying on terminfo".
Reported also by Lukas Sabota and Sven-Hendrik Haase.

9 years agodf: prioritize mounts nearer the device root
Dave Chiluk [Mon, 21 Sep 2015 20:04:11 +0000 (15:04 -0500)] 
df: prioritize mounts nearer the device root

In the presence of bind mounts of a device, the 4th "mount root" field
from /proc/self/mountinfo is now considered, so as to prefer mount
points closer to the root of the device.  Note on older systems with
an /etc/mtab file, the source device was listed as the originating
directory, and so this was not an issue.
Details at http://pad.lv/1432871

* src/df.c (filter_mount_list): When deduplicating mount entries,
only prefer sources nearer or at the root of the device, when the
target is nearer the root of the device.
* NEWS: Mention the change in behavior.

9 years agobuild: update gnulib submodule to latest
Pádraig Brady [Tue, 22 Sep 2015 21:26:40 +0000 (22:26 +0100)] 
build: update gnulib submodule to latest

This includes a change to propagate the 4th "mount root"
field from /proc/self/mountinfo from the mountlist module,
which is needed in a subsequent commit in df.

* gl/lib/regcomp.c.diff: Regenerate against latest gnulib.
* gl/lib/regex_internal.c.diff: Likewise.
* gl/lib/regex_internal.h.diff: Likewise.
* cfg.mk: Exclude diffs from trailing whitespace check,
which is generally correct, and now needed.

9 years agomaint: use adaptive approach for `ulimit -v` based tests
Bernhard Voelker [Tue, 22 Sep 2015 21:23:26 +0000 (23:23 +0200)] 
maint: use adaptive approach for `ulimit -v` based tests

When configured with either 'symlinks' or 'shebangs' as value for
the --enable-single-binary option, tests based on `ulimit -v` are
skipped.  The reason is that the multicall 'coreutils' binary requires
much more memory due to shared libraries being loaded, and the size of
the 'date' binary (~290KiB) compared to the multicall binary (~5MiB),
of course.  Finally, in the case of 'shebangs', the starting shell
requires more memory, too

Instead of using hard-coded values for the memory limit, use an
adaptive approach: first determine the amount of memory for a similar,
yet more trivial invocation of the command, and then do the real test
run using that limit (plus some buffer in some cases).

* init.cfg (require_ulimit_v_): Remove function.
(get_min_ulimit_v_): Add function to determine the minimum memory limit
required for a given command in an adaptive way.
* cfg.mk (sc_prohibit_test_ulimit_without_require_): Change the name
of the above function in the syntax-check rule.
* tests/cp/link-heap.sh: Use the above function to determine the
minimum memory required to run a command simpler than in the real test
run.  Use that limit plus a buffer there.  While at it, change to list
of commands in the subshell to fail also if the beginning `ulimit -v`
fails.
* tests/dd/no-allocate.sh: Likewise.
* tests/misc/csplit-heap.sh: Likewise.
* tests/misc/cut-huge-range.sh: Likewise.
* tests/misc/head-c.sh: Likewise.
* tests/misc/printf-surprise.sh: Likewise.
* tests/split/line-bytes.sh: Likewise.
* tests/rm/many-dir-entries-vs-OOM.sh: Likewise - doing it separately
for each program under test.

9 years agomaint: avoid deprecation warning with <selinux/flask.h>
Pádraig Brady [Tue, 22 Sep 2015 18:07:41 +0000 (19:07 +0100)] 
maint: avoid deprecation warning with <selinux/flask.h>

* src/runcon.c (main): As per the compile time warning from
libselinux-2.4-3, lookup the class with string_to_security_class(),
rather than using defines from flask.h.

9 years agosort,numfmt: with --debug, diagnose failure to set locale
Pádraig Brady [Tue, 22 Sep 2015 01:07:41 +0000 (02:07 +0100)] 
sort,numfmt: with --debug, diagnose failure to set locale

* src/sort.c (main): With --debug, warn upon setlocale() failure,
which can happen due to incorrectly specified environment variables,
or due to memory exhaustion (simulated with ulimit -v), etc.
* tests/misc/sort-debug-warn.sh: Add a test case.
See also http://savannah.gnu.org/bugs/11004

9 years agodu: avoid to stat all mount points if possible
Bernhard Voelker [Fri, 18 Sep 2015 11:29:17 +0000 (13:29 +0200)] 
du: avoid to stat all mount points if possible

du calls stat for each mount point at startup.  This would block or
even make du fail if stat for an unrelated mount point hangs.
The result is not needed in the normal case anyway and therefore
should be avoided.  Issue introduced in commit v8.19-2-gcf7e1b5.

* src/du.c (fill_mount_table): Move function up as it's not used ...
(mount_point_in_fts_cycle): ... here, i.e., the DI_MNT set is
initialized and filled only iff FTS has detected a directory cycle.
(main): Remove the initialization and filling of the DI_MNT set here,
and free the DI_MNT set only if it was used.

9 years agoshred: don’t document -NUMBER option
Paul Eggert [Thu, 17 Sep 2015 07:37:30 +0000 (00:37 -0700)] 
shred: don’t document -NUMBER option

The -NUMBER option was removed from ‘shred’ in 1999, but the
manual wasn’t updated to match.  Problem reported by Nick Rose in:
http://bugs.gnu.org/21502
* doc/coreutils.texi (shred invocation):
Remove documentation for -NUMBER option.

9 years agonumfmt: use new set-fields module to parse --field
Assaf Gordon [Sat, 18 Jul 2015 03:58:31 +0000 (23:58 -0400)] 
numfmt: use new set-fields module to parse --field

numfmt --field=LIST can accept the same options as cut.

* bootstrap.conf: remove xlist, linked-list
* src/local.mk: link numfmt with set-fields
* src/numfmt.c: use set-fields.c instead of custom field parsing code.
  (include_field): adapt to new code.
* tests/misc/numfmt.pl: add new tests, adapt current tests to new
  error message wording from set-fields.c

9 years agocut: refactor into set-fields module
Assaf Gordon [Sat, 18 Jul 2015 03:30:30 +0000 (23:30 -0400)] 
cut: refactor into set-fields module

Extract the functionality of parsing --field=LIST into a separate
module, to be used by other programs.

* src/cut.c: move field parsing code from here ...
* src/set-fields.{c,h}: ... to here.
  (set_fields): generalize by supporting multiple parsing/reporting
  options.
  (struct range_pair): rename to field_range_pair.
* src/local.mk: link cut with set-field.
* po/POTFILES.in: add set-field.c
* tests/misc/cut.pl: update wording of error messages

9 years agomaint: fix heap manipulations in previous commit
Pádraig Brady [Tue, 8 Sep 2015 11:53:11 +0000 (12:53 +0100)] 
maint: fix heap manipulations in previous commit

* src/sort.c (main): Ensure we don't free() and invalid
pointer when reading implicit stdin.  Also avoid
"definitely lost" valgrind warnings in the --files0-from case.

9 years agomaint: avoid "definitely lost" valgrind warnings
Pádraig Brady [Fri, 4 Sep 2015 13:38:06 +0000 (14:38 +0100)] 
maint: avoid "definitely lost" valgrind warnings

Since commit v8.23-19-g8defcee, main() will return,
rather than call exit(), this inducing "definitely lost"
warnings in valgrind's leak checker.  That precludes using
the following to flag memory leaks:

  valgrind --leak-check=full --error-exitcode=1 \
           --errors-for-leak-kinds=definite

* src/pr.c (main): In dev builds, explicitly free memory allocated.
* src/sort.c (main): Likewise.
* src/tail.c (main): Likewise.
* src/tsort.c (tsort): Likewise.

9 years agotests: test numfmt stdin behavior
Pádraig Brady [Wed, 2 Sep 2015 23:34:27 +0000 (00:34 +0100)] 
tests: test numfmt stdin behavior

* tests/misc/tty-eof.pl: Add numfmt to the list of programs
that accept input on stdin.

9 years agols,ptx: restrict quotearg use to file name output
Pádraig Brady [Sun, 16 Aug 2015 15:47:17 +0000 (16:47 +0100)] 
ls,ptx: restrict quotearg use to file name output

* src/ls.c (getenv_quoting_style, decode_switches, parse_ls_color):
Use quote() rather than quotearg(), as the latter defaults to
outputting the input unquoted.
* src/ptx.c (main): Likewise.

9 years agobase64: no longer support hex or oct --wrap params
Pádraig Brady [Mon, 17 Aug 2015 04:45:47 +0000 (21:45 -0700)] 
base64: no longer support hex or oct --wrap params

* src/base64.c (main): Support decimal numbers with leading zeros,
by disabling the auto detection of octal and hex.  It's not
envisaged that base conversion is needed for --wrap parameters,
and in the edge case it is, $((0x0)) shell constructs can be used.
* tests/misc/base64.pl: Adjust accordingly.
* NEWS: Mention the change in behavior.

9 years agobase64: use stricter validation on wrap column
Pádraig Brady [Sun, 16 Aug 2015 14:31:17 +0000 (15:31 +0100)] 
base64: use stricter validation on wrap column

* src/base64.c (main): Use the higher level xnumtoumax()
rather than xstrtoumax(), which is simpler and improves
validation of input.  Also pass the _empty_ rather than NULL
string as the suffixes parameter so that invalid trailing
characters are not allowed.  For example -w08 is now
flagged as an error, rather than being interpreted as 0.
A subsequent commit will further improve verification
of numbers with leading zeros by dropping backwards compatibility
wrt auto parsing oct and hex numbers.
* tests/misc/base64.pl: Add tests for invalid wrap values.

9 years agobase32: A new program similar to base64
Pádraig Brady [Wed, 5 Aug 2015 08:28:36 +0000 (10:28 +0200)] 
base32: A new program similar to base64

Suggested in https://bugzilla.redhat.com/1250113

* AUTHORS: Add base32.
* THANKS.in: Add suggester.
* README: Reference the new program.
* NEWS: Mention the new program.
* src/.gitignore: Ignore the new binary.
* bootstrap.conf: Reference the gnulib base32 module.
* build-aux/gen-lists-of-programs.sh: Add base32.
* man/base32.x: A new template.
* man/.gitignore: Ignore the new man page.
* man/local.mk: Reference the new man page.
* doc/coreutils.texi (base32 invocation): Document the new command.
* src/local.mk: Adjust to build base32 based on base64.c.
* src/base64.c: Parameterize to use the correct headers,
functions and buffer sizes, depending on which binary
is being built.
* tests/misc/base64.pl: Adjust to test both base32 and base64.
* tests/misc/tty-eof.pl: Add base32 as a program that
accepts input on stdin without any options specified.
* scripts/git-hooks/commit-msg: Add base32 to the template.

9 years agobuild: update gnulib submodule to latest
Pádraig Brady [Tue, 1 Sep 2015 16:42:33 +0000 (17:42 +0100)] 
build: update gnulib submodule to latest

This includes a tweak to support building
the gnulib base32 module with -Wsuggest-attribute=const

9 years agodoc: clarify in --help/man where short options take no param
Pádraig Brady [Mon, 31 Aug 2015 17:07:34 +0000 (18:07 +0100)] 
doc: clarify in --help/man where short options take no param

* src/shred.c (usage): For -u, separate the decscription
of the short and long option, to clarify that the short option
takes no parameter.
* src/split.c (usage): Likewise for -d.
* src/tee.c (usage): Likewise for -p.
* src/uniq.c (usage): Likewise for -D.

Suggested by Stephane Chazelas

9 years agotests: avoid FP of ls/stat-free-color.sh with newer glibc
Bernhard Voelker [Sun, 30 Aug 2015 20:49:35 +0000 (22:49 +0200)] 
tests: avoid FP of ls/stat-free-color.sh with newer glibc

Since glibc-2.22, specifically commit [0], the opendir() implementation
implicitly makes an additional stat call thus leading to a FP.
Seen on openSUSE:Tumbleweed since snapshot 20150821.

[0]
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=46f894d8c60a

* tests/ls/stat-free-color.sh: Change the test to verify that ls(1)
needs the same number of stat-like calls for a single, empty directory
argument as for one with a few directory entries (sub-directory,
regular file, symlink, etc.).

9 years agodoc: clarify where ambiguous if short options take no param
Pádraig Brady [Thu, 27 Aug 2015 14:50:07 +0000 (15:50 +0100)] 
doc: clarify where ambiguous if short options take no param

* doc/coreutils.texi (split invocation): Clarify that -d takes no param.
(uniq invocation): Likewise for -D.
(shred invocation): Likewise for -u.
(tee invocation): Likewise for -p.

9 years agols: allow -w18446744073709551616
Paul Eggert [Sun, 23 Aug 2015 01:30:36 +0000 (18:30 -0700)] 
ls: allow -w18446744073709551616

Problem reported by Beco in: http://bugs.gnu.org/21325
* src/ls.c (set_line_length): New function.
(decode_switches): Use it to decode COLUMNS and -w.

9 years agomaint: add syntax check to ensure larger man/*.x files have a Copyright
Bernhard Voelker [Tue, 18 Aug 2015 18:27:48 +0000 (20:27 +0200)] 
maint: add syntax check to ensure larger man/*.x files have a Copyright

* cfg.mk (sc_man_check_x_copyright): Add rule to ensure that non-trivial
.x files in the 'man/' subdirectory, i.e., files exceeding a line count
of 20 or a byte count of 1000, contain a proper Copyright notice.

10 years agobuild: fprintftime/nstrftime API changes
Paul Eggert [Fri, 24 Jul 2015 01:49:31 +0000 (18:49 -0700)] 
build: fprintftime/nstrftime API changes

* bootstrap.conf (gnulib_modules): Add time_rz,
since the main source code now uses timezone_t.
* src/date.c (batch_convert, main, show_date):
* src/ls.c (align_nstrftime, long_time_expected_width)
(print_long_format):
* src/stat.c (human_time):
Use timezone_t rather than boolean to specify which time zone
is wanted.
* src/ls.c (localtz): New static var.
(main): Initialize it.

10 years agobuild: update gnulib submodule to latest
Paul Eggert [Fri, 24 Jul 2015 01:33:59 +0000 (18:33 -0700)] 
build: update gnulib submodule to latest

10 years agodoc: discourage use of uname -i and -p options
Pádraig Brady [Tue, 21 Jul 2015 09:17:43 +0000 (10:17 +0100)] 
doc: discourage use of uname -i and -p options

* src/uname.c (usage): State that the non POSIX -i and -p options
are non-portable.
* doc/coreutils.texi (uname invocation): Mention the discrepancies
even across GNU/Linux distros, and that the results should
be used as informational only, rather than impacting any
logic decisions.
Fixes http://bugs.gnu.org/13001

10 years agodoc: improve man page for realpath -m
Pádraig Brady [Wed, 15 Jul 2015 13:32:31 +0000 (14:32 +0100)] 
doc: improve man page for realpath -m

* src/realpath.c (usage): Mention 'directory' in the --help
output, so that ENOTDIR errors may be more easily investigated,
by inspecting the man page.
Reported at http://pad.lv/1474519

10 years agotests: avoid test warning with perl >= 5.22
Peter Bray [Wed, 15 Jul 2015 10:37:20 +0000 (11:37 +0100)] 
tests: avoid test warning with perl >= 5.22

* doc/local.mk (sc-lower-case-var): Escape a literal
left curly bracket, needed with perl >= 5.22
Fixes http://bugs.gnu.org/21060

10 years agosync: fix build with separate $(LIB_FDATASYNC)
Peter Bray [Wed, 15 Jul 2015 07:31:21 +0000 (08:31 +0100)] 
sync: fix build with separate $(LIB_FDATASYNC)

* src/local.mk: Link with $(LIB_FDATASYNC) needed
on some Solaris 10 systems for example.
Fixes http://bugs.gnu.org/21059

10 years agodircolors: add tmux entries
Pádraig Brady [Thu, 9 Jul 2015 16:48:16 +0000 (17:48 +0100)] 
dircolors: add tmux entries

* src/dircolors.hin: tmux entries were added to ncurses in:
http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff;\
f=misc/terminfo.src;h=ce9bdc3b;hp=7e576ef1;hb=be512fa0;hpb=ee1bcda2

10 years agoshred: fix pattern selection for certain iteration counts
Pádraig Brady [Tue, 7 Jul 2015 00:46:54 +0000 (01:46 +0100)] 
shred: fix pattern selection for certain iteration counts

This was detected in about 25% of runs with gcc -fsanitize=address

  ERROR: AddressSanitizer: global-buffer-overflow on address ...
  READ of size 4 at 0x000000416628 thread T0
    #0 0x40479f in genpattern src/shred.c:782
    #1 0x4050d9 in do_wipefd src/shred.c:921
    #2 0x406203 in wipefile src/shred.c:1175
    #3 0x406b84 in main src/shred.c:1316
    #4 0x7f3454a1ef9f in __libc_start_main (/lib64/libc.so.6+0x1ff9f)
    #5 0x4025d8 (/tmp/coreutils-8.23/src/shred+0x4025d8)
  0x000000416628 is located 56 bytes to the left of
  global variable '*.LC49' from 'src/shred.c' (0x416660) of size 17
  0x000000416628 is located 12 bytes to the right of
  global variable 'patterns' from 'src/shred.c' (0x416540) of size 220
  SUMMARY: AddressSanitizer: global-buffer-overflow src/shred.c:782

* src/shred.c (gen_patterns): Restrict pattern selection
to the K available, which regressed due to v5.92-1462-g65533e1.
* tests/misc/shred-passes.sh: Add a deterministic test case.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/20998

10 years agomaint: post-release administrivia
Pádraig Brady [Fri, 3 Jul 2015 21:23:56 +0000 (22:23 +0100)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

10 years agoversion 8.24 v8.24
Pádraig Brady [Fri, 3 Jul 2015 20:58:50 +0000 (21:58 +0100)] 
version 8.24

* NEWS: Record release date.

10 years agomaint: fix distclean-check failure due to THANKS
Pádraig Brady [Fri, 3 Jul 2015 18:32:13 +0000 (19:32 +0100)] 
maint: fix distclean-check failure due to THANKS

* Makefile.am: Remove our dependence on src/sort which
induces awkward dependencies for `make dist` since
THANKS will be rebuilt once src/sort is newer.
Instead we remove the problematic -f option to sort
which actually doesn't change the order given
our current input.

10 years agomaint: avoid false syntax-check failure in distcheck
Pádraig Brady [Fri, 3 Jul 2015 16:20:36 +0000 (17:20 +0100)] 
maint: avoid false syntax-check failure in distcheck

* cfk.mk (sc_tests_executable): Restrict the check to git files,
so we don't flag any gnulib files added to test/ during
`make distcheck`.

10 years agotests: update gnulib submodule and tests/init.sh to latest
Pádraig Brady [Fri, 3 Jul 2015 14:50:56 +0000 (15:50 +0100)] 
tests: update gnulib submodule and tests/init.sh to latest

* gnulib: Update to latest, with fixes to tests edge cases.
* tests/init.sh: Update from gnulib.

10 years agotests: avoid side effects of $SHELL environment variable
Pádraig Brady [Fri, 3 Jul 2015 03:44:05 +0000 (04:44 +0100)] 
tests: avoid side effects of $SHELL environment variable

Since non interactive shells don't generally set $SHELL,
its value is propagated through the tests and may cause issues;
for example if $SHELL implicitly adjusts $PATH when run.
Instead we set $SHELL to that determined by the posix-shell module,
and use that consistently for all test sub scripts,
including those created thorugh the `split --filter` command.

* tests/local.mk: Explicitly set $SHELL to $(PREFERABLY_POSIX_SHELL)
which defaults to $CONFIG_SHELL and thus usually /bin/sh.
* tests/envvar-check: Remove bash environment variables with
side effects, in case /bin/bash was selected for $SHELL.
* tests/misc/help-version.sh: Remove redundant initialization of $SHELL.
* tests/install/strip-program.sh: Use $SHELL for sub script.
* tests/misc/sort-compress-hang.sh: Likewise.
* tests/misc/sort-compress-proc.sh: Likewise.
* tests/misc/sort-compress.sh: Likewise.
* tests/misc/timeout-group.sh: Likewise.
* tests/rm/fail-eperm.xpl: Remove redundant elision of bash env vars.
* tests/misc/pwd-long.sh: Likewise.

10 years agotests: avoid false failures on OpenBSD 5.7
Pádraig Brady [Thu, 2 Jul 2015 12:55:52 +0000 (13:55 +0100)] 
tests: avoid false failures on OpenBSD 5.7

* tests/du/threshold.sh: Homogenize getopt error messages.
* tests/misc/numfmt.pl: Likewise.
* tests/mv/i-3.sh: Skip on *BSD not just FreeBSD.

10 years agowc: fix reading of /proc files on aarch64
Pádraig Brady [Wed, 1 Jul 2015 21:37:26 +0000 (22:37 +0100)] 
wc: fix reading of /proc files on aarch64

tests/misc/wc-proc.sh fails when the page size is 64K

* src/wc.c (wc): The lseek adjustment should be based on st_blksize,
rather than on the internal buffer size.  This is significant on
aarch64 where st_blksize in /proc is the 64K (the page size) and
thus larger than the internal buffer.
* src/split.c (main): Even though the similar processing is done
on the internal buffer size, that's based on st_blksize and
so fine in this regard.  Add an assert to enforce this.
Avoid this path for the undocumented ---io-blksize option.

10 years agobuild: update gnulib submodule to latest
Pádraig Brady [Wed, 1 Jul 2015 15:09:12 +0000 (16:09 +0100)] 
build: update gnulib submodule to latest

Mainly with build fixes for FreeBSD and OS X.

10 years agonumfmt: increase precision on 32 bit FreeBSD
Pádraig Brady [Tue, 30 Jun 2015 23:10:23 +0000 (00:10 +0100)] 
numfmt: increase precision on 32 bit FreeBSD

* m4/jm-macros.m4 (HAVE_FPSETPREC): Define if needed.
* src/numfmt.c (main): Call fpsetprec() if needed.
Fixes large-15 and large-16 test failures on 32 bit FreeBSD.

10 years agotests: avoid false failure on FreeBSD systems
Pádraig Brady [Tue, 30 Jun 2015 13:30:57 +0000 (14:30 +0100)] 
tests: avoid false failure on FreeBSD systems

* tests/misc/stty.sh: FreeBSD returns ENOTTY for
the TIOCEXT ioctl, so just avoid this option for now.

10 years agofactor: ensure atomic output through pipes
Pádraig Brady [Tue, 30 Jun 2015 05:58:57 +0000 (06:58 +0100)] 
factor: ensure atomic output through pipes

The new tests/misc/factor-parallel.sh test was
seen to fail on FreeBSD (derived) systems, which was
due to split(1) --filter reading partial lines
through pipes, as factor(1) was writing a little
over PIPE_BUF each time.

* src/factor.c (lbuf): A new structure to internally buffer lines.
(lbuf_alloc): A new function to allocate enough at program start.
(lbuf_putint): A new function to buffer a uintmax_t.
(lbuf_flush): A new function to write directly to standard output.
(lbuf_putc): A new function to buffer a character and if enough
lines are buffered, then output complete lines <= PIPE_BUF,
and continue to buffer the rest.
(main): Call the internal buffer allocator, and register
the final flush from the internal buffer at program exit.

10 years agotests: fix false failure on slower systems
Pádraig Brady [Tue, 30 Jun 2015 02:51:28 +0000 (03:51 +0100)] 
tests: fix false failure on slower systems

* tests/dd/stats.sh: Wait 20s for dd to write 250MB through a fifo,
rather than 10s for 500MB.  The failure was seen often on
a lightly loaded SPARC-Enterprise-T5220 running Solaris 10.

10 years agomaint: stdbuf.c: avoid the OS X putenv function
Jim Meyering [Sun, 28 Jun 2015 17:35:04 +0000 (10:35 -0700)] 
maint: stdbuf.c: avoid the OS X putenv function

* bootstrap.conf (gnulib_modules): Add setenv, to make this
module dependency explicit; setenv is also used by split.
* src/stdbuf.c (set_LD_PRELOAD) [__APPLE__]: Use the OS X setenv
function, rather than putenv, per that documentation:
https://developer.apple.com/\
library/mac/documentation/Darwin/Reference/ManPages/man3/putenv.3.html

10 years agobuild: numfmt.c: avoid a shadowing warning
Jim Meyering [Mon, 29 Jun 2015 17:25:07 +0000 (10:25 -0700)] 
build: numfmt.c: avoid a shadowing warning

* src/numfmt.c (parse_field_arg): Rename parameter s/optarg/arg/,
to avoid shadowing getopt's global variable.
Otherwise, building on OS X, with --enable-gcc-warnings, I saw this:

  In file included from src/numfmt.c:19:0:
  src/numfmt.c: In function 'parse_field_arg':
  ./lib/config.h:3109:25: error: declaration of 'rpl_optarg' shadows\
    a global declaration [-Werror=shadow]

10 years agonumfmt: fix printf argument order
Assaf Gordon [Mon, 29 Jun 2015 11:54:41 +0000 (12:54 +0100)] 
numfmt: fix printf argument order

* src/numfmt.c (double_to_human): Fix the argument order
passed to snprintf, which happened to work on amd64 with
its separate va_arg storage area for floats¹,
but would fail tests for example on i686.

¹ https://blog.nelhage.com/2010/10/amd64-and-va_arg/

10 years agomaint: clarify df's use of device IDs from /proc/self/mountinfo
Pádraig Brady [Sun, 28 Jun 2015 02:53:51 +0000 (03:53 +0100)] 
maint: clarify df's use of device IDs from /proc/self/mountinfo

* src/df.c (filter_mount_list): Clarify why we still stat even
though devices IDs may already be available.  Note using
/proc/self/mountinfo is still an advantage to get filtered items
with accurate device patchs in chroots and with bind mounts.
I.E. on older setups with static /etc/mtab, df will now
bypass that to get the more accuracte and dynamic info.

10 years agochroot: quote argument in error diagnostic
Pádraig Brady [Fri, 26 Jun 2015 18:31:00 +0000 (19:31 +0100)] 
chroot: quote argument in error diagnostic

* src/chroot.c (main): Quote the passed argument,
to avoid confusing error messages.

10 years agomaint: clarify integer operations in recent commit
Pádraig Brady [Thu, 25 Jun 2015 15:39:36 +0000 (16:39 +0100)] 
maint: clarify integer operations in recent commit

* src/factor.c (print_uintmaxes): Comment that the
value of n_out doesn't matter on error, and add an
explicit cast to avoid any future warnings.
Suggested by Jim Meyering RE commit v8.23-229-g4d2d6c5

10 years agotests: avoid false failure when running as root
Pádraig Brady [Thu, 25 Jun 2015 13:10:47 +0000 (14:10 +0100)] 
tests: avoid false failure when running as root

* tests/misc/sync.sh: Ensure dir is unreadable before
including the permission check.

10 years agotests: avoid false failures with LD_PRELOAD=libasan.so.2
Pádraig Brady [Thu, 25 Jun 2015 12:21:28 +0000 (13:21 +0100)] 
tests: avoid false failures with LD_PRELOAD=libasan.so.2

The LD_PRELOAD checks by -fsanitize=address are overly strict:
https://groups.google.com/forum/#!topic/address-sanitizer/jEvOJgkDqQk
A workaround is to first export LD_PRELOAD=libasan.so.2
The tests below are adjusted so that workaround is not discarded.

* tests/cp/no-ctx.sh: Append to $LD_PRELOAD.
* tests/df/no-mtab-status.sh: Likewise.
* tests/df/skip-duplicates.sh: Likewise.
* tests/ls/getxattr-speedup.sh: Likewise.
* tests/rm/r-root.sh: Likewise.
* tests/cp/nfs-removal-race.sh: Likewise.  Also check that
LD_PRELOAD is effective to aid future maintainability
and avoid false failure if libasan.so.2 is not preloaded.

10 years agobuild: update to latest gnulib
Pádraig Brady [Thu, 25 Jun 2015 11:18:03 +0000 (12:18 +0100)] 
build: update to latest gnulib

Mainly for -fsanitize=address and -fsanitize=undefined fixes

10 years agobuild: allow build to complete with -fsanitize=address
Pádraig Brady [Thu, 25 Jun 2015 01:43:02 +0000 (02:43 +0100)] 
build: allow build to complete with -fsanitize=address

* src/make-prime-list.c (main): When building with
the above option, avoid this build stopping error:
"LeakSanitizer: detected memory leaks"

10 years agomaint: avoid undefined behavior in qsort call
Pádraig Brady [Wed, 24 Jun 2015 18:14:47 +0000 (19:14 +0100)] 
maint: avoid undefined behavior in qsort call

GCC 5.1.1 -fsanitize=undefined with glibc 2.21 is returning:
"runtime error: null pointer passed as argument 1,
 which is declared to never be null"
* src/ptx.c (sort_found_occurs): Avoid the call with no entries.

10 years agofactor: avoid interspersed lines for parallel runs
Pádraig Brady [Wed, 15 Oct 2014 01:18:35 +0000 (02:18 +0100)] 
factor: avoid interspersed lines for parallel runs

* src/factor.c (n_out): A new global variable to track
how much data has been written to stdout.
(print_factors_single): Use n_out to determine whether
to flush the current (and previous) lines.
* tests/misc/factor-parallel.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.

10 years agoseq: handle exponents more consistently
Pádraig Brady [Tue, 23 Jun 2015 21:51:24 +0000 (22:51 +0100)] 
seq: handle exponents more consistently

src/seq.c (scan_arg): Set precision and width _after_ exponentiation.
For example, this will make '1.1e1 12' and '11 1.2e1' equivalent.
One can still set the precision by specifying extra precision on
the start value, or more naturally with a precision on a step value.
* tests/misc/seq-precision.sh: Add new cases.

10 years agoseq: use consistent output format with hex integers
Pádraig Brady [Tue, 23 Jun 2015 21:48:25 +0000 (22:48 +0100)] 
seq: use consistent output format with hex integers

* src/seq.c (scan_arg): Set precision to 0 for hex constants
(while avoiding hex floats).  This will use then use the
fast path for these arguments.  Note we also set the precision
of inf to 0 here, which ensures we use consistent precision
on output where possible.
* tests/misc/seq-precision.sh: Add corresponding test cases.

10 years agoseq: support inf last item more generally/efficiently
Pádraig Brady [Sat, 11 Oct 2014 09:06:48 +0000 (10:06 +0100)] 
seq: support inf last item more generally/efficiently

* src/seq.c (main): Call seq_fast for infinite last value.
This implicitly avoids format conversion on the
999999 -> 1000000 transition.
* src/seq.c (seq_fast): Generalize the buffer handling,
and adjust to handle the "inf" last value specifics.
* tests/misc/seq-precision.sh: A new test.
* tests/local.mk: Reference the new test.

10 years agodoc: list numfmt in the main menu with "Numeric operations"
Pádraig Brady [Mon, 22 Jun 2015 16:54:52 +0000 (17:54 +0100)] 
doc: list numfmt in the main menu with "Numeric operations"

* doc/coreutils.texi (main menu): Add numfmt.

10 years agonumfmt: don't hardcode floating point limits
Pádraig Brady [Mon, 22 Jun 2015 03:19:48 +0000 (04:19 +0100)] 
numfmt: don't hardcode floating point limits

* src/numfmt.c (MAX_UNSCALED_DIGITS): Set this to LDBL_DIG
rather than hardcoding at 18 for better portability.
* tests/misc/numfmt.pl: Restrict limit tests to supported platforms.

10 years agonumfmt: handle leading zeros correctly
Pádraig Brady [Mon, 22 Jun 2015 01:12:32 +0000 (02:12 +0100)] 
numfmt: handle leading zeros correctly

* src/numfmt.c (simple_strtod_int): Don't count leading zeros
as significant digits.  Also have leading zeros as optional
for floating point numbers.
* tests/misc/numfmt.pl: Add test cases.
* NEWS: Mention the fix.

10 years agonumfmt: avoid integer overflow when rounding
Pádraig Brady [Sun, 21 Jun 2015 03:04:29 +0000 (04:04 +0100)] 
numfmt: avoid integer overflow when rounding

Due to existing limits this is usually triggered
with an increased precision.  We also add further
restrictions to the output of increased precision numbers.

* src/numfmt.c (simple_round): Avoid intmax_t overflow.
(simple_strtod_int): Count digits consistently
for precision loss and overflow detection.
(prepare_padded_number): Include the precision
when excluding numbers to output, since the precision
determines the ultimate values used in the rounding scheme
in double_to_human().
* tests/misc/numfmt.pl: Add previously failing test cases.
* NEWS: Mention the fix.

10 years agonumfmt: support user specified output precision
Pádraig Brady [Fri, 19 Jun 2015 18:18:21 +0000 (19:18 +0100)] 
numfmt: support user specified output precision

* src/numfmt.c (usage): Update the --format description
to indicate precision is allowed.
(parse_format_string): Parse a precision specification
like the standard printf does.
(double_to_human): Honor the precision in --to mode.
* tests/misc/numfmt.pl: New tests.
* doc/coreutils.texi (numfmt invocation): Mention the new feature.
* NEWS: Likewise.

10 years agonumfmt: implement support for field ranges
Dylan Cali [Fri, 5 Sep 2014 09:42:02 +0000 (04:42 -0500)] 
numfmt: implement support for field ranges

* src/numfmt.c: Replace field handling code with logic that understands
field range specifiers.  Instead of processing a single field and
printing line prefix/suffix around it, process each field in the line
checking whether it has been included for conversion.  If so convert and
print, otherwise just print the unaltered field.
(extract_fields): Removed.
(skip_fields): Removed.
(process_line): Gutted and heavily reworked.
(process_suffixed_number): FIELD is now passed as an arg instead of
using a global.
(parse_field_arg): New function that parses field range specifiers.
(next_field): New function that returns pointers to the next field in
a line.
(process_field): New function that wraps the field conversion logic
(include_field): New function that checks whether a field should be
converted
(compare_field): New function used for field value comparisons in a
gl_list.
(free_field): New function used for freeing field values in a gl_list.
Global variable FIELD removed.
New global variable all_fields indicates whether all fields should be
processed.
New global variable all_fields_after stores the first field of a N-
style range.
New global variable all_fields_before stores the last field of a -M
style range.
New global variable field_list stores explicitly specified fields to
process (N N,M or N-M style specifiers).
(usage): Document newly supported field range specifiers.
* bootstrap.conf: Include xlist and linked-list modules.  numfmt now
uses the gl_linked_list implementation to store the field ranges.
* tests/misc/numfmt.pl: Add tests for 'cut style' field ranges.
Adjust existing tests as partial output can occur before an error
Remove test for the 'invalid' field -5.. this is now a valid range.
* gnulib: update to avoid compiler warnings in linked-list.
* NEWS: Mention the new feature.

10 years agodoc: use correct units in df | numfmt example
Pádraig Brady [Thu, 18 Jun 2015 08:48:04 +0000 (09:48 +0100)] 
doc: use correct units in df | numfmt example

* src/numfmt.c (usage): Don't scale output from df
so that numfmt outputs the correct values.

10 years agonumfmt: handle suffixes consistently with --{from,to}-unit
Pádraig Brady [Mon, 15 Jun 2015 02:55:46 +0000 (03:55 +0100)] 
numfmt: handle suffixes consistently with --{from,to}-unit

* src/numfmt.c (unit_to_umax): Support SI (power of 10) suffixes
with the --from-unit and --to-unit options.  Treat suffixes like
is done with --from=auto, which for example will change the meaning
of --to-unit=G to that of --to-unit=Gi.  The suffix support was
previously undocumented and it's better to avoid the traditional
coreutils suffix handling in numfmt by default.
* doc/coreutils.texi: Document the new behavior.  Also fix a typo
mentioning {from,to}=units=.
* tests/misc/numfmt.pl: Adjust accordingly.
* NEWS: Mention the change in behavior.

10 years agomaint: remove stale online manual items at release
Pádraig Brady [Wed, 17 Jun 2015 11:58:53 +0000 (12:58 +0100)] 
maint: remove stale online manual items at release

* gnulib: Update to get the new gnu-web-doc-update with --mirror option.
* README-release: Use the --mirror option in the instructions.
Also clarify and update various release steps.

10 years agotail: display consistent diagnostics upon file replacement
Pádraig Brady [Tue, 9 Jun 2015 10:33:44 +0000 (11:33 +0100)] 
tail: display consistent diagnostics upon file replacement

* src/tail.c (recheck): Display diagnostices for replaced files
even with reused inodes which is a common case.
* tests/tail-2/F-vs-missing.sh: Use correct diagnostic in comment.
* tests/tail-2/F-vs-rename.sh: Likewise.

10 years agotail: display file headers correctly with inotify
Pádraig Brady [Mon, 8 Jun 2015 23:53:35 +0000 (00:53 +0100)] 
tail: display file headers correctly with inotify

* src/tail.c (tail_forever_inotify): Use the fspec pointer to
distinguish previously output files, rather than a descriptor
from the inotify event.  That event descriptor was that of
the parent directory when files were created or renamed etc.
(check_fspec): Adjust for the new comparison.  Also show the
header when the file is truncated, since we show data
in this case also.
* tests/tail-2/F-headers.sh: A new test case.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.

10 years agomaint: sync .gitignore items with gnulib entries
Pádraig Brady [Sun, 7 Jun 2015 16:18:39 +0000 (17:18 +0100)] 
maint: sync .gitignore items with gnulib entries

* .gitignore: Add entries for potentially generated headers.
Also remove a couple of items already present in lib/.gitignore.
* cfg.mk (sc_gitignore_missing): A new syntax check rule to
identify missing .gitignore entries.
(sc_gitignore_redundant): A new syntax check rule to
identify redundant .gitignore entries.
Reported by Tomas Nordin.