From c7ec75a27687bc30627e70c9f14d80de778a0d85 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Sep 2023 16:25:00 -0700 Subject: [PATCH] cp,mv,install: add copy_internal comment * src/copy.c (copy_internal): Add comment about some particularly tricky logic. --- src/copy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/copy.c b/src/copy.c index 0c2004c7b0..e9924fb499 100644 --- a/src/copy.c +++ b/src/copy.c @@ -2292,6 +2292,13 @@ copy_internal (char const *src_name, char const *dst_name, if (! new_dst) { + /* Normally, fill in DST_SB or set NEW_DST so that later code + can use DST_SB if NEW_DST is false. However, don't bother + doing this when rename_errno == EEXIST and X->interactive is + I_ALWAYS_NO or I_ALWAYS_SKIP, something that can happen only + with mv in which case x->update must be false which means + that even if !NEW_DST the move will be abandoned without + looking at DST_SB. */ if (! (rename_errno == EEXIST && (x->interactive == I_ALWAYS_NO || x->interactive == I_ALWAYS_SKIP))) -- 2.47.2