aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2024-02-24 19:51:56 +0000
committerPádraig Brady <P@draigBrady.com>2024-02-26 17:33:02 +0000
commit9907b6f5dc3faf370c916c2f81bfcc3d06028e83 (patch)
treecfeb78590e8a194e1d34ec17b241188c4f469589 /tests
parentbuild: fix libcrypto version linked by sort at runtime (diff)
downloadcoreutils-9907b6f5dc3faf370c916c2f81bfcc3d06028e83.tar.gz
coreutils-9907b6f5dc3faf370c916c2f81bfcc3d06028e83.zip
cp,mv: reinstate that -n exits with success if files skipped
* 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
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp/cp-i.sh11
-rwxr-xr-xtests/mv/mv-n.sh11
2 files changed, 10 insertions, 12 deletions
diff --git a/tests/cp/cp-i.sh b/tests/cp/cp-i.sh
index d38268403..02a992c3a 100755
--- a/tests/cp/cp-i.sh
+++ b/tests/cp/cp-i.sh
@@ -29,7 +29,6 @@ echo n | returns_ 1 cp -iR a b 2>/dev/null || fail=1
# test miscellaneous combinations of -f -i -n parameters
touch c d || framework_failure_
echo "'c' -> 'd'" > out_copy || framework_failure_
-echo "cp: not replacing 'd'" > err_skip || framework_failure_
touch out_empty || framework_failure_
# ask for overwrite, answer no
@@ -45,12 +44,12 @@ echo y | cp -vni c d 2>/dev/null > out3 || fail=1
compare out3 out_copy || fail=1
# -n wins over -i
-echo y | returns_ 1 cp -vin c d 2>/dev/null > out4 || fail=1
+echo y | cp -vin c d 2>/dev/null > out4 || fail=1
compare out4 out_empty || fail=1
# -n wins over -i non verbose
-echo y | returns_ 1 cp -in c d 2>err4 > out4 || fail=1
-compare err4 err_skip || fail=1
+echo y | cp -in c d 2>err4 > out4 || fail=1
+compare /dev/null err4 || fail=1
compare out4 out_empty || fail=1
# ask for overwrite, answer yes
@@ -58,11 +57,11 @@ echo y | cp -vfi c d 2>/dev/null > out5 || fail=1
compare out5 out_copy || fail=1
# do not ask, prevent from overwrite
-echo n | returns_ 1 cp -vfn c d 2>/dev/null > out6 || fail=1
+echo n | cp -vfn c d 2>/dev/null > out6 || fail=1
compare out6 out_empty || fail=1
# do not ask, prevent from overwrite
-echo n | returns_ 1 cp -vnf c d 2>/dev/null > out7 || fail=1
+echo n | cp -vnf c d 2>/dev/null > out7 || fail=1
compare out7 out_empty || fail=1
# options --backup and --no-clobber are mutually exclusive
diff --git a/tests/mv/mv-n.sh b/tests/mv/mv-n.sh
index f484c2163..9bd3866cc 100755
--- a/tests/mv/mv-n.sh
+++ b/tests/mv/mv-n.sh
@@ -23,7 +23,6 @@ print_ver_ mv
# test miscellaneous combinations of -f -i -n parameters
touch a b || framework_failure_
echo "renamed 'a' -> 'b'" > out_move
-echo "mv: not replacing 'b'" > err_skip || framework_failure_
> out_empty
# ask for overwrite, answer no
@@ -38,23 +37,23 @@ compare out2 out_move || fail=1
# -n wins (as the last option)
touch a b || framework_failure_
-echo y | returns_ 1 mv -vin a b 2>/dev/null > out3 || fail=1
+echo y | mv -vin a b 2>/dev/null > out3 || fail=1
compare out3 out_empty || fail=1
# -n wins (non verbose)
touch a b || framework_failure_
-echo y | returns_ 1 mv -in a b 2>err3 > out3 || fail=1
+echo y | mv -in a b 2>err3 > out3 || fail=1
compare out3 out_empty || fail=1
-compare err3 err_skip || fail=1
+compare /dev/null err3 || fail=1
# -n wins (as the last option)
touch a b || framework_failure_
-echo y | returns_ 1 mv -vfn a b 2>/dev/null > out4 || fail=1
+echo y | mv -vfn a b 2>/dev/null > out4 || fail=1
compare out4 out_empty || fail=1
# -n wins (as the last option)
touch a b || framework_failure_
-echo y | returns_ 1 mv -vifn a b 2>/dev/null > out5 || fail=1
+echo y | mv -vifn a b 2>/dev/null > out5 || fail=1
compare out5 out_empty || fail=1
# options --backup and --no-clobber are mutually exclusive