]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
7 years agomaint: init.cfg: fix a minor test-related quoting bug
Jim Meyering [Sun, 1 Jul 2018 16:05:53 +0000 (09:05 -0700)] 
maint: init.cfg: fix a minor test-related quoting bug

* init.cfg (require_membership_in_two_groups_): This fixes a bug
introduced by me in v8.15-8-gdd0e4c562.  Luckily, the consequence
of low-probability triggering the bug was the mere added backslash
in the diagnostic: "...but running id -G\ either...".  It would be
triggered in a test failure for one who is a member of only one or
fewer groups.

7 years agomaint: post-release administrivia
Pádraig Brady [Mon, 2 Jul 2018 01:28:37 +0000 (18:28 -0700)] 
maint: post-release administrivia

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

7 years agoversion 8.30 v8.30
Pádraig Brady [Mon, 2 Jul 2018 00:56:07 +0000 (17:56 -0700)] 
version 8.30

* NEWS: Record release date.

7 years agotests: standardize perl usage in tests
Pádraig Brady [Sun, 1 Jul 2018 01:50:40 +0000 (18:50 -0700)] 
tests: standardize perl usage in tests

* tests/cp/fiemap-FMR.sh: Ensure perl is parameterized to $PERL,
and ensure require_perl_ is used, so tests are skipped appropriately.
* tests/cp/preserve-gid.sh: Likewise.
* tests/du/long-from-unreadable.sh: Likewise.
* tests/misc/env-S-script.sh: Likewise.
* tests/misc/sort-benchmark-random.sh: Likewise.
* tests/rm/deep-2.sh: Likewise.

7 years agomaint: copy: avoid new static analyzer warnings
Pádraig Brady [Thu, 28 Jun 2018 03:33:30 +0000 (20:33 -0700)] 
maint: copy: avoid new static analyzer warnings

* src/copy.c (copy_internal): Use the lint protected src_mode,
rather than accessing the src_sb again.  Also unconditionally
populate src_sb when !x->move_mode and in lint mode.
Reported by Kamil Dudka with coverity and clang analyzer.

7 years agomaint: fix recent stale comments and spelling mistakes
Pádraig Brady [Thu, 28 Jun 2018 01:09:11 +0000 (18:09 -0700)] 
maint: fix recent stale comments and spelling mistakes

* doc/coreutils.texi: s/seperator/separator/.
* tests/misc/env-S.pl: Likewise.
* src/env.c: Fix stale comment.

7 years agomaint: disable overly agressive sc_gitignore_redundant
Pádraig Brady [Wed, 27 Jun 2018 08:44:51 +0000 (01:44 -0700)] 
maint: disable overly agressive sc_gitignore_redundant

* cfg.mk (sc_gitignore_redundant): Disabled for now as too
aggressive flagging entries like /lib/arg-nonnull.h in
a newly checked out repo.

7 years agoenv: adjust diagnostics provided for shebang usage
Pádraig Brady [Wed, 27 Jun 2018 06:52:38 +0000 (23:52 -0700)] 
env: adjust diagnostics provided for shebang usage

* src/env.c (main): Don't process '-' specially since
that causes an issue on the openbsd getopt implementation
where a lone '-' is now processed as an option, and anyway
it doesn't particuarly help diagnosing common shebang
usage issues.  Also don't restrict the extra diagnostics
for shebang usage to the case with 3 arguments, as
further arguments can be passed to a script.
* tests/misc/env-S.pl: Adjust accordingly.

7 years agotests: accept getopt errors without single-quotes
Assaf Gordon [Tue, 26 Jun 2018 11:04:45 +0000 (05:04 -0600)] 
tests: accept getopt errors without single-quotes

On OpenBSD 6.2, invalid single options produce error messages
without single quotes:

    $ ./src/chroot -/
    chroot: unknown option -- /

As opposed to other systems:

    ./src/chroot: invalid option -- '/'

Modify the grep search to accept this.

* tests/misc/usage_vs_getopt.sh (checkprg): Change the grep pattern
to accomodate no-single-quotes cases.

7 years agotests: fix false failures when perl not available
Pádraig Brady [Tue, 26 Jun 2018 07:43:00 +0000 (00:43 -0700)] 
tests: fix false failures when perl not available

* tests/local.mk: Reference the stub that skips perl tests,
with the correct path.

7 years agotests: fix false failure with limited shebang lines
Pádraig Brady [Tue, 26 Jun 2018 07:39:48 +0000 (00:39 -0700)] 
tests: fix false failure with limited shebang lines

* tests/misc/env-S-script.sh: Provide a wrapper to
emulate shebang processing, but without length limits,
which are 127 on Linux for example.

7 years agomaint: update gnulib to latest
Pádraig Brady [Wed, 27 Jun 2018 07:48:03 +0000 (00:48 -0700)] 
maint: update gnulib to latest

* gnulib: Update to latest, which incorporates
a thread linking fix from Bruno Haible,
which was seen on newer Ubuntu systems.

7 years agotests: remove unused Data::Dumper perl module
Assaf Gordon [Tue, 26 Jun 2018 18:59:11 +0000 (12:59 -0600)] 
tests: remove unused Data::Dumper perl module

The module is not needed anymore (was used during development).
Despite being a Perl core module, platforms like CentOS don't install
it by default.  Reported by Bruno Haible at
https://lists.gnu.org/r/coreutils/2018-06/msg00093.html.

* tests/misc/csplit-suppress-matched.pl: Remove Data::Dumper.

7 years agomaint: fix -Werror=suggest-attribute=malloc in expr.c
Carlos Santos [Mon, 25 Jun 2018 03:00:14 +0000 (00:00 -0300)] 
maint: fix -Werror=suggest-attribute=malloc in expr.c

