Bug 150558 - cp -f (force copy) asks for confirmation
cp -f (force copy) asks for confirmation
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Depends On:
  Show dependency treegraph
Reported: 2005-03-08 06:46 EST by Adrian
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-08 07:40:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Adrian 2005-03-08 06:46:09 EST
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):

How reproducible:

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:

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 07:40:15 EST
No, that's not what the -f option is for.  Use --reply=yes to omit confirmation
Comment 2 Adrian 2005-03-08 09:14:10 EST
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

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

Maybe a recent change in the functionality of cp?
Comment 3 Tim Waugh 2005-03-08 09:40:12 EST
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 10:08:28 EST
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 11:25:15 EST
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.

Note You need to log in before you can comment on or make changes to this bug.