]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
10 years agotests: fix recent regression in tail inotify test
Pádraig Brady [Thu, 5 Feb 2015 16:32:49 +0000 (16:32 +0000)] 
tests: fix recent regression in tail inotify test

* tests/tail-2/inotify-rotate.sh (cleanup_fail_): Set fail=1
so that failures are identified.  Regression in v8.23-63-g111a2b9
Also use print_ver_ rather than open coding --verbose support.
Also check for more than a single 'b' which seems brittle.

10 years agobuild: ensure make-prime-list doesn't access out of bounds memory
Yury Usishchev [Thu, 5 Feb 2015 23:04:29 +0000 (23:04 +0000)] 
build: ensure make-prime-list doesn't access out of bounds memory

The -fsanitize=address run associated with v8.22-75-gf940fec
failed to check make-prime-list, as src/primes.h is not
regenerated with `make clean`.  Running with -fsanitize=address
indicates a read 1 byte beyond the allocated buffer.

  $ rm src/make-prime-list.o
  $ make AM_CFLAGS=-fsanitize=address src/make-prime-list
  $ src/make-prime-list 5000

=================================================================
==13913==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x61e00000fa43 at pc 0x4016f5 bp 0x7fff9d9840e0 sp 0x7fff9d9840d0
READ of size 1 at 0x61e00000fa43 thread T0
    #0 0x4016f4 in main src/make-prime-list.c:214
    #1 0x7f98892c5fdf in __libc_start_main (/lib64/libc.so.6+0x1ffdf)
    #2 0x401774 (src/make-prime-list+0x401774)

0x61e00000fa43 is located 0 bytes to the right of 2499-byte
region [0x61e00000f080,0x61e00000fa43) allocated by thread T0 here:
    #0 0x7f98896ba7b7 in malloc (/lib64/libasan.so.1+0x577b7)
    #1 0x400f3f in xalloc src/make-prime-list.c:163
    #2 0x400f3f in main src/make-prime-list.c:198

SUMMARY: AddressSanitizer: heap-buffer-overflow
src/make-prime-list.c:214 main
Shadow bytes around the buggy address:
  0x0c3c7fff9ef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3c7fff9f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3c7fff9f10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3c7fff9f20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3c7fff9f30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c3c7fff9f40: 00 00 00 00 00 00 00 00[03]fa fa fa fa fa fa fa
  0x0c3c7fff9f50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3c7fff9f60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3c7fff9f70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3c7fff9f80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3c7fff9f90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:     fa
  ...
==13913==ABORTING

* src/make-prime-list.c (main): Bounds check the incremented index,
before using to access the buffer.
Fixes http://bugs.gnu.org/19784

10 years agobuild: fix invalid gnulib patch
Pádraig Brady [Tue, 3 Feb 2015 03:15:10 +0000 (03:15 +0000)] 
build: fix invalid gnulib patch

* gl/lib/tempname.c.diff: Fix recent breakage so it applies again.
Invalid patch was noticed at http://hydra.nixos.org/eval/1172233
* cfg.mk: Exempt diff files from these "id_est" syntax checks.
(sc_ensure_gl_diffs_apply): A new syntax check, to ensure all
patches under gl/ apply cleanly.  Note we use --fuzz=0 to check
patches apply cleanly for safety, due to the patch(1) issue detailed
in commit v8.21-117-g46f7e05
* gl/lib/regcomp.c.diff: Rediffed.
* gl/lib/regex_internal.c.diff: Likewise.
* gl/lib/regex_internal.h.diff: Likewise.
* gl/lib/regexec.c.diff: Likewise.
* gl/lib/tempname.h.diff: Likewise.

10 years agotests: avoid a FP on aarch64 when comparing env/printenv output
Bernhard Voelker [Tue, 3 Feb 2015 00:52:04 +0000 (01:52 +0100)] 
tests: avoid a FP on aarch64 when comparing env/printenv output

The following test fails on aarch64 on openSUSE's OpenBuildService
due to glibc's execvp reversing the pointers of 'environ', i.e.,
the output of "env|tac" equals "env env" on that platform.

* tests/misc/printenv.sh: Use 'env env' to work around the behavior
on that platform.
While at it, fix the grep pattern which suppressed all environment
variables starting with an underscore "_" instead of "$_" (and
"$LD_PRELOAD") only.

10 years agodircolors: sync with Xiph file extensions
Pádraig Brady [Mon, 2 Feb 2015 15:55:28 +0000 (15:55 +0000)] 
dircolors: sync with Xiph file extensions

* src/dircolors.hin: Remove deprecated anx, axa, axv.  Add opus.
Suggested by Scott Teal.

10 years agodoc,maint: fix use of "i.e." in documentation and comments
Bernhard Voelker [Sat, 31 Jan 2015 16:39:04 +0000 (17:39 +0100)] 
doc,maint: fix use of "i.e." in documentation and comments

To align with all other places (and correct grammar), change all
upper-case "I.E." to "I.e.".  Furthermore, ensure that "i.e." is
followed by a comma.  Finally, ensure to use a double-space before
"I.e.," at the beginning of a sentence.

The following was used to change all offending uses (apart from
old ChangeLog files):

  $ git grep -liF 'i.e.' \
      | xargs sed -i \
            -e 's/I\.E\./I.e./g' \
            -e 's/\. \(I\.e\.\)/.  \1/g' \
            -e 's/\([Ii]\.e\.\)\( \)/\1,\2/g' \
            -e 's/\([Ii]\.e\.\)$/\1,/g'

* cfg.mk (sc_prohibit_uppercase_id_est): Add new rule.
(sc_ensure_double_space_after_dot_before_id_est): Likewise.
(sc_ensure_comma_after_id_est): Likewise.
(old_NEWS_hash): Refresh hash via "make update-NEWS-hash".
* NEWS: Change use of "id est" abbreviation via the above command.
* README: Likewise.
* README-prereq: Likewise.
* doc/coreutils.texi: Likewise.
* gl/lib/rand-isaac.c: Likewise.
* gl/lib/tempname.c.diff: Likewise.
* man/stdbuf.x: Likewise.
* src/cat.c: Likewise.
* src/copy.c: Likewise.
* src/copy.h: Likewise.
* src/cp.c: Likewise.
* src/cut.c: Likewise.
* src/dd.c: Likewise.
* src/df.c: Likewise.
* src/fiemap.h: Likewise.
* src/longlong.h: Likewise.
* src/ls.c: Likewise.
* src/numfmt.c: Likewise.
* src/pr.c: Likewise.
* src/shred.c: Likewise.
* src/shuf.c: Likewise.
* src/split.c: Likewise.
* tests/Coreutils.pm: Likewise.
* tests/df/df-symlink.sh: Likewise.
* tests/df/skip-rootfs.sh: Likewise.
* tests/init.sh: Likewise.
* tests/ls/color-norm.sh: Likewise.
* tests/misc/basename.pl: Likewise.
* tests/misc/ls-misc.pl: Likewise.
* tests/misc/md5sum-bsd.sh: Likewise.
* tests/misc/shred-exact.sh: Likewise.
* tests/misc/sort.pl: Likewise.
* tests/misc/stdbuf.sh: Likewise.
* tests/misc/tac-continue.sh: Likewise.
* tests/rm/r-root.sh: Likewise.
* tests/tail-2/symlink.sh: Likewise.

10 years agodoc: clarify the output format for the *sum utilities
Pádraig Brady [Thu, 29 Jan 2015 18:44:41 +0000 (18:44 +0000)] 
doc: clarify the output format for the *sum utilities

* src/md5sum.c (usage): Detail the reasons for the default
double space between checksum and file name.
* doc/coreutils.texi (md5sum invocation): Likewise.
Explicitly mention the 3 formats that --check supports.

Fixes http://bugs.gnu.org/19725

