OT: the rm bug hit me again
Nigel Wade
nmw at ion.le.ac.uk
Mon Oct 30 09:52:12 UTC 2006
Jeff Vian wrote:
> On Fri, 2006-10-27 at 14:41 +0100, Nigel Wade wrote:
>> Mike McCarty wrote:
>>> Arthur Pemberton wrote:
>>>> On 10/25/06, Robin Laing <Robin.Laing at drdc-rddc.gc.ca> wrote:
>>>>
>>>>> Graphical file manager? That isn't the *nix way of doing things. :)
>>>>>
>>>>> And the -f in the rm command it to stop the "Confirm delete?" questions.
>>>>> My rm is set to confirm all deletes using alias.
>>>>>
>>>>> --
>>>>
>>>> How exactly did you do this? I got bit by this bug once in my Linux
>>>> life, would prefer it never happens again.
>>>>
>>> alias rm='rm -i'
>>>
>> That's not a good idea as it teaches you to expect to be prompted, and you'll be
>> bitten badly some time when the alias isn't present.
>>
> Strange that you feel this is wrong.
I just think it's dangerous to become reliant on that non-standard behaviour of
a potentially very dangerous command. If you expect the prompt when you wildcard
rm, then you'll suffer when it isn't there. At first it might start out as a
useful safeguard, but over time you will become subconsciously trained to expect
it. You get used to typing 'rm *' and answering 'y' to those files you want to
be deleted, until you do that on a system where the alias isn't present, or you
are logged on as a user who doesn't have the alias.
>
> Fedora has from the beginning done exactly that for the root user, and
> the reason is to help prevent those type human errors when you are root
> and have the power of god to destroy your system.
I don't only use Linux/Fedora... Getting used to a "feature" of one system, and
then expecting it on another, is a route to disaster with a command like rm.
>
> For me, I never run as root unless absolutely necessary, and I always
> preview my commands before I hit enter.
It's not a root issue, it's a global issue. Any user can delete files by mistake
if they expect to be prompted when they wildcard rm.
>
> I personally like the prompt because it reminds me that I am running as
> root.
That's the worst of all positions to have the alias. A user who expects rm to
prompt will only delete their own files if it doesn't, a root user who expects
rm to prompt can delete the entire system if it doesn't. I would never, ever,
want to rely on non-standard behaviour of such a dangerous command. What will
you do if your root .bash_profile, or whatever script sets the alias for root,
gets deleted, modified or in some other way not executed? Or if you administer a
system which isn't running Fedora?
It's better to train yourself to review any rm command with a wildcard in it,
than it is to get used to being prompted by rm.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw at ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
More information about the fedora-list
mailing list