Bug 188241 - cp --reply=HOW deprecated misleading
Summary: cp --reply=HOW deprecated misleading
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: rootfiles
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Phil Knirsch
QA Contact: Ben Levenson
URL:
Whiteboard: bzcl34nup
Depends On:
Blocks: FC6Target
TreeView+ depends on / blocked
 
Reported: 2006-04-07 12:34 UTC by Derek Carter
Modified: 2015-03-05 01:16 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-05-06 15:45:58 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Derek Carter 2006-04-07 12:34:17 UTC
Description of problem:
cp --reply=HOW deprecated and the suggested alternative:
cp -f doesn't work due to a default cp alias of cp -i (from root's .bashrc)

Version-Release number of selected component (if applicable):
coreutils-5.93-7.2

How reproducible:
Always

Steps to Reproduce:
1. Login as root (root alias problem)

2. Create two files

3. Use cp to try and overwrite one file with the other using --reply=yes

4. Try to follow suggestion of output (cp -f instead) *fails*

5. Follow suggestion without alias in effect *succeeds*


Actual results:
[root@dohslapd01 tmp]# touch foo bar
[root@dohslapd01 tmp]# cp foo bar --reply=yes
cp: the --reply option is deprecated; use -i or -f instead
[root@dohslapd01 tmp]# cp -f foo bar
cp: overwrite `bar'?
[root@dohslapd01 tmp]# \cp -f foo bar
[root@dohslapd01 tmp]#

Expected results:
[root@dohslapd01 tmp]# touch foo bar
[root@dohslapd01 tmp]# cp foo bar --reply=yes
cp: the --reply option is deprecated; use -i or -f instead
[root@dohslapd01 tmp]# cp -f foo bar
[root@dohslapd01 tmp]#

Additional info:
Although the --reply switch is deprecated in mv as well, it seems to not be
affected with this same problem.

Comment 1 Derek Carter 2006-04-07 12:36:40 UTC
Alias which causes the problem:
alias cp='cp -i'
(located in /root/.bashrc)




Comment 3 Jim Meyering 2006-05-26 14:08:07 UTC
Hi Tim and Derek,

Without --reply=... there is no way to override cp's -i option.
But neither is there a way to turn off --update, -s, -x, etc.
However, if you change root's alias to use --backup=numbered instead of -i,
you get the advantage of -i (not clobbering the target) without the
inconvenience of being prompted.  Also, as the report shows, the alias
can be temporarily disabled with a leading backslash.

I admit that the differences between how -i and -f work in mv and in cp
can be confusing, but they are consistent with historical practice, and
conform to the POSIX specs for those tools.

If you feel strongly that cp should (continue to) provide such an option,
please post to bug-coreutils with as much justification as possible,
so the suggestion gets a wider audience.

Comment 4 Tim Waugh 2006-05-26 14:24:49 UTC
Thanks Jim.  Perhaps the answer is to change the /root/.bashrc alias to
--backup=numbered then.

Comment 5 Jim Meyering 2006-05-26 15:34:33 UTC
I've just realized there is one potential downside.
While cp doesn't change the permissions of an existing destination
(other than resetting special bits),
cp --backup changes the target to have permissions of the
source minus the bits in he umask.

For root, that would present a security risk.

IMHO, it's better to avoid such system-provided aliases altogether.
People with root access are supposed to be clueful enough to deal
with such things.  But, I do see that once you've provided an option
like -i by default, it becomes hard (and risky) to remove it later.

Comment 6 Phil Knirsch 2006-06-28 04:16:52 UTC
I've been giving considerable thought to the change but i'm neither happy with
changing the alias nor with keeping it, though i tend to lean towards not
chaning it.

My reasoning for that is that if a user as root really wants to have
none-interactive operation here he should use the full path of the binary like this:

/bin/cp -f foo bar

in order to be very clear that he/she doesn't want any influence of any kind of
aliases here which could cause any kind of other sideeffects.

It's the same general rule for writing secure scripts e.g., and using commands
like rm, mv or cp in such an unrestricted manner should be really used carefully.

Just my $0.02

Read ya, Phil



Comment 7 Bug Zapper 2008-04-04 02:35:14 UTC
Fedora apologizes that these issues have not been resolved yet. We're
sorry it's taken so long for your bug to be properly triaged and acted
on. We appreciate the time you took to report this issue and want to
make sure no important bugs slip through the cracks.

If you're currently running a version of Fedora Core between 1 and 6,
please note that Fedora no longer maintains these releases. We strongly
encourage you to upgrade to a current Fedora release. In order to
refocus our efforts as a project we are flagging all of the open bugs
for releases which are no longer maintained and closing them.
http://fedoraproject.org/wiki/LifeCycle/EOL

If this bug is still open against Fedora Core 1 through 6, thirty days
from now, it will be closed 'WONTFIX'. If you can reporduce this bug in
the latest Fedora version, please change to the respective version. If
you are unable to do this, please add a comment to this bug requesting
the change.

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we are following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

And if you'd like to join the bug triage team to help make things
better, check out http://fedoraproject.org/wiki/BugZappers

Comment 8 Bug Zapper 2008-05-06 15:45:57 UTC
This bug is open for a Fedora version that is no longer maintained and
will not be fixed by Fedora. Therefore we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen thus bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


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