10 years agosync: support syncing specified arguments
Giuseppe Scrivano [Sun, 25 Jan 2015 00:33:45 +0000 (01:33 +0100)] 
sync: support syncing specified arguments

* m4/jm-macros.m4 (coreutils_MACROS): Check for syncfs().
* man/sync.x: Add references to syncfs, fsync and fdatasync.
* doc/coreutils.texi (sync invocation): Document the new feature.
* src/sync.c: Include "quote.h".
(AUTHORS): Include myself.
(MODE_FILE, MODE_DATA, MODE_FILE_SYSTEM, MODE_SYNC): New enum values.
(long_options): Define.
(sync_arg): New function.
(usage): Describe that arguments are now accepted.
(main): Add arguments parsing and add support for fsync(2),
fdatasync(2) and syncfs(2).
* tests/misc/sync.sh: New (and only) test for sync.
* tests/local.mk: Reference the new test.
* AUTHORS: Add myself to sync's authors.
* NEWS: Mention the new feature.

10 years agoscripts: autotools-install: update
Jim Meyering [Tue, 6 Jan 2015 15:51:01 +0000 (07:51 -0800)] 
scripts: autotools-install: update

* scripts/autotools-install: Increase automake's version number
to 1.15 and add Stefano Lattarini's new GPG key ID.
Increase gettext's version to 0.19.4 and add Daiki Ueno's GPG key ID.
Also move VERSION definition "up" so that it is once again
automatically updated via the emacs hook snippet at the end
of the file.

10 years agostty: only print supported options for combined options
Pádraig Brady [Fri, 23 Jan 2015 03:09:16 +0000 (03:09 +0000)] 
stty: only print supported options for combined options

* src/stty.c (usage): Don't reference unsupported options,
in the combined options descriptions.
* doc/coreutils.texi (stty invocation): Adjust for the
new order of the 'sane' and 'raw' combined options.
Also add -iutf8 to the 'sane' list.

10 years agostty: document the 'status' character where supported
Pádraig Brady [Fri, 23 Jan 2015 01:26:29 +0000 (01:26 +0000)] 
stty: document the 'status' character where supported

* src/stty.c (usage): On systems that support this setting (BSD),
display 'status' in the list of adjustable special characters.
* doc/coreutils.texi (stty invocation): Mention the option, and that
it's not currently supported on Linux.

10 years agostty: document the 'discard' character setting
Pádraig Brady [Fri, 23 Jan 2015 00:43:58 +0000 (00:43 +0000)] 
stty: document the 'discard' character setting

The equivalent of this is 'flush', but that was never documented
as an option (though was output with stty -a).  Therefore use
the more descriptive name, also generally used on BSD systems.
Note even though this setting seems ineffective on Linux, supporting
the setting is useful to allow terminal programs to receive
the default ^O character code.

* doc/coreutils.texi (stty invocation): Document the 'discard' option.
* src/stty.c (struct control_info): Add 'discard'; same as 'flush'.
(display_all): Show 'discard' rather than 'flush' char.
(display_changed): Likewise.
(usage): Document the 'discard' option.

10 years agostty: add support for extproc/LINEMODE
Pádraig Brady [Wed, 21 Jan 2015 18:11:06 +0000 (18:11 +0000)] 
stty: add support for extproc/LINEMODE

Add support for the "extproc" option which is well described at:
http://lists.gnu.org/archive/html/bug-readline/2011-01/msg00004.html

* src/stty.c (usage): Describe the extproc option if either the
Linux EXTPROC local option is defined, or the equivalent
BSD TIOCEXT ioctl is defined.
(main): Make the separate ioctl call for extproc on BSD.
* doc/coreutils.texi (stty invocation): Describe the option,
and reference the related RFC 1116.
* NEWS: Mention the new feature.

10 years agotests: use returns_ function for new split test
Bernhard Voelker [Tue, 20 Jan 2015 00:54:55 +0000 (01:54 +0100)] 
tests: use returns_ function for new split test

* tests/split/record-sep.sh: Use the recently added returns_ function
to simplify the shell syntax in this test.  Also remove the redirection
of stdout/stderr to /dev/null as this eases analyzing errors.

10 years agosplit: new -t option to select record separator
Assaf Gordon [Wed, 7 Jan 2015 23:30:28 +0000 (18:30 -0500)] 
split: new -t option to select record separator

* src/split.c (eolchar): A new variable to hold
the separator character (unibyte for now).
This is reference throughout rather than hardcoding '\n'.
(usage): Describe the new --separator option, and
mention records along with lines so there is no ambiguity
that all options treat lines and records equivalently.
(main): Have -t update eolchar, or default to '\n'.
* tests/split/record-sep.sh: New test case.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (split invocation): Document the new option.
Adjust --lines, --line-bytes, --number=[lr]/... to mention
they pertain to records if --separator is specified.
* NEWS: Mention the new feature.

10 years agomaint: fix typo in THANKS.in in previous commit
Pádraig Brady [Mon, 19 Jan 2015 23:17:29 +0000 (23:17 +0000)] 
maint: fix typo in THANKS.in in previous commit

* THANKS.in: s/Stehpen/Stephen/

10 years agodoc: clarify that du operands are interdependent
Pádraig Brady [Mon, 19 Jan 2015 10:52:54 +0000 (10:52 +0000)] 
doc: clarify that du operands are interdependent

Following on from http://bugs.gnu.org/17546
make it more obvious that du may elide specified operands
to avoid double counting in the set.

* src/du.c (usage): Specify that du operates on the set of
operands, rather than each independently.
* doc/coreutils.texi (du invocation): Likewise.  Also state
that the number of entries printed may change due to the
order specified.  Currently, deeper items specified earlier
will result in them being displayed, but don't mention that
implementation detail in the documentation.
* THANKS.in: Add reporter.
Reported by Stephen Shirley

10 years agotests: use compare-vs-/dev/null instead of 'test -s'
Bernhard Voelker [Wed, 14 Jan 2015 16:38:12 +0000 (17:38 +0100)] 
tests: use compare-vs-/dev/null instead of 'test -s'

When some program produces unexpected output, that use of
compare-vs-/dev/null will ensure that the surprising output is
printed in the test's output.  With "test -s err" only, one
would have to instrument and rerun in order to see the offending
output.

* cfg.mk (sc_prohibit_and_fail_1): Exempt 'compare' from this check.
* tests/dd/misc.sh: Change "tests -s ... || fail=1" to
"compare /dev/null ... && fail=1".
* tests/misc/nice.sh: Likewise.
* tests/rm/read-only.sh: Likewise.
* tests/tail-2/inotify-race.sh: Likewise.
* tests/touch/no-dereference.sh: Likewise.

Suggested by Jim Meyering in
http://lists.gnu.org/archive/html/coreutils/2015-01/msg00042.html

10 years agotests: add extra protection against unexpected exits
Pádraig Brady [Tue, 13 Jan 2015 03:30:33 +0000 (03:30 +0000)] 
tests: add extra protection against unexpected exits

Many tests use `program ... && fail=1` to ensure expected
error situations are indicated.  However that would mask
an unexpected exit (like a crash).  Therefore explicitly
check the expected exit code.
Note where error messages are also verified, the extra
protection is not added.

* tests/init.sh (returns_): A new helper function to
check the return code of a command, and used
throughout the tests.
* cfg.mk (sc_prohibit_and_fail_1): Add a syntax check
to avoid new instances of this issue.

10 years agotests: avoid skipping some df tests with libmount
Pádraig Brady [Mon, 12 Jan 2015 01:14:11 +0000 (01:14 +0000)] 
tests: avoid skipping some df tests with libmount

