aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mv (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-03-23mv: port test to OpenBSD 7.5Paul Eggert1-3/+12
Problem reported by Bruno Haible <https://bugs.gnu.org/75685>. * tests/mv/sticky-to-xpart.sh: Also allow OpenBSD behavior.
2025-01-20tests: remove use of unprotected 'set'Pádraig Brady1-2/+2
* cfg.mk (sc_prohibit_bare_set): A new syntax check to ensure we protect use of set with '--', so that args beginning with '-' are not interpreted as options, and if no args are present, all existing args are cleared. * tests/cp/symlink-slash.sh: Add -- to unprotected use of set. * tests/ls/ls-time.sh: Likewise. * tests/ls/symlink-slash.sh: Likewise. * tests/mkdir/perm.sh: Likewise. * tests/mkdir/selinux.sh: Likewise. * tests/mkdir/smack-no-root.sh: Likewise. * tests/mkdir/smack-root.sh: Likewise. * tests/mv/part-hardlink.sh: Likewise. * tests/nice/nice.sh: Likewise. * tests/stty/stty-row-col.sh: Likewise.
2025-01-06cp,mv: ensure -i,f are not overridden by -uPádraig Brady2-4/+16
Since coreutils 9.3 we had --update={all,older} override -i. In coreutils 9.5 this was expanded to -u (to make it consistent with --update=older). This patch reinstates things so that -i combines with -u instead. I.e. have -i be protective, rather than selective (like -u). The -f option of mv is similarly adjusted in this patch, so now --update does not override any of -f,-i,-n. * NEWS: Mention the bug fix. * src/cp.c (main): Don't have -u disable prompting. * src/mv.c (main): Likewise. * tests/cp/cp-i.sh: Add a test case for -i. * tests/mv/update.sh: Likewise. * tests/mv/i-3.sh. Add a test case for -f. Fixes https://bugs.gnu.org/70887
2025-01-01maint: update all copyright year number rangesPádraig Brady44-44/+44
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2024-05-03cp: actually support --update=none-failPádraig Brady1-0/+11
* src/cp.c: Add the entries for the --update=none-fail option. * tests/mv/update.sh: Add a test case. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/70727
2024-03-24tests: avoid false failure on new mv --exchange testPádraig Brady1-1/+4
* tests/mv/mv-exchange.sh: Canonicalize different "operation not supported" messages, so we can ignore correctly. Reported by Bruno Haible on AIX, NetBSD, and OpenBSD.
2024-03-20mv: new option --exchangePaul Eggert1-0/+41
* src/copy.h (struct cp_options): New member 'exchange'. * src/copy.c (copy_internal): Support the new member. * src/mv.c (EXCHANGE_OPTION): New constant. (long_options): Add --exchange. (usage): Document --exchange. (main): Support --exchange. * tests/mv/mv-exchange.sh: New test case. * tests/local.mk (all_tests): Add it.
2024-03-05mv: revert add --swap (-x) optionPádraig Brady1-47/+0
Since this functionality is recently available in the exch(1) utility from util-linux, it was thought best not to complicate mv with it. This reverts commit 6cd2d5e5335b5c286ff39e154e9dd38ba6923775
2024-03-03mv: add --swap (-x) option to atomically swap 2 pathsPetr Malat1-0/+47
renameat2() syscall allows atomically swapping 2 paths on one file system. Expose this ability to the user with --swap. * doc/coreutils.texi: Describe mv --swap option. * src/mv.c (main): Support --swap. * tests/mv/mv-swap.sh: Add test for mv -x. * tests/local.mk: Reference new test. * NEWS: Mention the new option.
2024-02-26cp,mv: add --update=none-fail to fail if existing filesPádraig Brady2-4/+12
* src/cp.c (main): Add support for --update=none-fail to provide the functionality of diagnosing files in the destination, and exiting with failure status. (usage): Mark -n as deprecated. * src/mv.c: Likewise. * src/copy.h: Add UPDATE_NONE_FAIL definition. * src/system.h (emit_update_parameters_note): Add --update=none-fail description. * doc/coreutils.texi (cp invocation): Likewise. Also mention why -n is deprecated. * tests/mv/update.sh: Add a test case, including precedence with -n and other --update options. * tests/cp/cp-i.sh: Verify that --backup and --update=none{,-fail} are mutually exclusive. * tests/mv/mv-n.sh: Likewise. * NEWS: Mention the new feature. Addresses https://bugs.gnu.org/62572
2024-02-26cp,mv: reinstate that -n exits with success if files skippedPádraig Brady1-6/+5
* src/cp.c (main): Adjust so that -n will exit success if skipped files. * src/mv.c (main): Likewise. * doc/coreutils.texi (cp invocation): Adjust the description of -n. * src/system.h (emit_update_parameters_note): Adjust --update=none comparison. * tests/cp/cp-i.sh: Adjust -n exit status checks. * tests/mv/mv-n.sh: Likewise. * NEWS: Mention the change in behavior. Fixes https://bugs.gnu.org/62572
2024-01-01maint: update all copyright year number rangesPádraig Brady43-43/+43
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * 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.
2023-07-22mv: better diagnostic for 'mv dir x' failurePaul Eggert1-1/+1
Problem reported by Nir Oren <https://bugs.gnu.org/64785>. * src/copy.c (copy_internal): Use a more-specific diagnostic when a rename fails due to a problem that must be due to the destination, avoiding user confusion in cases like 'mv dir x' where x is a nonempty directory. * tests/mv/dir2dir.sh: Adjust to match.
2023-04-25copy: reduce verbosity of -i and -u with --verbosePádraig Brady1-5/+4
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.
2023-04-08cp,mv: issue "skipped" messages when skipping filesPádraig Brady1-3/+11
* 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.
2023-04-08cp,mv: add --update=none to always skip existing filesPádraig Brady1-16/+31
Add --update=none which is equivalent to the --no-clobber behavior from before coreutils 9.2. I.e. existing files are unconditionally skipped, and them not being replaced does not affect the exit status. * src/copy.h [enum Update_type]: A new type to support parameters to the --update command line option. [enum Interactive]: Add I_ALWAYS_SKIP. * src/copy.c: Treat I_ALWAYS_SKIP like I_ALWAYS_NO (-n), except that we don't fail when skipping. * src/system.h (emit_update_parameters_note): A new function to output the description of the new --update parameters. * src/cp.c (main): Parse --update arguments, ensuring that -n takes precedence if specified. (usage): Describe the new option. Also allude that -u is related in the -n description. * src/mv.c: Accept the new --update parameters and update usage() accordingly. * doc/coreutils.texi (cp invocation): Describe the new --update parameters. Also reference --update from the --no-clobber description. (mv invocation): Likewise. * tests/mv/update.sh: Test the new parameters. * NEWS: Mention the new feature. Addresses https://bugs.gnu.org/62572
2023-01-31cp,mv: skipping due to -u is success, not failurePaul Eggert1-2/+1
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.
2023-01-31cp,ln,mv: when skipping exit with nonzero statusPaul Eggert4-7/+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.
2023-01-27tests: ensure we fail if mv --no-copy crashesPádraig Brady1-2/+2
* tests/mv/no-copy.sh: Honor `make syntax` check and use the `returns_ 1 ...` pattern.
2023-01-27mv: new option --no-copyPaul Eggert1-0/+33
Wishlist item from Mike Frysinger (Bug#61050). * src/copy.c (copy_internal): Do not fall back on copying if x->no_copy. * src/copy.h (struct cp_options): New member no_copy. * src/mv.c (NO_COPY_OPTION): New constant. (long_options, usage, main): Support --no-copy. * tests/mv/no-copy.sh: New test. * tests/local.mk (all_tests): Add it.
2023-01-01maint: update all copyright year number rangesPádraig Brady42-42/+42
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.
2022-04-20mv: test Bug#55029Paul Eggert1-0/+6
* tests/mv/backup-dir.sh: New test for Bug#55029, reported by Steve Ward.
2022-01-29mv: when installing to dir use dir-relative namesPaul Eggert1-2/+2
When the destination for mv is 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. Likewise for 'install'. * src/cp.c (must_be_working_directory, target_directory_operand) (target_dirfd_valid): Move from here ... * src/system.h: ... to here, so that install and mv can use them. Make them inline so GCC doesn’t complain. * src/install.c (lchown) [HAVE_LCHOWN]: Remove; no longer needed. (need_copy, copy_file, change_attributes, change_timestamps) (install_file_in_file, install_file_in_dir): New args for directory-relative names. All uses changed. Continue to pass full names as needed, for diagnostics and for lower-level functions that do not support directory-relative names. (install_file_in_dir): Update *TARGET_DIRFD as needed. (main): Handle target-directory in the new, cp-like way. * src/mv.c (remove_trailing_slashes): Remove static var; now local. (do_move): New args for directory-relative names. All uses changed. Continue to pass full names as needed, for diagnostics and for lower-level functions that do not support directory-relative names. (movefile): Remove; no longer needed. (main): Handle target-directory in the new, cp-like way. * tests/install/basic-1.sh: * tests/mv/diag.sh: Adjust to match new diagnostic wording.
2022-01-02maint: update all copyright year number rangesPádraig Brady42-42/+42
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.
2021-12-10mv: Bug#52410 fixPaul Eggert1-0/+5
The recent Gnulib update fixed this bug reported by Vincent Vermilya. * tests/mv/backup-dir.sh: Test for Bug#52410.
2021-01-01maint: update all copyright year number rangesPádraig Brady42-42/+42
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.
2020-01-01maint: update all copyright year number rangesPádraig Brady42-42/+42
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-01maint: update all copyright year number rangesAssaf Gordon42-42/+42
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.
2018-01-01maint: update all copyright year number rangesPádraig Brady42-42/+42
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.
2017-09-24copy: revert recent patch for vulnerable dirsPaul Eggert1-38/+0
I plan to propose a better patch to catch vulnerable parent directories. * NEWS, doc/coreutils.texi (Target directory): Document this. * src/cp.c, src/install.c, src/ln.c, src/mv.c: Do not include targetdir.h. (target_directory_operand): Remove test for vulnerable parents. * src/cp.c (stat_target_operand): Remove. All uses removed. * src/local.mk (noinst_HEADERS): Remove src/targetdir.h. (src_ginstall_SOURCES, src_cp_SOURCES, src_ln_SOURCES) (src_mv_SOURCES): Remove src/targetdir.c. * src/targetdir.c, src/targetdir.h: Remove. * tests/mv/vulnerable-target.sh: Remove. * tests/local.mk (all_root_tests): Remove it.
2017-09-19maint: fix new syntax check failures from copy restrictionsPádraig Brady1-1/+1
* doc/coreutils.texi: Remove doubled word. * src/targetdir.c: Explicitly mark exported function. * tests/local.mk: This is not a root only test. * tests/mv/vulnerable-target.sh: Use returns_. Introduced in v8.28-3-g44ccd1c
2017-09-19all: prefer HTTPS in URLsPaul Eggert43-43/+43
2017-09-19copy: check for vulnerable target dirsPaul Eggert1-0/+38
* NEWS, doc/coreutils.texi (Target directory): Document this. * src/cp.c, src/install.c, src/ln.c, src/mv.c: Include targetdir.h. (target_directory_operand): Use the new targetdir_operand_type function to check for vulnerable target directories. * src/cp.c (stat_target_operand): New function. (target_directory_operand, do_copy): Use it. * src/local.mk (noinst_HEADERS): Add src/targetdir.h. (src_ginstall_SOURCES, src_cp_SOURCES, src_ln_SOURCES) (src_mv_SOURCES): Add src/targetdir.c. * src/targetdir.c, src/targetdir.h: New files. * tests/mv/vulnerable-target.sh: New test. * tests/local.mk (all_root_tests): Add it.
2017-08-29tests: don't fail tests when failing to write filesPádraig Brady5-8/+8
* 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.
2017-08-03copy: more-accurate warning about destructionPaul Eggert1-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".
2017-08-01copy: go back to failing 'cp --backup a~ a'Paul Eggert1-8/+15
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.
2017-07-30copy: make backup files more reliablyPaul Eggert1-15/+8
* 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.
2017-05-18mv: distinguish copy and rename operations with --verbosePádraig Brady3-2/+5
* src/copy.c (copy_internal): In x->move_mode distinguish whether we're copying, creating directory, or renaming. * tests/mv/backup-dir.sh: Adjust to new output. * tests/mv/mv-n.sh: Likewise. * tests/mv/mv-special-1.sh: Likewise. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/26971
2017-01-01maint: update all copyright year number rangesPádraig Brady42-42/+42
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.
2016-01-19tests: avoid false failure due to remove() ignoring u-w on NFSPádraig Brady1-1/+1
* tests/rm/rm1.sh: Also remove the group write bit which was required on one NFS setup at least. Note u-w was enough to deny file creation, g-w was also required to deny file removal. * tests/rm/cycle.sh: Likewise. * tests/mv/perm-1.sh: Likewise.
2016-01-13mv: fix data loss with repeated source dir and same destinationPádraig Brady1-10/+36
commit v8.23-31-g90aa291 failed to consider this case, where the previous rename has failed, thus causing the following to remove the specified directory: mv dir dir dir * src/copy.c (copy_internal): Assume this rename attempt has succeeded, as a previous failure will already have been handled, and we don't want to remove the source directory in this case. * tests/cp/duplicate-sources.sh: Consolidate this test file to... * tests/mv/dup-source.sh: ...here. Add test cases for same source and dest. * tests/local.mk: Remove the consolidated test. * NEWS: Mention the bug fix. Reported at https://bugzilla.redhat.com/1297464
2016-01-01maint: update all copyright year number rangesPádraig Brady42-42/+42
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.
2015-11-10tests: ensure programs are built before testingPádraig Brady1-1/+1
programs may not be built due to missing system dependencies, or any program can be excluded at configure time with --enable-no-install-program. So ensure we're not testing the system versions in these cases. * init.cfg (print_ver_): Call require_built_ first. * tests/misc/tty-eof.pl: Skip programs not built. * tests/Coreutils.pm (run_tests): Likewise. * tests/misc/ls-misc.pl: Use 'env test' rather than abs path. * tests/misc/test-diag.pl: Likewise. * tests/local.mk: Adjust include order for dependencies. * tests/misc/arch.sh: Remove redundant calls to require_built_. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/groups-dash.sh: Likewise. * tests/misc/groups-version.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/cp/acl.sh: Remove problematic call to print_ver_ [gs]etfacl. * tests/mv/acl.sh: Likewise. * cfg.mk (sc_env_test_dependencies): A new syntax check to enforce specifying dependencies with print_ver_ for programs specified through the env command. * du/bigtime.sh: Add new print_ver_ dependencies. * du/max-depth.sh: Likewise. * dd/ascii.sh: Likewise. * tests/ls/capability.sh: Likewise. * tests/ls/root-rel-symlink-color.sh: Likewise. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/readlink-fp-loop.sh: Likewise. * tests/misc/sort-debug-keys.sh: Likewise. * tests/readlink/can-e.sh: Likewise. * tests/readlink/can-f.sh: Likewise. * tests/readlink/can-m.sh: Likewise. * tests/tail-2/inotify-race.sh: Likewise. * tests/tail-2/inotify-race2.sh: Likewise. * tests/touch/no-create-missing.sh: Likewise. * tests/touch/no-dereference.sh: Likewise. * tests/misc/printenv.sh: Tweak to avoid syntax check trigger. * tests/misc/help-version.sh: Likewise. * tests/misc/yes.sh: Likewise. * tests/misc/printf-quote.sh: Use previously unused $prog. * configure.ac (EXTRA_MANS): Add $gl_no_install_prog to the list so that check-x-vs-1 syntax check is satisfied.
2015-11-10maint: use standard spacing in shebang line in testsPádraig Brady2-2/+2
It's better to be consistent even though spacing is insignificant: http://www.in-ulm.de/~mascheck/various/shebang/#blankrequired
2015-07-02tests: avoid false failures on OpenBSD 5.7Pádraig Brady1-1/+1
* tests/du/threshold.sh: Homogenize getopt error messages. * tests/misc/numfmt.pl: Likewise. * tests/mv/i-3.sh: Skip on *BSD not just FreeBSD.
2015-05-11tests: cleanup background processes upon interruptionPádraig Brady1-1/+4
Reap background processes so that: - Stray processes aren't left on the system - Files aren't held open causing deletion issues on NFS - Partitions used to run the tests from can be unmounted * tests/tail-2/F-vs-missing.sh: Add the `kill && wait` of the background $pid(s) to cleanup_(). * tests/tail-2/F-vs-rename.sh: Likewise. * tests/tail-2/f-vs-rename.sh: Likewise. * tests/tail-2/append-only.sh: Likewise. * tests/tail-2/assert-2.sh: Likewise. * tests/tail-2/assert.sh: Likewise. * tests/tail-2/flush-initial.sh: Likewise. * tests/tail-2/inotify-hash-abuse.sh: Likewise. * tests/tail-2/inotify-hash-abuse2.sh: Likewise. * tests/tail-2/inotify-race.sh: Likewise. * tests/tail-2/inotify-rotate-resources.sh: Likewise. * tests/tail-2/inotify-rotate.sh: Likewise. * tests/tail-2/pid.sh: Likewise. * tests/tail-2/pipe-f2.sh: Likewise. * tests/tail-2/retry.sh: Likewise. * tests/tail-2/symlink.sh: Likewise. * tests/tail-2/tail-n0f.sh: Likewise. * tests/tail-2/wait.sh: Likewise. * tests/cp/existing-perm-race.sh: Likewise. * tests/cp/file-perm-race.sh: Likewise. * tests/cp/parent-perm-race.sh: Likewise. * tests/cp/sparse-to-pipe.sh: Likewise. * tests/dd/stats.sh: Likewise. * tests/du/move-dir-while-traversing.sh: Likewise. * tests/misc/cat-buf.sh: Likewise. * tests/misc/help-version.sh: Likewise. * tests/misc/printf-surprise.sh: Likewise. * tests/misc/sort-compress-proc.sh: Likewise. * tests/misc/sort-spinlock-abuse.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/misc/tac-continue.sh: Likewise. * tests/misc/timeout-group.sh: Likewise. * tests/mv/i-3.sh: Likewise. * tests/rm/dangling-symlink.sh: Likewise. * tests/rm/isatty.sh: Likewise. * cfg.mk (sc_prohibit_test_background_without_cleanup_): A new syntax-check to ensure cleanup_() is defined when background tasks are created in a test.
2015-01-14tests: add extra protection against unexpected exitsPádraig Brady8-17/+19
Many tests use `program ... && fail=1` to ensure expected error situations are indicated. However that would mask an unexpected exit (like a crash). Therefore explicitly check the expected exit code. Note where error messages are also verified, the extra protection is not added. * tests/init.sh (returns_): A new helper function to check the return code of a command, and used throughout the tests. * cfg.mk (sc_prohibit_and_fail_1): Add a syntax check to avoid new instances of this issue.
2015-01-01maint: update all copyright year number rangesPádraig Brady42-42/+42
Run "make update-copyright" and then... * tests/sample-test: Adjust to use the single most recent year. * tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message, so that year is updated automatically in future.
2014-11-22tests: add a case verifying mv on case insensitive file systemsPádraig Brady2-64/+37
* NEWS: Update the recent entry to also mention the avoidance of incorrectly unlinking a multi-hardlinked "source" file when presented with source and dest that only differ in case. * src/copy.c (same_file_ok): Mention the case issue with same_name(). * tests/mv/hardlink-case.sh: Test the issue on HFS+. * tests/local.mk: Reference the new test case. * tests/mv/vfat: Remove an old related but unused test case.
2014-11-21mv: fail when moving a file to a hardlinkBoris Ranto5-72/+48
We may run into a race condition if we treat hard links to the same file as distinct files. If we do 'mv a b' and 'mv b a' in parallel, both a and b can disappear from the file system. The reason is that in this case the unlink on src is called and the system calls can end up being run in the order where unlink(a) and unlink(b) are the last two system calls. Therefore exit with an error code so that we avoid the potential data loss. * src/copy.c (same_file_ok): Don't set unlink_src that was used by mv, and return false for two hardlinks to a file in move_mode. *src/copy.c (copy_internal): No longer honor the unlink_src option, used only by mv. NEWS: Mention the change in behavior. * tests/cp/same-file.sh: Augment to cover the `cp -a hlsl1 sl1` case. * tests/mv/hard-verbose.sh: Remove no longer needed test. * tests/local.mk: Remove the reference to hard-verbose.sh. * tests/mv/hard-4.sh: Adjust so we fail in this case. * tests/mv/i-4.sh: Likewise. * tests/mv/symlink-onto-hardlink-to-self.sh: Likewise.