bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#70887: In coreutils 9.5, "cp" command does not honor "--interactive"


From: Paul Eggert
Subject: bug#70887: In coreutils 9.5, "cp" command does not honor "--interactive" option
Date: Sun, 12 May 2024 08:06:01 -0700
User-agent: Mozilla Thunderbird

On 2024-05-12 04:49, Pádraig Brady wrote:

@@ -1151,7 +1151,8 @@ main (int argc, char **argv)
                 {
                   /* Default cp operation.  */
                   x.update = false;
-                  x.interactive = I_UNSPECIFIED;
+                  if (x.interactive != I_ASK_USER)
+                    x.interactive = I_UNSPECIFIED;
                 }
               else if (update_opt == UPDATE_NONE)
                 {
@@ -1166,7 +1167,8 @@ main (int argc, char **argv)
               else if (update_opt == UPDATE_OLDER)
                 {
                   x.update = true;
-                  x.interactive = I_UNSPECIFIED;
+                  if (x.interactive != I_ASK_USER)
+                    x.interactive = I_UNSPECIFIED;

Thanks for looking into this messy area. Here is a comment from another pair of eyes.

Could you elaborate a bit more about why these two bits of code change x.interactive at all? That is, why doesn't update_opt simply affect x.update? Why does update_opt bother to override a previous setting of x.interactive to I_ALWAYS_YES, I_ALWAYS_NO, or I_ALWAYS_SKIP?

Another way to put it: shouldn't x.update simply reflect the value of the --update option, whereas x.interactive reflects reflects whether -f, -i, -n are used? Although this would require changes to copy.c, it'd make the code easier to follow.

Another way to put it: why should, for example, --update=all override a previous -f or (partly) -n but not a previous -i?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]