my $path = something_that_can_return_undef_on_failure;
`rm -rf /$path`;
during the execution of its test suite. The author didn't catch it in testing because he never ran "make test" as root (who would?). But people on the Internet ran "make test" as root, with disastrous consequences.Ooops.
11–20 of 247 posts
I don't remember the exact details, but a few years ago there was a Perl module that did something like:
Re: Ooops.
#12Re: Ooops.
#13This terrifies me now of every single install script that refuses to run if not root.
Re: Ooops.
#14just tried to explain this to a few of my windows using coworkers.
Re: Ooops.
#15rm is like a knife where the handle has a sharp edge too...
Re: Ooops.
#16reminds me of http://thedailywtf.com/Articles/Bourne-Into-Oblivion.aspx
That never gets old
Re: Ooops.
#17I use the safe-rm ( http://freshmeat.net/projects/safe-rm ) package to help me avoid doing this kind of thing.
Do you not find that a lack of wide installation limits its usefulness?
You can use GNU remove, which lets you put arguments last for safety, on any Linux box:
Eg:
rm /whatever -rf
Ie, if you hit enter too early, you still haven't forced.
I've been using Linux for 14 years and have never accidentally rm'd recursively. I'm not sure when they added it, but I've been using it for a very long time.
Re: Ooops.
#18While we're on the subject, has anyone successfully found/created a replacement for rm on OS X that moves files to the trash, but doesn't break the interface of rm for use in scripts?
Re: Ooops.
#19just tried to explain this to a few of my windows using coworkers.
Just tell them it's the same as a Windows installer accidentally removing the entire Program Files directory.
Re: Ooops.
#20just tried to explain this to a few of my windows using coworkers.
"Tried?" Certainly it wasn't that hard to explain.