Bug 19148 - cp ignores -f and --force at cmdline
Summary: cp ignores -f and --force at cmdline
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: fileutils
Version: 7.0
Hardware: i686
OS: Linux
low
low
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-15 21:56 UTC by Robin Green
Modified: 2006-11-16 10:58 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-10-16 00:03:08 UTC
Embargoed:


Attachments (Terms of Use)

Description Robin Green 2000-10-15 21:56:32 UTC
Version info:

[root@ega051000009 xml-cocoon]# rpm -q -f /bin/cp
fileutils-4.0x-3

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
/greenrd/ws2/xml-cocoon/
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'?
n                                                                           

This bug does not occur on RedHat 6.2.

Comment 1 Alan Cox 2000-10-16 00:03:06 UTC
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 09:17:28 UTC
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 10:58:26 UTC
why rm -f works?


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