tests: avoid false failure on 32 bit in readdir() test
* tests/rm/rm-readdir-fail.sh: Since we use the returned dirent
from the readdir wrapper it must be the correct type and not
just cast. Therefore setup so that we only have to define a
wrapper for readdir(), which works appropriately on 32 and 64 bit.
Issue reported by Bernhard Voelker, where rm was seen to invoke
rmdir() on invalid file names.
Assaf Gordon [Sun, 1 May 2016 19:43:59 +0000 (15:43 -0400)]
tests: improve recent seq EPIPE test
Follow-up to commit c92585b1: improve epipe test script, with
suggestions from Bernhard Voelker and Pádraig Brady.
see: http://lists.gnu.org/archive/html/coreutils/2016-04/msg00067.html .
* tests/misc/seq-epipe.sh: Avoid too many subshells,
stricter validation of errors and output from seq,
skip if trapping SIGPIPE is not supported.
Pádraig Brady [Wed, 29 Jun 2016 08:49:01 +0000 (09:49 +0100)]
stty: fix sane setting of susp to ^z on Solaris
* src/stty.c: Disable setting of "swtch" to ^z as that
conflicts with and disables using ^z as "susp".
* NEWS: Mention the bug fix.
Reported and tested by Rich Burridge at:
http://bugs.gnu.org/23866
Peter Benie [Sun, 26 Jun 2016 18:07:45 +0000 (19:07 +0100)]
tests: verify that fts diagnoses readdir() failures
* tests/rm/rm-readdir-fail.sh: A new test to simulate readdir()
failing immediately or after returning a few entries, and verifying
that rm does the appropriate thing.
This was initially reported at:
http://bugzilla.opensuse.org/show_bug.cgi?id=984910
where it was mentioned that readdir() may fail
when an NFS server has a poor readdir cookie implementation.
Pádraig Brady [Sun, 26 Jun 2016 19:58:41 +0000 (20:58 +0100)]
all: update gnulib submodule and tests/init.sh to latest
* gnulib: Update to latest.
* NEWS: Specifically mention the fts readdir() fix
and reindent to standard indentation.
* tests/init.sh: Update from gnulib.
Paul Eggert [Fri, 24 Jun 2016 22:58:44 +0000 (00:58 +0200)]
maint: simplify partial writes etc. in 'yes'
* src/yes.c: Include full-write.h.
(main): Use full_write, not write, to simplify handling of partial
writes. Don't bother using stdio to output data; just use
full_write with a buffer as large as needed. Reuse operand
strings if possible, and if the buffer would otherwise be large.
Pádraig Brady [Thu, 23 Jun 2016 13:15:59 +0000 (14:15 +0100)]
yes: handle short writes
* src/yes.c (main): Loop over the write buffer to
handle the case where write may write less than requested.
* NEWS: Mention the bug fix.
Reported by Paul Eggert.
Paul Eggert [Thu, 23 Jun 2016 18:16:45 +0000 (20:16 +0200)]
maint: work even if argc == INT_MAX
GCC 7 warned about undefined behavior in this unlikely case.
Problem reported by Jim Meyering in: http://bugs.gnu.org/23825
* src/md5sum.c (main):
* src/paste.c (main):
* src/yes.c (main):
Avoid undefined behavior when argc == INT_MAX.
Pádraig Brady [Wed, 1 Jun 2016 10:56:47 +0000 (11:56 +0100)]
doc: clarify sort --key handling of default field separators
* doc/coreutils.texi (sort invocation): Mention in the summary
dicussion that --key is used to specify fields. Give a summary
in the --key description, of the most common use case of specifying
a field, and that by default those fields include the blank separators
at the start of each field in the comparisons.
Pádraig Brady [Sun, 15 May 2016 20:23:42 +0000 (21:23 +0100)]
dircolors: output colors for any $TERM matching *color*
* src/dircolors.hin: Reduce the list by replacing all specific
mentions of "color" with the pattern "*color*". This will also
cater for other entries like "konsole-256color".
Fixes http://bugs.gnu.org/23542
Pádraig Brady [Thu, 12 May 2016 08:50:48 +0000 (09:50 +0100)]
stat,tail: add support for the SMB2 remote file system
* stc/stat.c (human_fstype): Add file system ID definition,
and use "smb2" as the name.
* NEWS (Improvements): Mention the change.
Fixes http://bugs.gnu.org/23516
Jim Meyering [Wed, 4 May 2016 03:56:20 +0000 (20:56 -0700)]
maint: avoid new warning from gcc (GCC) 7.0.0 20160503 (experimental)
* src/id.c (main): When configured with --enable-gcc-warnings and using
the very latest gcc built from git, building would fail with this:
src/id.c:200:8: error: assuming signed overflow does not occur when \
simplifying conditional to constant [-Werror=strict-overflow]
bool default_format = (just_user + just_group + just_group_list
^~~~~~~~~~~~~~
Rewrite to use bool-appropriate operators.
Assaf Gordon [Sun, 17 Apr 2016 06:28:13 +0000 (02:28 -0400)]
seq: detect and report I/O errors immediately
Ensure I/O errors are detected (and terminate seq), preventing seq
from infloop (or running for long time with a large
range) upon write errors or ignored SIGPIPE. Examples:
* src/seq.c (io_error): A new function to diagnose appropriate
stdio errors and exit the program with failure status.
(seq_fast, print_numbers): Explicitly check for write errors
and terminate the program with diagnostic.
* tests/misc/seq-io-errors.sh: Test error detection with /dev/full.
* tests/misc/seq-epipe.sh: Test error detection with broken pipes.
* tests/local.mk: Add new tests.
* NEWS: Mention the fix.
stat,tail: add support for Windows Subsystem for Linux
* src/stat.c (human_fstype): Add file system ID definition,
and use "wslfs" as the name.
* NEWS (Improvements): Mention the change.
Fixes http://bugs.gnu.org/23273
sleep,timeout: support overflowing floating point values
* src/sleep.c (main): Allow ERANGE since we allow "inf" values.
* src/timeout.c (parse_duration): Likewise.
* tests/misc/sleep.sh: New file. Tests for sleep(1).
* tests/misc/timeout-parameters.sh: Add case for newly allowed
$LDBL_MAX. Also use returns_ throughout the file. Also avoid
small timeout values which might give false failures under load.
* cfg.mk (sc_prohibit_expr_unsigned): expr uses intmax_t internally
when GMP is not available, so flag any uses of unsigned limits.
* tests/misc/timeout-parameters.sh: Remove the overflow related
to UINT_MAX as it's handled by the following case. Change the
following case from 99... to $TIME_T_OFLOW to be more expressive
in what it's actually testing. Directly check that commands succeed,
rather than inspecting $? afterwards.
* tests/dd/skip-seek-past-dev.sh: Guard against large device sizes.
* tests/id/setgid.sh: Protect: Guard against large group IDs.
* tests/misc/cut-huge-range.sh: Tweak comment to avoid syntax check.
It's tempting to simplify to just skip the test if expr fails,
but SIZE_MAX > INTMAX_MAX is the common case.
* tests/cp/parent-perm-race.sh: This new race introduced in
commit v8.25-5-g632eda5 is quite hard to hit, but is due to
`ls > fifo` doing write()/close()/exit() once `cp` has
open() the source fifo. Then the subsequent comparison of the
destination file may fail due to the file being missing or empty.
Previously `ls` generated output that was independent of `cp`.
Now we must wait for `cp` to finish before inspecting the
destination file that it wrote.
Bernhard Voelker [Thu, 14 Apr 2016 10:39:28 +0000 (12:39 +0200)]
seq: do not allow NaN arguments
* src/seq.c (isnan): Define macro.
(scan_arg): Add check if the given argument is NaN, and exit with
a proper error diagnostic in such a case.
(usage): Document it.
* tests/misc/seq.pl: Add tests.
* doc/coreutils.texi (seq invocation): Document the change.
* NEWS (Changes in behavior): Mention the change.
Bernhard Voelker [Thu, 14 Apr 2016 10:38:09 +0000 (12:38 +0200)]
seq: do not allow 0 as increment value
* src/seq.c (main): Exit with an error diagnostic when the given
step value is Zero.
(usage): Document it.
* doc/coreutils.texi (seq invocation): Likewise.
* tests/misc/seq.pl: Add tests.
* NEWS (Changes in behavior): Mention the change.
Reported by Маренков Евгений in:
http://bugs.gnu.org/23110
* src/stat.c (human_fstype): Add file system ID definition.
* NEWS (Improvements): Mention the change, moving the previously added
"prl_fs" change note from "Changes in behavior" to here.
Fixes http://bugs.gnu.org/23283
Pádraig Brady [Thu, 31 Mar 2016 15:34:28 +0000 (16:34 +0100)]
stat: report type for "prl_fs" file systems
* src/stat.c (human_fstype): Identify the parallels file system.
Also tag as remote so that tail(1) doesn't use inotify, which
fails to detect changes made outside a VM.
Fixes http://bugs.gnu.org/23143
Paul Eggert [Thu, 17 Mar 2016 17:35:18 +0000 (10:35 -0700)]
date ls pr: fix time zone abbrs on SysV platforms
The problematic code computed a struct tm in one time zone, and
then printed it or converted it to a string in another. To be
portable the same time zone needs to be used for both operations.
On GNU platforms this is not an issue, but incorrect output can be
generated on System V style platforms like AIX where time zone
abbreviations are available only in the 'tzname' global variable.
Problem reported by Assaf Gordon in: http://bugs.gnu.org/23035
* NEWS: Document the bug.
* src/date.c (show_date):
* src/ls.c (long_time_expected_width, print_long_format):
* src/pr.c (init_header):
* src/stat.c (human_time): Use localtime_rz instead of localtime,
so that the time zone information is consistent for both localtime
and time-formatting functions like fprintftime and nstrftime. For
'stat' this change is mostly just a code cleanup but it also
causes stat to also print nanoseconds when printing time stamps
that are out of localtime range, as this is more consistent with
what other programs do. For programs other than 'stat' this fixes
bugs with time zone formats that use %Z.
* src/du.c, src/pr.c (localtz): New static var.
(main): Initialize it.
* src/du.c (show_date): New time zone argument, so that localtime
and fprintftime use the same time zone information. All callers
changed.
* tests/misc/time-style.sh: New file.
* tests/local.mk (all_tests): Add it.
* tests/misc/date.pl: Test alphabetic time zone abbreviations.
Jim Meyering [Mon, 14 Mar 2016 15:59:56 +0000 (08:59 -0700)]
maint: remove gl/lib/reg*.c.diff; no longer needed
* gl/lib/regcomp.c.diff: Remove file, now that gnulib's
regcomp.c compiles regex.c with -Wno-unused-parameter.
* gl/lib/regex_internal.h.diff: Likewise.
* gl/lib/regex_internal.c.diff: This file induced a change to ensure
that the "Idx" type was unsigned and to remove a few "VAR < 0"
comparisons. These days, it is probably fine to stay in sync with
gnulib/glibc's copies
of these files, so remove these patches, too.
* gl/lib/regexec.c.diff: Likewise.
Prompted by a report by Assaf Gordon and a suggestion from Paul Eggert.
Jim Meyering [Mon, 7 Mar 2016 00:38:01 +0000 (16:38 -0800)]
tests: avoid false-failure of split/filter.sh on XFS
* tests/split/filter.sh: Use OFF_T_MAX-1 rather than OFF_T_MAX
as the size of a test file, to avoid false failure on an XFS file
system (or any file system permitting a file of size OFF_T_MAX).
Reported as http://bugs.gnu.org/22931
Eric Blake [Fri, 4 Mar 2016 16:47:33 +0000 (09:47 -0700)]
test: Document that -a and -o are undesirable
POSIX recommends avoiding -a and -o, for good reason.
src/test.c (usage): Mention that inherent ambiguities exist with
binary -a and -o.
Problem reported by Martin Gebert in: http://bugs.gnu.org/22909
Paul Eggert [Tue, 23 Feb 2016 09:03:55 +0000 (01:03 -0800)]
all: be less strict about usage if POSIX 2008
sort, tail, and uniq now support traditional usage like 'sort +2'
and 'tail +10' on systems conforming to POSIX 1003.1-2008 and later.
* NEWS: Document this.
* doc/coreutils.texi (Standards conformance, tail invocation)
(sort invocation, uniq invocation, touch invocation):
Document new behavior, or behavior's dependence on POSIX 1003.1-2001.
* src/sort.c (struct keyfield.traditional_used):
Rename from obsolete_used, since implementations are now allowed
to support it. All uses changed.
(main): Allow traditional usage if _POSIX2_VERSION is 200809.
* src/tail.c (parse_obsolete_option): Distinguish between
traditional usage (which POSIX 2008 and later allows) and obsolete
(which it still does not).
* src/uniq.c (strict_posix2): New function.
(main): Allow traditional usage if _POSIX2_VERSION is 200809.
* tests/misc/tail.pl: Test for new behavior.
Paul Eggert [Tue, 23 Feb 2016 07:48:36 +0000 (23:48 -0800)]
doc: document sort -o F F danger
Problem reported by Yanyan Jiang 蒋炎岩 in: http://bugs.gnu.org/22769
* doc/coreutils.texi (sort invocation):
Mention possibility of 'sort -o F F' data loss during crashes.
Pádraig Brady [Sat, 13 Feb 2016 04:15:51 +0000 (20:15 -0800)]
split: adjust recent --number changes
* src/split.c (lines_rr): Reinstate the conditional
setting of the WROTE boolean, as otherwise split -n r/1 would
consume all input when all --filter commands are stopped.
There was a test in place to check for this, but
it was incorrect as detailed below.
(input_file_size): Immediately disallow --number with
non seekable inputs, as such an invocation is not currently
generally supported and will fail as the data overflows
the internal buffer.
* tests/split/l-chunk.sh: Adjust to again disallow -n /dev/zero.
Also change all '&& fail=1' checks to use the 'returns_ 1' form.
* tests/split/filter.sh: Change the no longer supported /dev/zero
case to a regular $OFF_T_MAX file (supported on XFS for example).
Also fix the timeout(1) commands so they're not subject to
pipefail issues.
Göran Uddeborg [Mon, 15 Feb 2016 21:00:52 +0000 (13:00 -0800)]
stty: fix translated --help so the gettext header is not printed
* src/stty.c (usage): Remove an erroneous call to translate an
empty string, added in commit v8.23-112-g564f84a, which results
in the gettext header being printed for translated languages.
* THANKS.in: Remove the now committer.
* NEWS: Mention the bug fix.
Paul Eggert [Fri, 12 Feb 2016 18:59:20 +0000 (10:59 -0800)]
tests: don't wait forever on GNU/Hurd
* tests/cp/parent-perm-race.sh: Add timeouts so that the test does
not wait forever on GNU/Hurd. This does not fix the underlying
bug but at least lets the tests make progress.
Problem reported by Nelson H.F. Beebe in: http://bugs.gnu.org/22624
Also, check that 'cp' actually copies the data; this is a better
test anyway, and simplifies the test code.
Also, avoid unlikely race if 'pid' is set in the environment.
Paul Eggert [Fri, 12 Feb 2016 18:16:11 +0000 (10:16 -0800)]
split: fix problems with /dev/zero
Problem reported by Nelson H.F. Beebe in: http://bugs.gnu.org/22624
Other problems also fixed: basically, the code got confused because
GNU/Linux reports that /dev/zero has size zero.
* src/split.c (input_file_size): Now takes struct stat *, not just
size. Always store the first buffer. All callers changed. Treat
/dev/zero as an infinitely-large file, both on GNU/Linux where
fstat and lseek say its size is zero, and on GNU/Hurd where they
say the size is OFF_T_MAX.
(cwrite): Return true on success.
(bytes_split): Don't try to read past EOF, and stop if a write fails.
(lines_rr): Omit stray check for ignorable errno.
(main): Get file size only when n_units > 1, since that's the only
time it is needed. Defer most of the work to input_file_size.
* tests/split/l-chunk.sh: Adjust tests to match new behavior
on oddball inputs.
Vincent Lefevre [Sat, 30 Jan 2016 07:07:13 +0000 (23:07 -0800)]
doc: fix the --iso-8601 example in date --help
* src/date.c (usage): The colon is used in the timezone offset
since commit v8.24-64-g17bbf6c.
* THANKS.in: Remove committer.
Fixes http://bugs.gnu.org/22491
Pádraig Brady [Mon, 25 Jan 2016 01:57:12 +0000 (17:57 -0800)]
build: avoid dynamic linking issue on Solaris sparc
Solaris Studio 12 on sparc (not x86) will not remove
unused functions, thus leaving a reference to an
undefined program_name symbol from emit_try_help().
* src/system.h (emit_try_help): Change from an inline function
to a macro, so that the inline function is not actually
defined in libstdbuf.c.
Fixes http://bugs.gnu.org/22430
Pádraig Brady [Tue, 19 Jan 2016 18:45:07 +0000 (18:45 +0000)]
tests: avoid false failure in tail inotify test
* tests/tail-2/wait.sh: Restrict inotify specific test portion
to local file systems and also not with ---disable-inotify specified.
Failure noticed on NFS.
Pádraig Brady [Tue, 19 Jan 2016 17:49:11 +0000 (17:49 +0000)]
tests: avoid false failure due to remove() ignoring u-w on NFS
* tests/rm/rm1.sh: Also remove the group write bit which
was required on one NFS setup at least. Note u-w was
enough to deny file creation, g-w was also required to
deny file removal.
* tests/rm/cycle.sh: Likewise.
* tests/mv/perm-1.sh: Likewise.
Pádraig Brady [Tue, 19 Jan 2016 15:51:00 +0000 (15:51 +0000)]
tests: avoid false failure in preserve-slink-time.sh on GPFS
* tests/cp/preserve-slink-time.sh: Add a delay between the
ln and the cp so that there is enough difference between
the timestamps so GPFS won't discard the update.
Reported by Assaf Gordon.
Pádraig Brady [Tue, 19 Jan 2016 14:58:55 +0000 (14:58 +0000)]
tests: avoid false failure in shred-passes.sh
* tests/misc/shred-passes.sh: Specify an exact amount to shred,
to avoid running out of simulated random data on file systems
with a large st_blksize like GPFS for example.
Reported by Assaf Gordon.
Pádraig Brady [Tue, 19 Jan 2016 13:22:42 +0000 (13:22 +0000)]
tail: disable inotify with only non existent files
tests/tail-2/F-headers.sh and test/tail-2/retry.sh fail on
on remote file systems due to tail going into inotify mode
due to not being able to determine the remoteness of the
non existent files.
* src/tail.c (any_non_remote_file): A new function used
to disable inotify when there are no open files, as
we can't determine remoteness in that case.
* NEWS: Mention the bug fix.
Pádraig Brady [Mon, 18 Jan 2016 18:35:48 +0000 (18:35 +0000)]
all: don't unconditionally use leaf optimization for NFS
* gnulib: Update to latest where the only change is to
not unconditionally enable leaf optimization for fts on NFS,
as it was seen to abort() with some NFS servers as per:
https://bugzilla.redhat.com/1299169
This affects utilities that traverse directories like
cp, rm, chmod etc.
* NEWS: Adjust the improvement message to leave only XFS.
Pádraig Brady [Mon, 18 Jan 2016 12:41:36 +0000 (12:41 +0000)]
tests: adjust delays to avoid false positives
* tests/rm/dangling-symlink.sh: The effective delay was only
1.5s. So delay before the operation, and increase the iteration
count by 1 to increase the delay to 6.3s. This failure was
noticed once on a FreeBSD 10.2 x86_64 virtual machine.
* tests/dd/stats.sh: Remove quotes on sleep argument
to ensure arguments are accumulated appropriately.
* tests/du/move-dir-while-traversing.sh: sleep before operation,
to increase the effective delay from 1.6s to 3.2s.
* tests/tail-2/flush-initial.sh: Likewise.
* tests/tail-2/pipe-f2.sh: Sleep first so that the effective delay
matches the commented value.
Pádraig Brady [Mon, 18 Jan 2016 12:26:15 +0000 (12:26 +0000)]
test: skip test rather than fail with Solaris 10 sed
* tests/rm/r-root.sh: This test was seen to ERROR due to
sed input not having a terminating '\n'. Therefore just skip
with diagnostics upon failure to adjust the error output with sed.
Reported by Assaf Gordon.
Pádraig Brady [Sat, 16 Jan 2016 13:53:48 +0000 (13:53 +0000)]
tests: show mount list on failure for df tests
* init.cfg (dump_mount_list_): A new function to output the
system mount list.
* tests/df/df-symlink.sh: Call dump_mount_list_ upon failure.
* tests/df/over-mount-device.sh: Likewise.
* tests/df/problematic-chars.sh: Likewise.
* tests/df/skip-rootfs.sh: Likewise.
* tests/df/total-verify.sh: Likewise.
* tests/df/unreadable.sh: Likewise.
Pádraig Brady [Sat, 16 Jan 2016 13:34:07 +0000 (13:34 +0000)]
tests: avoid false failure with BTRFS subvolumes
* tests/df/df-symlink.sh: Only check the symmetry of
the source <-> target lookup, when the source is only mounted once,
which isn't the case if '.' is a BTRFS subvolume for example.
Reported by Assaf Gordon on a default OpenSUSE 42.1 install.
Pádraig Brady [Sat, 16 Jan 2016 11:35:50 +0000 (11:35 +0000)]
mv: consistently warn about multiply specified source dirs
* src/copy.c (copy internal): Remember directories irrespective
of their link count, because on some file systems like BTRFS,
directories always have a link count of 1.
Pádraig Brady [Fri, 15 Jan 2016 15:56:30 +0000 (15:56 +0000)]
tests: remove a non portable localtime test
* tests/misc/date.pl: This test was dependent on perl
unconditionally calling the system localtime() as date(1) does.
However perl has its own configure checks in place to avoid buggy
localtime implementations. Therefore comment out this test
as a FIXME for now. This test was seen to fail on FreeBSD 10
where localtime() returns nonsense values instead of failing
for arguments >= 2^56.
Pádraig Brady [Fri, 15 Jan 2016 14:16:11 +0000 (14:16 +0000)]
tests: adjust memory limits in head-c.sh
* tests/misc/head-c.sh: Further increase the limit, to account
for the fact that head(1) needs at least 1.576MB over the base test
command on FreeBSD 10. 4MB should be enough headroom while
still providing over allocation protection.
Reported by Assaf Gordon.
Pádraig Brady [Thu, 14 Jan 2016 14:21:53 +0000 (14:21 +0000)]
tests: simplify invalid signal determination for kill -l
* src/operand2sig.c (operand2sig): Add a detailed comment explaining
why we validate even very large shell exit status values.
* tests/misc/kill.sh: Add a test case for the ksh scheme.
Simplify the INVALID signal number determination which also avoids
a false failure on systems like FreeBSD 10 with incomplete
signal list (caused by inaccurate NSIG).
Pádraig Brady [Thu, 14 Jan 2016 02:18:58 +0000 (02:18 +0000)]
tests: support older fallocate number formats
* tests/cp/fiemap-extents.sh: Support RHEL6 fallocate
which doesn't support IEC suffixes like "MiB" on numbers.
Also add some extra framework_failure_ protections.
Reported by Assaf Gordon.
Pádraig Brady [Thu, 14 Jan 2016 01:17:57 +0000 (01:17 +0000)]
sort: with --debug, flag setlocale() failures on OpenBSD
Locale categories are not equivalent on OpenBSD,
and LC_COLLATE only supports "C" for example.
Now LC_ALL is supported to set multiple other categories
on OpenBSD, so setlocale(LC_ALL, "") returns a string
indicating which categories were updated and which ignored.
Therefore...
* src/sort.c (main): ...Call setlocale(LC_COLLATE, "")
to explicitly check whether a specified LC_ALL or
LC_COLLATE environment variable value is supported
for the LC_COLLATE category. Also use !! to explicitly
convert to bool to support c89 systems where bool is an int,
and thus would get values > 1.
Reported by Assaf Gordon.
Pádraig Brady [Mon, 11 Jan 2016 22:31:45 +0000 (22:31 +0000)]
doc: suggest dd "sync" flag to maximize "nocache" effectiveness
doc/coreutils.texi (dd invocation): Add oflag=sync to the streaming
example. Also reference the "direct" flag. Mention this is only
a request to the system.
* src/dd.c (usage): Mention the "sync" flag along with "nocache".
Also mention that it's only a request to drop the cache.
* THANKS.in: Add reporter Francois Rigault.
Pádraig Brady [Tue, 12 Jan 2016 13:12:37 +0000 (13:12 +0000)]
doc: mention the '0#' printf flags with stat %a
* src/stat.c (usage): Mention the '#' and '0' flags are useful with %a.
* doc/coreutils.texi (stat invocation): Likewise. Also give an example
printing unambiguous octal output.
Reported at http://bugs.debian.org/810539
Pádraig Brady [Tue, 12 Jan 2016 12:39:43 +0000 (12:39 +0000)]
mv: fix data loss with repeated source dir and same destination
commit v8.23-31-g90aa291 failed to consider this case,
where the previous rename has failed, thus causing the
following to remove the specified directory:
mv dir dir dir
* src/copy.c (copy_internal): Assume this rename attempt has
succeeded, as a previous failure will already have been handled,
and we don't want to remove the source directory in this case.
* tests/cp/duplicate-sources.sh: Consolidate this test file to...
* tests/mv/dup-source.sh: ...here. Add test cases for same
source and dest.
* tests/local.mk: Remove the consolidated test.
* NEWS: Mention the bug fix.
Pádraig Brady [Sat, 9 Jan 2016 01:38:30 +0000 (01:38 +0000)]
wc: avoid ambiguous output with '\n' in file names
* src/wc.c (write_counts): Shell escape the file name
if it contains '\n' so only a single line per file is output.
* tests/misc/wc-files0.sh: Add a test case.
* NEWS: Mention the improvement.
Assaf Gordon [Fri, 8 Jan 2016 18:55:12 +0000 (13:55 -0500)]
numfmt: add the -z,--zero-terminated option
* doc/coreutils.texi (numfmt invocation): Reference the description.
* src/numfmt.c: Parameterize '\n' references.
* tests/misc/numfmt.pl: Add tests for character and field processing.
* NEWS: Mention the new feature.
Pádraig Brady [Fri, 8 Jan 2016 15:57:06 +0000 (15:57 +0000)]
paste: add the -z,--zero-terminated option
* doc/coreutils.texi (paste invocation): Reference -z description.
* src/paste.c (main): Parameterize the use of '\n'.
* tests/misc/paste.pl: Add test cases.
* NEWS: Mention the new feature.
Pádraig Brady [Fri, 8 Jan 2016 15:42:56 +0000 (15:42 +0000)]
comm: support NUL --output-delimiter for consistency
* src/comm.c (main): Track the output delimiter length,
so that it can be adjusted to 1 for the NUL delimiter.
Also rename the global variable from "delimiter" to
"col_sep" so its use is more obvious, and to distinguish
from the recently added "delim" global variable.
* tests/misc/comm.pl: Adjust accordingly.
Pádraig Brady [Fri, 8 Jan 2016 15:14:01 +0000 (15:14 +0000)]
comm: add the -z,--zero-terminated option
* doc/coreutils.texi (comm invocation): Reference option description.
* src/comm.c (main): Use readlinebuffer_delim() to support
a parameterized delimiter.
* tests/misc/comm.pl: Add test cases.
* NEWS: Mention the new feature.
Pádraig Brady [Fri, 8 Jan 2016 14:31:27 +0000 (14:31 +0000)]
tac: support an empty (NUL) --separator
* doc/coreutils.texi (tac invocation): Mention the
NUL delineation with an empty --separator.
* src/tac.c (main): Allow an empty separator when -r not specified.
* tests/misc/tac.pl: Add test cases.
* NEWS: Mention the new feature.
Fixes http://bugs.gnu.org/8103
Pádraig Brady [Fri, 8 Jan 2016 13:04:03 +0000 (13:04 +0000)]
cut: add the -z,--zero-terminated option
* doc/coreutils.texi (cut invocation): Reference the description.
* src/cut.c: Parameterize '\n' references.
* tests/misc/cut.pl: Add tests for character and field processing.
* NEWS: Mention the new feature.
Pádraig Brady [Tue, 12 Jan 2016 16:29:32 +0000 (16:29 +0000)]
join,sort,uniq: with -z, treat '\n' as a field separator
* NEWS: Mention the change in behavior.
* doc/coreutils.texi (newlineFieldSeparator): A new description,
referenced from ({join,sort,uniq} invocation).
* src/system.h (field_sep): A new inline function to determine
if a character is a field separator.
* src/join.c (usage): s/whitespace/blank/ to be more accurate
wrt which characters are field separators.
(xfields): s/isblank/field_sep/.
* src/sort.c (inittables): Likewise.
* src/uniq.c (find_field): Likewise.
* tests/misc/join.pl: Adjust -z test, and add a test/example
for processing the whole record with field processing.
* tests/misc/sort.pl: Add -z test cases, including case with '\n'.
* tests/misc/uniq.pl: Add -z -f test case with \n.
Bernhard Voelker [Sun, 10 Jan 2016 00:44:04 +0000 (01:44 +0100)]
tests: fix races wrt output files of background processes
At least the false positive in tail-2/follow-stdin.sh could be seen
on a 4-core i5 system with -j8. Fix similar cases. too.
* tests/tail-2/follow-stdin.sh: Empty the 'out' file in each iteration.
Otherwise, under heavy system load, 'check_tail_output' would see the
expected output from the previous round before tail would have the
chance to come up in the background.
While at it, move the creation of the 'exp' file out of the loop.
* tests/dd/stats.sh: Empty the output file of the background process
here, too.
* tests/misc/cat-buf.sh: Likewise.
* tests/misc/stdbuf.sh: Likewise.
* tests/tail-2/wait.sh: Likewise.
Pádraig Brady [Wed, 6 Jan 2016 15:50:11 +0000 (15:50 +0000)]
stty: support "flusho" local setting
This is used to discard terminal output on FreeBSD based systems.
* src/stty.c (mode_info): Add FLUSHO where supported.
(usage): Document for "local" and "combination" settings.
* doc/coreutils.texi (local stty settings): Document,
mentioning that this option is supported but ignored on GNU/Linux.
Pádraig Brady [Wed, 6 Jan 2016 14:40:03 +0000 (14:40 +0000)]
stty: support [-]drain setting to control waiting for pending Tx
Instead of commit v8.24-132-g5171bef which only provides
control to disable this behavior (with -I), provide
the symmetrical "[-]drain" special setting.
* src/stty.c (main): Parse the [-]drain setting instead of -I,
and treat like a global option.
(usage): Adjust accordingly.
* tests/misc/stty.sh: Test "drain" with and without options.
* NEWS: Mention the new feature.
Pádraig Brady [Mon, 4 Jan 2016 12:13:40 +0000 (12:13 +0000)]
stty: support -I, --immediate to not wait for pending transmission
In some cases an initial drain may block indefinitely as discussed at:
http://lists.gnu.org/archive/html/coreutils/2016-01/msg00007.html
* src/stty.c (main): Use TCSANOW rather than TCSADRAIN if -I specified.
(usage): Document the new option.
* doc/coreutils.texi (stty invocation): Likewise.
* tests/misc/stty.sh: Ensure -I is supported.
* NEWS: Mention the new feature.
Pádraig Brady [Sun, 3 Jan 2016 01:28:47 +0000 (01:28 +0000)]
doc: avoid unwanted display of the 'coreutils' command info
* doc/coreutils.texi (coreutils): Remove this direntry
so that `info coreutils` will display the table of contents,
rather than the unlikely intended coreutils Multi-call invocation.
This also supports lookups like `info coreutils readlink`,
but note that only works with the standard info viewer,
and not with pinfo for example.
Pádraig Brady [Sat, 2 Jan 2016 22:22:55 +0000 (22:22 +0000)]
doc: mention in more places that -D will create --target-directory
* src/install.c (usage): Mention this commonly required functionality
in the -D option description.
* doc/coreutils.texi (install invocation): Likewise for the
--target-directory description.
Pádraig Brady [Sat, 2 Jan 2016 22:14:41 +0000 (22:14 +0000)]
install: only attempt to create a target dir once
* src/install.c (main): As an optimization, when calling
install_file_in_dir() for each file, only attempt to create
the target directory once, as this is invariant over the loop.
Pádraig Brady [Sat, 2 Jan 2016 18:38:37 +0000 (18:38 +0000)]
install: fix relative copies to absolute directory with -D
* src/install.c (mkancesdirs_safe_wd): Unconditionally
restore the current working directory when possibly called
multiple times (from install_file_in_dir()).
* tests/install/create-leading.sh: Add a test case.
* NEWS: Mention the fix.
Fixes http://bugs.gnu.org/21497
maint: fix sc_long_lines to warn about 100+ maximum line length again
Since commit v8.23-60-g414a8cf, the above check failed to find sources
where the length of the longest line is a 3 or more digit number.
* cfg.mk (sc_long_lines): Remove the '\' escape character before '{'
and '}', because this would mean literal '{' and '}' characters in
an extended regular expression in sed(1).
Pádraig Brady [Fri, 1 Jan 2016 14:10:41 +0000 (14:10 +0000)]
maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* tests/sample-test: Adjust to use the single most recent year.
Paul Eggert [Thu, 31 Dec 2015 22:09:05 +0000 (14:09 -0800)]
dd: append spaces to shorter status=progress line
Problem noted by Pádraig Brady in: http://bugs.gnu.org/22277#8
Also, make the output a bit more precise while we're at it.
* NEWS: Document this.
* src/dd.c (previous_time): Remove, replacing with ...
(next_time): New var. All uses changed.
This avoids some rounding errors, and should be a bit faster.
(newline_pending): Remove, replacing with ...
(progress_len): New var. All uses changed.
This lets us keep track of how many trailing spaces to append.
(print_xfer_stats): Get the time first thing, so that it's
closer to being correct. Count the bytes output, and append
trailing spaces if needed. Add remarks to translators about
translation lengths.
Paul Eggert [Thu, 31 Dec 2015 19:43:09 +0000 (11:43 -0800)]
dd: summarize in --human-readable format too
Problem reported by Linda Walsh in: http://bugs.gnu.org/17505
* NEWS: Document this.
* doc/coreutils.texi (dd invocation): Use a simpler script.
Adjust output example to match new behavior.
* src/dd.c (human_size): Remove.
All uses changed to use human_readable and ...
(human_opts): ... this new constant.
(abbreviation_lacks_prefix): New function.
(print_xfer_stats): Use it. Output both --si and --human-readable
summaries, but only if they have prefixes.
* tests/dd/reblock.sh, tests/dd/stats.sh: Test new behavior.
Pádraig Brady [Wed, 23 Dec 2015 00:43:45 +0000 (00:43 +0000)]
build: update to latest gnulib
Mainly for these changes:
- freadptr: fix to work with ungetc on all uClibc configs
- fts: enable leaf optimization for XFS
- fts: ensure leaf optimization used for NFS
- strftime-tests: avoid false failure on OS X
- intprops-tests: avoid warnings (causing CI failures)
* NEWS: Update with items from above that are
significant from the previous coreutils release.
Pádraig Brady [Mon, 21 Dec 2015 17:57:30 +0000 (17:57 +0000)]
doc: describe test operator precedence and associativity
* doc/coreutils.texi (Connectives for test): Add notes
on precedence and associativity. Also mention the
portability caveats with these operators.
* cfg.mk: Avoid sc_prohibit_test_minus_ao for coreutils.texi.
Fixes http://bugs.gnu.org/22216
Bernhard Voelker [Thu, 17 Dec 2015 11:46:59 +0000 (12:46 +0100)]
build: rely on umask for setting permissions in tarball
Commit v8.24-116-g896006b changed the file permissions for the tarball
using ug+rw. Better to let the umask decide whether the file should
be group-writeable or not.
* Makefile.am (dist-hook): Change chmod call from 'ug+rw' to '+rw'.
Pádraig Brady [Wed, 16 Dec 2015 02:07:56 +0000 (02:07 +0000)]
tests: avoid intermittent ulimit -v failures
* init.cfg (get_min_ulimit_v_): Increase the determined
virtual memory limit for the command by a page size
to avoid alignment issues causing false failures for
subsequent runs.
* tests/misc/cut-huge-range.sh: Be defensive and match
the cut invocations under test, more closely with the
form used to determine the VM memory limit.
This was noticed on i686 linux at:
http://hydra.nixos.org/build/28990456
Pádraig Brady [Wed, 16 Dec 2015 00:28:19 +0000 (00:28 +0000)]
build: ensure all files are writable in the tarball
* Makefile.am (dist-hook): Ensure all files are writable
so that extracted tarballs are easy to remove, without
getting prompts about removing read-only files.
Reported by Benno Schulenberg.