Bug 19148 - cp ignores -f and --force at cmdline
cp ignores -f and --force at cmdline
Product: Red Hat Linux
Classification: Retired
Component: fileutils (Show other bugs)
i686 Linux
low Severity low
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Aaron Brown
Depends On:
  Show dependency treegraph
Reported: 2000-10-15 17:56 EDT by Robin Green
Modified: 2006-11-16 05:58 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-10-15 20:03:08 EDT
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 Robin Green 2000-10-15 17:56:32 EDT
Version info:

[root@ega051000009 xml-cocoon]# rpm -q -f /bin/cp

When used at the command line, cp always prompts for overwriting a file,
regardless of whether the -f or --force switch is set or not, as shown.
According to "info cp", the -f switch should disable interactive prompting.

[root@ega051000009 xml-cocoon]# cp -f changes.xml /greenrd/ws2/xml-cocoon/
cp: overwrite `/greenrd/ws2/xml-cocoon/changes.xml'? y
[root@ega051000009 xml-cocoon]# cp --force changes.xml
cp: overwrite `/greenrd/ws2/xml-cocoon/changes.xml'?
y                                                    [root@ega051000009
xml-cocoon]# cp changes.xml /greenrd/ws2/xml-cocoon/
cp: overwrite `/greenrd/ws2/xml-cocoon/changes.xml'?

This bug does not occur on RedHat 6.2.
Comment 1 Alan Cox 2000-10-15 20:03:06 EDT
This is because by default cp is aliased to 'cp -i'. The behaviour of the GNU
supplied fileutils has changed so tht cp -i -f  still prompts. 
Comment 2 Bernhard Rosenkraenzer 2000-10-16 05:17:28 EDT
And it's not a bug - the fileutils changelog states that they had to do it because POSIX demands it.

The 'fix' is to get rid of the "cp='cp -i'" alias in your ~/.bashrc.
Comment 3 Edouard Bourguignon 2006-11-16 05:58:26 EST
why rm -f works?

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