* tests/df/no-mtab-status.sh: Provide libmount placeholders,
to avoid skipping the test when libmount is in use.
* tests/df/skip-duplicates.sh: Likewise.
* tests/df/skip-rootfs.sh: Comment that the test is moot
when libmount (/proc/self/mountinfo) is being used.

10 years agomaint: clean up some test issues identified with shellcheck
Pádraig Brady [Sat, 10 Jan 2015 21:12:38 +0000 (21:12 +0000)] 
maint: clean up some test issues identified with shellcheck

* tests/cp/cp-a-selinux.sh: Comment why unused variables are assigned.
Fix misspellings noticed while adjusting.
* tests/cp/fiemap-perf.sh: Fix quoting.
* tests/misc/shuf.sh: Avoid useless use of cat.
* tests/misc/printf-surprise.sh: Likewise.

10 years agomaint: adjustments related to previous shuf crash fix
Daiki Ueno [Tue, 6 Jan 2015 03:36:57 +0000 (03:36 +0000)] 
maint: adjustments related to previous shuf crash fix

* tests/misc/shuf.sh: Improve the test so it detects
crashes in more cases.
* NEWS: Mention the previous fix.

10 years agomaint: skip long-lines syntax-check if unsupported
Assaf Gordon [Thu, 8 Jan 2015 06:20:06 +0000 (01:20 -0500)] 
maint: skip long-lines syntax-check if unsupported

* cfg.mk(sc_long_lines): Skip if required wc and sed options
are not supported, which is currently the case on OS X.

10 years agoshuf: do not mishandle 'shuf -i0-0 1'
Paul Eggert [Tue, 6 Jan 2015 03:40:03 +0000 (19:40 -0800)] 
shuf: do not mishandle 'shuf -i0-0 1'

Problem reported by Daiki Ueno in: http://bugs.gnu.org/19520
* src/shuf.c (main): Avoid core dump if !input_range.
* tests/misc/shuf.sh: Test for this bug.

10 years agomaint: update further copyright year number ranges
Bernhard Voelker [Thu, 1 Jan 2015 18:56:25 +0000 (19:56 +0100)] 
maint: update further copyright year number ranges

* bootstrap: Update copyright year manually (missing in previous
gnulib update).
* tests/init.sh: Likewise.

The entries in the exemption list are processed by
"grep -vEf ./.x-update-copyright", and therefore evaluated as an
extended regular expression (ERE).  Thus, the "bootstrap" entry
also matched for bootstrap.conf which we want to be updated.

* .x-update-copyright: Change all entries to EREs, i.e. including
the caret ^ and dollar sign $ meta-characters matching the beginning
and the end of a line.
* bootstrap.conf: Update copyright year by "make update-copyright".

Finally, the only one showing up with the following command should
be the COPYING file:
  $ git grep 'Copyright .* Free Software' | grep -v '2015 Free Software'

10 years agodoc: fix man page formatting for split CHUNKS options
Pádraig Brady [Thu, 1 Jan 2015 18:05:10 +0000 (18:05 +0000)] 
doc: fix man page formatting for split CHUNKS options

* src/split.c (usage): Indent the info on CHUNKS so that
help2man can match it and align appropriately in its own section.
Fixes http://bugs.gnu.org/19228

10 years agobuild: update to latest gnulib
Pádraig Brady [Thu, 1 Jan 2015 05:02:29 +0000 (05:02 +0000)] 
build: update to latest gnulib

Pick up an errno adjustment in xstrtol() that fixes
a spurious test failure on Darwin 14.0.0.
Also update copyright year to 2015 avoiding a syntax-check failure.

10 years agomaint: update all copyright year number ranges
Pádraig Brady [Thu, 1 Jan 2015 04:49:02 +0000 (04:49 +0000)] 
maint: update all copyright year number ranges

Run "make update-copyright" and then...

* tests/sample-test: Adjust to use the single most recent year.
* tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message,
so that year is updated automatically in future.

10 years agotests: fix possible 8 minute running time of inotify-rotate.sh
Pádraig Brady [Tue, 30 Dec 2014 01:25:17 +0000 (01:25 +0000)] 
tests: fix possible 8 minute running time of inotify-rotate.sh

Commit v8.23-63-g111a2b9 removed the expensive tag on this test,
as it runs quickly on systems with inotify.  However without that
it would take about 8 minutes for the test to complete all iterations.

* tests/tail-2/inotify-rotate.sh: Tag as expensive without inotify.
Also adjust the polling parameters used on systems without inotify
so that the test completes within about 15 seconds.

10 years agobuild: update to latest gnulib
Pádraig Brady [Mon, 29 Dec 2014 22:33:25 +0000 (22:33 +0000)] 
build: update to latest gnulib

Included in this are gnulib changes 3ea43e02 2768ceb7
which make the device IDs from /proc/self/mountinfo
available to df.  This can be leveraged by a subsequent
change to df to present a more accurate list of file systems.

* bootstrap: Merge from gnulib.
* src/ls.c (dev_ino_pop): s/obstack_blank/obstack_blank_fast/
as this API/ABI has changed, giving memory exhausted errors
if negative (large positive) numbers are passed to obstack_blank().
* tests/df/skip-duplicates.sh: Adjust as the new gnulib code
requires a non NULL mnt_opts even when mnt_type is not "none".

10 years agomaint: remove duplicate names from THANKS
Pádraig Brady [Mon, 29 Dec 2014 23:17:22 +0000 (23:17 +0000)] 
maint: remove duplicate names from THANKS

* .mailmap: Adjust so that there is only a single
entry per name in the generated THANKS.

10 years agodoc: update the URL referencing SI prefixes
Pádraig Brady [Fri, 26 Dec 2014 14:37:15 +0000 (14:37 +0000)] 
doc: update the URL referencing SI prefixes

Identified at https://www.gnu.org/software/gnun/linc/linc.html

* doc/coreutils.texi (Block size): Fix the stale link.

10 years agotests: fix error message check on some systems
Pádraig Brady [Thu, 25 Dec 2014 02:21:11 +0000 (02:21 +0000)] 
tests: fix error message check on some systems

http://hydra.nixos.org/build/18129583 identified (on OS X)
an incorrect test assumption in the previous commit.

* gl/lib/xdectoint.c (__xnumtoint): Suppress the EINVAL
error message as it's redundant in this context.
* tests/misc/tail.pl: Suppress _optionally_ appended
strerror messages.
* tests/fmt/base.pl: Likewise.
* tests/pr/pr-tests.pl: Likewise.
* tests/split/l-chunk.sh: Likewise.

10 years agodiagnose too-large numbers better
Pádraig Brady [Tue, 16 Dec 2014 12:36:39 +0000 (12:36 +0000)] 
diagnose too-large numbers better

Following on from commit v8.23-82-gaddae94, consistently diagnose
numbers that are too large, so as to distinguish from other errors,
and make the limits obvious.

* gl/modules/xdectoint: A new module implementing xdecto[iu]max(),
which handles the common case of parsing a bounded integer and
exiting with a diagnostic on error.
* gl/lib/xdectoimax.c: The signed variant.
* gl/lib/xdectoint.c: The parameterized implementation.
* gl/lib/xdectoint.h: The interface.
* gl/lib/xdectoumax.c: The unsigned variant.
* bootstrap.conf: Reference the new module.
* cfg.mk (exclude_file_name_regexp--sc_require_config_h_first):
Exclude the parameterized templates.
* src/csplit.c: Output EOVERFLOW or ERANGE errors if appropriate.
* src/fmt.c: Likewise.
* src/fold.c: Likewise.
* src/head.c: Likewise.
* src/ls.c: Likewise.
* src/nl.c: Likewise.
* src/nproc.c: Likewise.
* src/shred.c: Likewise.
* src/shuf.c: Likewise.
* src/stdbuf.c: Likewise.
* src/stty.c: Likewise.
* src/tail.c: Likewise.
* src/truncate.c: Likewise.
* src/split.c: Likewise.
* src/pr.c: Likewise.
* tests/pr/pr-tests.pl: Adjust to avoid matching errno diagnostic.
* tests/fmt/base.pl: Likewise.
* tests/split/l-chunk.sh: Likewise.
* tests/misc/shred-negative.sh: Likewise.
* tests/misc/tail.pl: Likewise.  Also remove the redundant
existing ERR_SUBST from test err-6.
* tests/ls/hex-option.sh: Check HEX/OCT options.
* tests/misc/shred-size.sh: Likewise.
* tests/misc/stty-row-col.sh: Likewise.

