Bug 19148

Summary: cp ignores -f and --force at cmdline
Product: [Retired] Red Hat Linux Reporter: Robin Green <greenrd>
Component: fileutilsAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED NOTABUG QA Contact: Aaron Brown <abrown>
Severity: low Docs Contact:
Priority: low    
Version: 7.0   
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: 2000-10-16 00:03:08 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 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?