]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cp,mv,install: add copy_internal comment
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Sep 2023 23:25:00 +0000 (16:25 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Sep 2023 23:25:39 +0000 (16:25 -0700)
* src/copy.c (copy_internal): Add comment about
some particularly tricky logic.

src/copy.c

index 0c2004c7b0ce88be4b6a3b6d8710c410d737510b..e9924fb499a675b360a61e10eb8b5848918d3390 100644 (file)
@@ -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)))