10 years agobuild: add $(EXEEXT) suffix to man page make targets
KO Myung-Hun [Sun, 14 Dec 2014 03:47:38 +0000 (12:47 +0900)] 
build: add $(EXEEXT) suffix to man page make targets

* man/local.mk: Add $(EXEEXT) suffix to the executables,
which is significant on OS/2 for example.

10 years agobuild: don't call OS/2 routines on all systems
KO Myung-Hun [Fri, 19 Dec 2014 01:52:01 +0000 (01:52 +0000)] 
build: don't call OS/2 routines on all systems

* src/system.h: Add a missing __OS2__ ifdef guard.
Also adjust spacing around () to avoid a syntax-check failure.

10 years agobuild: expand a response file and a wildcard on OS/2
KO Myung-Hun [Tue, 16 Dec 2014 02:27:28 +0000 (11:27 +0900)] 
build: expand a response file and a wildcard on OS/2

OS/2 traditional shells(cmd) do not expand a response file(@file)
or a wildcard.  Expand them in each utility itself.

* src/system.h (initialize_main): Define on OS/2. Expand a response
file and a wildcard.

10 years agomaint: fix how to request changes for THANKS.in
Bernhard Voelker [Tue, 16 Dec 2014 08:05:16 +0000 (09:05 +0100)] 
maint: fix how to request changes for THANKS.in

* THANKS.in: Change the comment at the top to send change requests
regarding this file to the main mailing list rather than referring
to cp's --help output for the mailing list's address - which does
not include that information anymore.

10 years agodd: fix typo in previous change
Paul Eggert [Tue, 16 Dec 2014 08:41:08 +0000 (00:41 -0800)] 
dd: fix typo in previous change

Reported by Bernhard Voelker in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00191.html
* src/dd.c (scanargs): s/IN/OUT/.

10 years agodd: diagnose too-large numbers better
Paul Eggert [Tue, 16 Dec 2014 07:43:48 +0000 (23:43 -0800)] 
dd: diagnose too-large numbers better

Reported by Isabella Parakiss in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00184.html
* src/dd.c (parse_integer): Return strtol_error code, not bool.
All callers changed.
(scanargs): Improve quality of diagnostic when a number is too large.

10 years agobuild: use the system printf routines in most cases
Pádraig Brady [Wed, 10 Dec 2014 16:26:27 +0000 (16:26 +0000)] 
build: use the system printf routines in most cases

glibc <= 2.5 would crash when passed invalid long double values,
therefore internal gnulib routines were used, essentially only by od,
to output such invalid values.  Later glibc versions don't crash,
as per https://sourceware.org/bugzilla/show_bug.cgi?id=4586
and subsequently od was adjusted to use the system printf routines
through the use of the ftoastr module with commit v8.7-22-ga71c22f.
Consequently our testing of this feature was moot, and use of
the gnulib printf replacement for printf(1), od(1) and error(3) etc.
was redundant.

* configure.ac (gl_printf_safe): Unset so that we don't check that
"nan" is output for these long double values.
* tests/misc/od-float.sh: Adjust all existing checks to fail if od
exits with failure status (like crashing for example).  Add a new case
for one of the problematic invalid long double values for x86_64.
We only check that od exits successfully at present, which may change
if https://sourceware.org/bugzilla/show_bug.cgi?id=17661 is resolved.

10 years agomaint: avoid -fsanitize=undefined warning in rand-isaac
Pádraig Brady [Wed, 3 Dec 2014 21:06:11 +0000 (21:06 +0000)] 
maint: avoid -fsanitize=undefined warning in rand-isaac

* gl/lib/rand-isaac.c (isaac_refill): readisaac() purposefully passes
unaligned pointers to avoid memory copies.  This is only done on
platforms where this is defined, so avoid the associated
runtime warning generated with -fsanitize=undefined, which is:

  lib/rand-isaac.c:125:182: runtime error: store to misaligned address
  0x63100003d7fd for type 'isaac_word', which requires 8 byte alignment
  0x63100003d7fd: note: pointer points here
   47 ce ed a4 be be be  00 00 00 00 00 00 00 00  ...
               ^

10 years agomaint: avoid signed overflow warning with -O3
Pádraig Brady [Mon, 1 Dec 2014 23:04:36 +0000 (23:04 +0000)] 
maint: avoid signed overflow warning with -O3

Prompted by the implicit -O3 added by american-fuzzy-lop,
seen with GCC 4.9.2 on x86_64.

  src/pr.c: In function 'print_files.part.5':
  src/pr.c:1781:6: error: assuming signed overflow does not occur
  when simplifying conditional to constant [-Werror=strict-overflow]
     if (cols_ready_to_print () == 0)

This happens because cols_ready_to_print() is inlined
thus reducing the comparison to the N variable in print_page().
Now this can't overflow due to the protection when parsing the
specified column, but use an unsigned type to avoid the
apparent signed overflow.

* src/pr.c (cols_ready_to_print): Increment an unsigned type to
avoid the subsequent signed overflow warning.

10 years agodu: handle sub-bind-mount cycles gracefully
Boris Ranto [Mon, 1 Dec 2014 08:24:14 +0000 (09:24 +0100)] 
du: handle sub-bind-mount cycles gracefully

This patch fixes the handling of sub-bind-mount cycles which are
incorrectly detected as the file system errors.  If you bind mount the
directory 'a' to its subdirectory 'a/b/c' and then run 'du a/b' you
will get the circular dependency warning even though nothing is wrong
with the file system.  This happens because the first directory that is
traversed twice in this case is not a bind mount but a child of bind
mount.  The solution is to traverse all the directories in the cycle
that fts detected and check whether they are not a (bind) mount.

* src/du.c (mount_point_in_fts_cycle): New function that checks whether
any of the directories in the cycle that fts detected is a mount point.
* src/du.c (process_file): Update the function to use the new function
that looks up all the directories in the fts cycle instead of only the
last one.
* tests/du/bind-mount-dir-cycle-v2.sh: New test case that exhibits the
described behavior.
* tests/local.mk: Reference the new root test.
* NEWS: Mention the bug fix.

10 years agotests: avoid hardlink to symlink tests where not supported
Pádraig Brady [Sat, 29 Nov 2014 22:42:04 +0000 (22:42 +0000)] 
tests: avoid hardlink to symlink tests where not supported

These checks weren't correctly avoided in commit v8.23-66-g222d7ac

* tests/cp/same-file.sh: Avoid all hardlink to symlink tests
on platforms where that's not supported.
Identified by http://hydra.nixos.org/build/17636446

10 years agobuild: fix missing casts from recent change
Pádraig Brady [Fri, 28 Nov 2014 10:25:22 +0000 (10:25 +0000)] 
build: fix missing casts from recent change

* src/dd.c (alloc_[io]buf): I committed a stale patch that omitted
the casts needed on 32 bit.
Identified by http://hydra.nixos.org/build/17610188

10 years agorm: fix prompted number of arguments to remove on some platforms
Pádraig Brady [Thu, 27 Nov 2014 00:51:00 +0000 (00:51 +0000)] 
rm: fix prompted number of arguments to remove on some platforms

"zu" was output on solaris 8 for example rather than the number,
since coreutils-8.22.

