Bug 150558

Summary: cp -f (force copy) asks for confirmation
Product: [Fedora] Fedora Reporter: Adrian <adrian>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-08 12:40:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adrian 2005-03-08 11:46:09 UTC
Description of problem:
As root, if you run "cp -f file1 file2" and file2 exists, the command
asks for confirmation: "cp: Overwrite �file2�? (y/n)".

The "-f" option should omit the confirmation request.


Version-Release number of selected component (if applicable):
coreutils-5.2.1-31

How reproducible:
Always

Steps to Reproduce:
1. su -
2. touch file1 file2
3. cp -f file1 file2


Actual Results:  I'm asked for confirmation:
  cp: Overwrite �file2�? (y/n) 


Expected Results:  Confirmation shouldn't appear.

Additional info:

FedoraCore3
coreutils-5.2.1-31 (comes with the distribution)

There are no update available in the updates-released repository.

Comment 1 Tim Waugh 2005-03-08 12:40:15 UTC
No, that's not what the -f option is for.  Use --reply=yes to omit confirmation
questions.

Comment 2 Adrian 2005-03-08 14:14:10 UTC
Sure? I've always used -f option to avoid the question.

Running "cp --help" I obtain:
  -f, --force     borra los destinos que ya existan, sin preguntar

Translated:
  -f, --force     deletes existing destinations, without asking


Maybe a recent change in the functionality of cp?

Comment 3 Tim Waugh 2005-03-08 14:40:12 UTC
Yes, I'm sure -- and if that's what cp --help really says then the
translation is incorrect.

Here is the original:

  -f, --force                  if an existing destination file cannot be
                                 opened, remove it and try again

This is POSIX territory.  We *used* to patch cp so that -f also had
the effect that --reply=yes now does, because at the time the latter
option did not exist.

Comment 4 Adrian 2005-03-08 15:08:28 UTC
I see...
Hmmm, the new option looks a bit long:

  cp --reply=yes ...

Let me make a suggestion. What about patching cp so that -y assumes
"yes" in all questions?

  cp -y ...

The -y option is used in many commands, and I suppose it would be
useful for cp too.

Comment 5 Tim Waugh 2005-03-08 16:25:15 UTC
It's better to have fewer patches in our packages -- we already patch coreutils
heavily enough.

Feel free to suggest this on the bug-coreutils mailing list.