[nycbug-talk] Safety Expansion for FreeBSD rm(1)

Jesse Callaway bonsaime at gmail.com
Mon Oct 1 12:19:56 EDT 2007


On 10/1/07, Steven Kreuzer <skreuzer at exit2shell.com> wrote:
> Greetings-
>
> I am reading through the freebsd-current mailing list and I stumbled upon a
> proposed patch that I thought was rather interesting
>
> Basically, is a patch to rm that first reads ~/.rm before actually removing
> anything to make sure that what you are trying to delete isn't "protected"
>
> Example, if I did rm -rf ~ /bin (when I really wanted ~/bin) it would check
> to make sure that /bin and ~ are allowed to be removed.
>
> I am kinda on the fence about this, but think it could be a useful way to
> protect yourself from yourself
>
> Project Page: http://people.freebsd.org/~daichi/safety-rm/
> eMail thread on freebsd-current: http://marc.info/?l=freebsd-current&m=119072708632143&w=2
>
> What do you think?
>
> --
> Steven Kreuzer

I don't think it's a good idea. We need to keep rm speedy, the disks
are slow enough as it is. It's way too trivial to write one's own
wrapper for rm. The way to do it is to make an alias for rm in your
profile which points to a shell script of whatever design is desired
for the "recycle bin".

I shudder to think if all the command tools went this way. Aside from
breaking a good deal of scripts it takes away the direct control feel
of the shell. Do you want something to make sure you're not dd-ing the
wrong thing? Sounds good, go ahead and do it, but not as part of the
OS.

I think that using permissions might be another sane way to do this.
If it shouldn't be deleted, then set the bits.

If it's a port/package then I think it's a great idea because a lot of
people invent this wheel.

-jesse



More information about the talk mailing list