* cfg.mk: Disallow %z, since we don't currently use the gnulib
fprintf module, so any usage with it is non portable.  Also
our usage with error() currently works only through an ancillary
dependency on the vfprintf gnulib module.
* src/rm.c (main): Use %PRIuMAX rather than %zu for portability.
* src/dd.c (alloc_[io]buf): Likewise for consistency.
* src/od.c (main): Likewise.
* src/split.c (set_suffix_length): Likewise.
* NEWS: Mention the rm bug fix.
Reported in http://bugs.gnu.org/19184

10 years agotests: fix portability issue in dd/ascii test
Pádraig Brady [Wed, 26 Nov 2014 20:15:15 +0000 (20:15 +0000)] 
tests: fix portability issue in dd/ascii test

Solaris 8 was seen to issue this error:
"printf: `&': illegal format character"

* test/dd/ascii.sh: Use the coreutils printf in this test
rather than the system one, to avoid portability issues.

10 years agobuild: port new rule for coreutils.h to old Bash
Paul Eggert [Wed, 26 Nov 2014 05:16:20 +0000 (21:16 -0800)] 
build: port new rule for coreutils.h to old Bash

Reported by Ted Carr in: http://bugs.gnu.org/19184
* src/local.mk (src/coreutils.h):
Don't assume single_binary_progs is nonempty.

10 years agopaste: fix possible truncated output with large files
Tobias Stoeckmann [Mon, 24 Nov 2014 09:14:44 +0000 (09:14 +0000)] 
paste: fix possible truncated output with large files

If '\n' was present at the size_t boundary of a file,
then that and subsequent data would be discarded.

* src/paste.c (paste_parallel): Avoid the overflow issue
by changing the flag to a boolean rather than a count.
* NEWS: Mention the bug fix.

10 years agodf: only suppress remote mounts of separate exports with --total
Pádraig Brady [Wed, 29 Oct 2014 02:49:17 +0000 (02:49 +0000)] 
df: only suppress remote mounts of separate exports with --total

* src/df.c (filter_mount_list): Separate remote locations are
generally explicitly mounted, so list each even if they share
the same remote device and thus storage.  However with --total
keep the suppression to give a more accurate value for the
total storage available.
(usage): Expand on the new implications of --total and move
it in the options list according to alphabetic order.
doc/coreutils.texi (df invocation): Mention that --total impacts
on deduplication of remote file systems and also move location
according to alphabetic order.
* tests/df/skip-duplicates.sh: Add remote test cases.
* NEWS: Mention the change in behavior.

Reported in http://bugs.debian.org/737399
Reported in http://bugzilla.redhat.com/920806
Reported in http://bugzilla.opensuse.org/866010
Reported in http://bugzilla.opensuse.org/901905

10 years agodf: ensure -a shows all remote file system entries
Pádraig Brady [Mon, 27 Oct 2014 23:37:08 +0000 (23:37 +0000)] 
df: ensure -a shows all remote file system entries

commit v8.22-125-g9d736f8 printed placeholder "-" values
for device names that didn't match the preferred device name
for a particular mount point.  However that was seen to erroneously
suppress values for aliased host names or exports, common with
remote file systems.

* src/df.c (me_for_dev): Rename from devname_for_dev() so that
we can determine the remoteness as well as the name for the
preferred mount entry.
(get_dev): Don't output place holder values when both
current and preferred mount entries are remote.

Reported in http://bugs.debian.org/737399

10 years agotests: add a case verifying mv on case insensitive file systems
Pádraig Brady [Sat, 22 Nov 2014 03:41:55 +0000 (03:41 +0000)] 
tests: add a case verifying mv on case insensitive file systems

* NEWS: Update the recent entry to also mention the avoidance
of incorrectly unlinking a multi-hardlinked "source" file when
presented with source and dest that only differ in case.
* src/copy.c (same_file_ok): Mention the case issue with same_name().
* tests/mv/hardlink-case.sh: Test the issue on HFS+.
* tests/local.mk: Reference the new test case.
* tests/mv/vfat: Remove an old related but unused test case.

10 years agodoc: mention how to avoid newlines impacting ls -1
Pádraig Brady [Fri, 21 Nov 2014 16:20:03 +0000 (16:20 +0000)] 
doc: mention how to avoid newlines impacting ls -1

* src/ls.c (usage): Mention the -b and -q options
in the -1 description.
* doc/coreutils.texi (ls invocation): Likewise.

10 years agotests: chcon: avoid false failure with newer selinux
Pádraig Brady [Fri, 21 Nov 2014 15:27:41 +0000 (15:27 +0000)] 
tests: chcon: avoid false failure with newer selinux

file_t is now mapped to unlabeled_t as per:
http://danwalsh.livejournal.com/68189.html

Therefore use the latter to ensure we match correctly.
This is needed on >= Fedora 21 for example,
while it also works on earlier releases.

10 years agomv: fail when moving a file to a hardlink
Boris Ranto [Tue, 18 Nov 2014 19:20:50 +0000 (20:20 +0100)] 
mv: fail when moving a file to a hardlink

We may run into a race condition if we treat hard links to the same file
as distinct files.  If we do 'mv a b' and 'mv b a' in parallel, both a
and b can disappear from the file system.  The reason is that in this
case the unlink on src is called and the system calls can end up being
run in the order where unlink(a) and unlink(b) are the last two system
calls.  Therefore exit with an error code so that we avoid the potential
data loss.

* src/copy.c (same_file_ok): Don't set unlink_src that was used by mv,
and return false for two hardlinks to a file in move_mode.
*src/copy.c (copy_internal): No longer honor the unlink_src option,
used only by mv.
NEWS: Mention the change in behavior.
* tests/cp/same-file.sh: Augment to cover the `cp -a hlsl1 sl1` case.
* tests/mv/hard-verbose.sh: Remove no longer needed test.
* tests/local.mk: Remove the reference to hard-verbose.sh.
* tests/mv/hard-4.sh: Adjust so we fail in this case.
* tests/mv/i-4.sh: Likewise.
* tests/mv/symlink-onto-hardlink-to-self.sh: Likewise.

10 years agomaint: run strftime syntax check on newer systems
Pádraig Brady [Tue, 18 Nov 2014 03:29:07 +0000 (03:29 +0000)] 
maint: run strftime syntax check on newer systems

* cfg.mk (sc_strftime_check): Adjust regex to handle
newer glibc info formatting with different indentation
and quoting.

10 years agomaint: tests: fix comments about retry_delay_
Pádraig Brady [Wed, 29 Oct 2014 14:32:01 +0000 (14:32 +0000)] 
maint: tests: fix comments about retry_delay_

* tests/tail-2/F-vs-missing.sh: Comment with the correct total delay.
* tests/tail-2/F-vs-rename.shi: Likewise.
* tests/tail-2/flush-initial.sh: Likewise.
* tests/tail-2/inotify-hash-abuse.sh: Likewise.
* tests/tail-2/pipe-f2.sh: Likewise.
* tests/misc/chroot-fail.sh: Initialize can_chroot_root in all cases.

10 years agotests: make inotify-rotate more robust and efficient
Pádraig Brady [Wed, 29 Oct 2014 14:08:05 +0000 (14:08 +0000)] 
tests: make inotify-rotate more robust and efficient

* tests/tail-2/inotify-rotate.sh: Use retry_delay_
to employ an exponential backoff with a total delay of
up to 25.5s.  The 15s delay was seen to trigger a false
failure in http://hydra.nixos.org/build/16546517
Also remove the .1s sleep in each of the 50 iterations
to reduce the running time of the test and thus the
expensive_ tag on this test was removed.
Also ensure that we use the standard exit procedure
upon failure to avoid any erroneous diagnostics due
to persistent files on NFS.