Add attribute 'malloc' to mpz_get_str to prevent
the following on GCC 8.1.1

  src/expr.c:117:1: error: function might be candidate for attribute
    'malloc' if it is known to return normally
      [-Werror=suggest-attribute=malloc]
   mpz_get_str (char const *str, int base, mpz_t z)
   ^~~~~~~~~~~
  cc1: all warnings being treated as errors

* src/expr.c (mpz_get_str): Add _GL_ATTRIBUTE_MALLOC.

7 years agomaint: update gnulib to latest
Pádraig Brady [Sun, 24 Jun 2018 04:52:12 +0000 (21:52 -0700)] 
maint: update gnulib to latest

* gnulib: Update to latest.
* .gitignore: Add new entries.
* bootstrap.conf: Enable wchar-single, which will enable more
efficient replacements of wcwidth and mbrtowc, as we indicate
that the charset will no change between invocations of these functions.

7 years agomaint: sync longlong.h from gmp repo
Pádraig Brady [Sun, 24 Jun 2018 22:48:32 +0000 (15:48 -0700)] 
maint: sync longlong.h from gmp repo

* src/longlong.h: Sync changes.  No functional change.

7 years agomaint: avoid false positive in src/fs-magic-compare
Pádraig Brady [Sun, 24 Jun 2018 22:33:06 +0000 (15:33 -0700)] 
maint: avoid false positive in src/fs-magic-compare

* src/local.mk (fs_normalize_perl_subst): `make src/fs-magic-compare`
was reporting incorrectly that AFS was not being handled.
Add a mapping to our KAFS identifier.
* .gitignore: Add intermediate files from `make src/fs-magic-compare`

7 years agotests: initialize fail=0 to avoid "unary operator expected" errors
Bernhard Voelker [Thu, 21 Jun 2018 22:29:00 +0000 (00:29 +0200)] 
tests: initialize fail=0 to avoid "unary operator expected" errors

With an uninitialized variable 'fail', the unquoted use like
  test $fail = 1
lead to the shell error
  "unary operator expected".

The uninitialized 'fail' variable was a side effect of
  https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=e91c0d4f9
which was pulled into coreutils-v8.26 with
  https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=ef9650170
Coreutils test code relied and relies on 'fail' to be initialized,
so initialize that variable here.

* tests/local.mk (TESTS_ENVIRONMENT): Initialize fail=0.

7 years agomaint: do not depend directly on gnulib's now-unused ftello module
Jim Meyering [Tue, 19 Jun 2018 23:49:39 +0000 (16:49 -0700)] 
maint: do not depend directly on gnulib's now-unused ftello module

* bootstrap.conf (gnulib_modules): Remove ftello, since it is
no longer used directly, since v8.9-11-geab97b307.

7 years agotests: provide an option to relax the need for gdb
Pádraig Brady [Thu, 21 Jun 2018 03:48:36 +0000 (20:48 -0700)] 
tests: provide an option to relax the need for gdb

* tests/rm/r-root.sh: gdb provides extra protection,
but is not strictly necessary.  So provide an option
for maintainers to relax the requirements.

7 years agorm: add --preserve-root=all to protect mounts
Pádraig Brady [Mon, 11 Jun 2018 06:02:58 +0000 (23:02 -0700)] 
rm: add --preserve-root=all to protect mounts

* src/remove.c (rm_fts): With the --preserve-root=all extension,
reject command line arguments that are mount points.
* src/remove.h (rm_options): Add preserve_all_root to store config.
* src/mv.c (rm_option_init): Init preserve_all_root to false.
* src/rm.c (main): Init preserve_all_root as per option.
(usage): Describe the new option.
* src/remove.c (rm_fts): Lookup the parent device id,
and reject the cli argument if a separate file system.
* tests/rm/one-file-system.sh: Add a test case.
* NEWS: Mention the new feature.

7 years agocp: add --reflink=never to force standard copy mode
Adam Borowski [Sun, 17 Jun 2018 22:38:04 +0000 (00:38 +0200)] 
cp: add --reflink=never to force standard copy mode

This mode is currently the default, but most if not all users of
reflink-capable filesystems want --reflink=auto, which is often
encapsulated into an alias.  Adding --reflink=never allows overriding
such an alias.

* doc/coreutils.texi (cp invocation): Describe the new option.
* src/cp.c: Support --reflink=never.
* tests/cp/reflink-auto.sh: Add a test case.
* NEWS: Mention the new feature.

7 years agoenv: add -S/--split-string option
Assaf Gordon [Sat, 21 Apr 2018 02:58:28 +0000 (20:58 -0600)] 
env: add -S/--split-string option

