GNU bug report logs -
#15232
cp: "-i a/s b/s c" ask for confirmation then still fails
Previous Next
Full log
View this message in rfc822 format
On 09/01/2013 08:37 AM, jidanni <at> jidanni.org wrote:
> $ cp -i a/s b/s c
> cp: overwrite ‘c/s’? y
> cp: will not overwrite just-created ‘c/s’ with ‘b/s’
> Mmmm OK, but maybe don't ask then.
This is a fair point.
There are two ways to handle this.
1. Do allow the overwrite if 'y' answered.
2. Don't prompt and just display the error.
Case 1 could be useful if you wanted to give
priority to the last item copied in.
However there would be an ambiguity in that case,
as you wouldn't know if the prompt was for an
existing file or a newly copied file.
Also that use case is handled with -n anyway,
by just ordering the parameters according to priority.
So option 2 as you suggest seems like the right thing to do.
So this is a generally means we might only prompt
_after_ we discount all cases that aren't allowed.
Another for example is:
$ rm -f c/s && mkdir c/s && cp -i a/s b/s c
cp: overwrite `c/s'? y
cp: cannot overwrite directory `c/s' with non-directory
cp: overwrite `c/s'? y
cp: cannot overwrite directory `c/s' with non-directory
But then on the other hand, if you did answer 'n' above,
the exit code from cp would be 'success' rather than 'failure'.
I.E. it would be a change in behavior to adjust this,
rather than just a prompt avoidance.
I.E. it's only a redundant prompt when you answer 'y'.
So I'm inclined to leave this as is?
thanks,
Pádraig.
This bug report was last modified 6 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.