10 years agotests: make du/move-dir-while-traversing more robust
Bernhard Voelker [Wed, 29 Oct 2014 22:21:13 +0000 (23:21 +0100)] 
tests: make du/move-dir-while-traversing more robust

* tests/du/move-dir-while-traversing.sh: Catch failure of retry_delay_
when waiting for the watcher to get ready.

10 years agodoc: mention that df -a includes duplicate file systems
Pádraig Brady [Mon, 27 Oct 2014 11:41:09 +0000 (11:41 +0000)] 
doc: mention that df -a includes duplicate file systems

* src/df.c (usage): Mention that duplicate file systems are shown
with this option, not just dummy file systems.
* doc/coreutils.texi (df invocation): For the --all option, expand
on the class of normally suppressed mount entries that it includes.

Reported in http://bugs.debian.org/737399

10 years agomaint: improve sc_long_lines syntax-check speed
Pádraig Brady [Thu, 23 Oct 2014 09:51:22 +0000 (10:51 +0100)] 
maint: improve sc_long_lines syntax-check speed

sc_long_lines was the slowest syntax check

before$ time make sc_long_lines
        long_lines
        real    0m2.740s

after $ time make sc_long_lines
        long_lines
        real    0m0.677s

* src/cfg.mk (sc_dd_max_sym_length): s/--max-line-length/-L/
for compat with BSDs.
(sc_long_lines): Prefilter with wc -L to only identify lines
in files that have lines longer than 80 characters.

10 years agotests: d_type-check: don't hardcode the C library name
Mike Frysinger [Thu, 23 Oct 2014 02:30:23 +0000 (03:30 +0100)] 
tests: d_type-check: don't hardcode the C library name

* tests/d_type-check: The hardcoded name doesn't hold true for all
Linux/glibc platforms, let alone Linux/non-glibc.
Use ctypes.util.find_library() instead to search for the library.

10 years agotests: avoid false failure when comparing /proc files
Bernhard Voelker [Thu, 16 Oct 2014 10:23:04 +0000 (12:23 +0200)] 
tests: avoid false failure when comparing /proc files

At least the MHz number in /proc/cpuinfo may change, thus leading to
a false positive failure when comparing the expected against the
actual output file.  Use an invariant file instead: /proc/version.

* tests/misc/head-c.sh: s/cpuinfo/version/

10 years agotests: fix test hang with unstable inodes in /proc
Pádraig Brady [Thu, 16 Oct 2014 09:33:46 +0000 (10:33 +0100)] 
tests: fix test hang with unstable inodes in /proc

* cp/proc-zero-len.sh: Search the 'err' file
for the error to ignore, not stdin.

10 years agochroot: call chroot() unconditionally to handle bind mounted "/"
Pádraig Brady [Wed, 15 Oct 2014 17:08:42 +0000 (18:08 +0100)] 
chroot: call chroot() unconditionally to handle bind mounted "/"

* src/chroot.c (is_root): Adjust to compare canonicalized paths
rather than inodes, to handle (return false in) the case where
we have a tree that is constructed by first bind mounting "/"
(thus having the same inode).
(main): Unconditionally call chroot() because it's safer
and of minimal performance benefit to avoid in this case.
This will cause inconsistency with some platforms
not allowing `chroot / true` for non root users.
* tests/misc/chroot-fail.sh: Adjust appropriately.
* NEWS: Mention the bug fixes.
Fixes http://bugs.gnu.org/18736

10 years agocopy: avoid an extraneous error when reporting errors
Pádraig Brady [Tue, 7 Oct 2014 18:48:53 +0000 (19:48 +0100)] 
copy: avoid an extraneous error when reporting errors

* src/copy.c (copy_reg): If sparse_copy() failed, then an
erroneous error about failing to extend the file would be reported.

10 years agocp: read sparse files more efficiently with non regular destination
Pádraig Brady [Mon, 6 Oct 2014 10:02:34 +0000 (11:02 +0100)] 
cp: read sparse files more efficiently with non regular destination

* src.copy.c (copy_reg): Use fiemap to read sparse files, even
if the output is not to a regular file.
* NEWS: Mention the improvement.

10 years agocp: avoid speculative preallocation with --sparse=always
Pádraig Brady [Mon, 6 Oct 2014 09:19:58 +0000 (10:19 +0100)] 
cp: avoid speculative preallocation with --sparse=always

With --sparse=always use fallocate(...PUNCH_HOLE...) to
avoid any permanent allocation due to speculative
preallocation employed by file systems such as XFS.

* m4/jm-macros.m4: Check for <linux/falloc.h> and fallocate().
* src/copy.c (punch_hole): A new function to try and punch
a hole at the specified offset if supported.
(create_hole): Call punch_hole() after requesting a hole.
(extent_copy): Likewise.
* NEWS: Mention the improvement.

10 years agocopy: detect smaller holes than the copy buffer size
Pádraig Brady [Thu, 2 Oct 2014 13:07:42 +0000 (14:07 +0100)] 
copy: detect smaller holes than the copy buffer size

Previously cp would not detect runs of NULs that were
smaller than the buffer size used for I/O (currently 128KiB).

* src/copy.c (copy_reg): Use an independent hole_size, set to
st_blksize, to increase the chances of detecting a representable hole,
in a run of NULs read from the input.
(create_hole): A new function refactored from sparse_copy() and
extent_copy() so we have a single place to handle holes.
(sparse_copy): Adjust to loop over the larger input buffer
in chunks of the passed hole size.  Also adjust to only call
lseek once per hole, rather than at least once per input buffer.
* tests/cp/sparse.sh: Add test cases for various sparse chunk sizes.
* NEWS: Mention the improvement.

10 years agodoc: clarify that timeout limits are not 2038 seconds
Wieland Hoffmann [Thu, 9 Oct 2014 18:38:13 +0000 (20:38 +0200)] 
doc: clarify that timeout limits are not 2038 seconds

* man/timeout.x: The 2038 that the sentence is referring to is the year
2038, not 2038 seconds (the default unit used for timeouts).

10 years agomaint: avoid new signed overflow warning on 32 bit
Pádraig Brady [Wed, 8 Oct 2014 11:35:36 +0000 (12:35 +0100)] 
maint: avoid new signed overflow warning on 32 bit

Prompted by http://hydra.nixos.org/build/15682577
with GCC 4.8.3 on i686

  src/tac.c:557:6: error: assuming signed overflow does not occur
  when simplifying conditional to constant [-Werror=strict-overflow]
     if (bytes_copied < 0)

This happens because copy_to_temp() is inlined in tac_nonseekable(),
thus reducing the comparison to the bytes_copied variable in
copy_to_temp.  Now this can't overflow on either 32 or 64 bit
due to the protection of the preceding fwrite().  We could use a
guard like "if (bytes_copied <= OFF_T_MAX - bytes_read)" to avoid
the warning, but rather than a runtime branch, just use an unsigned
type to avoid apparent signed overflow on systems where the accumulation
is not promoted to unsigned (32 bit size_t, 64 bit off_t).

* src/tac.c (copy_to_temp): Increment an unsigned type to
avoid the subsequent signed overflow warning.

10 years agotests: split/b-chunk.sh: avoid spurious fail on non-Linux
Jim Meyering [Wed, 8 Oct 2014 01:08:25 +0000 (18:08 -0700)] 
tests: split/b-chunk.sh: avoid spurious fail on non-Linux

* tests/split/b-chunk.sh: Skip each file that does not exist.
Some systems lack /proc/version or /sys/kernel/profiling

10 years agomaint: avoid syntax-check failures in previous patch
Pádraig Brady [Wed, 8 Oct 2014 00:14:57 +0000 (01:14 +0100)] 
maint: avoid syntax-check failures in previous patch