Adopted from FreeBSD's env(1), useful for specifing multiple
parameters on a shebang (#!) script line, e.g:

   #!/usr/bin/env -S perl -w -T

Discussed in https://lists.gnu.org/r/coreutils/2018-04/msg00011.html

* src/env.c (valid_escape_sequence,escape_char,scan_varname,
  extract_varname,validate_split_str,build_argv,
  parse_split_string): New functions.
  (main): Process new option and call parse_split_string.
  (usage): Mention new option.
* tests/misc/env-S.pl: Test new option from the command line.
* tests/misc/env-S-script.sh: Test new option from shebang scripts.
* tests/local.mk (all_tests): Add new tests.
* man/env.x (OPTIONS): Show a brief example of -S usage and point to
the full documentation for more information.
* doc/coreutils.texi (env invocation): Detail usage of -S/--split-string
option.
* NEWS: Mention new option.

7 years agoenv: add -v/--debug option
Assaf Gordon [Fri, 20 Apr 2018 00:26:07 +0000 (18:26 -0600)] 
env: add -v/--debug option

Prints verbose information about each step:

  $ env -v -uFOO  -C /tmp BAR=BAZ date -u
  env: unset:    FOO
  env: setenv:   BAR=BAZ
  env: chdir:    '/tmp'
  env: executing: date
  env:    arg[0]= ‘date’
  env:    arg[1]= ‘-u’
  Sun Apr 22 08:52:30 UTC 2018

Inspired by FreeBSD's env(1).

* src/env.c (usage): Mention new option.
  (main): Print debug information if requested.
* NEWS: Mention new option.
* doc/coreutils.texi (env invocation): Mention -v/--debug.

7 years agomaint: refactor unsetenv call in env
Assaf Gordon [Tue, 24 Apr 2018 23:37:53 +0000 (17:37 -0600)] 
maint: refactor unsetenv call in env

Keep unset envvars (-uFOO) in an array for later deletion,
instead of reiterating over argv.  Done in preparation for
'-S string' feature. Related to '-u' discussion in
https://lists.gnu.org/r/coreutils/2018-04/msg00013.html

* src/env.c (append_unset_var,unset_envvars): New functions.
 (main): Use new functions.

7 years agols: ignore case when coloring file extensions
Kaxandra Labat [Sun, 17 Jun 2018 03:45:33 +0000 (20:45 -0700)] 
ls: ignore case when coloring file extensions

* src/ls.c (get_color_indicator): s/STREQ_LEN/c_strncasecmp/
* src/dircolors.hin: Remove a now redundant entry.
* tests/ls/color-ext.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the change in behavior.

7 years agomd5sum,b2sum,sha*sum: support -z,--zero option
Pádraig Brady [Mon, 11 Jun 2018 00:45:35 +0000 (17:45 -0700)] 
md5sum,b2sum,sha*sum: support -z,--zero option

* doc/coreutils.texi (md5sum invocation): Describe the new option,
and how it's not supported by --check, and how it disables escaping.
* src/md5sum.c (delim): A new global to parmeterize the out delimiter.
(main): Don't enable file name escaping with -z, and output '\0'.
* tests/misc/md5sum-newline.pl: Add a test case.
* NEWS: Mention the new feature.

7 years agowc: optimize processing of ASCII in multi byte locales
Pádraig Brady [Fri, 18 May 2018 04:41:46 +0000 (21:41 -0700)] 
wc: optimize processing of ASCII in multi byte locales

===== Benchmark setup (on GNU/Linux) ====
$ yes áááááááááááááááááááá | head -n100000 > mbc.txt
$ yes 12345678901234567890 | head -n100000 > num.txt

===== Before ====
$ time src/wc -Lm < mbc.txt
real    0m0.186s
$ time src/wc -m < mbc.txt
real    0m0.186s
$ time src/wc -Lm < num.txt
real    0m0.055s
$ time src/wc -m < num.txt
real    0m0.056s

==== After ====
$ time src/wc -Lm < mbc.txt
real    0m0.196s
$ time src/wc -m < mbc.txt
real    0m0.173s
$ time src/wc -Lm < num.txt
real    0m0.031s
$ time src/wc -m < num.txt
real    0m0.028s

* src/wc.c (wc): Only call wide variant functions like
iswprint() and wcwidth() for non is_basic() characters.
I.E. non ISO C "basic character set" characters.
This is especially significant on OSX where wcwidth()
is very expensive (about 10x in tests).
* NEWS: Mention the improvement.
Suggested by Eric Fischer.

7 years agodoc: port test.1 to doclifter
Paul Eggert [Thu, 14 Jun 2018 19:04:57 +0000 (12:04 -0700)] 
doc: port test.1 to doclifter

* man/test.x: Use \& instead of quoting (Bug#31803).

7 years agodoc: port man pages to doclifter
Paul Eggert [Wed, 13 Jun 2018 23:00:45 +0000 (16:00 -0700)] 
doc: port man pages to doclifter

Problem reported by Eric S. Raymond (Bug#31803).
* man/test.x: Add SYNOPSIS section, since help2man
understandably gets confused by the square brackets.
* src/ln.c (usage): Omit parenthetical "(Nth form)" in usage,
as it confuses doclifter.

7 years agocp: preserve existing permissions with --no-preserve=mode
Pádraig Brady [Sun, 3 Jun 2018 23:19:20 +0000 (16:19 -0700)] 
cp: preserve existing permissions with --no-preserve=mode

This issue was introduced in commit v8.19-145-g24ebca6

* src/copy.c (copy_internal): With --no-preserve=mode,
only reset permissions for newly created files.
(copy_reg): Likewise.
* NEWS: Mention the fix.
* tests/cp/preserve-mode.sh: Add a test case.
Fixes https://bugs.gnu.org/31675

7 years agotests: fix periodic false failure in month alignment
Pádraig Brady [Tue, 29 May 2018 17:10:35 +0000 (10:10 -0700)] 
tests: fix periodic false failure in month alignment

* tests/ls/abmon-align.sh: Base relative month adjustment
from the middle of the month, to avoid failures due
to months being repeated.
Fixes https://bugs.gnu.org/31644

7 years agodoc: formatting fixes in "du.x" and "rm.x"
Bjarni Ingi Gislason [Sat, 26 May 2018 00:10:11 +0000 (00:10 +0000)] 
doc: formatting fixes in "du.x" and "rm.x"

Avoid warnings from: groff -b -e -mandoc -T utf8 -rF0 -t -w w -z

* man/du.x: Change ".BR" to ".B" if there is only one argument.
Protect an end-of-sentence indicator (.?!) with '\&'
if it does not mean an end of a sentence.
Change '--' to '\-\-' if it indicates an option.
* man/rm.x: Change '\=' to '='.

7 years agocp: with --force; replace self referential symlinks
Pádraig Brady [Wed, 16 May 2018 06:41:36 +0000 (23:41 -0700)] 
cp: with --force; replace self referential symlinks

* src/copy.c (copy_internal): Don't fail immediately upon
getting ELOOP when running stat() on the destination,
rather proceeding if -f specified, allowing the link
to be removed.  If the loop is not in the final component
of the destination path, we still fail but at the
subsequent unlink() stage.
* doc/coreutils.texi (cp invocation): Adjust wording to say
that --force doesn't work with dangling links, rather than
all links that can't be traversed.
* tests/cp/thru-dangling.sh: Add a test case.
* NEWS: Mention the change in behavior.
Discussed in https://bugs.gnu.org/31335

7 years agocp: fix symlink checks when overwriting files
Pádraig Brady [Mon, 14 May 2018 09:26:05 +0000 (02:26 -0700)] 
cp: fix symlink checks when overwriting files

Ensure this _does_ recreate the symlink
  Given "path1" and "path2" are on different devices.
  $ touch "path1/file"
  $ cd path2/; ln -s path1/file
  $ cp -dsf path1/file .

Ensure this does _not_ overwrite file
  $ touch file
  $ ln -s file l1
  $ cp -sf l1 file

* src/copy.c (same_file_ok): Remove device ids from consideration,
instead deferring to future EXDEV with --link or allowing
the first case above to work.
Also ensure that we do not exist this function too early,
when the destination file is not a symlink, which protects
against the second case.
* tests/cp/cross-dev-symlink.sh: Add a test for the first case.
* tests/cp/same-file.sh: Add a test for the second case above.
* NEWS: Mention the bug fixes.
* THANKS.in: Mention the reporters who also analyzed the code.
Fixes https://bugs.gnu.org/31364

7 years agocp: ensure --remove-destination doesn't traverse symlinks
Pádraig Brady [Fri, 4 May 2018 04:19:15 +0000 (21:19 -0700)] 
cp: ensure --remove-destination doesn't traverse symlinks

* src/cp.c (target_directory_operand): Allow through inaccessible
arguments with -f or --remove.
* doc/coreutils.texi (cp invocation): Clarify that -f doesn't directly
impact the removal of non-traversable symlinks.
* tests/cp/dir-rm-dest.sh: Test the new behavior.
* tests/cp/thru-dangling.sh: Enforce -f behavior wrt symlinks.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/31335

7 years agomaint: make chmod/chgrp/chown leak free under valgrind
Pádraig Brady [Mon, 14 May 2018 01:52:25 +0000 (18:52 -0700)] 
maint: make chmod/chgrp/chown leak free under valgrind

* src/chmod.c: Deallocate the mode change array in dev mode.
* src/chown.c: Make chopt_free() actually deallocate, but
only call in dev mode.
* src/chgrp.c: Likewise.

7 years agodoc: improve formatting of nl --help
Pádraig Brady [Tue, 15 May 2018 04:33:37 +0000 (21:33 -0700)] 
doc: improve formatting of nl --help

* src/nl.c (usage): Better delineate the information.

7 years agowho: simplify port to GCC 8
Paul Eggert [Mon, 14 May 2018 20:49:35 +0000 (13:49 -0700)] 
who: simplify port to GCC 8

* src/who.c (make_id_equals_comment): Use simpler workaround
for GCC bug 85602.  Suggested by Martin Sebor in:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85602#c3

7 years agobuild: make GCC 8 adjustments more portable
Pádraig Brady [Fri, 4 May 2018 01:56:30 +0000 (18:56 -0700)] 
build: make GCC 8 adjustments more portable

* src/chown-core.h (chopt_free): Just define away this noop.
* src/chown-core.c (chopt_free): Remove the empty implementation.

7 years agobuild: update gnulib submodule to latest
Paul Eggert [Fri, 4 May 2018 00:41:41 +0000 (17:41 -0700)] 
build: update gnulib submodule to latest

7 years agomaint: port to GCC 8
Paul Eggert [Thu, 3 May 2018 20:03:34 +0000 (13:03 -0700)] 
maint: port to GCC 8

* src/chown-core.h (chopt_free, gid_to_name, uid_to_name):
No longer const.
* src/make-prime-list.c (xalloc): Add malloc attribute.
* src/who.c (make_id_equals_comment): Work around GCC bug 85602
by using mempcpy rather than strncat.  Although the old code
was correct, strncat raises so many hackles that it’s not
worth maintaining its use here.

7 years agomaint: remove strpbrk module
Paul Eggert [Thu, 3 May 2018 19:59:21 +0000 (12:59 -0700)] 
maint: remove strpbrk module

* bootstrap.conf (gnulib_modules): Remove obsolete module strpbrk.

7 years agobuild: update gnulib submodule to latest
Paul Eggert [Tue, 1 May 2018 19:15:22 +0000 (12:15 -0700)] 
build: update gnulib submodule to latest

7 years agodoc: retroactively adjust info about tail and closed output
Pádraig Brady [Sat, 21 Apr 2018 00:51:14 +0000 (17:51 -0700)] 
doc: retroactively adjust info about tail and closed output

* NEWS: Expand on the 8.28 description of how tail more
responsively reacts to closed output, and move from "Improvements"
to "Changed behavior".
* cfg.mk (old_NEWS_hash): Regenerate.
Fixes https://bugs.gnu.org/31225

7 years agodoc: timeout --help: mention 0 DURATION disables timeout
Pádraig Brady [Thu, 19 Apr 2018 03:08:12 +0000 (20:08 -0700)] 
doc: timeout --help: mention 0 DURATION disables timeout

* src/timeout.c (usage): Mention that a duration of 0 disables
the associated timeout, which is both concise info and useful
functionality as timeouts are frequently configured.

7 years agodoc: retroactively document -e/-u addition in NEWS
Eric Blake [Tue, 3 Apr 2018 14:40:43 +0000 (09:40 -0500)] 
doc: retroactively document -e/-u addition in NEWS

Prompted by https://bugs.gnu.org/31045

* NEWS: Update 8.8 blurb to mention other split additions.
* cfg.mk (old_NEWS_hash): Regenerate.

7 years agodoc: Clarify octal bits in permissions
Paul Eggert [Tue, 3 Apr 2018 15:40:34 +0000 (08:40 -0700)] 
doc: Clarify octal bits in permissions

* doc/perm.texi (Numeric Modes): Briefly explain octal.
Reorder description to make it more intuitive (Bug#29069).

7 years agocut: improve large file support on 32 bit
Tobias Stoeckmann [Mon, 26 Mar 2018 11:37:12 +0000 (13:37 +0200)] 
cut: improve large file support on 32 bit

Increase max range from SIZE_MAX to UINTMAX_MAX, which will
allow cut to support line lengths up to the max file size
on all systems. The inherent SIZE_MAX limitation in cut was
removed with the enhancements in https://bugs.gnu.org/13127.
Also numfmt gets similarly increased --field ranges due to
shared code.

* src/cut.c: s/size_t/uintmax_t/.
* src/numfmt.c: Likewise.
* src/set-fields.c: Likewise.
* src/set-fields.h: Likewise.
* tests/misc/cut-huge-range.sh: Adjust accordingly.
* tests/misc/numfmt.pl: Likewise.
* NEWS: Mention the improvement.

7 years agotests: avoid a recent syntax-check failure
Pádraig Brady [Wed, 28 Mar 2018 06:51:29 +0000 (23:51 -0700)] 
tests: avoid a recent syntax-check failure

* tests/ls/a-option.sh: s/framework_failure/&_/.

7 years agols: -A now overrides -a
Paul Eggert [Tue, 27 Mar 2018 21:55:22 +0000 (14:55 -0700)] 
ls: -A now overrides -a

Problem reported by Karl Berry (Bug#30963).
* NEWS: Mention this.
* src/ls.c (decode_switches): Implement this.
* tests/ls/a-option.sh: New file.
* tests/local.mk (all_tests): Add it.

7 years agodoc: fix two typos in github templates
Roland Hieber [Tue, 20 Mar 2018 13:34:03 +0000 (14:34 +0100)] 
doc: fix two typos in github templates

* .github/ISSUE_TEMPLATE.txt: Fix typo "coreitils" in the URL to the bug
tracker.
* .github/PULL_REQUEST_TEMPLATE.txt: Likewise.

7 years agols: increase the allowed abmon width from 5 to 12
Pádraig Brady [Wed, 14 Mar 2018 18:31:43 +0000 (11:31 -0700)] 
ls: increase the allowed abmon width from 5 to 12

This will impact relatively few languages,
and will make Arabic or Catalan etc.
output unambiguous abbreviated month names.

* src/ls.c (MAX_MON_WIDTH): Increase from 5 to 12.
* NEWS: Mention the bug fix.
* tests/ls/abmon-align.sh: Augment to check for ambiguous output.
Fixes https://bugs.gnu.org/30814

7 years agostat,tail: add support for the EXFS file system
Brent Petit [Tue, 9 Jan 2018 21:43:24 +0000 (21:43 +0000)] 
stat,tail: add support for the EXFS file system

Enhanced XFS (EXFS) is a version of XFS maintained by HPE.
EXFS uses a unique magic number to allow the use of community
XFS, and EXFS filesystems at the same time.

* src/stat.c (human_fstype): Add file system ID definition,
and use "exfs" as the name.
* NEWS: Mention the Improvement.

7 years agobuild: update gnulib submodule to latest
Paul Eggert [Tue, 6 Mar 2018 23:15:24 +0000 (15:15 -0800)] 
build: update gnulib submodule to latest

7 years agostat: work around IBM xlC bug
Paul Eggert [Mon, 5 Mar 2018 23:50:39 +0000 (15:50 -0800)] 
stat: work around IBM xlC bug

Problem reported by John Wiersba (Bug#30718)
* src/stat.c (human_time): Avoid giving an integer constant
expression a name, as it runs afoul of a bug in IBM XL C/C++ for
AIX 12.01.0000.0002.

7 years agomaint: adjust email address of Keith Thompson in THANKS.in
Bernhard Voelker [Sun, 4 Mar 2018 19:31:49 +0000 (20:31 +0100)] 
maint: adjust email address of Keith Thompson in THANKS.in

* THANKS.in (Keith Thompson): Update email address as requested by
himself at https://lists.gnu.org/r/coreutils/2018-03/msg00004.html

7 years agocp: set appropriate default permissions for special files
Pádraig Brady [Tue, 20 Feb 2018 03:10:14 +0000 (19:10 -0800)] 
cp: set appropriate default permissions for special files

This issue was introduced in commit v8.19-145-g24ebca6

* src/copy.c (copy_internal): When setting default permissions
to use with --no-preserve=mode, only set executable bits for
directories or sockets.
* NEWS: Mention the fix.
* tests/cp/preserve-mode.sh: Add a test case.
Fixes https://bugs.gnu.org/30534

7 years agodoc: use consistent example format in manual
Pádraig Brady [Sun, 21 Jan 2018 04:30:52 +0000 (20:30 -0800)] 
doc: use consistent example format in manual

* doc/coreutils.texi: Use @example consistently
as we don't need the smaller or fixed width representation.
This is especially true for the synopsis of commands.
@smallexample is rendered left aligned for HTML
which is awkward to read with the center aligned main content.

7 years agomv: clarify ‘mv -n A A’ change
Paul Eggert [Wed, 10 Jan 2018 08:48:51 +0000 (00:48 -0800)] 
mv: clarify ‘mv -n A A’ change

7 years agomv: fewer syscalls for ‘mv a b’
Paul Eggert [Wed, 10 Jan 2018 08:48:51 +0000 (00:48 -0800)] 
mv: fewer syscalls for ‘mv a b’

This builds on a previous patch for mv atomicity (Bug#29961).
It merely improves performance; it does not fix bugs.
* src/copy.h (struct cp_options): New members last_file, rename_errno.
* src/copy.c (copy_internal): Support new rename_errno member
for the copy options.  Avoid calling stat when new members
suggest it’s not needed.
(cp_options_default): Initialize new members.
* src/mv.c: Include renameat2.h.
(main): With two arguments, first call ‘renamat2 (AT_FDCWD, "a",
AT_FDCWD, "b", RENAME_NOREPLACE)’.  Use its results to skip
remaining processing if possible; for example, if it succeeds
there is no need to stat either "a" or "b".  Also, set
x.last_file when it is the last file to rename.

7 years agomv: improve -n atomicity
Paul Eggert [Wed, 10 Jan 2018 08:48:51 +0000 (00:48 -0800)] 
mv: improve -n atomicity

Problem reported by Kamil Dudka (Bug#29961).
* NEWS: Mention this.
* src/copy.c: Include renameat2.h.
(copy_internal): If mv, try renameat2 first thing, with
RENAME_NOREPLACE.  If this works, skip most of the remaining code.
Also, fail quickly if it fails with EEXIST, and we are using -n.

7 years agodoc: warn about following symlinks recursively in chown/chgrp
Michael Orlitzky [Thu, 4 Jan 2018 16:38:21 +0000 (11:38 -0500)] 
doc: warn about following symlinks recursively in chown/chgrp

In both chown and chgrp (which shares its code with chown), operating
on symlinks recursively has a window of vulnerability where the
destination user or group can change the target of the operation.
Warn about combining the --dereference, --recursive, and -L flags.

* doc/coreutils.texi (warnOptDerefWithRec): Add macro.
(node chown invocation): Add it to --dereference and -L.
(node chgrp invocation): Likewise.

See also: CVE-2017-18018

7 years agocp: remove ASSIGN_BASENAME_STRDUPA
Paul Eggert [Sat, 6 Jan 2018 06:55:47 +0000 (22:55 -0800)] 
cp: remove ASSIGN_BASENAME_STRDUPA

* src/cp.c (do_copy): Just use ASSIGN_STRDUPA, as this simplifies
the code and uses less memory.

7 years agomv: -n overrides -u
Paul Eggert [Thu, 4 Jan 2018 21:57:40 +0000 (13:57 -0800)] 
mv: -n overrides -u

* NEWS: Mention these fixes.
* doc/coreutils.texi (cp invocation, mv invocation):
Mention that -n is silent, and that it overrides -u.
* src/cp.c, src/mv.c (main): -n overrides -u.

7 years agotr: add -A, for compatibility with AIX tr
Paul Eggert [Wed, 3 Jan 2018 19:02:17 +0000 (11:02 -0800)] 
tr: add -A, for compatibility with AIX tr

Problem reported by Michael (Bug#29946).
* src/tr.c (main): Add undocumented -A option.

7 years agodoc: clarify chown/chgrp --dereference defaults
Michael Orlitzky [Thu, 28 Dec 2017 20:52:42 +0000 (15:52 -0500)] 
doc: clarify chown/chgrp --dereference defaults

* doc/coreutils.texi: the documentation for the --dereference
  flag of chown/chgrp states that it is the default mode of
  operation. Document that this is only the case when operating
  non-recursively.

7 years agotests: avoid false failure with xargs on AIX
Pádraig Brady [Tue, 2 Jan 2018 12:52:11 +0000 (12:52 +0000)] 
tests: avoid false failure with xargs on AIX

* tests/misc/shred-remove.sh: AIX xargs defaults to using
'_' to indicate end of input, thus ignoring it.
Rather than specifying -E to avoid this behavior, simplify
by removing sed and xargs usage.

7 years agomaint: update all copyright year number ranges
Pádraig Brady [Mon, 1 Jan 2018 15:57:22 +0000 (15:57 +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.

7 years agomaint: post-release administrivia
Pádraig Brady [Wed, 27 Dec 2017 18:26:39 +0000 (18:26 +0000)] 
maint: post-release administrivia

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

7 years agoversion 8.29 v8.29
Pádraig Brady [Wed, 27 Dec 2017 17:54:32 +0000 (17:54 +0000)] 
version 8.29

* NEWS: Record release date.

7 years agotests: avoid false failure on AIX 7.2
Pádraig Brady [Fri, 22 Dec 2017 13:10:24 +0000 (13:10 +0000)] 
tests: avoid false failure on AIX 7.2

* tests/tail-2/pipe-f.sh: Close stdout in a subshell
to ensure the current shell isn't impacted.  Subsequent
piped commands like `echo foo | blah` were seen to fail
due to the previous closing of stdout.
Reported by Assaf Gordon.

7 years agodoc: describe recent build checks for 32 bit time_t
Pádraig Brady [Fri, 22 Dec 2017 12:33:30 +0000 (12:33 +0000)] 
doc: describe recent build checks for 32 bit time_t

* README: Document the new handling of 32 bit time_t,
with examples of how to build in 64 bit mode on AIX.
Also mention that GNU make is desired on AIX
due to its mishandling of the "[" target.
Suggested by Assaf Gordon.

7 years agotests: fix recent portability issues on solaris 10
Pádraig Brady [Thu, 21 Dec 2017 13:52:24 +0000 (13:52 +0000)] 
tests: fix recent portability issues on solaris 10

* tests/misc/ptx.pl: Escape the '^' character which is
otherwise considered as a line continuation character.
* tests/misc/shred-remove.sh: sed doesn't support \n.

7 years agomaint: remove reference to excluded changelog item
Pádraig Brady [Thu, 21 Dec 2017 12:13:42 +0000 (12:13 +0000)] 
maint: remove reference to excluded changelog item

* build-aux/git-log-fix: Remove old entry.

7 years agomaint: add doc/coverage to .gitignore
Pádraig Brady [Wed, 20 Dec 2017 14:53:29 +0000 (14:53 +0000)] 
maint: add doc/coverage to .gitignore

* .gitignore: Ignore the generated coverage report.

7 years agodoc: remove older ChangeLog items
Pádraig Brady [Wed, 20 Dec 2017 14:36:37 +0000 (14:36 +0000)] 
doc: remove older ChangeLog items

* Makefile.am: Update the oldest documented version
to 8.20 which is now about 5 years old.

7 years agodoc: mention which privileges are needed to chmod
Bernhard Voelker [Sat, 16 Dec 2017 22:07:27 +0000 (23:07 +0100)] 
doc: mention which privileges are needed to chmod

POSIX specification for chmod(1):
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html

* doc/coreutils.texi (chmod invocation): Add a sentence about who can
change the file mode bits of a file - (almost) a copy from what POSIX
requires.

Fixes https://bugs.gnu.org/29207.

7 years agotests: fix recent regressions with dash
Pádraig Brady [Sat, 16 Dec 2017 21:34:19 +0000 (13:34 -0800)] 
tests: fix recent regressions with dash

* tests/misc/timeout.sh: dash outputs the "Killed"
message to stderr rather than the terminal.
* tests/misc/usage_vs_getopt.sh: dash doesn't yet
support the POSIX proposed $'...' shell quoting syntax.

7 years agobuild: avoid a signed overflow warning in ptx
Pádraig Brady [Sat, 16 Dec 2017 21:07:43 +0000 (13:07 -0800)] 
build: avoid a signed overflow warning in ptx

* src/ptx.c (fix_output_parameters): GCC 6.3.1 with
./configure --enable-single-binary would give:
  error: assuming signed overflow does not occur
  when simplifying conditional to constant [-Werror=strict-overflow]
    if (file_index > 0)
So change the type of file_index to signed (size_t).

7 years agomaint: adjust for the renamed nstrfime gnulib module
Bernhard Voelker [Mon, 11 Dec 2017 02:46:17 +0000 (18:46 -0800)] 
maint: adjust for the renamed nstrfime gnulib module

* bootstrap.conf: s/strftime/nstrfrime/.

7 years agobuild: update gnulib submodule to latest
Pádraig Brady [Mon, 11 Dec 2017 01:50:16 +0000 (17:50 -0800)] 
build: update gnulib submodule to latest

* gnulib: Update with various build/test fixes.

7 years agotests: fix false failure in new dd/nocache_eof test
Pádraig Brady [Sun, 10 Dec 2017 23:36:30 +0000 (15:36 -0800)] 
tests: fix false failure in new dd/nocache_eof test

* test/dd/nocache_eof.sh: Also handle fadvise64_64 which is
used on 32 bit x86.  Note strace internally maps fadvise64_64
to {arm,xtensa}_fadvise64_64.

7 years agotail: fix tailing non seekable files on certain systems
Pádraig Brady [Sun, 10 Dec 2017 04:18:22 +0000 (20:18 -0800)] 
tail: fix tailing non seekable files on certain systems

* src/tail.c (tail_bytes): On systems were blksize_t is unsigned
and the same size or wider than off_t (android for example),
our initialized (off_t) -1 would be promoted to unsigned before
comparison, and thus fail to follow the appropriate path.
* tests/tail-2/tail-c.sh: Add a test case.
* NEWS: Mention the fix.
This issue was introduced in commit v8.23-47-g2662702
Reported at https://github.com/termux/termux-app/issues/233

7 years agobuild: avoid build failure without sys/mtio.h
Pádraig Brady [Sun, 10 Dec 2017 03:05:32 +0000 (19:05 -0800)] 
build: avoid build failure without sys/mtio.h

* m4/jm-macros.m4: Check for the header.
* src/dd.c: Avoid the workaround where the header
is not available (on non glibc systems).
* src/shred.c: Likewise.

7 years agodoc: reorganize ls -k and --time-style help
Pádraig Brady [Sun, 3 Dec 2017 00:56:50 +0000 (16:56 -0800)] 
doc: reorganize ls -k and --time-style help

* src/ls.c (usage): Clarify -k only applies to -s usage
and directory 'total' lines.  Move the description
of TIME_STYLE out of the option section as it was awkward
to read and write there within 80 columns.

7 years agodoc: clarify numeric setuid handling in chmod man page
Pádraig Brady [Sun, 10 Dec 2017 02:26:56 +0000 (18:26 -0800)] 
doc: clarify numeric setuid handling in chmod man page

* man/chmod.x: Update the information to state one can
clear the setuid and setgid bits for directories numerically
using an additional leading '0' or a leading '='.
That has been supported since v8.15-64-g8931cdb.
Fixes https://bugs.gnu.org/29390

7 years agodoc: shred: change 'truncate' to the more descriptive 'deallocate'
Pádraig Brady [Sun, 10 Dec 2017 00:49:45 +0000 (16:49 -0800)] 
doc: shred: change 'truncate' to the more descriptive 'deallocate'

* doc/coreutils.texi (shred invocation): s/truncate/deallocate/.
* src/shred.c (usage): Likewise.
Fixes https://bugs.gnu.org/29317

7 years agodoc: clarify that cp --force may recreate files
Pádraig Brady [Sun, 10 Dec 2017 00:18:00 +0000 (16:18 -0800)] 
doc: clarify that cp --force may recreate files

* doc/coreutils.texi (cp invocation): The language used
to describe recreating the file was a little confusing
as it mentioned opening a removed file.
Fixes https://bugs.gnu.org/29315

7 years agodoc: fix default QUOTING_STYLE for %N format of stat(1)
Kamil Dudka [Mon, 4 Dec 2017 16:06:38 +0000 (17:06 +0100)] 
doc: fix default QUOTING_STYLE for %N format of stat(1)

* doc/coreutils.texi (stat invocation): The default value
of QUOTING_STYLE for the %N format of 'stat --printf' is
'shell-escape-always'.
Fixes https://bugs.gnu.org/29563
Reported by Christian Groessler at
https://bugzilla.redhat.com/1520399#c3

7 years agotests: make ls/block-size more readable
Jean Delvare [Fri, 1 Dec 2017 10:01:30 +0000 (11:01 +0100)] 
tests: make ls/block-size more readable

* tests/ls/block-size.sh: The output of the test was hard to read. Add
comments saying what we are testing to make it easier to understand.

7 years agotests: verify usage vs. getopt
Bernhard Voelker [Mon, 27 Nov 2017 22:46:51 +0000 (23:46 +0100)] 
tests: verify usage vs. getopt

Verify that all options mentioned in usage are actually recognized
by the program.

* tests/misc/usage_vs_getopt.sh: Add test.
* tests/local.mk (all_tests): Reference it.

Co-authored-by: Pádraig Brady <P@draigBrady.com>
7 years agoreadlink: remove superfluous comma from usage output
Pádraig Brady [Tue, 28 Nov 2017 22:34:41 +0000 (23:34 +0100)] 
readlink: remove superfluous comma from usage output

* src/readlink.c (usage): Remove ',' after --quiet option.

7 years agoall: use consistent diagnostics for unknown long options
Bernhard Voelker [Tue, 28 Nov 2017 16:32:29 +0000 (17:32 +0100)] 
all: use consistent diagnostics for unknown long options

Previously, e.g. cksum failed to output the offending unknown long
option:
  $ cksum --unknown-opt
  cksum: invalid option -- '-'
  Try 'cksum --help' for more information.
i.e., it tried to diagnose '-' as short option.
Instead, it should diagnose the unknown long option:
  $ cksum --unknown-opt
  cksum: unrecognized option '--unknown-opt'
  Try 'cksum --help' for more information.

* src/cksum.c (long_options): Add struct with null entry only.
(main): Use it in the getopt_long call.
* src/dd.c: Likewise.
* src/hostid.c: Likewise.
* src/hostname.c: Likewise.
* src/link.c: Likewise.
* src/logname.c: Likewise.
* src/nohup.c: Likewise.
* src/sleep.c: Likewise.
* src/tsort.c: Likewise.
* src/unlink.c: Likewise.
* src/uptime.c: Likewise.
* src/users.c: Likewise.
* src/whoami.c: Likewise.
* src/yes.c: Likewise.
* NEWS (Improvements): Mention the fix.

7 years agotest: fix issues with tests/cp/preserve-mode.sh
Pádraig Brady [Wed, 29 Nov 2017 05:54:12 +0000 (21:54 -0800)] 
test: fix issues with tests/cp/preserve-mode.sh

* tests/cp/preserve-mode.sh: This was the only use of awk,
which may not be available on the system resulting
in an ineffective test.  Also the permissions bits for
directories were not being checked at all.

7 years agobuild: update gnulib submodule to latest
Pádraig Brady [Wed, 29 Nov 2017 06:04:10 +0000 (22:04 -0800)] 
build: update gnulib submodule to latest

* gnulib: Update with various build/test fixes.

7 years agobuild: update gnulib submodule to latest
Pádraig Brady [Tue, 28 Nov 2017 08:43:08 +0000 (00:43 -0800)] 
build: update gnulib submodule to latest

* gnulib: Update including various build fixes.

7 years agotimeout: also support short -v option
Bernhard Voelker [Mon, 27 Nov 2017 10:25:39 +0000 (11:25 +0100)] 
timeout: also support short -v option

* src/timeout.c (main): Add short option character 'v' to getopt_long
call.
* tests/misc/timeout.sh: Run the test both for the long and the short
option.

7 years agodd: support iflag=direct with arbitrary sized files
Pádraig Brady [Mon, 16 Oct 2017 06:54:29 +0000 (23:54 -0700)] 
dd: support iflag=direct with arbitrary sized files

* src/dd.c (iread): Handle read error with a non-aligned
file offset in the O_DIRECT case.  This is not an issue
on XFS at least, but on EXT4 the final read will return
EINVAL rather than the expected 0 to indicate EOF.
* tests/dd/direct.sh: Test the iflag=direct case also.
* NEWS: Mention the improvement.

7 years agotimeout: add --verbose to diagnose timeouts
Pádraig Brady [Thu, 23 Nov 2017 22:30:59 +0000 (14:30 -0800)] 
timeout: add --verbose to diagnose timeouts

This is useful as handling in shell is complicated
with the varying exit status in the --kill-after case.

* src/timeout.c (main): Handle '-v' and store
COMMAND for the diagnostic.
(cleanup): Diagnose the signal name before sending.
(usage): Document -v, --verbose.
* doc/coreutils.texi (timeout invocation): Likewise.
* tests/misc/timeout.sh: Add a test case.
* NEWS: Mention the new feature
Fixes https://bugs.gnu.org/21760