summaryrefslogtreecommitdiffstats
path: root/tests/mv
AgeCommit message (Collapse)AuthorLines
2026-02-18tests: use system ENOTEMPTY messagePádraig Brady-5/+5
* tests/mv/dir2dir.sh: Map system specific messages. * tests/rm/d-2.sh: Likewise.
2026-02-18maint: tests: avoid ENOTSUP specific handlingPádraig Brady-5/+3
* tests/mv/mv-exchange.sh: Use ENOTSUP rather than transforming variations.
2026-02-18tests: use system EACCES messagePádraig Brady-5/+8
* tests/chgrp/no-x.sh: Don't harcode "Permission denied". * tests/chmod/no-x.sh: Likewise. * tests/du/inacc-dest.sh: Likewise. * tests/du/no-x.sh: Likewise. * tests/misc/nohup.sh: Likewise. * tests/mv/part-fail.sh: Likewise. * tests/mv/perm-1.sh: Likewise. * tests/rm/fail-eacces.sh: Likewise. * tests/rm/rm1.sh: Likewise. * tests/rm/rm2.sh: Likewise. * tests/rm/unread2.sh: Likewise. * tests/rm/unreadable.pl: Likewise.
2026-02-18maint: tests: avoid EPERM/EACCES specific handlingPádraig Brady-6/+5
* tests/Coreutils.pm: Remove associated comment. * tests/mv/sticky-to-xpart.sh: Use $EACCES and $EPERM. * tests/rm/fail-2eperm.sh: Likewise. * tests/touch/not-owner.sh: Likewise.
2026-01-01maint: run 'make update-copyright'Collin Funk-46/+46
2026-01-01tests: mv: check broken symlink cross-filesystem moveSylvestre Ledru-0/+6
Identified here: <https://github.com/uutils/coreutils/issues/8586> * tests/mv/mv-special-2.sh: Add the check.
2025-12-16tests: mv: check moving named sockets is supportedPádraig Brady-0/+7
* tests/mv/mv-special-2.sh: Use python to create a named socket, and ensure it's copied across file systems.
2025-12-15tests: mv: check traversed fifos copy correctlyPádraig Brady-1/+9
* tests/mv/mv-special-1.sh: Add a case also for fifos encountered when traversing.
2025-12-15tests: mv: add timeout protection when moving fifosPádraig Brady-1/+1
* tests/mv/mv-special-1.sh: Implementations could potentially hang interacting with fifos, so wrap with timeout.
2025-12-11tests: mv: ensure ownership preserved when copyingPádraig Brady-0/+40
* tests/mv/meta-to-xpart.sh: Add new test. * tests/local.mk: Reference new test.
2025-12-01tests: mv: add checks for cross device handling of special filesPádraig Brady-0/+62
* tests/mv/mv-special-2.sh: Add test to ensure we preserve sparse files, character devices, symlinks, when moving across file system boundaries. Addresses https://github.com/coreutils/coreutils/issues/136
2025-11-28tests: prefer ext4 casefold for case insensitive testsPádraig Brady-4/+16
* tests/mv/hardlink-case.sh: Try both ext4 casefold and hfsplus, as ext4 has better availability. Suggested at https://github.com/coreutils/coreutils/issues/133
2025-03-23mv: port test to OpenBSD 7.5Paul Eggert-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 Brady-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 Brady-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 Brady-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 Brady-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 Brady-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 Eggert-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 Brady-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 Malat-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 Brady-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 Brady-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 Brady-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 Eggert-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 Brady-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 Brady-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 Brady-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 Eggert-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 Eggert-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 Brady-2/+2
* tests/mv/no-copy.sh: Honor `make syntax` check and use the `returns_ 1 ...` pattern.
2023-01-27mv: new option --no-copyPaul Eggert-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 Brady-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 Eggert-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 Eggert-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 Brady-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 Eggert-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 Brady-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 Brady-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 Gordon-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 Brady-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 Eggert-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 Brady-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 Eggert-43/+43
2017-09-19copy: check for vulnerable target dirsPaul Eggert-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 Brady-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 Eggert-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 Eggert-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 Eggert-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 Brady-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