* tests/misc/od-j.sh: Non standard comparison order.
* tests/split/b-chunk.sh: Confusing input file name.
* tests/tail-2/tail-c.sh: Redundant require ulimit.

10 years agowc: don't miscount /sys and similar file systems
Paul Eggert [Tue, 7 Oct 2014 23:46:08 +0000 (16:46 -0700)] 
wc: don't miscount /sys and similar file systems

Fix similar problems in head, od, split, tac, and tail.
Reported by George Shuklin in: http://bugs.gnu.org/18621
* NEWS: Document this.
* src/head.c (elseek): Move up.
(elide_tail_bytes_pipe, elide_tail_lines_pipe): New arg
CURRENT_POS.  All uses changed.
(elide_tail_bytes_file, elide_tail_lines_file):
New arg ST and remove arg SIZE.  All uses changed.
* src/head.c (elide_tail_bytes_file):
* src/od.c (skip): Avoid optimization for /sys files, where
st_size is bogus and st_size == st_blksize.
Don't report error at EOF when not optimizing.
* src/head.c, src/od.c, src/tail.c: Include "stat-size.h".
* src/split.c (input_file_size): New function.
(bytes_split, lines_chunk_split, bytes_chunk_extract): New arg
INITIAL_READ.  All uses changed. Use it to double-check st_size.
* src/tac.c (tac_seekable): New arg FILE_POS.  All uses changed.
(copy_to_temp): Return size of temp file.  All uses changed.
* src/tac.c (tac_seekable):
* src/tail.c (tail_bytes):
* src/wc.c (wc):
Don't trust st_size; double-check by reading.
* src/wc.c (wc): New arg CURRENT_POS.  All uses changed.
* tests/local.mk (all_tests): Add tests/misc/wc-proc.sh,
tests/misc/od-j.sh, tests/tail-2/tail-c.sh.
* tests/misc/head-c.sh:
* tests/misc/tac-2-nonseekable.sh:
* tests/split/b-chunk.sh:
Add tests for problems with /proc and /sys files.
* tests/misc/od-j.sh, tests/misc/wc-proc.sh, tests/tail-2/tail-c.sh:
New files.

10 years agodoc: document stat's output with the --terse option
Bernhard Voelker [Sat, 4 Oct 2014 15:09:59 +0000 (17:09 +0200)] 
doc: document stat's output with the --terse option

* doc/coreutils.texi (stat invocation): Add a paragraph documenting
stat's output format when the --terse option is specified, both in
normal and in --file-system mode.

Reported by Dan Jacobson <jidanni@jidanni.org>
in http://bugs.gnu.org/18624

10 years agotests: fix false failure for test referencing libdl
Nick Alcock [Thu, 2 Oct 2014 14:26:21 +0000 (15:26 +0100)] 
tests: fix false failure for test referencing libdl

* init.cfg (gcc_shared_): -ldl has to be positioned after the object
files that may rely upon it.  This fixes tests/cp/nfs-removal-race.sh
which references dlsym() from libdl.

10 years agomaint: avoid double semicolon syntax check failure
Bernhard Voelker [Thu, 2 Oct 2014 00:34:48 +0000 (02:34 +0200)] 
maint: avoid double semicolon syntax check failure

A syntax-check recently added to gnulib would trigger a failure
(once gnulib gets updated here) for a statement introduced with
commit v8.23-43-gaf2a4ed:

  src/dd.c:806:  char const *time_fmt = _(", %g s, %s/s\n");;
  maint.mk: Double semicolon detected
  make: *** [sc_prohibit_double_semicolon] Error 1

* src/dd.c (print_xfer_stats): s/;;/;/

10 years agodd: new status=progress level to print stats periodically
Federico Simoncelli [Fri, 26 Sep 2014 17:12:32 +0000 (17:12 +0000)] 
dd: new status=progress level to print stats periodically

* src/dd.c: Report the transfer progress every second when the
new status=progress level is used.  Adjust the handling and
description of the status= option so that they're treated as
mutually exclusive levels, rather than flags with implicit precedence.
* doc/coreutils.texi (dd invocation): Document the new progress
status level.  Reference the new level in the description of SIGUSR1.
* tests/dd/stats.sh: Add new test for status=progress.
* tests/dd/misc.sh: Change so status=none only takes precedence
if it's the last level specified.
* NEWS: Mention the feature.

10 years agodd: use more robust SIGUSR1 handling
Pádraig Brady [Fri, 26 Sep 2014 14:46:28 +0000 (15:46 +0100)] 
dd: use more robust SIGUSR1 handling

* src/dd.c (ifd_reopen): A new wrapper to ensure we
don't exit upon receiving a SIGUSR1 in a blocking open()
on a fifo for example.
(iftruncate): Likewise for ftruncate().
(iread): Process signals also after a short read.
(install_signal_handlers): Install SIGINFO/SIGUSR1 handler
even if set to SIG_IGN, as this is what the parent can easily
set from a shell script that can send SIGUSR1 without the
possiblity of inadvertently killing the dd process.
* doc/coreutils.texi (dd invocation): Improve the example to
show robust usage wrt signal races and short reads.
* tests/dd/stats.sh: A new test for various signal races.
* tests/local.mk: Reference the new test.
* NEWS: Mention the fix.

10 years agotest: check for Fedora 20 sort key bug
Paul Eggert [Wed, 24 Sep 2014 18:55:20 +0000 (11:55 -0700)] 
test: check for Fedora 20 sort key bug

Problem reported by Göran Uddeborg in: http://bugs.gnu.org/18540
* tests/misc/sort.pl: New test 23.

10 years agomv: use reflink=auto mode by default
David Sterba [Wed, 24 Sep 2014 10:15:05 +0000 (11:15 +0100)] 
mv: use reflink=auto mode by default

On some filesystems (BTRFS), moving a file within the filesystem may
cross subvolume boundaries and we can use a lightweight reflink copy,
similar to what cp(1) can do, which is faster than a full file copy.
This is enabled by default because it's only an optimization for
the fall back copy and does not break user expectations or usability.

* src/mv.c (cp_option_init): Set the reflink mode to AUTO.
* NEWS: Mention the improvement.

10 years agostty: only list supported options in --help and man pages
Pádraig Brady [Fri, 19 Sep 2014 15:15:04 +0000 (16:15 +0100)] 
stty: only list supported options in --help and man pages

* src/stty.c (usage): Exclude unsupported options from --help,
which for example impacts the "dsusp" and "cdtrdsr" options on Linux.
Fixes http://bugs.gnu.org/18506

10 years agodoc: fix use of "e.g." in stdbuf help message
Michal Nazarewicz [Tue, 23 Sep 2014 01:50:14 +0000 (03:50 +0200)] 
doc: fix use of "e.g." in stdbuf help message

"E.g." stands for latin "exempli gratia" which is typically read
as "for example".  "E.g." does not stand for the word "example".
As such, "for e.g." might be read as "for for example".

Fix this usage by simply replacing "e.g." with "example".

10 years agobuild: pass program name to help2man after other options
Bernhard Voelker [Mon, 22 Sep 2014 23:49:47 +0000 (01:49 +0200)] 
build: pass program name to help2man after other options

* man/local.mk (.x.1): Move the program name argument down after
the last option argument when calling $(run_help2man).
While the other way would be accepted for the GNU help2man program,
it is not for the 'dummy-man' script (called as a fallback on
systems lacking perl).
The wrong order was introduced in commit v8.21-119-gb3578fc while
adding the --info-page option.

10 years agobuild: fix argument count check in dummy-man again
Bernhard Voelker [Mon, 22 Sep 2014 23:44:51 +0000 (01:44 +0200)] 
build: fix argument count check in dummy-man again

* man/dummy-man: Fix argument count check, now only permitting
exactly 1 argument, the program name.
Reported by Andreas Schwab <schwab@linux-m68k.org>

