17 ms·
Ooops.
- gm 15y agolol, f*ckups don't get any bigger than this
- hackermom 15y ago<rm -rfi> -i interactive mode man is here to save the day - now you can put up to 50% more blame on the end-user!
- mootothemax 15y agoThis release fixes the install script; it no longer deletes the /usr directory in its entirety. But how on earth did this get through even basic testing? Absolutely shocking!
- djcapelis 15y agoNot really that shocking if you realize it's a mostly one man project that probably doesn't have basic testing.
- latch 15y agoSeems non-trivial to test. First, its in a bash install script - i wouldn't know where to start. Second, if you tested the behavior, you might just test that it "deletes /urs/lib/nvidia-current/xorg/xorg" by running the install script and checking that the folder is gone. Guess what, the folder is gone...test passes.
- jefffoster 15y agoI use the safe-rm (http://freshmeat.net/projects/safe-rm http://freshmeat.net/projects/safe-rm) package to help me avoid doing this kind of thing.
- troutwine 15y agoDo you not find that a lack of wide installation limits its usefulness?
- mikemaccana 15y agoYou 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.
- jefffoster 15y agoI just use it for my boxes. It doesn't stop me putting something silly in a make file (as in the example here), but it does stop me getting burnt by it.
- troutwine 15y agoI see; thank you.
- sbierwagen 15y agoNeat. I just installed that on my machines.
- deleted 15y ago[deleted]
- yesimahuman 15y agoThis terrifies me now of every single install script that refuses to run if not root.
- thomas11 15y agoWith a bug like this, an install script without root permissions can still wipe out your $HOME when messing around in the dotfiles. Scary!
- billswift 15y agoThat is why I keep a second home directory, /home/experimental for trying things out.
- jedbrown 15y agohttp://linux.die.net/man/1/fakeroot http://linux.die.net/man/1/fakeroot
- code_duck 15y agoI backup a couple of servers daily, why not the ol' home machine too?
- malux85 15y agoOHHHHHHHHHHHH wow .... great link, passed around the office for a few laughs ... this is one of those heart sinking moments ....
- wladimir 15y agoReminds me of some slackware install script back in 1999 or so, I think it was for the gnome documentation. Anyway, it accidentally removed rm-rf'ed /, I only discovered it in time because it gave errors about removing nodes in /proc...
- jrockway 15y agoI don't remember the exact details, but a few years ago there was a Perl module that did something like: 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.
- SwellJoe 15y agoI'm not sure if you're being sarcastic with the "who would?" portion of your comment, but doesn't cpan run tests, by default, whenever installing something? And, most people who aren't Perl developers with their own private Perl installation install CPAN modules as root, so they are available to all users. So, to answer the question seriously: Most people.
- jrockway 15y agoUh, the cpan client runs "make install" as root, not "make test".
- floriancargoet 15y ago$ rm -rf / rm: it is dangerous to operate recursively on `/' rm: use --no-preserve-root to override this failsafe
- mootothemax 15y agorm: use --no-preserve-root to override this failsafe Brilliant, at long last at least a bit of protection! :) Sadly, I can still remember doing this to my one of my first Linux installs, albeit via the classic: rm -fr .* On the plus side, that day I learned one hell of a lot about how Linux works ;)
- tripa 15y agohttp://use.perl.org/~Alias/journal/34680 http://use.perl.org/~Alias/journal/34680
- nickolai 15y agoreminds me of http://thedailywtf.com/Articles/Bourne-Into-Oblivion.aspx http://thedailywtf.com/Articles/Bourne-Into-Oblivion.aspx
- orenmazor 15y agojust tried to explain this to a few of my windows using coworkers.
- stephen_g 15y agoJust tell them it's the same as a Windows installer accidentally removing the entire Program Files directory.
- mikemaccana 15y agoIt's a DELTREE on %whateveritis%
- Splines 15y agoPool of Radiance had a bug where the uninstaller would wipe your hard drive. Oops. http://arstechnica.com/reviews/01q4/pool_of_radiance/pool-1.html http://arstechnica.com/reviews/01q4/pool_of_radiance/pool-1....
- aidenn0 15y agoOkay, that is not the pool of radiance I played as a kid.
- nuclear_eclipse 15y agoand the entire windows directory, and the entire users directory, and ...
- stephen_g 15y agoIt was only deleting /usr, which doesn't contain home directories or config files. I suppose that /usr does store a good chunk of what the Windows directory has in it though.
- nuclear_eclipse 15y agoSorry, was thinking of the awful `rm -rf /` variant...
- phaedrus 15y agorm is like a knife where the handle has a sharp edge too...
- Trufa 15y agoA double edge knife/sword?
- baq 15y agomore like a double-edge bladed boomerang that'll come back to bite you in the ass if you throw it just the right way.
- AretNCarlsen 15y ago"Double-edged sword" has never worked for me, as a cliche. Do you often find yourself inadvertently smacking against the dull side of a single-edged sword, such that you stay away from double-edged swords for your own safety? rm is like a double-ended knife, i.e.: http://image.shutterstock.com/display_pic_with_logo/4253/4253,1131019295,1/stock-photo-double-bladed-throwing-knife-686738.jpg http://image.shutterstock.com/display_pic_with_logo/4253/425... (Fun fact: many knife throwers grip the blade end anyway, rendering the cliche to an even simpler "rm is like a knife".)
- daeken 15y agoThis is completely unrelated to the original topic at hand, but I thought it might be interesting to shed some light on knife throwers' grips. For a given thrown weapon, whether a knife or an axe (or anything else that is meant to spin end-over-end), the number of revolutions is roughly fixed and is a function of the distance from the thrower to the target. Thus if you happen to be at a distance where you're getting a half revolution, you'll throw from the knife blade, or turn the axe around (so it's pointing towards you on throw). That enables it to hit the target the right way around. Of course, many people prefer to take a half-revolution step forwards/back so that they can throw from the tip regardless, just as a matter of form -- I did this for a while, although I feel I get better control when throwing from the handle.
- JonnieCache 15y agoWhile 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?
- mikemaccana 15y agoNormal Unix method of doing this is via LD_PRELOAD, then you wrap unlink() in something that moves things to a folder. I used something - think it was libtrash - when I used Linux on the desktop, but haven't investigated what the OS X equivalent would be.
- neanderdog 15y agormtrash http://www.nightproductions.net/cli.htm http://www.nightproductions.net/cli.htm I prefer 'brew install rmtrash'
- JonnieCache 15y agoThere's lots of stuff like that out there, I'm talking about something I can actually replace the rm binary with, a wrapper that precisely maintains the rm interface as described here: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/rm.1.html http://developer.apple.com/library/mac/#documentation/Darwin... I like the idea of actually wrapping the unlink syscall, but I have no idea if/how darwin allows that.
- ordinary 15y agoYou can alias trash-cli over rm, though it ignores -i, -r and -f and instead runs recursively, forced and non-interactively by default.
- maweaver 15y agoI use trash-cli (http://code.google.com/p/trash-cli/ http://code.google.com/p/trash-cli/) on Linux, it is in Python so it shouldn't be too hard to get running on OS X (although I guess you might have to modify the location of the trash folder)
- JoachimSchipper 15y agoIt's a pretty messy script anyway - rm'ing /usr/lib/nvidia-current/xorg/xorg doesn't strike me as the most delicate approach to the problem.
- bradly 15y agoHere is the original bug report. https://github.com/MrMEEE/bumblebee/issues/123 https://github.com/MrMEEE/bumblebee/issues/123 I've never heard of BumbleBee, but it must be great if a user can have their machine wiped out and still thank the library author for their work.
- callahad 15y agoThe other bug reports linked in the commit are kind of sad. From 122: "I thinking that something is messed up with bashrc or sh because in few seconds I cannot execute any command in other terminal. Am I doing something wrong? Hope You can help me." https://github.com/MrMEEE/bumblebee/issues/122 https://github.com/MrMEEE/bumblebee/issues/122
- srl 15y agoIt is great. Quality linux support for nvidia optimus cards is pretty important for a lot of people I know, and bumblebee appears to provide it. (Apparently, optimus cards act /really/ strangely without a proper driver.)
- kragen 15y agoTo be fair, it was only rendering the machine unusable, not wiping out your home directory. A simple OS reinstall should get people back to square one. (Unless the OS reinstall script was botched and formats your disk when you've told it not to, which I've heard the latest Ubuntu does.)
- ch0wn 15y agoThat poor guy. But I appreciate the reminder to double-check any rm command.
- shrikant 15y agoPerhaps because I'm not a GitHub user, and because I've only ever peeked at HNers' GitHub accounts, but I was always under the impression that given the nature of the service, it would have an early-days-of-HN feel wrt to user behaviour. It was a little disheartening to see the number of Reddit-esque comments that are simply a couple of words along the lines of "omfg" and a constant stream of meme abuse. I expected better from the programming community. Sigh. Am I just becoming old, jaded and too elitist for my own good?
- cruise02 15y agoNo, that was exactly my impression as well. Those comments remind me more of the Daily WTF where everyone points and laughs, but people rarely step forward to explain exactly what the problem is, and more importantly the solution.
- crikli 15y agoI laugh at Daily WTF but I always cringe thinking about some of those its3AMgottalaunchat8AMshitI'msotired nasty kludgy hacks I've been responsible for. Or just the times I was well rested, under no pressure, and just coughed up some stupid.
- monochromatic 15y agoIt's like reading Youtube comments--not for the faint of heart. And the jab at reddit from the HN pedestal is probably misguided... reddit used to be more like HN, and HN is becoming more like the bad parts of reddit every day. Every site tends toward Youtube level comments as time passes, and the people who don't like it eventually jump ship to a new site, and then the process repeats itself.
- RyanMcGreal 15y agoIf your account is less than a year old, please don't submit comments saying that HN is turning into Reddit. (It's a common semi-noob illusion.) http://ycombinator.com/newsguidelines.html http://ycombinator.com/newsguidelines.html
- srean 15y agoI learned a rather unusual trick to keep myself safe from unintended glob matches. It is not "fool"-proof, but it will probably dilute an unmitigated disaster into an incomplete disaster: Keep a file named -i in the sensitive directories. When glob picks it up, which should be fairly early, it will be treated like a command line argument. Has saved me on occasions. I also had a friend in school who used to, for whatever reasons, name his files using characters drawn from a pool of only two characters. One being "." the other "*". Please don't ask me why. He would then try to delete some particular file. You can well imagine what would happen next. This happened multiple times, till I went ahead and populated his directories with "-i" files. That worked great. I usually keep rm aliased to 'rm -i', but once I did get burned. It was not because of hitting return early but because of having a space between a directory and the trailing "/".....while running rm as root. It was taking a bit longer than I had imagined, so I looked again at the prompt to see what had I typed..$#@!&~ :)
- trafficlight 15y agoI hate that feeling you get in the pit of your stomach after you realize what's happening. Same thing when you forget the WHERE on a DELETE FROM.
- tomjen3 15y agoUse the Dummy switch: http://sql-info.de/mysql/notes/I-am-a-dummy.html http://sql-info.de/mysql/notes/I-am-a-dummy.html
- illumin8 15y agoSweet! Just "alias mysql='mysql --i-am-a-dummy'" in /etc/profile and never make mistakes again!
- jerf 15y agoOver the years I've been steadily training myself to type "WHERE" earlier in the process, until I have finally settled on the obvious-in-hindsight solution: Always simply start with the WHERE clause. (Of course every effort not to be on the SQL shell of a production server in the first place should be taken, but sometimes you need a sledgehammer and nothing else will work.)
- Yhippa 15y agoDas ist nein gut.
- delinka 15y agoNever use rm's -f flag while operating as the root user. Never. Replace with -i until you are absolutely 100% certain the script you're writing works as expected. Always doubt yourself; be humble.
- nathanb 15y agoThe -I flag is a bit more friendly; one may safely alias rm to rm -I and not even notice on the common case (deleting a single file).
- billswift 15y agoI use a script that moves a file to a ~/.trash directory when I use rm. If I am sure I want to actually delete a file permanently I just use /bin/rm.
- gnoupi 15y agoBut that's also the best way to becoming careless about typing "rm". And the day you will be ssh'd on another computer, you may forget that you are using a command which is really deleting.
- nathanb 15y agoSounds like a great way to fill up your disk to me.
- presto8 15y agoYou could use a cron job that removes the "deleted" files after some period, such as 30 days.
- crikli 15y agoThe reason we all know to be careful with rm -r is because of that one time we weren't. Me, it was the time I rm r'ed the MySQL data directory for my company's customer service management system. Oops. Thankfully we had a backup from the month prior, but I learned two things that day: a) be really careful with rm and b) take it on yourself to make sure IT is backing up stuff that you're messing with. You gotta hedge against your own stupid. What about you, how'd you learn the hard way?
- nl 15y agoIn a script: sudo chown -R username:group $WEBAPP For various reasons, $WEBAPP got set to "/ usr/local/blah/blah" (note the space) I had the Linode backup service, so got away with restoring the whole VM from the previous night's backup.
- illumin8 15y agoWas asked to uninstall IBM/Rational ClearCase from our source code repository server. Apparently at the time, Clearcase's installer NFS mounted 127.0.0.1:/ to a subdirectory. Don't ask me what brain-dead system designer thought this was a good idea. So, I did a simple /etc/init.d/clearcase stop (not sure that is the exact name) and: # rm -rf /opt/clearcase (hmm... that seems to be taking a little too long to run) Panic - then ctrl-C - it was too late, /opt/clearcase/foo was NFS mounted 127.0.0.1:/ and it had already trashed /bin, /sbin, /etc, /var, and most of /usr. Luckily I had good backups, but we did spend the rest of the day rebuilding the source repository while the developers couldn't check in any code.
- CGamesPlay 15y agoI've also done this, but it was a cPanel server and the jailshell did bind mounts to various directories on the system. I tried to remove the jailshell instance, and ended up removing a whole lot more.
- endgame 15y agoNot useful in your case, but I've made a habit of using rmdir when removing directories that I think might be mounted.
- Garbage 15y agohttp://www.google.com/codesearch#search/&q=%22rm%20-rf%20/%20%22&type=cs http://www.google.com/codesearch#search/&q=%22rm%20-rf%2...
- Jach 15y agoA couple months ago I had to recover some rm'd files by basically grepping 512-byte blocks on the file system for the file headers then writing out the next few KB to a file on a separate partition to manually go through.. My command sequence was more like this though, rather than a straight rm: find -name '*.java' | xargs grep --color 'something' # guh, get rid of these old copied .svn dirs polluting output find -name '.svn' | xargs rm -rf # now what was that.. find -name '*.java' | xargs rm -rf Forgot to edit the right side of the pipe back to the grep. Zealous use of the up-arrow burned me...
- cool-RR 15y agoIs there a good reason why Linux doesn't have a recycle bin?
- trustfundbaby 15y ago<sarcasm>because real Operating systems don't need one?</sarcasm>
- cool-RR 15y agoThat's what I thought. I'd be happy if anyone chimed in with a legitimate reason, but I won't be surprised if the lack of a recycling bin is just one more symptom of the Linux developer community's apathy towards the actual human beings who use their software.
- uxp 15y agoI would speculate that it is a historical reason. It's no secret that the Unix environment was not designed for personal use in homes, but on mainframe time shared computers inside universities and businesses. Space was limited, and just moving files to another location to deal with later added unnecessary steps to a process that didn't have much of a benefit, at the time. As space has become less valuable on computers, and they have become less of a specialized tool, it may be wise to add one, but most of the desktop environments already implement it already so there is no need to recreate the functionality at a lower level.
- danso 15y agoI hate languages with significant whitespace
- dfranke 15y agoThe "significant whitespace" here is a space between command-line arguments. For that to qualify, you'd also have to include C as such a language. long jmp(); longjmp();
- danso 15y agoc'mon everyone, I was being facetious :)
- kragen 15y agoZim'sclassicbook"CodesandSecretWriting"beginswiththisexample ofaverysimplecryptogram: EAR LYTOB EDEAR LYTOR ISEM AKE SAM ANHEAL THYWEAL THYAN DWISEM Ihaveactuallyprogrammedinlanguagesthatdisregardedwhitespacee ntirely.OldversionsofMicrosoftBASICforexampleusedaonelevelpa rserwhichdidnothaveaseparatetokenizer.Fortranalsoignoredwhit espace(asidefromthewhitespaceneededtogetyourcodeintotheright columnonthecard!)withtheunfortunateeffectthatthesetwostateme ntswereequivalent: do 20 i = 1. 10 do20i = 1.10 Thefirstoneisanobvioustypoofthefollowing: do 20 i = 1, 10 Which,ifmymemorydoesnotfailme,istheoldFortranwayofwriting for (i = 1; i <= 10; i++) { withline20beingthecorresponding"}".¶Ihopethiscommenthasbeenh elpfulinunderstandingwhySteveBournethoughtmakingwhitespacesi gnificantinhislanguagedesignwasagoodidea!
- getsat 15y agoLooks like someone never read the Unix Hater's Handbook. Another fun thing is rm + shell expansion. A file named * or / can cause extremely unintended deletions.
- peterwwillis 15y agoI'd like to make a request to all the posters on Hacker News, and the people that upvote them. STOP POSTING SHIT FROM REDDIT AND 4CHAN. THERE'S ENOUGH RETARDED MEME BULLSHIT ALL OVER THE INTERNET. WE DON'T NEED IT HERE. Thank you.
- shabble 15y agoI only recently discovered molly-guard: http://packages.debian.org/sid/molly-guard http://packages.debian.org/sid/molly-guard which prevents you from running halt/shutdown etc. via SSH without first confirming the hostname. I've done that before with pretty traumatic consequences, so it's now on my list of must-have's for any important remote box. http://www.catb.org/jargon/html/M/molly-guard.html http://www.catb.org/jargon/html/M/molly-guard.html
- hyperbovine 15y agoThat's pretty heinous, but deleting /usr shouldn't cause you to lose any irreplaceable data.
- jonhohle 15y agoFrom the FreeBSD handbook ( http://www.freebsd.org/doc/handbook/users-introduction.html http://www.freebsd.org/doc/handbook/users-introduction.html): The home directory is the full path to a directory on the system in which the user will start when logging on to the system. A common convention is to put all user home directories under /home/username or /usr/home/username. The user would store their personal files in their home directory, and any directories they may create in there. All of my irreplaceable data is stored in `/usr'. `/home' is a symlink to `/usr/home', as created by the installer.
- DenisM 15y agoYou get in trouble not at the moment this happens, you get in trouble much earlier than that - when you allow yourself into a situation where a single typo leads to ruin. Myself, I use TimeMachine and bitbucket on my Mac, and every-15-minutes snapshots on all Amazon EC2 EBS volumes. Similar solutions can certainly be found for your platform of choice.
- sambeau 15y agoUnix could really do with a command that you can wrap around this type of call. Either a sanity check on the path part or a safe rm alternative that contains it. I would gladly give up full rm access to know that I can safely (or safer-ly) delete in scripts. It could be something as simple as a file with paths on each line it - match one path or a path with a glob - and the script fails before destroying anything important. Overriding it might involve adding a --override=/path/to/something but at least then it would be very explicit
- sambeau 15y agoAh. It seems I have just described 'safe-rm'. Great minds etc :)
- fmarier 15y agoIndeed. Those were exactly the design goals I had when I wrote safe-rm (shortly after deleting my /usr/lib!).
- adsr 15y agoI sometimes use a wrapper around mv that moves the folder to trash. Guess it's not that portable but it could be replaced by moving to /tmp or something instead perhaps.
- tlrobinson 15y agoI've started quoting arguments in shell scripts even when it's not technically necessary to avoid problems with spaces. I can't count how many scripts I've written/encountered that didn't work with a path containing a space (apparently much more common with OS X users than Linux users) This wouldn't delete the correct directory, but at least it won't delete "/usr" either: rm -rf "/usr /lib/nvidia-current/xorg/xorg" There are lots of other pitfalls associated with not quoting things in shell scripts, like this common one: if [ $foo -eq "bar" ]; will cause an error if $foo isn't set or is an empty string, while this will work correctly: if [ "$foo" -eq "bar" ]; Bonus that your syntax highlighter can highlight the arguments. My rule is that flags aren't quoted, but paths and other parameters are.
- whacker 15y agoI always use set -eu. Makes my scripts much safer and less unpredictable.
- earl 15y agoA decade ago, I worked on a DNA sequencer / aligner product. This produced easily 1GB+ raw data files, and they typically exploded by a factor of ten by the time you performed a bunch of cleaning, smoothing, filtering, etc on them. For several reasons, not least of which was a 4GB file size limit in fat32, this software had to use a directory as a pseudo file. I was working on some file saving logic. A customer had a problem where they'd overlaid a new logical file on top of an old logical file. Where these actual files, this would just have overwritten the old file, but since these were directories, we got a mishmash of pieces of two different logical files overlaid in the same directory, and of course our software got confused as hell. So, I wrote code that, in case you saved a new file as an extent filename (really directory name), would perform the equivalent of rm -rf $dirname; mkdir $dirname; You can see where this is going... Some grad student didn't understand this, and named a pseudo file as the root directory of a tree of research. Two years of research vanished into the ether, despite a dialog box that had red text in it. That sucked.
- aw3c2 15y agoIt is crazy not to have backups of research data.
- tomkarlo 15y agoBack in the late 90s I worked on a small Windows product... our CEO complained that when the uninstaller ran, it left the empty directory behind along with some small temp files created by the software (that the package hadn't put there during install). So the guy making the package added a command to remove the directory and its contents... ... and the first reporter to try software, for reasons I'll never totally understand, chose to install it in C:\. Worked great until he went to uninstall it.
- chops 15y agoI've done a similar thing a few years ago when I was first starting work on my guild hosting company's code. At the time, the main thing hosted on that machine was my WoW guild's website, which I had been working on for close to a year, and was beginning work on converting the site over to a general purpose guild hosting site. I was doing some work for a client, setting up a mirror of sorts for some kind of yearbook thing I had built for them. For that, I made a script that would mirror the online yearbook with wget, zip up the whole directory, then clear out the mirrored pages (all I cared to store and serve was the zip file). All of my websites were stored in /www on the server, and the raw yearbook was located at /www/clientname/www. Inside the clientname directory, I had the mirror script which was something like this: wget -whatever_options http://whatever.address www zip yearbook.zip www rm -fr /www Unfortunately, because of how frequently I type / before www to get to my web dev directory, I instinctively put "/www" in the script where I just wanted to do "www". I ran the script, checked to make sure and it looked good, and deployed it to a cronjob. My heart sank when I tried loading my guild page a few minutes later (just to see what was going on on the forum, if anything), and it served up a bunch of 404s. I went to /www/guildsite and saw it completely empty, and almost immediately figured out what had happened. At that point, I had to get my composure and figure out what I was going to do (I did not have backups or source control). I unmounted the directory, and went off to lunch with a friend, shaking with anxiety. Upon return, I started writing out a perl script to scour the device byte for byte looking for PHP scripts, looking for instances of <? and then capturing the following 2000 lines or so, assuming that would be a sufficient buffer. When the script was done, I set it to run on the partition, and 45 minutes later I had a few hundred files to work with. I had to manually go through every file (which were named numerically in the order they were found in the filesystem) and determine if it was the most recent (or recent enough) copy of the code, clear off any trailing bytes, and rename it to the filename it used to have. Luckily I could remember the name of almost every file in the system. It took about 8 hours to go through the few hundred files and recover them. Needless to say, I learned my lesson after that, but the feeling of victory I got from recovering those files from the device was epic. 6 years later, I realize that that's a rather trivial thing to do, but at the time, I didn't know what I was going to do, and remembering that the file system doesn't clear all the bytes of the a file just it's reference gave me tons of hope.
- jcarreiro 15y agoI wonder if this is what the founders of github expected from "social coding"?
- ltamake 15y agoThat's quite a big bug. :/
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]
- fedd 15y agoand it was 666 points a second ago. symbolic.
- dools 15y agoThe two sure fire ways to live a long and happy life: 1. find . -name "pattern" <enter> <look carefully> <up arrow> | sudo xargs rm -f 2. WHERE some_id = 36; <home> DELETE FROM table_name
- leif 15y agoI keep /usr in a squashfs, mounted with aufs over top of it, for the 0.01% speedup I probably get (I grew up on gentoo, forgive me). Periodically, I need to rebuild the squashfs to reclaim space in the aufs writable directory. I once had a script something like this: mksquashfs /usr /squashed/usr/usr_tmp.sfs -b 65536 umount -l /usr umount -l /squashed/usr/ro rm /squashed/usr/usr.sfs mv /squashed/usr/usr_tmp.sfs /squashed/usr/usr.sfs rm -rf /squashed/usr/rw/* mount /squashed/usr/ro mount /usr Guess what happens if you hit Ctrl-C during the mksquashfs? That's right, bash runs all the rest too, including the deletion of the old squashfs file. I was left without a /usr, and it was brutal. Managed to recover (it's incredible how resilient a linux system is, as long as /bin and /lib are intact), and immediately put "set -e" in almost every bash script on my machine (I also fixed the script to keep the system in a recoverable state at all times...).
- levesque 15y agoI actually ran that piece of code. Sure was glad it was only on a test partition. I did lose some trust in the developers after this, but I tried bumblebee again later and am happy I did because it works great! I forgive them.
- damoncali 15y agoThis would be a lot funnier if there was anything preventing me from doing exactly the same thing... ouch.
- TheEzEzz 15y ago(I'm not a Linux user, forgive my ignorance) Is there no way to prevent bugs like this at the source, by modifying Linux, rather than hoping there isn't any extra white space in a command that might delete your usr directory?
- creativeembassy 15y agoI had a hard drive crash on me once, and I wasn't that worried about it, because I had setup network-based backup to the server in a different room. I remember thinking, "Restoring this backup will be sooo much easier if I can just connect it directly to the PC." Que me walking with the backup HDD towards the PC in question, when I drop it on the floor. When I plugged it in, it literally bounced inside of the chassis (platters fell off motor or something).
- sigil 15y agoThis tip only applies to interactive shells: I often prefix potentially dangerous commands with '#' while I edit them. Tab-completion still works (with bash at least, so I assume also with certain other vastly superior shells). # rm -rf /path/to/^I
- eran 15y agoOnce we got catastrophic backup rsync -a --delete /home/project/ /mnt/backupDisk Left unnecessary slash after "project" and rewrite all content on "backupDisk" by project files (instead of sync project folder on it)
- fmx 15y agoThe designer of rm is the greater culprit here, not the author of that install script. A single mistyped character should not lead to such drastic consequences. "Usability? What's that? I'm really smart, so I don't make mistakes. If lesser humans do - that's their problem". That seems to be the attitude of many Linux programs and rm is among the worst of them. No doubt I'll get downvoted for saying this, but I've rarely, if ever, heard of such things happening in Windows. (And people still manage to delete files in Windows without too much difficulty.)
- indrora 15y agoOh man. an RPM I had at one point had / as one of its trees. There's a reason I moved to debian.
- monological 15y ago1000 points really? This is on par with initial tsunamii news.
- yoyoyogi 15y agoglad it wasn't me..
- rektide 15y agolinux can still boot without a /usr. this was a commit; how many people ran it? on the other hand, delete the boot.ini[1] and most windows systems cant even boot. now deploy that boot.ini deleting build on an MMO (eve online) and watch the fur fly. that, ladies and gentlemen, is how you earn a :golfclap:. [1] http://google.com/search?q=ccp+boot.ini http://google.com/search?q=ccp+boot.ini