Protection from the dreaded "rm -fr /"

Giorgos Keramidas keramida at freebsd.org
Sat Oct 2 10:10:56 PDT 2004


On 2004-10-02 11:46, "Jacques A. Vidrine" <nectar at freebsd.org> wrote:
>
> Will the next step be to prevent `rm -fr *' iff the current working
> directory is '/' ?  Please explain your answer.  :-)

No.  The fact * was passed is not visible to the running program.  It's
probably better to do this in the shell before it does the wildcard
expansion, just like tcsh does.  The "rm -fr / tmp/foo" case *is*
visible to the running program though and is a lot easier to handle.

I see a lot of people don't like the change, even though I made it
default to off and controlled by an environment variable.  There's
no reason to keep pushing for it, then.



More information about the freebsd-hackers mailing list