[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: cp -if a b: should it prompt? POSIX says `yes', most don't
From: |
Adrian |
Subject: |
Re: RFC: cp -if a b: should it prompt? POSIX says `yes', most don't |
Date: |
Wed, 09 Mar 2005 13:12:38 +0100 |
Hi. I found the following thread on the "cp -if" problem:
http://lists.gnu.org/archive/html/bug-coreutils/2004-02/msg00077.html
which also refers to the discussion at:
https://www.opengroup.org/sophocles/show_archive.tpl?
source=L&listname=austin-group-l&first=1&pagesize=80&searchstring=cp+-
if&zone=G
Recently I upgraded to FedoraCore3, and I saw that my "cp -f" commands,
when launched as root, now ask me for confirmation (they didn't in the
past):
# cp -f a b
cp: ¿overwrite «b»? (y/n)
This happens because old redhat patch is not used any more, as Tim Waugh
explains:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=150558
> 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.
Jim Meyering also commented that in the first mentioned thread:
http://lists.gnu.org/archive/html/bug-coreutils/2004-02/msg00077.html
> Note that RedHat has been using a patch that makes cp's behavior
> non-POSIX, yet consistent with that of most other systems, for years.
I've seen that the behaviour only occurs with root because it has an
alias:
# alias cp
alias cp='cp -i'
So the "cp -f" if equivalent to "cp -i -f". This is what Paul Eggert
comments:
http://lists.gnu.org/archive/html/bug-coreutils/2004-02/msg00092.html
> The main motivation here, I think, is that if you have an alias like
> this:
>
> alias cp cp -i
>
> then "cp -f" should cancel the -i. This alias is (or was) common for
> root on Red Hat systems.
I think I'll define a new default alias for root, for example:
# alias cpf='cp -f'
in order to have a short alternative to the long "cp --reply=yes", that
I commented here:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=150558#c4
> 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.
What's your opinion about adding a -y option to assume "yes" in all
questions?
Thanks
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: RFC: cp -if a b: should it prompt? POSIX says `yes', most don't,
Adrian <=