mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-08-13 05:32:19 +02:00
cp,mv: skipping due to -u is success, not failure
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.
This commit is contained in:
+4
-3
@@ -9191,8 +9191,8 @@ results in an error message on systems that do not support symbolic links.
|
||||
@opindex --update
|
||||
@cindex newer files, copying only
|
||||
Do not copy a non-directory that has an existing destination with the
|
||||
same or newer modification timestamp; silently fail instead.
|
||||
If timestamps are being preserved,
|
||||
same or newer modification timestamp; instead, silently skip the file
|
||||
without failing. If timestamps are being preserved,
|
||||
the comparison is to the source timestamp truncated to the
|
||||
resolutions of the destination file system and of the system calls
|
||||
used to update timestamps; this avoids duplicate work if several
|
||||
@@ -10124,7 +10124,8 @@ fail with a diagnostic instead of copying and then removing the file.
|
||||
@opindex --update
|
||||
@cindex newer files, moving only
|
||||
Do not move a non-directory that has an existing destination with the
|
||||
same or newer modification timestamp; silently fail instead.
|
||||
same or newer modification timestamp;
|
||||
instead, silently skip the file without failing.
|
||||
If the move is across file system boundaries, the comparison is to the
|
||||
source timestamp truncated to the resolutions of the destination file
|
||||
system and of the system calls used to update timestamps; this avoids
|
||||
|
||||
+1
-1
@@ -2197,7 +2197,7 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ ln -s file b || framework_failure_
|
||||
ln -s no-such-file c || framework_failure_
|
||||
ln -s no-such-file d || framework_failure_
|
||||
|
||||
returns_ 1 cp --update --no-dereference a b || fail=1
|
||||
returns_ 1 cp --update --no-dereference c d || fail=1
|
||||
cp --update --no-dereference a b || fail=1
|
||||
cp --update --no-dereference c d || fail=1
|
||||
|
||||
Exit $fail
|
||||
|
||||
+1
-2
@@ -29,8 +29,7 @@ for interactive in '' -i; do
|
||||
# This is a no-op, with no prompt.
|
||||
# With coreutils-6.9 and earlier, using --update with -i would
|
||||
# mistakenly elicit a prompt.
|
||||
returns_ 1 $cp_or_mv $interactive --update old new </dev/null >out 2>&1 ||
|
||||
fail=1
|
||||
$cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
case "$(cat new)" in new) ;; *) fail=1 ;; esac
|
||||
case "$(cat old)" in old) ;; *) fail=1 ;; esac
|
||||
|
||||
Reference in New Issue
Block a user