]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
8 years agotests: improve 'date --debug' tests
Assaf Gordon [Fri, 6 Jan 2017 02:29:17 +0000 (21:29 -0500)] 
tests: improve 'date --debug' tests

Update tests following improvements to gnulib's parse-datetime.y module.
See https://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00002.html

* tests/misc/date-debug.sh: Add tests for each of the gnulib changes.

8 years agobuild: update gnulib submodule to latest
Assaf Gordon [Fri, 6 Jan 2017 01:49:13 +0000 (20:49 -0500)] 
build: update gnulib submodule to latest

8 years agomaint: update all copyright year number ranges
Pádraig Brady [Sun, 1 Jan 2017 22:38:02 +0000 (22:38 +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.

8 years agodoc: recommend b2sum as well as SHA2
Zooko [Mon, 26 Dec 2016 20:06:36 +0000 (20:06 +0000)] 
doc: recommend b2sum as well as SHA2

b2sum is faster, easier to use safely, and more future-proof

8 years agotests: avoid false fails on NFS due to EPERM
Pádraig Brady [Mon, 26 Dec 2016 13:06:57 +0000 (13:06 +0000)] 
tests: avoid false fails on NFS due to EPERM

* tests/chgrp/basic.sh: On some NFS setups a user is
not allowed to set a group on a file even if a member
of that group.  Therefore skip this test on remote file systems.
* tests/chgrp/default-no-deref.sh: Likewise.
* tests/chgrp/no-x.sh: Likewise.
* tests/chgrp/posix-H.sh: Likewise.
* tests/chgrp/recurse.sh: Likewise.
* tests/tail-2/inotify-rotate-resources.sh: Change to skipping
on remote file systems in the standard way.

8 years agodoc: Update POSIX part of README (Bug#25259)
Paul Eggert [Tue, 27 Dec 2016 23:02:34 +0000 (15:02 -0800)] 
doc: Update POSIX part of README (Bug#25259)

8 years agowc: with only --bytes, determine size more efficiently
Pádraig Brady [Thu, 22 Dec 2016 14:31:44 +0000 (14:31 +0000)] 
wc: with only --bytes, determine size more efficiently

* src/wc.c (wc): Avoid reading the end of the file
when the size is not a multiple of PAGE_SIZE,
as the special case handling for files in /proc and /sys
is only required when st_size is 0 or a multiple of PAGE_SIZE.
* tests/misc/wc-proc.sh: Add a test case.

8 years agomaint: correct the version for the previous bug fix
Pádraig Brady [Tue, 20 Dec 2016 13:07:07 +0000 (13:07 +0000)] 
maint: correct the version for the previous bug fix

While st_size would have been incorrect for subsequent
files since v7.1, it was only used since v8.24.

* tests/misc/wc-files0.sh: s/7.1/8.24/
* NEWS: Likewise.

Reported by Bernhard Voelker

8 years agowc: fix wrong byte counts when using --files-from0
William R. Fraser [Mon, 21 Mar 2016 00:44:09 +0000 (17:44 -0700)] 
wc: fix wrong byte counts when using --files-from0

* src/wc.c (main): Reset fstatus[0].failed between files when reusing
the fstatus[0] entry in --files-from0 mode.  This ensures a stat() is
done for each file, avoiding incorrect counts and redundant reading.
* NEWS: Mention the bug fix.
* tests/misc/wc-files0.sh: Add a test case.
Fixes http://bugs.gnu.org/23073

8 years agotests: fix typos in previous commit
Pádraig Brady [Sun, 18 Dec 2016 20:37:21 +0000 (20:37 +0000)] 
tests: fix typos in previous commit

* init.cfg (skip_if_mcstransd_is_running_): Fix typos
_introduced my me_ in the previous commit.

8 years agotests: support non-MLS enabled SELinux systems
Nicolas Iooss [Thu, 11 Feb 2016 14:07:52 +0000 (15:07 +0100)] 
tests: support non-MLS enabled SELinux systems

When running "make check" on a Linux system running SELinux with a
non-MLS policy, tests/mkdir/restorecon.sh test fails with:

  chcon: invalid context: root:object_r:tmp_t:s0: Invalid argument

Indeed in such a configuration, contexts cannot have ":s0" suffix.

* init.cfg (get_selinux_type): Refactor this function to here
from various tests.  Update to work with a non-MLS policy.
(mls_enabled_): A new function to detect if MLS is enabled.
(skip_if_mcstransd_is_running_): Update to not skip when
MLS is not enabled.
* tests/mkdir/restorecon.sh: Use a valid non-MLS context when needed.
* tests/install/install-Z-selinux.sh: Likewise.
* tests/cp/cp-a-selinux.sh: Likewise.
* tests/misc/selinux.sh: Likewise.
* tests/misc/chcon.sh: Skip if non-MLS as --range used throughout.
Fixes http://bugs.gnu.org/22631

8 years agofactor: retry properly if Pollard rho gives a trivial factorization
Torbjörn Granlund [Thu, 8 Dec 2016 10:07:29 +0000 (10:07 +0000)] 
factor: retry properly if Pollard rho gives a trivial factorization

* src/factor.c (factor_using_pollard_rho): Handle trivial factor g = n.
(factor_using_pollard_rho2): Handle trivial factor g1 = n1, g0 = n0.
* tests/misc/factor.pl: Add a test case.
Fixes http://bugs.gnu.org/25135

8 years agofactor: fix infinite loop in gcd2_odd
Niels Möller [Thu, 8 Dec 2016 09:48:50 +0000 (09:48 +0000)] 
factor: fix infinite loop in gcd2_odd

* src/factor.c (gcd2_odd): Fix the case a1 == 0, a0 == 0.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/25135

8 years agodoc: fix --help for: od -t f[SIZE]
Pádraig Brady [Fri, 2 Dec 2016 13:10:18 +0000 (13:10 +0000)] 
doc: fix --help for: od -t f[SIZE]

* src/od.c (usage): SIZE is that of float, not integer.

8 years agomaint: post-release administrivia
Pádraig Brady [Wed, 30 Nov 2016 18:35:39 +0000 (18:35 +0000)] 
maint: post-release administrivia

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

8 years agoversion 8.26 v8.26
Pádraig Brady [Wed, 30 Nov 2016 18:11:57 +0000 (18:11 +0000)] 
version 8.26

* NEWS: Record release date.

8 years agotests: fix false failure with spaces in $PWD
Pádraig Brady [Wed, 30 Nov 2016 15:50:59 +0000 (15:50 +0000)] 
tests: fix false failure with spaces in $PWD

* tests/misc/ptx-overrun.sh: Quote appropriately to avoid this
recently added issue, noticed by `make taint-distcheck`.

8 years agomaint: avoid "make distcheck" failure without excess .deps directories
Pádraig Brady [Wed, 30 Nov 2016 14:47:08 +0000 (14:47 +0000)] 
maint: avoid "make distcheck" failure without excess .deps directories

* Makefile.am (my-distcheck): Add the -r option to xargs so that
rmdir doesn't return an error when there are no extraneous .deps dirs.

8 years agotests: fix ERRORs and false FAILs on some platforms
Pádraig Brady [Tue, 29 Nov 2016 21:15:59 +0000 (21:15 +0000)] 
tests: fix ERRORs and false FAILs on some platforms

* tests/misc/ls-time.sh: Skip the test rather than ERROR
when `touch -m -d ...` fails (Hurd).
* tests/tail-2/follow-stdin.sh: Avoid false FAILs by ignoring
the variances in sterror output.
* tests/rm/rm-readdir-fail.sh: Likewise.  Also avoid ERRORs
on systems that don't define _D_EXACT_NAMELEN.

8 years agohead: fix processing of non-seekable input as seekable
Pádraig Brady [Mon, 28 Nov 2016 17:11:18 +0000 (17:11 +0000)] 
head: fix processing of non-seekable input as seekable

* src/head.c (elide_tail_bytes_file): Ensure we don't use
st_size unless we've previously used seek() to determine
the CURRENT_POS in the seekable file.
This was seen to cause issue on FreeBSD 11 when the pipe
buffer was filled with `yes | head --lines=-0`, in which
case st_size was 64KiB while ST_BLKSIZE() was 4KiB.
Reported by Assaf Gordon.

8 years agoinstall,mkdir: fix handling of -DZ and -pZ, respectively
Kamil Dudka [Mon, 28 Nov 2016 15:21:42 +0000 (16:21 +0100)] 
install,mkdir: fix handling of -DZ and -pZ, respectively

... in the case where two or more directories nested in each other are
created and each of them defaults to a different SELinux context.

* src/install.c (make_ancestor): When calling defaultcon(), give it the
same path that is given to mkdir().  The other path is not always valid
wrt. current working directory.
* src/mkdir.c (make_ancestor): Likewise.
* NEWS: Mention the bug fix.

Reported at https://bugzilla.redhat.com/1398913

8 years agotac: fix mem corruption when failing to read non seekable inputs
Pádraig Brady [Sun, 27 Nov 2016 15:09:53 +0000 (15:09 +0000)] 
tac: fix mem corruption when failing to read non seekable inputs

This was detected with ASAN, but can also be seen without ASAN with:
  $ tac - - <&-
  tac: standard input: read error: Bad file descriptor
  *** Error in `tac': malloc(): memory corruption: 0x...

* src/tac.c (copy_to_temp): Don't close our output stream on
(possibly transient) output error, or on input error.
(temp_stream): clearerr() on the stream about to be reused,
to ensure future stream use is not impacted by transient errors.
* tests/misc/tac-2-nonseekable.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/25041

8 years agotail: fix uninitialized memory read when failing to read file
Pádraig Brady [Sun, 27 Nov 2016 13:00:35 +0000 (13:00 +0000)] 
tail: fix uninitialized memory read when failing to read file

Reproduced under UBSAN with `tail -f <&-` giving:
  tail.c:2220:18: runtime error: load of value 190,
  which is not a valid value for type ‘_Bool'

* src/tail.c (tail_file): Ensure f->ignore is initialized
in all cases where we can't tail the specified file.
* tests/tail-2/follow-stdin.sh: Add a test case which
checks stderr has no UBSAN warnings.
Fixes http://bugs.gnu.org/25041

8 years agodoc: add NEWS entries for recent changes
Pádraig Brady [Sun, 27 Nov 2016 01:20:09 +0000 (01:20 +0000)] 
doc: add NEWS entries for recent changes

* NEWS: Mention in improvements about the workaround for
the glibc issue with closed stdin, and the new supported file systems.
* tests/misc/b2sum.sh: Spelling fix.

8 years agostat,tail: sync with latest Linux file systems
Pádraig Brady [Sat, 26 Nov 2016 16:10:53 +0000 (16:10 +0000)] 
stat,tail: sync with latest Linux file systems

Update with the results from:

  kgit='https://git.kernel.org/cgit/linux/kernel/git'
  wget -q $kgit/torvalds/linux.git/plain/include/uapi/linux/magic.h \
    -O src/fs-latest-magic.h
  make src/fs-magic-compare

* src/stat.c (human_fstype): Add entries for:
BALLOON_KVM, CGROUP2, DAXFS, ZSMALLOC.

8 years agobuild: fix potential factor build failure on arm and risc
Pádraig Brady [Sat, 26 Nov 2016 15:55:04 +0000 (15:55 +0000)] 
build: fix potential factor build failure on arm and risc

* src/longlong.h: Sync from gmp repo incorporating:
Protect umul_ppmm with do ... while (0)
Replace obsolete ARC asm 'J' constraints with 'Cal'
Provide umul_ppmm for riscv64

8 years agoshred,sort: ensure faster unaligned access to rand module
Pádraig Brady [Fri, 25 Nov 2016 22:10:20 +0000 (22:10 +0000)] 
shred,sort: ensure faster unaligned access to rand module

glibc has changed the public define
from _STRING_ARCH_unaligned to _STRING_INLINE_unaligned as per
https://sourceware.org/bugzilla/show_bug.cgi?id=19462

* gl/lib/rand-isaac.c: Cater for both defines.
* gl/lib/randread.c: Likewise.
* src/system.h: Update commented out code.

8 years agoshuf: test input-closed bug
Paul Eggert [Sat, 26 Nov 2016 23:37:43 +0000 (15:37 -0800)] 
shuf: test input-closed bug

Problem reported by Alex Ryan (Bug#25029).
* tests/misc/shuf.sh: Test for shuffling with stdin closed.

8 years agobuild: update gnulib submodule to latest
Paul Eggert [Sat, 26 Nov 2016 22:59:33 +0000 (14:59 -0800)] 
build: update gnulib submodule to latest

8 years agonumfmt: pacify Sun C 5.14
Paul Eggert [Sat, 26 Nov 2016 02:54:03 +0000 (18:54 -0800)] 
numfmt: pacify Sun C 5.14

* src/numfmt.c (main): Don't implicitly coerce pointer in bool
initializer.  Although it's portable C99 code, it's confusing.

8 years agotests: fix false failure on new ls test
Pádraig Brady [Fri, 25 Nov 2016 14:35:13 +0000 (14:35 +0000)] 
tests: fix false failure on new ls test

* tests/ls/quote-align.sh: Remove "total" line
which can vary per file system depending on allocation.
Reported by Assaf Gordon on OpenSolaris (5.11/5.10).

8 years agopr: fix read from invalid memory with tabs in separator
Pádraig Brady [Fri, 25 Nov 2016 13:46:23 +0000 (13:46 +0000)] 
pr: fix read from invalid memory with tabs in separator

This was detected with:
  echo a > a; pr "-S$(printf "\t\t\t")" a -m a > /dev/null
Resulting in ASAN triggering:
  ====================================================
  ERROR: AddressSanitizer: global-buffer-overflow
  READ of size 1 at 0x00000041b622 thread T0
    #0 0x40506a in print_sep_string ../src/pr.c:2241
    #1 0x407ec4 in read_line ../src/pr.c:2493
    #2 0x40985c in print_page ../src/pr.c:1802
    #3 0x40985c in print_files ../src/pr.c:1618
    #4 0x4036e0 in main ../src/pr.c:1136

* src/pr.c (init_parameters): Ensure we only override the
specified separator when it's a single tab, thus matching
the calculated separator length.
* tests/pr/pr-tests.pl: Add a test case.
* NEWS: Mention the fix.

8 years agoptx: fix an invalid heap reference with short --width
Pádraig Brady [Thu, 24 Nov 2016 15:56:01 +0000 (15:56 +0000)] 
ptx: fix an invalid heap reference with short --width

* src/ptx.c (fix_output_parameters): Ensure line_width doesn't
go negative, which can happen when the --width is less
than the --gap-size.
* tests/misc/ptx-overrun.sh: Add a test case that triggers
with ASAN.  (Note the longer filename is needed to trigger).
Fixes http://bugs.gnu.org/25011

8 years agodoc: clarify that readlink's --quiet option is on by default
Bernhard Voelker [Thu, 24 Nov 2016 09:51:27 +0000 (10:51 +0100)] 
doc: clarify that readlink's --quiet option is on by default

* src/readlink.c (usage): Mark the --quiet/--silent option as active
by default.
* doc/coreutils.texi (readlink invocation): Likewise.

8 years agotests: fix false failure with ASAN in rm-readdir-fail
Pádraig Brady [Thu, 24 Nov 2016 01:26:30 +0000 (01:26 +0000)] 
tests: fix false failure with ASAN in rm-readdir-fail

* tests/rm/rm-readdir-fail.sh: ASAN correctly indicated
that fts was writing to freed memory.  This was because
we reused a single dirent in our readdir() test wrapper.
Since fts was deallocating those dirents, we now get
a new dirent for each call to our readdir wrapper.

8 years agosplit: fix memory corruption during chunk extraction
Pádraig Brady [Thu, 24 Nov 2016 00:03:16 +0000 (00:03 +0000)] 
split: fix memory corruption during chunk extraction

ASAN reported this error for: split -n2/3 /dev/null
  ERROR: AddressSanitizer: negative-size-param: (size=-1)
  #0 0x7f0d4c36951d in __asan_memmove (/lib64/libasan.so.2+0x8d51d)
  #1 0x404e06 in memmove /usr/include/bits/string3.h:59
  #2 0x404e06 in bytes_chunk_extract src/split.c:988
  #3 0x404e06 in main src/split.c:1626

Specifically there would be invalid memory access
and subsequent processing if the chunk to be extracted
was beyond the initial amount read from file (which is
currently capped at 128KiB).  This issue is not in a
released version, only being introduced in commit v8.25-4-g62e7af0

* src/split.c (bytes_chunk_extract): The initial_read != SIZE_MAX
should have been combined with && rather than ||, but also this
condition is always true in this function so remove entirely.
* tests/split/b-chunk.sh: Add a test case.

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

8 years agotail: fix checking of remoteness when not using inotify
Pádraig Brady [Wed, 23 Nov 2016 17:10:20 +0000 (17:10 +0000)] 
tail: fix checking of remoteness when not using inotify

In recent commit v8.25-93-g7fc7206 we used the f->remote flag
which wasn't set in all cases.  This was detected with
ASAN giving this error when reading f->remote;
  runtime error: load of value 190,
  which is not a valid value for type '_Bool'

* src/tail.c (fremote): Query the system even without inotify.
(recheck): Always set f->fremote for valid files.

8 years agobuild: avoid racy failure of "make -jN install"
Jim Meyering [Wed, 23 Nov 2016 05:33:58 +0000 (21:33 -0800)] 
build: avoid racy failure of "make -jN install"

Installing with -j2 or greater could result in a failure like
  /bin/sh: line 29: /P/bin/install: Permission denied
when /P/bin/install specifies your PATH-selected install program.
This would arise because we're using "install" to install all
man/*.1 files, and that command would run concurrently with the one
that installs "/P/bin/install" itself.  We would run this command:
"src/ginstall src/ginstall /P/bin/install", and it would result
in intervals during which the destination file does not exist,
is empty or incomplete and not executable.  We addressed this
problem long ago for installation of actual binaries by telling the
installation rules to use our just-built bin/ginstall (only when not
cross-compiling) rather than the PATH-resolved "install" program.
This change is to do the same for those .1 files.
* src/local.mk (INSTALL): Override automake's default of something
like "INSTALL = /P/bin/install -c".
(INSTALL_PROGRAM): Now that we set INSTALL, there is no longer any
need to set this derived variable.  Its default definition,
"INSTALL_PROGRAM = ${INSTALL}" does what we require.
Improved by Eric Blake.

8 years agomaint: fix 'syntax-check' targets for VPATH builds
Bernhard Voelker [Tue, 22 Nov 2016 21:27:51 +0000 (22:27 +0100)] 
maint: fix 'syntax-check' targets for VPATH builds

* cfg.mk (sc_gitignore_missing): Add $(srcdir) to .gitignore filename.
(sc_gitignore_redundant): Likewise.

8 years agomaint: add build-aux/ar-lib to .gitignore
Bernhard Voelker [Tue, 22 Nov 2016 22:40:30 +0000 (23:40 +0100)] 
maint: add build-aux/ar-lib to .gitignore

* .gitignore: Add entry for the above file which is created
by  './bootstrap'.

8 years agopr: fix integer overflow in buffer size calcs
Paul Eggert [Wed, 23 Nov 2016 08:05:51 +0000 (00:05 -0800)] 
pr: fix integer overflow in buffer size calcs

Problem reported by Marcel Böhme (Bug#24996).
* configure.ac (WERROR_CFLAGS): Avoid -Wtype-limits.
* src/pr.c (col_sep_string): Now a const pointer.  All uses changed.
(integer_overflow): New function.
(separator_string, main, init_parameters, init_store_cols):
Check for integer overflow.
(align_column, read_line, print_stored): Avoid integer overflow.

8 years agocomm: add --total option
Bernhard Voelker [Tue, 22 Nov 2016 21:03:47 +0000 (22:03 +0100)] 
comm: add --total option

* src/comm.c (total_option): Add bool variable for the new option.
(TOTAL_OPTION): Add enum value.
(long_options): Add array element for the new option.
(usage): Document the new option here.
(compare_files): Count the lines in total[3], and output the summary at
the end.
(main): Accept the new option.
* doc/coreutils.texi (comm invocation): Document it.
* tests/misc/comm.pl: Test it.  While at it, improve the test data
to have 1 unique line in the first file, 2 unique lines in the second
file, and 3 common lines.
* NEWS (New Features): Mention the new option.

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

8 years agoall: update gnulib submodule to latest
Pádraig Brady [Tue, 22 Nov 2016 19:41:20 +0000 (19:41 +0000)] 
all: update gnulib submodule to latest

Also sync these copies with gnulib:
* bootstrap: Sync missed part of AIX support.
* tests/init.sh: Support compare_ on AIX.

8 years agotests: fix false failure with FreeBSD 11 multibyte quoting
Pádraig Brady [Tue, 22 Nov 2016 01:45:56 +0000 (01:45 +0000)] 
tests: fix false failure with FreeBSD 11 multibyte quoting

* tests/misc/printf-quote.sh: FreeBSD 11 was seen to treat
\u0378 as a printable character.  Therefore change to
using the \u0081 C1 control character.  We use the UTF-8
representation because our printf implementation explicitly
disallows \u0081 as input.
Reported by Assaf Gordon

8 years agotests: fix false fails due to passing env vars to returns_
Pádraig Brady [Tue, 22 Nov 2016 01:23:22 +0000 (01:23 +0000)] 
tests: fix false fails due to passing env vars to returns_

On BSD /bin/sh it was seen that unexported env vars passed to
returns_() would not be propagated to the wrapped command.

* cfg.mk (sc_prohibit_env_returns): Add a syntax check to disallow.
* tests/misc/csplit-io-err.sh: Rearrange to export vars in a subshell.
* tests/rm/rm-readdir-fail.sh: Likewise.
* tests/misc/nohup.sh: Export and unset vars around returns_.
* tests/misc/printenv.sh: Likewise.
Reported by Assaf Gordon

8 years agotests: fix recent tail-2 test regressions
Pádraig Brady [Sat, 19 Nov 2016 11:14:49 +0000 (11:14 +0000)] 
tests: fix recent tail-2 test regressions

* tests/tail-2/pipe-f.sh: Avoid issue with readable
directories on BSD systems.
* tests/tail-2/retry.sh: Likewise.
Reported by Assaf Gordon

8 years agols: improve alignment of quoted names
Pádraig Brady [Fri, 19 Feb 2016 04:07:23 +0000 (20:07 -0800)] 
ls: improve alignment of quoted names

This provides better alignment when some names are quoted,
which also provides better indication that quotes are not
part of the name.

* src/ls.c (align_variable_outer_quotes): A new variable
set when ls is aligning columns (not using -m, non-zero -w),
and has a variable quoting style (shell, shell-escape, c-maybe).
(quote_name_buf): Writes to buffer rather than FILE,
taking care to avoid data copying if possible.  Refactored from...
(quote_name): ...here.  This now manages the buffer passed
to quote_name_buf() and outputs the padding, colors and name
in the appropriate order, while managing the --dired offsets.
(get_color_indicator): A new function to return the color sequence,
refactored from...
(print_color_indicator): ...here.  This now simply outputs.
(print_dir): Refactor common parts to quote_name().
(clear_files): Reset the flag indicating at least one
file is quoted in the current directory.
(needs_quoting): A new function to indicate at the scan stage
whether a name needs quoting.  Called from...
(gobble_file): ...here, until we find the first quoted file.
(print_name_with_quoting): Mostly refactored to quote_name().
* tests/ls/quote-align.sh: A new test for various output formats.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.

8 years agob2sum: a new checksum utility with md5sum like interface
Pádraig Brady [Mon, 31 Oct 2016 13:29:34 +0000 (13:29 +0000)] 
b2sum: a new checksum utility with md5sum like interface

Note we don't support the --algorithm option of the
b2sum command in the external BLAKE2 project, as that
was deemed too confusing for users.
"BLAKE2b" was chosen as the default algorithm to use,
which is single threaded but performs well on 64 bit.

* src/blake2: CC0 source copied from external project.
* cfg.mk[VC_LIST_ALWAYS_EXCLUDE_REGEX]: Exclude blake2/
from syntax checks, make update-copyright, etc.
* src/local.mk: Reference the sources for b2sum,
and set the compilation flags.
* doc/coreutils.texi (b2sum invocation): Reference the
md5sum invocation node, and add descriptions of -l.
* tests/misc/b2sum.sh: Add new test.
* tests/local.mk: Reference new test.
* AUTHORS: Add new binary.
* README: Likewise.
* build-aux/gen-lists-of-programs.sh: Likewise.
* man/.gitignore: Likewise.
* scripts/git-hooks/commit-msg: Likewise.
* man/b2sum.x: New man page template.
* man/local.mk: Reference new template.
* src/.gitignore: Ignore new binaries.
* src/blake2/.gitignore: Ignore new build atrifacts.
* src/md5sum.c (usage): Describe the new -l option.
* NEWS: Mention the new program.

8 years agomaint: avoid "make distcheck" failure due to excess .deps directories
Jim Meyering [Wed, 14 Sep 2016 21:16:40 +0000 (14:16 -0700)] 
maint: avoid "make distcheck" failure due to excess .deps directories

* Makefile.am (my-distcheck): Remove all .deps directories before the
recursive diff that searches for left-behind files.  Otherwise, with
automake master (some time after v1.15), "make distcheck" would fail
due to those directories being left behind after "make distclean".

8 years agocp: improve status message when omitting directories
Pádraig Brady [Sat, 19 Nov 2016 11:26:43 +0000 (11:26 +0000)] 
cp: improve status message when omitting directories

* src/copy.h (cp_options): Add a new flag for install(1).
* src/copy.c (copy_internal): For cp, also output remediation
advice which also indicates why directories aren't copied by default.
The message is unchanged for install(1).
* src/cp.c (cp_option_init): Init install_mode to false.
* src/mv.c (cp_option_init): Likewise.
* src/install.c (cp_option_init): Init install_mode to true.
* tests/install/basic-1.sh: Add a test case.
* tests/cp/link-deref.sh: Adjust test case.
Fixes http://bugs.gnu.org/24958

8 years agotests: fix non portable date in recent test
Pádraig Brady [Wed, 16 Nov 2016 01:58:36 +0000 (01:58 +0000)] 
tests: fix non portable date in recent test

* tests/misc/date.pl: Years < 1900 fail on solaris at least.
Reported by Assaf Gordon

8 years agotests: fix false failure on OS X
Pádraig Brady [Tue, 15 Nov 2016 21:27:31 +0000 (21:27 +0000)] 
tests: fix false failure on OS X

* tests/misc/sort-h-thousands-sep.sh: The sv_SE locale
may be available while sv_SE.utf8 is not.  Therefore
test and use the same locale, now definfed in a variable.
Reported by Jim Meyering.

8 years agodircolors: highlight Motion JPEG multimedia files
Antonio Ospite [Wed, 14 Sep 2016 14:13:26 +0000 (16:13 +0200)] 
dircolors: highlight Motion JPEG multimedia files

* src/dircolors.hin: Add .mjpg and .mjpeg multimedia files.
This resolves http://bugs.gnu.org/24436.

8 years agotests: use "returns_" rather than explicit comparison with "$?"
Jim Meyering [Wed, 9 Nov 2016 01:57:41 +0000 (19:57 -0600)] 
tests: use "returns_" rather than explicit comparison with "$?"

The previous "returns_"-using change failed to convert many
uses of "$?".  Convert all but two of the remaining ones.
* tests/ls/stat-vs-dirent.sh: Likewise.
* tests/misc/head-write-error.sh: Likewise.
* tests/misc/nice.sh: Likewise.
* tests/misc/nohup.sh: Likewise.
* tests/misc/stdbuf.sh: Likewise.
* tests/misc/sync.sh: Likewise.
* tests/tail-2/pid.sh: Likewise.
* tests/tail-2/wait.sh: Likewise.
Thanks to Bernhard Volker for spotting this.

8 years agoall: reduce usage of proper_name_utf8()
Pádraig Brady [Sun, 13 Nov 2016 14:08:48 +0000 (14:08 +0000)] 
all: reduce usage of proper_name_utf8()

This reduces a standard coreutils install size by about 160K.

* src/cat.c: Change to proper_name() which removes about 18K text.
* src/cp.c: Likewise.
* src/df.c: Likewise.
* src/du.c: Likewise.
* src/getlimits.c: Likewise.
* src/realpath.c: Likewise.
* src/split.c: Likewise.
* src/stdbuf.c: Likewise.
* src/timeout.c: Likewise.
* src/truncate.c: Likewise.
* src/local.mk: Remove -llibiconv from the above programs.
* cfg.mk (sc_check-AUTHORS): Adjust to use factor(1).
* AUTHORS: Adjust to use ASCII to satisfy sc_check-AUTHORS.

8 years agomaint: add 'returns_' to exclude list in sc_prohibit_and_fail_1
Bernhard Voelker [Sun, 13 Nov 2016 17:16:32 +0000 (18:16 +0100)] 
maint: add 'returns_' to exclude list in sc_prohibit_and_fail_1

The previous commit v8.25-96-g22063c8 lets 'make syntax-check' fail,
because the above check falsely detects a case where 'returns_' is
already in use.

* cfg.mk (sc_prohibit_and_fail_1): Add 'returns_' to exclude list.

8 years agotests: use "returns_" rather than explicit comparison with "$?"
Jim Meyering [Wed, 9 Nov 2016 01:57:41 +0000 (19:57 -0600)] 
tests: use "returns_" rather than explicit comparison with "$?"

* tests/chmod/no-x.sh: Likewise.
* tests/cp/no-deref-link1.sh: Likewise.
* tests/cp/no-deref-link2.sh: Likewise.
* tests/cp/no-deref-link3.sh: Likewise.
* tests/du/move-dir-while-traversing.sh: Likewise.
* tests/ls/infloop.sh: Likewise.
* tests/ls/stat-failed.sh: Likewise.
* tests/ls/time-style-diag.sh: Likewise.
* tests/misc/chroot-fail.sh: Likewise.
* tests/misc/env-null.sh: Likewise.
* tests/misc/env.sh: Likewise.
* tests/misc/nice-fail.sh: Likewise.
* tests/misc/printenv.sh: Likewise.
* tests/misc/timeout.sh: Likewise.
* tests/tail-2/follow-name.sh: Likewise.

8 years agotail: only retry file open if --retry specifed
Pádraig Brady [Wed, 9 Nov 2016 19:28:23 +0000 (19:28 +0000)] 
tail: only retry file open if --retry specifed

* src/tail.c (tail_file): On failure to open a file,
set ignore=true when --retry is not specified.
* tests/tail-2/assert-2.sh: Adjust to the new behavior.
* tests/tail-2/retry.sh: Add a test case.  Also change
from `tail ... && fail=1` to the more robust `returns_ 1 ...`
construct which detects segfaults etc.
* NEWS: Document the fix.

8 years agotail: ensure -f --retry 'missing' handles truncation
Pádraig Brady [Wed, 9 Nov 2016 17:51:13 +0000 (17:51 +0000)] 
tail: ensure -f --retry 'missing' handles truncation

* src/tail.c (tail_forever): The BLOCKING optimization is only
enabled for non regular files (which can't be truncated), so ensure
we don't enable that unless we've a valid file descriptor.
* tests/tail-2/retry.sh: Add a test case.
* NEWS: Mention the bug fix.

8 years agotail: avoid outputting repeated data with remote files
Pádraig Brady [Wed, 9 Nov 2016 17:23:04 +0000 (17:23 +0000)] 
tail: avoid outputting repeated data with remote files

* src/tail.c (tail_forever): Only read up to st_size on network
file systems to avoid the issue with a stale attribute cache
returning a smaller st_size than we have already read().
The was seen with glusterfs at least and caused the complete
file to be repeatedly output due to assuming the file was
truncated in this case.
* NEWS: Mention the fix.

8 years agotail: terminate when following pipes and untailable non pipes
Pádraig Brady [Tue, 8 Nov 2016 17:34:44 +0000 (17:34 +0000)] 
tail: terminate when following pipes and untailable non pipes

* src/tail.c (ignore_pipe_or_fifo): Mark the descriptor as -1
for pipes so that any_live_files() detects correctly that
the entry is no longer live.
* tests/tail-2/pipe-f.sh: Add a test case.
* NEWS: Mention the fix.
Fixes http://bugs.gnu.org/24903 which was detected
using Symbolic Execution techniques developed in
the course of the SYMBIOSYS research project at
COMSYS, RWTH Aachen University.

8 years agomaint: misc tweaks to recent changes
Pádraig Brady [Sun, 6 Nov 2016 21:34:12 +0000 (21:34 +0000)] 
maint: misc tweaks to recent changes

* doc/coreutils.texi(cut invocation): Give a more accurate description
of cut field handling limitations.
* tests/misc/stat-fmt.sh: Fix the test header to be more general.
* tests/tail-2/retry.sh: Spellings.

8 years agomaint: refactor printing of backup suffix --help
Pádraig Brady [Wed, 2 Nov 2016 23:56:53 +0000 (23:56 +0000)] 
maint: refactor printing of backup suffix --help

* src/system.h (emit_backup_suffix_note): A new function to
output the backup suffix info.  The strings are unchanged,
so translations are not impacted.
* src/cp.c (usage): Use the new function.
* src/ln.c (usage): Likewise.
* src/mv.c (usage): Likewise.
* src/install.c (usage): Likewise.

8 years agomaint: simplify handling of backup --suffix in various tools
Rishabh Dave [Wed, 2 Nov 2016 23:43:47 +0000 (23:43 +0000)] 
maint: simplify handling of backup --suffix in various tools

* src/cp.c (main): Avoid the getenv("SIMPLE_BACKUP_SUFFIX") call,
which is now done if needed in the gnulib backupfile module.
Also avoid the redundant strdup, as we don't modify this suffix.
* src/install.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/mv.c (main): Likewise.
Fixes http://bugs.gnu.org/23153

8 years agodate: add %q to output the quarter of the year
Pádraig Brady [Wed, 19 Oct 2016 21:57:57 +0000 (14:57 -0700)] 
date: add %q to output the quarter of the year

* doc/coreutils.texi (date invocation): Document %q.
* src/date.c (usage): Likewise.
* tests/misc/date.pl: Add a test case.
* cfg.mk (sc_strftime_check): Adjust to allow %q.
* NEWS: Mention the new feature.

8 years agoall: update gnulib submodule to latest
Pádraig Brady [Sat, 5 Nov 2016 17:14:41 +0000 (17:14 +0000)] 
all: update gnulib submodule to latest

Incorporating these coreutils specific changes:
  backupfile: initialize default suffix within the implementation
  strftime,strptime: support %q to represent the quarter

Also sync these copies with gnulib:
* bootstrap: Now supports AIX.
* gnulib: Update to the latest.
* tests/init.sh: dash(1) is now disabled.

8 years agodoc: clarify in texinfo that cut doesn't reorder fields
Pádraig Brady [Sat, 5 Nov 2016 12:16:34 +0000 (12:16 +0000)] 
doc: clarify in texinfo that cut doesn't reorder fields

* doc/coreutils.texi (cut invocation): Clarify the more
sophisticated field processing supported by awk(1).
Fixes http://bugs.gnu.org/24881

8 years agostat: make --format=%N honor the QUOTING_STYLE env var
Pádraig Brady [Thu, 3 Nov 2016 15:36:48 +0000 (15:36 +0000)] 
stat: make --format=%N honor the QUOTING_STYLE env var

* doc/coreutils.texi (stat invocation): Describe the
QUOTING_STYLE values now supported.
* src/stat.c (getenv_quoting_style): A new function called
from main, that sets the default quoting style for quotearg.
(main): Call getenv_quoting_style() when %N specified.
* tests/misc/stat-fmt.sh: Add a test case.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/23422

8 years agodoc: improve the --help description of ls -N
Pádraig Brady [Thu, 3 Nov 2016 19:24:25 +0000 (19:24 +0000)] 
doc: improve the --help description of ls -N

* src/ls.c (usage): The existing description was inaccurate
as -N does not directly impact whether control characters
are displayed or not.

8 years agodd: warn about counts specified with confusing 0x prefix
Pádraig Brady [Fri, 4 Nov 2016 16:55:58 +0000 (16:55 +0000)] 
dd: warn about counts specified with confusing 0x prefix

* src/dd.c (parse_integer): Suggest to use "00x" instead of "0x",
which is significant for the "count", "seek", and "skip" operands.
* tests/dd/misc.sh: Add a test case.
Fixes http://bugs.gnu.org/24874

8 years agomd5sum,sha*sum: fix --ignore-missing with checksums starting with 00
Pádraig Brady [Wed, 26 Oct 2016 14:45:01 +0000 (15:45 +0100)] 
md5sum,sha*sum: fix --ignore-missing with checksums starting with 00

* NEWS: Mention the fix.
* src/md5sum.c (digest_file): Add a new MISSING parameter to
return whether the file was missing, separately from the digest.
* tests/misc/md5sum.pl: Add a test case.
Fixes http://bugs.gnu.org/24795

8 years agodoc: fix typo in stdbuf man page
Bishop Bettini [Sat, 22 Oct 2016 00:31:22 +0000 (17:31 -0700)] 
doc: fix typo in stdbuf man page

* man/stdbuf.x: Correct spelling of immediately.
Fixes http://bugs.gnu.org/24763

8 years agomaint: we use die; remove now-unnecessary uses of abort
Jim Meyering [Sun, 16 Oct 2016 18:28:39 +0000 (11:28 -0700)] 
maint: we use die; remove now-unnecessary uses of abort

* src/expr.c (integer_overflow): Remove an abort-after-die.
* src/paste.c (write_error): Likewise.
* src/sort.c (badfieldspec): Likewise.
* src/tr.c (string2_extend): Likewise. Also remove a few
break statements, each after an abort.

8 years agoall: use die() rather than error(EXIT_FAILURE)
Pádraig Brady [Sat, 15 Oct 2016 22:10:35 +0000 (23:10 +0100)] 
all: use die() rather than error(EXIT_FAILURE)

die() has the advantage of being apparent to the compiler
that it doesn't return, which will avoid warnings in some cases,
and possibly generate better code.
* cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to
catch any new uses of error (CONSTANT, ...);

8 years agobuild: also distribute new file, src/die.h
Jim Meyering [Sat, 15 Oct 2016 22:27:48 +0000 (15:27 -0700)] 
build: also distribute new file, src/die.h

* src/local.mk (noinst_HEADERS): Add die.h.

8 years agobuild: add die.h; avoid new warnings from GCC 7
Jim Meyering [Wed, 5 Oct 2016 02:20:46 +0000 (19:20 -0700)] 
build: add die.h; avoid new warnings from GCC 7

* src/die.h (die): New file/function from grep.
Note: we expect this file to migrate to gnulib.
* src/csplit.c: Include die.h.
(check_format_conv_type): Use die in place of error-nonzero;break;
* src/install.c (strip): Likewise.
* src/nl.c (proc_text): Likewise.  This also suppresses a new warning
from GCC 7's -Werror=strict-overflow.
* src/tail.c (parse_options): Likewise.
* src/basename.c (main): Adjust "fall through" comment
so that GCC 7's -Wimplicit-fallthrough honors it.
* src/cp.c (main): Add a "fall through" comment.
* src/ls.c (gobble_file): Likewise.
(get_funky_string): Adjust a "fall through" comment so it is
recognized.
* cfg.mk (exclude_file_name_regexp--sc_system_h_headers): Add die.h
to this list of exempt src/*.h files.

8 years agomaint: pr: avoid new GCC 7 warning
Jim Meyering [Wed, 14 Sep 2016 18:48:33 +0000 (11:48 -0700)] 
maint: pr: avoid new GCC 7 warning

* src/pr.c (main): Avoid this warning from GCC 7:
src/pr.c:1119:6: error: assuming signed overflow does not occur when \
  simplifying conditional to constant [-Werror=strict-overflow]
   if (n_files == 0)

8 years agognulib: update to latest and adapt printf-quote.sh test
Jim Meyering [Mon, 3 Oct 2016 16:00:48 +0000 (09:00 -0700)] 
gnulib: update to latest and adapt printf-quote.sh test

* .gitignore: Add /lib/limits.h.
* tests/misc/printf-quote.sh: Reflect that a single quote is now
rendered as "'", rather than as ''\'''.

8 years agorm: disallow --n alias for --no-preserve-root
Pádraig Brady [Tue, 4 Oct 2016 12:43:32 +0000 (13:43 +0100)] 
rm: disallow --n alias for --no-preserve-root

* src/rm.c (main): Ensure the full --no-preserve-root
option is specified, rather than allowing --n etc.
* tests/rm/r-root.sh: Add a test case.
* NEWS: Mention the change in behavior.

Improved by Jim Meyering.
Fixes http://bugs.gnu.org/24604

8 years agotail: -F now always processes initially untailable files
Pádraig Brady [Wed, 21 Sep 2016 17:42:40 +0000 (18:42 +0100)] 
tail: -F now always processes initially untailable files

which was not the case when inotify was not available.

* src/tail.c (any_live_files): Simplify, since the IGNORE
flag is now only set when a file should be ignored indefinitely.
(recheck): Only output the "giving up on name" message
when that's actually the case.  Only set the IGNORE flag
when ignoring a file indefinitely.
(tail_file): Likewise.
* tests/tail-2/retry.sh: Add a test case.  Also run
all existing test cases with and without inotify.
NEWS: Mention the fix.
THANKS.in: Add the reporter.
Fixes http://bugs.gnu.org/24495 which was detected
using Symbolic Execution techniques developed in
the course of the SYMBIOSYS research project at
COMSYS, RWTH Aachen University.

8 years agowho: avoid new warning from upcoming gcc-7
Jim Meyering [Thu, 22 Sep 2016 14:56:15 +0000 (07:56 -0700)] 
who: avoid new warning from upcoming gcc-7

* src/who.c (idle_string): This function would fail to compile
with -Werror and today's built-from-git gcc due to this warning:
src/who.c: In function 'print_user':
src/who.c:201:36: error: may write format character ':' at offset 4 \
  past the end of the destination [-Werror=format-length=]
           sprintf (idle_hhmm, "%02d:%02d",
                                    ^~~~~
The fix is to use an assertion to inform gcc of the existing
invariant that guarantees the number of hours is less than 24.

8 years agols: fix %%b format and precompute more
Paul Eggert [Mon, 19 Sep 2016 19:36:18 +0000 (12:36 -0700)] 
ls: fix %%b format and precompute more

The old code mishandled --time-spec='+%%b', as it misinterpreted
the '%b' as being the month abbreviation.  Also, it mishandled
the extremely unlikely case of a month abbreviation containing '%'.
The performance part of this patch sped up 'ls' by about 1% on my
little benchmark of 'ls -lR' on the source directory in the
en_US.UTF-8 locale (Fedora 24 x86-64).
* NEWS: Document the bug fix.
* src/ls.c (first_percent_b, abformat_init): New static functions.
(ABFORMAT_SIZE): New constant.
(use_abformat): New static var.
(abmon, required_mon_width): Remove these static vars.
(abmon_init): Now accepts a pointer to abmon, and returns a boolean.
All callers changed.  Reject month abbrs containing '%', as these
would mess up strftime.  Simplify mbsalign result checking,
since (size_t) -1 exceeds ABFORMAT_SIZE.
(abformat_init, align_nstrftime): Precompute all 24 formats at
startup, rather than computing a format for each time stamp.
(decode_switches): Call abformat_init instead of abmon_init.
(align_nstrftime): Accept recentness bool instead of format.
All callers changed.
* tests/misc/time-style.sh: Test for format with '%%b'.

8 years agopinky,who: remove redeclarations of ttyname
George Burgess IV [Sat, 10 Sep 2016 06:43:19 +0000 (23:43 -0700)] 
pinky,who: remove redeclarations of ttyname

Given that `ttyname` is already conditionally declared in src/system.h,
other declarations are redundant and problematic for example in ChromeOS
which has a new FORTIFY implementation that, as an artifact of how it's
implemented, causes the compiler to complain if certain standard library
functions are redeclared without special compiler-specific attributes.

* src/pinky.c: Remove declaration (which was unused anyway).
* src/who.c: Remove declaration.
* src/system.h (getlogin, getuid, geteuid, getgrgid, getpwuid, ttyname):
Add the parameter type to the declarations to avoid warnings when these
backup declarations are used.

8 years agognulib: update to latest, for getprogname fixes
Jim Meyering [Sat, 10 Sep 2016 01:46:55 +0000 (18:46 -0700)] 
gnulib: update to latest, for getprogname fixes

Compiling in gnulib-tests/ would fail on some platforms
due to a missing lib/assert.h.  Reported by Assaf Gordon in
https://lists.gnu.org/archive/html/coreutils/2016-09/msg00016.html

8 years agocp: use FICLONE instead of BTRFS_IOC_CLONE
Paul Eggert [Fri, 9 Sep 2016 22:28:31 +0000 (15:28 -0700)] 
cp: use FICLONE instead of BTRFS_IOC_CLONE

This doesn't affect the generated code on my system; it's merely
a cleaner way to use the recently-introduced Linux-specific API.
* m4/jm-macros.m4 (gl_CHECK_ALL_HEADERS): Check for linux/fs.h.
* src/copy.c: Include <linux.fs.h> if available.
(FICLONE) [__linux__]: Define if not already defined.
(clone_file): Use FICLONE instead of the older BTRFS_IOC_CLONE,
as this ioctl is no longer btrfs-specific.

8 years agodate: add '--debug' option
Assaf Gordon [Thu, 8 Sep 2016 05:00:23 +0000 (01:00 -0400)] 
date: add '--debug' option

Usage example:
    date --debug -d 'now + 3 days'

Print parsing and debugging information to stderr when using date's
-d/--date option.
See: http://lists.gnu.org/archive/html/coreutils/2016-01/msg00076.html

* src/date.c (main): Add '--debug' option, enable debugging
in gnulib's parse-datetime.y module.
* tests/misc/date.pl: Repeat tests with '--debug' enable, ensure
no regression.
* tests/misc/date-debug.sh: Test output of '--debug' option.
* tests/local.mk: Add above test.
* NEWS: Mention new option.
* doc/coreutils.texi: Likewise.

8 years agosort: port to strict C + valgrind
Paul Eggert [Thu, 8 Sep 2016 02:49:55 +0000 (19:49 -0700)] 
sort: port to strict C + valgrind

* bootstrap.conf (gnulib_modules): Add flexmember.
* src/sort.c: Include flexmember.h.
(struct tempnode): Make the last member flexible.
(create_temp_file): Port to strict C11/C99 rules for
allocation alignment with flexible array members.

8 years agobuild: update gnulib submodule to latest
Paul Eggert [Thu, 8 Sep 2016 01:31:16 +0000 (18:31 -0700)] 
build: update gnulib submodule to latest

8 years agofactor: reinstate immediate output with interactive use
Pádraig Brady [Tue, 6 Sep 2016 14:13:32 +0000 (15:13 +0100)] 
factor: reinstate immediate output with interactive use

* src/factor.c (lbuf_putc): Only buffer more than a line
when not using the tool interactively.
* NEWS: Mention the bug fix.
Fixes http://pad.lv/1620139

8 years agols: allow interruption when reading slow directories
Kamil Dudka [Tue, 6 Sep 2016 15:38:26 +0000 (17:38 +0200)] 
ls: allow interruption when reading slow directories

Postpone installation of signal handlers until they're needed.
That is right before the first escape sequence is printed.

* src/ls.c (signal_setup): A new function refactored from main()
to set and restore signal handlers.
(main): Move signal handler setup to put_indicator()
so that the default signal handling is untouched as long as possible.
Adjusted condition for restoring signal handlers to reflect the change.
(put_indicator): Install signal handlers if called for the very first
time.  It uses the same code that was in main() prior to this commit.
* NEWS: Mention the improvement.

See https://bugzilla.redhat.com/1365933
Fixes http://bugs.gnu.org/24232

8 years agodoc: fix typo in date example
Pádraig Brady [Thu, 1 Sep 2016 15:39:04 +0000 (16:39 +0100)] 
doc: fix typo in date example

* doc/coreutils.texi (date invocation): Add a missing quotation mark.
Fixes http://bugs.gnu.org/24349

8 years agodircolors: recognize .zst and .tzst suffixes
Jim Meyering [Wed, 27 Jul 2016 16:30:02 +0000 (09:30 -0700)] 
dircolors: recognize .zst and .tzst suffixes

* src/dircolors.hin: Add .zst and .tzst suffixes for the
Zstandard/zstd compression tools.  See http://zStd.net and
https://code.facebook.com/posts/1658392934479273/

8 years agomaint: tr: tweak/make-consistent a pair of loop indices
Jim Meyering [Fri, 25 Sep 2015 01:28:16 +0000 (18:28 -0700)] 
maint: tr: tweak/make-consistent a pair of loop indices

* src/tr.c (unquote): Use indices of type "unsigned int", rather
than a mix or "size_t" and "int", presuming that no command-line-
specified string will have length longer than UINT_MAX.

8 years agotr: move decls "down"
Jim Meyering [Thu, 17 Sep 2015 03:07:42 +0000 (20:07 -0700)] 
tr: move decls "down"

8 years agoptx: avoid new warning/error from upcoming gcc-7.x
Jim Meyering [Mon, 29 Aug 2016 05:53:50 +0000 (22:53 -0700)] 
ptx: avoid new warning/error from upcoming gcc-7.x

* src/ptx.c (fix_output_parameters): Switch to an unsigned type that
matches the OCCURS.file_index type. This avoids the following error
from gcc-7.0.0 20160829 (experimental):
  src/ptx.c:1220:14: error: assuming signed overflow does not occur \
    when simplifying conditional to constant [-Werror=strict-overflow]
          if (file_index > 0)

8 years agocp: with --parents --no-preserve=mode don't copy dir perms
Pádraig Brady [Thu, 18 Aug 2016 12:54:48 +0000 (13:54 +0100)] 
cp: with --parents --no-preserve=mode don't copy dir perms

* src/cp.c (make_dir_parents_private): Use default permissions for
created directories when --no-preserve=mode is specified.
* tests/cp/cp-parents.sh: Add a test case.
* NEWS: Mention the fix.
Fixes http://bugs.gnu.org/24251

8 years agodoc: fix ambiguous multiplier info in dd man page
Pádraig Brady [Thu, 18 Aug 2016 10:58:39 +0000 (11:58 +0100)] 
doc: fix ambiguous multiplier info in dd man page

* src/dd.c (usage): Add a comma which is significant for
the rewrapping done in man pages.

9 years agomaint: refactor common expand(1) and unexpand(1) code
Assaf Gordon [Sat, 25 Jun 2016 01:48:29 +0000 (21:48 -0400)] 
maint: refactor common expand(1) and unexpand(1) code

* src/expand.c, src/unexpand.c: Move global variables from here...
* src/expand-common.h, src/expand-common.c: ... to here.
* src/expand.c, src/unexpand.c: (parse_tab_stops, validate_tab_stops,
next_file): Move identical functions to new module.
(add_tab_stop): Move to new module, including additional code from
'unexpand' (keeping max_column_width) which will have no effect in when
used in 'expand'. Refactor common next-column calculation code
into a new function 'get_next_tab_column'.
* src/local.mk: (src_expand_SOURCES, src_unexpand_SOURCES): Add
'expand-common.c'; (noinst_HEADERS): Add 'expand-common.h'.
* po/POTFILES.in: Add 'expand-common.c'.
* tests/misc/expand.pl: Add more tests.
* tests/misc/unexpand.pl: Likewise.
* TODO: Move conclusions to above test after investigation.

9 years agodf: improve performance with many mount points
Philipp Thomas [Sun, 31 Jul 2016 19:24:18 +0000 (21:24 +0200)] 
df: improve performance with many mount points

Use hash table for seaching in filter_mount_list() and get_dev()

This improves performance for 20K mount entries from:
  real    0m1.731s
  user    0m0.532s
  sys     0m1.188s
to:
  real    0m1.066s
  user    0m0.028s
  sys     0m1.032s

* src/df.c (devlist_table): Define hash table.
(devlist_hash): Add hash function.
(devlist_compare): Add hash comparison function.
(devlist_for_dev): Add lookup function.
(devlist_free): Add cleanup function.
(filter_mount_list): Use the above hash table.
While at it, rename the variable 'devlist' to 'seen_dev' for
better readability.
(me_for_dev): Use the above lookup function.
NEWS: Mention the improvement.
THANKS.in: Remove the committer; add original submitter Josef Cejka.

9 years agodoc: revert recent date(1) synopsis change
Pádraig Brady [Thu, 28 Jul 2016 11:38:20 +0000 (12:38 +0100)] 
doc: revert recent date(1) synopsis change

* src/date.c (usage): This was thought to introduce other ambiguities,
and was inconsistent with the format presented in the touch(1) docs.
* doc/coreutils.texi (date invocation): Likewise.
See http://bugs.gnu.org/24077