Commit Graph

1412 Commits

Author SHA1 Message Date
Pádraig Brady
738a746d82 split: fix failure for certain number of specified files
* src/split.c (set_suffix_length): Use a more standard
zero based logN calculation for the number of units.
* tests/split/suffix-auto-length.sh: Add a test case.
* THANKS.in: Mention the reporter.
* NEWS: Mention the fix.
Fixes https://bugs.gnu.org/35291
2019-06-08 22:58:01 +01:00
Paul Eggert
00d72e6122 dd: be more careful about signal handling
Problem reported by Hans Henrik Bergan (Bug#36007).
* NEWS: Mention this.
* src/dd.c (iclose, ifdatasync, ifstat, ifsync):
New functions, which are more careful about SIGINT.
(cleanup): Use iclose instead of close.
(finish_up): Process signals first.
(skip, dd_copy, main): Use ifstat instead of fstat.
(dd_copy): Use ifdatasync and ifsync instead of fdatasync and fsync.
2019-05-30 13:54:18 -07:00
Paul Eggert
4c223ab4b6 maint: fix version number in NEWS 2019-05-29 16:45:16 -07:00
Paul Eggert
3b1046f80f cp: fix /dev/stdin problem on Solaris
Problem reported by Jakub Kulik (Bug#35713).
* NEWS: Mention this.
* configure.ac (DEV_FD_MIGHT_BE_CHR): New macro.
* src/copy.c (DEV_FD_MIGHT_BE_CHR): Default to false.
(follow_fstatat): New function.
(copy_internal): Use it.
* src/copy.h (XSTAT): Remove; no longer used.
2019-05-28 13:44:40 -07:00
Bernhard Voelker
7d8adb20f6 gnulib: update to the latest
* gnulib: Update to latest, mainly for:
  > mountlist: make parsing /proc/self/mountinfo more robust
* NEWS: Mention the fix.

Fixes https://bugs.gnu.org/33468
2019-04-19 10:21:43 +02:00
Shugo Maeda
6d78a28078 factor: output immediately if stdout is a tty but stdin is not
* src/factor.c (lbuf_putc): Use line buffered mode if the standard
output is a terminal in the same way as the stdio library.
User programs might use pty only for the standard out
like the example of Ruby's PTY module:
https://docs.ruby-lang.org/en/2.6.0/PTY.html#module-PTY-label-Example
* NEWS: Mention the fix.
Fixes https://bugs.gnu.orv/35046
2019-03-31 15:49:48 -07:00
Paul Eggert
1a69508711 doc: add NEWS item for Solaris symlink fix 2019-03-17 13:25:10 -07:00
Pádraig Brady
4a21102470 doc: add a NEWS entry for the ln O_DIRECTORY fix
* NEWS: Mention the bugfix.
2019-03-16 14:21:40 -07:00
Pádraig Brady
ab8c604765 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-03-10 17:08:36 -07:00
Pádraig Brady
cf28242fd5 version 8.31
* NEWS: Record release date.
2019-03-10 16:34:41 -07:00
Pádraig Brady
6bf6d7f461 env: add --list-signal-handling to output non default handling
* src/env.c (main): Output blocked or ignored signals
before a command is executed.
* doc/coreutils.texi (env invocation): Add the option.
* tests/misc/env-signal-handler.sh: Add a test case.
* NEWS: Mention the new feature.
2019-03-04 00:37:42 -08:00
Assaf Gordon
95adadd9a4 env: new options --{default,ignore,block}-signal[=SIG]
New options to set signal handlers for the command being executed.
--block-signal suggested by Paul Eggert in http://bugs.gnu.org/34488#71
--default-signal is useful to overcome the POSIX limitation that shell
must not override inherited signal state, e.g. the second 'trap' here is
a no-op:

   trap '' PIPE && sh -c 'trap - PIPE ; seq inf | head -n1'

Instead use:

   trap '' PIPE && sh -c 'env --default-signal=PIPE seq inf | head -n1'

Similarly, the following will prevent CTRL-C from terminating the
program:

   env --ignore-signal=INT seq inf > /dev/null

See https://bugs.gnu.org/34488#8

* NEWS: Mention new options.
* doc/coreutils.texi (env invocation): Document new options.
* man/env.x: Add example of --default-signal=SIG usage.
(SEE ALSO): Mention sigprocmask.
* src/env.c (signals): New global variable.
(longopts): Add new options.
(usage): Print new options.
(parse_signal_params): Parse comma-separated list of signals, store in
signals variable.
(reset_signal_handlers): Set each signal to SIG_DFL/SIG_IGN.
(parse_block_signal_params): Parse command-line options.
(set_signal_proc_mask): Call sigprocmask to block/unblock signals.
(main): Process new options.
* src/local.mk (src_env_SOURCES): Add operand2sig.c.
* tests/misc/env-signal-handler.sh: New test.
* tests/local.mk (all_tests): Add new test.
2019-03-04 00:37:07 -08:00
Martin Bukatovic
186896d65f stat: print birth time on systems supporting statx
* configure.ac: Check for statx(), available on glibc >= 2.28.
* src/stat.c (get_birthtime): Call statx() when available.
* NEWS: Mention the improvement.
2019-03-03 23:33:51 -08:00
Pádraig Brady
0d6be4b01f maint: tidy up recent additions to NEWS
* NEWS: Move date change to improvements and fix nohup grammar.
2019-03-03 19:21:37 -08:00
Pádraig Brady
a5202bd585 wc: treat non breaking space as a word separator
* src/wc.c (iswnbspace): A new function to match
characters in this class.
(isnbspace): Likewise for single byte charsets.
(main): Initialize posixly_correct from the environment,
to allow disabling honoring NBSP in non C locales.
(wc): Call is[w]nbspace() along with is[w]space.
* bootstrap.conf: Ensure btowc is available.
* tests/misc/wc-nbsp.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the change in behavior.
2019-02-25 22:49:44 -08:00
Paul Eggert
b1e7af28eb date: ‘+’ conversion specification flag
The recent Gnulib update fixed Bug#34608; document and test this.
* NEWS: Mention the change.
* doc/coreutils.texi (Padding and other flags):
Update doc to cover new flag and other POSIX.1-2017 changes.
* tests/misc/date.pl (date-century-plus): New test.
2019-02-24 23:59:55 -08:00
Bernhard Voelker
44af84263e all: detect --help and --version more consistently
For select programs which accept only --help and --version options
(in addition to non-option arguments), process these options before
any other options.

Before:

  $ dd bs=1 --help
  dd: unrecognized option '--help'
  Try 'dd --help' for more information.

  $ yes me --help
  me --help
  me --help
  ...

After:
Any occurrence of '--help' in the arguments (prior to '--') will
show the help screen.

Discussed in https://bugs.gnu.org/33468 .

* NEWS: Mention change.
* src/cksum.c, src/dd.c, src/hostid.c, src/hostname.c, src/link.c,
src/logname.c, src/nohup.c, src/sleep.c, src/tsort.c, src/unlink.c,
src/uptime.c, src/users.c, src/whoami.c, src/yes.c (main): Replace
parse_long_options() + getopt_long() calls with
parse_gnu_standard_options_only(); Remove <getopt.h> inclusion;
Remove empty 'struct long_options' variable;
* tests/misc/help-version-getopt.sh: Add test.
* tests/local.mk (all_tests): Reference it.
2019-02-24 19:32:29 +01:00
Daming Yang
b1ac478653 ls: better align month abbreviations containing digits
* src/ls.c (abmon_init): Align numeric abbreviations right.
* NEWS: Mention the improvement.
2019-02-18 20:06:05 -08:00
Pádraig Brady
03fbb5ecec seq: output decimal points consistently with invalid locales
* src/seq.c (print_numbers): Only reset the locale if it
was successfully set originally.
* tests/misc/seq-locale.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the fix.
2019-02-03 17:18:08 -08:00
Pádraig Brady
2e8f885a2a stat,tail: fix android build and support inotify
* src/extract-magic: Treat android like linux,
which fixes the build by ensuring the constants are defined.
* src/stat.c: Support all constants on android, including
the android specific "sdcardfs".
* src/tail.c: Fix inclusion of statfs headers to be independent
of inotify availability, as fremote() is used on linux even
if inotify has been disabled.  Also enable fremote() on android.
* NEWS: Mention the improvment.
Fixes https://bugs.gnu.org/34239
2019-02-03 17:18:08 -08:00
Paul Eggert
3fe8bc09be printf,seq,sleep,tail,timeout: accept current-locale floats
These commands now accept floating-point numbers in the
current locale, as well as in the C locale.
Compatibility problem reported by Robert Elz.
* NEWS: Document this.
* bootstrap.conf (gnulib_modules): Add cl-strtod, cl-strtold.
Remove c-strtold.
* doc/coreutils.texi (Floating point, tail invocation)
(printf invocation, timeout invocation, sleep invocation)
(seq invocation): Document this.
* gl/lib/cl-strtod.c, gl/lib/cl-strtod.h, gl/lib/cl-strtold.c:
* gl/modules/cl-strtod, gl/modules/cl-strtold: New files.
* src/printf.c, src/seq.c, src/sleep.c, src/tail.c, src/timeout.c:
Include cl-strtod.h instead of c-strtod.
* src/printf.c (vstrtold):
* src/seq.c (scan_arg, print_numbers):
* src/sleep.c (main):
* src/tail.c (parse_options):
* src/timeout.c (parse_duration):
Use cl_strtold instead of c_strtold.
2019-01-26 22:41:09 -08:00
Pádraig Brady
fa50623394 tail: fix handling of broken pipes with SIGPIPE ignored
* init.cfg (trap_sigpipe_or_skip_): A new function refactored from...
* tests/misc/printf-surprise.sh: ...here.
* tests/misc/seq-epipe.sh. Likewise.
* src/tail.c (die_pipe): Ensure we exit upon sending SIGPIPE.
* tests/tail-2/pipe-f.sh: Ensure we exit even if SIGPIPE is ignored.
* NEWS: Mention the bug fix.
2019-01-20 12:53:24 -08:00
Pádraig Brady
39ca7731e2 ls: with --group-directories-first, also group symlinked dirs
* src/ls.c (is_linked_directory): A new function to
also consider symlinked directories.
(main): Rename check_symlink_color to check_symlink_mode,
and enable that with --group-directories-first.
(DIRFIRST_CHECK): Adjust to use is_linked_directory,
rather than just is_directory.
(gobble_file): Simplify to always update f->linkmode
if the stat() succeeds.
* tests/ls/group-dirs.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the change in behavior.
Suggested by Amin Bandali in
https://lists.gnu.org/r/coreutils/2018-12/msg00017.html
2019-01-12 19:23:45 -08:00
Pádraig Brady
d5ab4cbe42 tail: don't exit immediately with filters on AIX
* src/tail.c: Fix the check_output_available check on AIX.
Note we don't use poll for all systems as the overhead
of adding the gnulib poll module wouldn't be worth it
just for this single use.
* tests/tail-2/pipe-f.sh: Fix the test which always passed
due to only the exit code of sleep being checked.
* NEWS: Mention the bug fix and rearrange alphabetically.
Fixes http://bugs.gnu.org/33946
2019-01-12 19:23:41 -08:00
Assaf Gordon
8dfcf38af1 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.
2019-01-01 16:51:48 -07:00
Assaf Gordon
67c537b91c base64,base32: fix 'extra operand' error message
In the following invocation, 'a' is the input file, and 'b' is the extra
operand:

  $ base64 a b

Report 'b' in the error message instead of 'a':

  $ base64 a b
  base64: extra operand 'b'

Discussed in https://lists.gnu.org/r/coreutils/2018-12/msg00008.html .

* src/basenc.c (main): If there is more than one non-option operand,
report the second one (assuming the first is a the input file name).
* tests/misc/base64.pl: Add tests.
* tests/misc/basenc.pl: Adjust expectedc error message in tests.
* NEWS: Mention bugfix.
2019-01-01 16:32:27 -07:00
Assaf Gordon
2f438fa9f5 basenc: A new program complementary to base64/base32
Encodes/decodes data in various common formats:
base64,base64url,base32,base32,base16,base2,z85.

Discussed here:
https://lists.gnu.org/r/coreutils/2018-11/msg00014.html
https://lists.gnu.org/r/coreutils/2018-12/msg00019.html

* AUTHORS: Add basenc.
* README: Reference the new program.
* NEWS: Mention the new program.
* build-aux/gen-lists-of-programs.sh: Add basenc.
* doc/coreutils.texi: (basenc invocation): Document the new command.
* man/.gitignore: Ignore the generated man page.
* man/basenc.x: A new template, with few examples.
* man/local.mk: Reference the new man page.
* scripts/git-hooks/commit-msg: Allow basenc as program prefix.
* src/.gitignore: Ignore the new binary.
* src/basenc.c:
(usage): Mention new options.
(main): Handle new options.
(isbase*, base*_length, base*_encode, base*_decode_ctx): Implement new
encoding/decoding formats.
* src/local.mk: Add new program.
* tests/local.mk: Add new test.
* tests/misc/basenc.pl: New tests.
* tests/misc/help-version.sh (basenc_setup): use '--version' for default
invocation (basenc errors with no parameters).
2018-12-27 23:46:02 -07:00
Paul Eggert
69df9e20e2 shred,sort,split: add NEWS item 2018-12-15 12:42:50 -08:00
Bernhard Voelker
4711c49312 sync: add NEWS and test for the fix in the previous commit
* NEWS (Bug fixes): Mention the fix in commit 94d364f157.
While at it, remove duplicate "Changes in behavior" heading.
* tests/misc/sync.sh: Add a test with a write-only file for the fix.
2018-11-06 17:02:26 -08:00
Pádraig Brady
8d328706c6 echo: always process escapes when POSIXLY_CORRECT is set
* src/echo.c (main): Always enable backslash processing if
POSIXLY_CORRECT is set.
* tests/misc/echo.sh: Add (the first) test for the echo command.
* tests/local.mk: Reference the new test.
* tests/misc/printf.sh: Update a stale comment.
* doc/coreutils.texi (echo invocation). Mention that POSIXLY_CORRECT
now always enables backslash processing.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/32703
Issue identified by Eric Blake.
2018-10-27 03:05:24 -07:00
Bernhard Voelker
1a674a036b test: add -N unary operator
Bash knows 'test -N FILE'.  Add it to GNU 'test' as well.

* src/test.c (unary_operator): Add a case for 'N'.
(usage): Document it.
* doc/coreutils.texi (node File characteristic tests): Likewise.
* NEWS (New features): Likewise.
* tests/misc/test-N.sh: Add a test.
* tests/local.mk (all_tests): Reference it.
2018-10-26 11:05:25 +02:00
Bernhard Voelker
88c32fa68e test: remove support for the ambigous -a unary operator
* src/test.c (unary_operator): Remove case 'a'.
(test_unop): Likewise.
* NEWS (Changes in behavior): Document the change.

Discussed at https://bugs.gnu.org/33097
2018-10-26 10:53:57 +02:00
Paul Eggert
571f63f501 ln: avoid directory hard-link races
Previously, 'ln A B' did 'stat("B"), lstat("A"), link("A","B")'
where the stat and lstat were necessary to avoid hard-linking
directories on systems that can hard-link directories.
Now, in situations that prohibit hard links to directories,
'ln A B' merely does 'link("A","B")'.  The new behavior
avoids some races and should be more efficient.
This patch was inspired by Bug#10020, which was about 'ln'.
* bootstrap.conf (gnulib_modules): Add unlinkdir.
* src/force-link.c (force_linkat, force_symlinkat): New arg for
error number of previous try.  Return error number, 0, or -1 if
error, success, or success after removal.  All callers changed.
* src/ln.c: Include priv-set.h, unlinkdir.h.
(beware_hard_dir_link): New static var.
(errnoize, atomic_link): New functions.
(target_directory_operand): Use errnoize for simplicity.
(do_link): New arg for error number of previous try.  All callers
changed.  Do each link atomically if possible.
(main): Do -r check earlier.  Remove linkdir privileges so we can
use a single linkat/symlinkat instead of a racy substitute for the
common case of 'ln A B' and 'ln -s A B'.  Set beware_hard_dir_link
to disable this optimization.
2018-10-19 12:38:34 -07:00
Paul Eggert
cbc427485e cp: 'cp -il A B' no longer fails if user OKs it
* NEWS: Mention the change.
* src/copy.c (copy_internal): Replace the link if the
user has okayed it.
2018-10-19 12:38:34 -07:00
Achilles Gaikwad
a32a756a58 id: support multiple specified users
$ id root nobody
  uid=0(root) gid=0(root) groups=0(root)
  uid=99(nobody) gid=99(nobody) groups=99(nobody)

* src/id.c (main): Make variables opt_zero, just_group_list,
just_group, use_real, just_user global to be used in a new
function.
(print_stuff): New function that will print user and group
information for the specified USER.
When using -G option delimit each record with two NULs.
Restructure the code in the file to have global variables
followed by functions.
* tests/id/zero.sh: Add test cases to check the usage
of -z option with multiple users.
* tests/id/uid.sh: Add a test case to ensure all users
are queried in the presence of errors.
* doc/coreutils.texi: Document the interface changes.
* NEWS: Mention the new feature.
2018-09-29 22:39:26 -07:00
Chih-Hsuan Yen
437555061c df: avoid multibyte character corruption on macOS
* src/df.c (hide_problematic_chars): Use c_iscntrl() as
passing 8 bit characters to iscntrl() is not supported on macOS.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/32236
2018-07-26 10:24:41 -07:00
Pádraig Brady
83322567de maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-07-01 18:28:37 -07:00
Pádraig Brady
53793cd35f version 8.30
* NEWS: Record release date.
2018-07-01 17:56:07 -07:00
Pádraig Brady
c932e5c9ec 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.
2018-06-20 21:18:32 -07:00
Adam Borowski
163df41d45 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.
2018-06-20 21:17:19 -07:00
Assaf Gordon
668306ed86 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.
2018-06-20 21:15:31 -07:00
Assaf Gordon
a0118a71bb 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.
2018-06-20 21:14:47 -07:00
Kaxandra Labat
24053fbd8f 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.
2018-06-20 21:02:30 -07:00
Pádraig Brady
c744c65f50 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.
2018-06-20 21:01:14 -07:00
Pádraig Brady
77517a9917 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.
2018-06-20 21:00:39 -07:00
Pádraig Brady
5e7b8928b7 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
2018-06-03 16:27:37 -07:00
Pádraig Brady
c732388fa1 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
2018-05-17 20:52:09 -07:00
Pádraig Brady
d3daa95096 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
2018-05-15 09:55:19 -07:00
Pádraig Brady
a391007511 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
2018-05-15 09:52:44 -07:00
Pádraig Brady
22424dde74 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
2018-04-20 17:54:14 -07:00