GNU bug report logs - #70887
In coreutils 9.5, "cp" command does not honor "--interactive" option

Previous Next

Package: coreutils;

Reported by: Robert Hill <hill-robert <at> hotmail.com>

Date: Sun, 12 May 2024 01:03:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 70887 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>,
 Robert Hill <hill-robert <at> hotmail.com>, 70887 <at> debbugs.gnu.org
Subject: Re: bug#70887: In coreutils 9.5, "cp" command does not honor
 "--interactive" option
Date: Sun, 12 May 2024 08:06:01 -0700
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?




This bug report was last modified 213 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.