Hi,
I don't know how many times a day some system administrator, junior sysadmin,
part-time unix admin
on this planet deletes the root directory by accident. I have personally heard of two
cases, one of
them just yesterday:
Scenario:
=========
A web developer, actually somewhat savvy on the shell, tries to remove some
directories and makes a
deadly typo:
rm -r /home/username /*
He was following instructions from a memo and thought that there was a space after the
username.
I don't have to tell you what our server administrator is doing right now .......
Suggestion:
===========
If an argument looks like / or /* then prompt the user with a message like this:
user@localhost> rm -r /*
rm: You are about the remove all entries from the root filesystem.
This will make your system unusable, are you sure? (y/n)
Implications:
=============
I realize that this could annoy some hard core shell users who don't want to see
themselves limited,
but in the end it's those gurus that have to fix the problem while they could do
better things. Well,
to be on the safe side I would introduce an additional switch similar to this:
--no-rootdir-check
to restore the original behaviour of the rm command, maybe somebody uses "rm -rf /" in
a shellscript,
but I really can't imagine who would do such a thing, and why.
I personally see no reason to ever delete the root dir, I don't know what you guys
think.
Code:
=====
I looked at the code (I have some C knowledge) and think that this could be somewhat
easily inserted
in the rm.c file when the argv[]s are being checked.
I offer to add that change to the rm.c file, but think that you could probably do it
more elegant
and faster.
Benefits:
=========
This would probably save thousands of hours every year and make Linux more friendly to
users that are not
yet all the way in understanding every single command.
I would appreciate your feedback and hope that you find my suggestion useful as well.
Best regards,
Ingmar Koecher.
_______________________________________________
Bug-fileutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-fileutils