summaryrefslogtreecommitdiff
path: root/tests/cp
Commit message (Collapse)AuthorAgeFilesLines
* cp: -p --parents: fix failure to preserve permissions for absolute pathsPádraig Brady2023-05-031-0/+6
| | | | | | | * src/cp.c (re_protect): Ensure copy_acl() is passed an absolute path. * tests/cp/cp-parents.sh: Add a test case. * NEWS: Mention the bug. Fixes https://bugs.gnu.org/63245
* copy: reduce verbosity of -i and -u with --verbosePádraig Brady2023-04-252-5/+8
| | | | | | | | | | | | | Since skipping of files is central to the operation of -i and -u, and with -u one may be updating few files out of many, reinstate the verbosity of this functionality as it was before 9.3. * src/copy.c (copy_internal): Only output "skipped" message with --debug. Also adjust so message never changes with --debug. * tests/cp/cp-i.sh: Adjust accordingly. * tests/mv/mv-n.sh: Likewise. * tests/cp/debug.sh: Add explicit test case for message. * NEWS: Mention the change in behavior.
* tests: avoid failure when cp fails for proc filesAndreas Schwab2023-04-241-1/+7
| | | | | | | When run under QEmu emulation emulated /proc files have unstable inode numbers. * tests/cp/proc-short-read.sh: Skip if unstable inode numbers detected.
* tests: avoid dependence on file layout for cp sparse checkPádraig Brady2023-04-131-14/+4
| | | | | | * tests/cp/sparse-2.sh: Don't depend on the copy taking <= allocation of the source. Instead leverage --debug to check that zero detection is being enabled.
* tests: avoid non portable brace expansionPádraig Brady2023-04-101-2/+2
| | | | | * tests/cp/backup-dir.sh: Avoid non portable brace expansion which is not supported by FreeBSD or Solaris shells at least.
* cp,mv: issue "skipped" messages when skipping filesPádraig Brady2023-04-081-5/+12
| | | | | | | | | * NEWS: Mention the change in behavior to issue a "not replaced" error diagnostic with -n, and the "skipped" message with -v. * src/copy.c (copy_internal): Adjust to output the "skipped" messages depending on -i, -n, -u. * tests/cp/cp-i.sh: Adjust accordingly. * tests/mv/mv-n.sh: Likewise.
* cp: fix --backup with subdirectoriesPádraig Brady2023-04-041-1/+7
| | | | | | | | | * gnulib: Reference the latest gnulib including the fix to the backupfile module in commit 94496522. * tests/cp/backup-dir.sh: Add a test to ensure we rename appropriately when backing up through subdirs. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/62607
* test: avoid a test hang on HurdPádraig Brady2023-03-151-1/+1
| | | | | | * tests/cp/sparse-to-pipe.sh: Protect the cp call seen to hang on Hurd/i686 with a timeout. Reported By: Bruno Haible
* tests: determine if SEEK_HOLE is enabledPádraig Brady2023-02-244-4/+4
| | | | | | | | | | | | | | Upcomming gnulib changes may disable SEEK_HOLE even if the system supports it, so dynamically check if we've SEEK_HOLE enabled. * init.cfg (seek_data_capable_): SEEK_DATA may be disabled in the build if the system support is deemed insufficient, so also use `cp --debug` to determine if it's enabled. * tests/cp/sparse-2.sh: Adjust to a more general diagnostic. * tests/cp/sparse-extents-2.sh: Likewise. * tests/cp/sparse-extents.sh: Likewise. * tests/cp/sparse-perf.sh: Likewise.
* cp,install,mv: add --debug to explain how a file is copiedPádraig Brady2023-02-241-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How a file is copied is dependent on the sparseness of the file, what file system it is on, what file system the destination is on, the attributes of the file, and whether they're being copied or not. Also the --reflink and --sparse options directly impact the operation. Given it's hard to reason about the combination of all of the above, the --debug option is useful for users to directly identify if copy offloading, reflinking, or sparse detection are being used. It will also be useful for tests to directly query if these operations are supported. The new output looks as follows: $ src/cp --debug src/cp file.sparse 'src/cp' -> 'file.sparse' copy offload: yes, reflink: unsupported, sparse detection: no $ truncate -s+1M file.sparse $ src/cp --debug file.sparse file.sparse.cp 'file.sparse' -> 'file.sparse.cp' copy offload: yes, reflink: unsupported, sparse detection: SEEK_HOLE $ src/cp --reflink=never --debug file.sparse file.sparse.cp 'file.sparse' -> 'file.sparse.cp' copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE * doc/coreutils.texi (cp invocation): Describe the --debug option. (mv invocation): Likewise. (install invocation): Likewise. * src/copy.h: Add a new DEBUG member to cp_options, to control whether to output debug info or not. * src/copy.c (copy_debug): A new global structure to unconditionally store debug into from the last copy_reg operations. (copy_debug_string, emit_debug): New functions to print debug info. * src/cp.c: if ("--debug") x->debug=true; * src/install.c: Likewise. * src/mv.c: Likewise. * tests/cp/debug.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the new feature.
* tests: fix exit status check in cp -u testPádraig Brady2023-02-031-1/+1
| | | | | * tests/cp/preserve-link.sh: This should have been part of commit v9.1-134-g01503ce73.
* cp,mv: skipping due to -u is success, not failurePaul Eggert2023-01-311-2/+2
| | | | | | | | | | This reverts the previous change, so that when a file is skipped due to -u, this is not considered a failure. * doc/coreutils.texi: Document this. * src/copy.c (copy_internal): If --update says to skip, treat this as success instead of failure. * tests/mv/update.sh, tests/cp/slink-2-slink.sh: Revert previous change, to match reverted behavior.
* cp,ln,mv: when skipping exit with nonzero statusPaul Eggert2023-01-313-8/+8
| | | | | | | | | | | * NEWS, doc/coreutils.texi: Document this. * src/copy.c (copy_internal): * src/ln.c (do_link): Return false when skipping action due to --interactive or --no-clobber. * tests/cp/cp-i.sh, tests/cp/preserve-link.sh: * tests/cp/slink-2-slink.sh, tests/mv/i-1.pl, tests/mv/i-5.sh: * tests/mv/mv-n.sh, tests/mv/update.sh: Adjust expectations of exit status to match revised behavior.
* maint: update all copyright year number rangesPádraig Brady2023-01-0162-62/+62
| | | | | | | | | | Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
* maint: avoid recent syntax check failurePádraig Brady2022-12-291-2/+3
| | | | * tests/cp/proc-short-read.sh: Adjust so shorter lines.
* tests: accommodate bogomips capitalizationsPaul Eggert2022-12-261-2/+2
| | | | | | * tests/cp/proc-short-read.sh: Kernel on ARMv7 Processor rev 3 (v7l) spells it "BogoMIPS", so allow any capitalization. Patch from Zach van Rijn in <https://bugs.gnu.org/60339>.
* cp,mv,install: avoid opening non directory destinationPádraig Brady2022-04-091-7/+5
| | | | | | | | | | | | | | | | | commit v9.0-66-ge2daa8f79 introduced an issue, for example where cp could hang when overwriting a destination fifo, when it would try to open() the fifo on systems like Solaris 10 that didn't support the O_DIRECTORY flag. This is still racy on such systems, but only in the case where a directory is replaced by a fifo in the small window between stat() and open(). * src/system.h (target_directory_operand): On systems without O_DIRECTORY, ensure the file is a directory before attempting to open(). * tests/cp/special-f.sh: Protect cp with timeout(1), as cp was seen to hang when trying to overwrite an existing fifo. * NEWS: Mention the bug fix.
* cp: when copying to dir use dir-relative namesPaul Eggert2022-01-131-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When copying to a directory, use functions like openat to access the destination files, when such functions are available. This should be more efficient and should avoid some race conditions. * bootstrap.conf (gnulib_modules): Add areadlinkat-with-size, fchmodat, fchownat, mkdirat, mkfifoat, utimensat. * src/copy.c (lchown) [!HAVE_LCHOWN]: * src/copy.c, src/system.h (rpl_mkfifo, mkfifo) [!HAVE_MKFIFO]: Remove. All uses removed. (utimens_symlink): Remove; we shouldn’t have to worry about those obsolete systems any more. All uses replaced by utimensat. * src/copy.c (copy_dir, set_owner, fchmod_or_lchmod, copy_reg) (same_file_ok, writable_destination, overwrite_ok, abandon_move) (create_hard_link, src_is_dst_backup, copy_internal, copy): * src/cp.c (make_dir_parents_private, re_protect): New args for directory-relative names. All uses changed. Continue to pass full names as needed, for diagnostics and for lower-level functions like qset_acl that do not support directory-relative names. * src/copy.c (copy_reg): Prefer readlinkat to lstatat for merely checking whether a file is a symlink, to avoid EOVERFLOW issues. (subst_suffix): New function. (create_hard_link): Accept a null SRC_NAME as meaning that if it is needed it needs to be constructed from SRC_RELNAME, DST_NAME, and DST_RELNAME. (source_is_dst_backup): Use subst_suffix instead of doing it by hand. (copy_internal): Remember and use directory-relative names instead of full names. * src/cp.c (lchown) [!HAVE_LCHOWN]: Remove. All uses removed. (must_be_working_directory): New function. (target_directory_operand): Simply take file name as arg, and return a file descriptor or negative number on failure; open with O_DIRECTORY to obtain any file descriptor. All uses changed. (target_dirfd_valid): New function. (do_copy): Use these new functions to obtain a file descriptor for any target directory, and use directory-relative names for that directory. (main): Omit no-longer-needed stat when --target-directory, as do_copy now does this. * src/ln.c (O_PATHSEARCH): Move from here ... * src/system.h: ... to here. * tests/cp/fail-perm.sh: Adjust to change in diagnostic wording, and add a test for --no-target-directory.
* maint: update all copyright year number rangesPádraig Brady2022-01-0262-62/+62
| | | | | | | | | 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.
* cp: fix --preserve=ownership permissions bugPaul Eggert2021-11-201-1/+9
| | | | | | | | | | | This fixes a bug that I introduced in 2006-12-06T19:44:08Z!eggert@cs.ucla.edu. * src/copy.c (USE_XATTR): New macro. (copy_reg): Use it to help the compiler. Prefer open u+w to a later chmod u=rw; u+r isn’t needed for xattr. For the later u-r, do only one (or zero) chmod calls instead of two (or one). In the last chmod, respect the umask instead of ignoring it. * tests/cp/preserve-mode.sh: Test for the bug.
* tests: cp/sparse-perf: make more robust and add zfs commentsPádraig Brady2021-09-251-16/+10
| | | | | | | | | | | | * init.cfg (seek_data_capable_): Add a timeout to ensure failure for slow lseek(...SEEK_DATA) calls (even if that syscall isn't interrupted). * tests/cp/sparse-perf.sh: Run the SEEK_DATA check on the 1TiB empty file to exclude both FreeBSD 9.1 which takes 35s, and ZFS which requires a delay of about 5s between file creation and use of SEEK_DATA to correctly determine it's empty (return ENXIO). Also remove the stat size checks as they invalidate the test due to cp never writing data due to it being always zeros, and thus converted to holes in the output.
* tests: sparse-perf: avoid false failurePádraig Brady2021-09-241-1/+10
| | | | | | | | * tests/cp/sparse-perf.sh: Avoid the case where we saw SEEK_DATA take 35s to return a result against a 1TB sparse file. This happened on a FreeBSD 9.1 VM at least. Reported by Nelson H. F. Beebe.
* tests: avoid reflinks when testing SEEK_DATA logicPádraig Brady2021-08-255-15/+20
| | | | | | | | | | | | | | | | This better tests the SEEK_HOLE logic which replaced the original fiemap hole identification logic. Also it avoids a false failure in sparse-2.sh on reflink supporting file systems, where we try to correlate the file sizes produced by cp and dd. * tests/cp/sparse-2.sh: s/cp/cp --reflink=never/ * tests/cp/sparse-extents-2.sh: Likewise. * tests/cp/sparse-extents.sh: Likewise. * tests/cp/sparse-perf.sh: Likewise. * tests/cp/sparse.sh: Likewise. Fixes https://github.com/coreutils/coreutils/issues/54
* doc: modernize usage of “disk” and “core”Paul Eggert2021-07-281-1/+1
| | | | | | | | | In documentation and comments, don’t assume that secondary storage devices are disk devices. Similarly, don’t assume that main memory uses magnetic cores, which became obsolete in the 1970s. * src/du.c (usage): * src/ls.c (usage): * src/shred.c (usage): Reword to avoid “disk” in usage messages.
* tests: fix tests/cp/sparse-2.sh false failure on some systemsPádraig Brady2021-05-121-3/+10
| | | | | | | | * tests/cp/sparse-2.sh: Double check cp --sparse=always, with dd conv=sparse, in the case where the former didn't create a sparse file. Now that this test is being newly run on macos, we're seeing a failure due to seek() not creating holes on apfs unless the size is >= 16MiB.
* tests: ensure we test SEEK_DATA where usedPádraig Brady2021-05-125-32/+19
| | | | | | | | | | | | | | | | | | | fiemap is no longer the default copy implementation, so check for SEEK_DATA support instead as that's preferred. This will ensure better test coverage on systems without fiemap. * init.cfg: Replace fiemap_capable_ with seek_data_capable_. This is best supported with python 3 so prefer that. * tests/seek-data-capable: A new test script checking for SEEK_DATA support on the passed file name, called from seek_data_capable_. * tests/fiemap-capable: Remove no longer used probing script. * tests/cp/fiemap-perf.sh: Renamed to tests/cp/sparse-perf.sh * tests/cp/fiemap-2.sh: Renamed to tests/cp/sparse-2.sh * tests/cp/fiemap-extents.sh: Renamed to tests/cp/sparse-extents.sh * tests/cp/sparse-fiemap.sh: Renamed to tests/cp/sparse-extents-2.sh * tests/cp/fiemap-FMR.sh: Renamed to tests/cp/copy-FMR.sh * tests/local.mk: Reference the renamed tests.
* maint: update all copyright year number rangesPádraig Brady2021-01-0162-62/+62
| | | | | | | | | 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.
* tests: fix false failure with valgrind and reflinkPádraig Brady2020-06-261-1/+1
| | | | | | | * tests/cp/fiemap-FMR.sh: Avoid FICLONE ioctl, which would avoid the point of the test (fiemap testing). Also it avoids a valgrind bug with this ioctl: https://bugs.kde.org/show_bug.cgi?id=397605
* cp: ensure --attributes-only doesn't remove filesPádraig Brady2020-04-021-3/+18
| | | | | | | | * src/copy.c (copy_internal): Ensure we don't unlink the destination unless explicitly requested. * tests/cp/attr-existing.sh: Add test cases. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/40352
* tests: fix test for symlinkPádraig Brady2020-02-101-1/+1
| | | | | * tests/cp/preserve-gid.sh: s/-l/-L/. Reported by Kamil Dudka
* tests: ensure tests/cp/preserve-gid.sh works with single binaryKamil Dudka2020-02-091-1/+8
| | | | | | | | * tests/cp/preserve-gid.sh: If configured with --enable-single-binary copy the coreutils single binary, instead of the cp one-line launcher. Discussed at https://bugzilla.redhat.com/1800597 Fixes https://bugs.gnu.org/39485
* tests: avoid false failure due to varying /proc/kallsymsPádraig Brady2020-02-041-13/+9
| | | | | | * tests/cp/proc-short-read.sh: Switch to using /proc/cpuinfo, rather than /proc/kallsyms which was seen to vary in some cases. Fixes https://bugs.gnu.org/39357
* maint: update all copyright year number rangesPádraig Brady2020-01-0162-62/+62
| | | | | | | | | 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.
* maint: update all copyright year number rangesAssaf Gordon2019-01-0162-62/+62
| | | | | | | | | 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.
* tests: fix skipping in some testsPádraig Brady2018-07-041-1/+1
| | | | | | | | | | | * tests/cp/cp-a-selinux.sh: Use 'skip_' rather than the probably undefined 'skip'. * tests/du/2g.sh: Likewise. * tests/install/install-Z-selinux.sh: Likewise. * tests/misc/chcon.sh: Likewise. * tests/misc/selinux.sh: Likewise. * tests/mkdir/restorecon.sh: Likewise. * cfg.mk (sc_prohibit-skip): A new syntax check to catch the issue.
* tests: standardize perl usage in testsPádraig Brady2018-06-302-1/+1
| | | | | | | | | | * 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.
* cp: add --reflink=never to force standard copy modeAdam Borowski2018-06-201-0/+4
| | | | | | | | | | | | 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.
* cp: preserve existing permissions with --no-preserve=modePádraig Brady2018-06-031-12/+12
| | | | | | | | | | | 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
* cp: with --force; replace self referential symlinksPádraig Brady2018-05-171-2/+11
| | | | | | | | | | | | | | | * 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
* cp: fix symlink checks when overwriting filesPádraig Brady2018-05-152-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* cp: ensure --remove-destination doesn't traverse symlinksPádraig Brady2018-05-152-5/+11
| | | | | | | | | | | * 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
* cp: set appropriate default permissions for special filesPádraig Brady2018-02-241-1/+9
| | | | | | | | | | | 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
* maint: update all copyright year number rangesPádraig Brady2018-01-0161-61/+61
| | | | | | | | | 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.
* test: fix issues with tests/cp/preserve-mode.shPádraig Brady2017-11-281-9/+5
| | | | | | | * 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.
* all: prefer HTTPS in URLsPaul Eggert2017-09-1961-61/+61
|
* tests: skip tests upon failure to set SELinux contextPádraig Brady2017-08-301-1/+1
| | | | | | | | | | | | | | On some setups the root:object_r:tmp_t context is invalid. This does indicate a limitation in the test framework, but for now we'll relax this to skipping the tests. The tests still run on a Fedora 25 system for example. * tests/cp/cp-a-selinux.sh: Upon chcon error, skip rather than ERROR. * tests/install/install-Z-selinux.sh: Likewise. * tests/misc/chcon.sh: Likewise. * tests/misc/runcon-no-reorder.sh: Likewise. * tests/misc/selinux.sh: Likewise. * tests/mkdir/restorecon.sh: Likewise.
* tests: don't fail tests when failing to write filesPádraig Brady2017-08-292-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/sample-test: Use framework_error_ rather than fail=1 * tests/chown/deref.sh: Likewise. * tests/chown/preserve-root.sh: Likewise. * tests/cp/src-base-dot.sh: Likewise. * tests/dd/unblock-sync.sh: Likewise. * tests/du/2g.sh: Likewise. * tests/du/inacc-dest.sh: Likewise. * tests/du/one-file-system.sh: Likewise. * tests/fmt/goal-option.sh: Likewise. * tests/ln/hard-backup.sh: Likewise. * tests/ls/color-dtype-dir.sh: Likewise. * tests/ls/m-option.sh: Likewise. * tests/ls/stat-dtype.sh: Likewise. * tests/ls/time-style-diag.sh: Likewise. * tests/ls/x-option.sh: Likewise. * tests/misc/chcon.sh: Likewise. * tests/misc/nohup.sh: Likewise. * tests/misc/od-N.sh: Likewise. * tests/misc/sort-compress.sh: Likewise. * tests/misc/tac-continue.sh: Likewise. * tests/misc/time-style.sh: Likewise. * tests/mv/backup-dir.sh: Likewise. * tests/mv/dir2dir.sh: Likewise. * tests/rm/dir-no-w.sh: Likewise. * tests/rm/dir-nonrecur.sh: Likewise. * tests/rm/inaccessible.sh: Likewise. * tests/rm/interactive-always.sh: Likewise. * tests/rm/interactive-once.sh: Likewise. * tests/rm/rm3.sh: Likewise. * tests/rm/v-slash.sh: Likewise. * tests/touch/relative.sh: Likewise.
* copy: more-accurate warning about destructionPaul Eggert2017-08-031-1/+1
| | | | | | * src/copy.c (copy_internal): * tests/cp/backup-is-src.sh, tests/mv/backup-is-src.sh: Say "might destroy", not "would destroy".
* copy: go back to failing 'cp --backup a~ a'Paul Eggert2017-08-011-7/+9
| | | | | | | | | | | | | Suggested by Kamil Dudka in: http://lists.gnu.org/archive/html/coreutils/2017-07/msg00072.html * NEWS: Document the changed nature of the fix. * doc/coreutils.texi, tests/cp/backup-is-src.sh: * tests/mv/backup-is-src.sh: Revert previous change. * src/copy.c (source_is_dst_backup): New function. (copy_internal): Use it. Fail instead of falling back on numbered backups when it looks like the backup will overwrite the source. Although this reintroduces a race, it's more compatible with previous behavior.
* copy: make backup files more reliablyPaul Eggert2017-07-301-9/+7
| | | | | | | | | | * NEWS, doc/coreutils.texi (Backup options): Document the change. * bootstrap.conf (gnulib_modules): Add backup-rename. * src/copy.c (copy_internal): Silently switch to numbered backups if a simple backup might lose data. Use backup_file_rename to avoid races with numbered backups. * tests/cp/backup-is-src.sh, tests/mv/backup-is-src.sh: Adjust to match new behavior.