10 years agobuild: fix an inverted test breaking dummy-man
Alban Bedel [Mon, 22 Sep 2014 09:53:13 +0000 (11:53 +0200)] 
build: fix an inverted test breaking dummy-man

* man/dummy-man: Fix argument count check,
allowing dummy-man to run (on systems without perl).
Fixes http://bugs.gnu.org/18531

10 years agobuild: fix dependency issues with man page generation
Pádraig Brady [Fri, 19 Sep 2014 15:49:26 +0000 (16:49 +0100)] 
build: fix dependency issues with man page generation

* .gitignore: Remove reference to no longer generated make file.
* configure.ac: Don't bother generating placeholder make file.
* man/local.mk: Hardcode the man page deps list for normal builds
to be compatible with all make implementations and configure options.
Note in SINGLE_BINARY mode, all man pages will be generated on
any change to the coreutils binary, but development will generally
not be done in this mode, so this shouldn't be an issue.

Fixes http://bugs.gnu.org/18055

10 years agomaint: don't trigger gcc-5's new -Wlogical-not-parentheses warning
Jim Meyering [Tue, 16 Sep 2014 18:15:25 +0000 (11:15 -0700)] 
maint: don't trigger gcc-5's new -Wlogical-not-parentheses warning

* src/dircolors.c (main): Parenthesize !VAR as LHS to "<",
to avoid triggering gcc's new -Wlogical-not-parentheses warning.

10 years agocp: fix handling of -H with multiply specified source dirs
Pádraig Brady [Thu, 18 Sep 2014 10:31:22 +0000 (11:31 +0100)] 
cp: fix handling of -H with multiply specified source dirs

Following on from commit v5.92-729-g130dd06, also avoid
the erroneous directory hardlink warning with -H.

* src/copy.c (copy_internal): Also handle the -H case
for command line arguments.
* tests/cp/duplicate-sources.sh: Augment the test case.
* NEWS: Augment the news entry.

10 years agocp: issue correct warning and ignore duplicate source dirs
Pádraig Brady [Wed, 17 Sep 2014 17:50:08 +0000 (18:50 +0100)] 
cp: issue correct warning and ignore duplicate source dirs

* src/copy.c (copy_internal): Handle the case where we have the
same destination directory as already encountered, which can only
be due to the corresponding source directory being specified multiple
times.
* tests/cp/duplicate-sources.sh: Add a test for the new multiply
specified directory case, and the existing multiply specified file case.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.

10 years agodoc: output correct --help references with --program-prefix
Pádraig Brady [Thu, 18 Sep 2014 13:50:47 +0000 (14:50 +0100)] 
doc: output correct --help references with --program-prefix

* src/system.h (emit_ancillary_info): Take the invariant PROGRAM_NAME
as a parameter, so that consistent references are made to online docs
and texinfo nodes, when a --program-prefix is in place.  Note the
man pages don't need this fix as they're generated before the program
prefix is used.
* NEWS: Mention the improvements in references to online documentation.

10 years agodoc: ensure the correct texinfo nodes are referenced in --help
Pádraig Brady [Thu, 18 Sep 2014 13:37:37 +0000 (14:37 +0100)] 
doc: ensure the correct texinfo nodes are referenced in --help

* src/system.h (emit_ancillary_info): For commands that don't have
a 1:1 mapping with the texinfo node names, provide a mapping to
the correct node.
* doc/coreutils.texi: Add some extra cross references noticed while
checking this.
Fixes http://bugs.debian.org/762092

10 years agotests: fix false du failure on newer XFS
Bernhard Voelker [Tue, 16 Sep 2014 16:50:29 +0000 (18:50 +0200)] 
tests: fix false du failure on newer XFS

On XFS, when creating the ~2G test file 'big' in a for-loop by
appending 20M each time, the file ends up using ~4G - visible in
'st_blocks'.  The unused space would be reclaimed later.
This feature is called "speculative preallocation" which aims at
avoiding fragmentation.
According to the XFS FAQ [1], there are two particular aspects of
XFS speculative preallocation that are triggering this:

  1. "Applications that repeatedly trigger preallocation and reclaim
     cycles [after file close] can cause fragmentation.
     Therefore, this pattern is detected and causes the preallocation
     to persist beyond the lifecycle of the file descriptor."

  2. "Preallocation sizes grow as files grow larger."

[1] http://xfs.org/index.php/XFS_FAQ

Avoid one of the above by only doing a single close (reclaim cycle).

* tests/du/2g.sh: Similar to the fix for a dd test (see commit
v8.22-65-g7c03fe2), avoid speculative preallocation by creating
the 'big' file in one go instead of appending to it in the loop.
Remove debugging statements as the output with 'set -x' is
sufficient nowadays.

10 years agocat: allow copying empty files to themselves
Paul Eggert [Thu, 11 Sep 2014 15:45:32 +0000 (08:45 -0700)] 
cat: allow copying empty files to themselves

Problem reported by Vincent Lefevre in: http://bugs.gnu.org/18449
* src/cat.c (main): Allow copying an empty file to itself.
* tests/misc/cat-self.sh: New test.
* tests/local.mk (all_tests): Add it.

10 years agodoc: reference online info pages directly from man pages
Pádraig Brady [Wed, 10 Sep 2014 10:53:50 +0000 (11:53 +0100)] 
doc: reference online info pages directly from man pages

* src/system.h (emit_ancillary_info): Add a direct reference
to the corresponding online info documentation.  Corresponding
redirects were put in place on www.gnu.org to allow for concise links.
* help2man: Adjust to add the "online help" link (and subsequent
translation bugs link) to a "REPORTING BUGS" section.
Also add the concise links for further information in --help
to the "SEE ALSO" section, and dispense with the more verbose
default for that.

10 years agodoc: adjust reference to info nodes in man pages
Pádraig Brady [Tue, 9 Sep 2014 01:05:45 +0000 (02:05 +0100)] 
doc: adjust reference to info nodes in man pages

old form: coreutils '$cmd invocation'
new form: '(coreutils) $cmd invocation'

The old form erroneously referenced the node for the 'coreutils'
multi-call program.  Now that problematic node name was renamed
in commit v8.23-18-g72e470b, but the newer less ambiguous form
also has the advantage of working with the pinfo viewer for example.
Full discussion at http://bugs.gnu.org/18428

* man/local.mk: Adjust man page references to texinfo nodes.
* src/system.h: Adjust --help references to texinfo nodes.

10 years agomaint: include libstdbuf.c in extraneous headers check
Pádraig Brady [Sat, 23 Aug 2014 00:14:36 +0000 (01:14 +0100)] 
maint: include libstdbuf.c in extraneous headers check

* cfg.mk (sc_system_h_headers): Don't exclude libstdbuf.c.
* src/libstdbuf.c: Remove headers already included in system.h.

10 years agobuild: adjust previous transformations on libstdbuf name
Pádraig Brady [Wed, 10 Sep 2014 22:43:00 +0000 (23:43 +0100)] 
build: adjust previous transformations on libstdbuf name

* src/local.mk (transform): commit v8.23-22-g6f9b018 discarded all
transformations on the libstdbuf.so name.  Be more conservative and
only exclude the $(program_transform_name) portion for libstdbuf.

10 years agobuild: avoid name transformations on libstdbuf
Pádraig Brady [Tue, 9 Sep 2014 14:50:07 +0000 (15:50 +0100)] 
build: avoid name transformations on libstdbuf

* src/local.mk (transform): Skip the transformation for libstdbuf
since that should not be subject to name clashes, and we need
to reference the name directly in LD_PRELOAD etc.
* configure.ac: Add a comment on the coupling of pkglibexec_PROGRAMS
to $(transform).
Issue reported at https://trac.macports.org/ticket/44922
Improved by Nick Bowler