This isn't exactly programming, but it was something that had unexpected disasterous results. I was working on a server during a system failure, so there were two or three of us admins all on the system at the same time, trying to figure out why the system had puked on itself. We were all logged in as root, reading logfiles, etc. Suddenly all the files begin vanishing off the hard drive. Within a few seconds the whole system had toasted itself, due to /usr/lib and /lib being blown away.
In the post-mortem we finally tracked down what had happened. Apparently one of us was in a root shell and had created some temporary files in /tmp/blah. When we were finished with the temp files, the admin did a standard 'cd /tmp/blah' and 'rm -rf *'. This was harmless. However, this admin then immediately did a ^D and logged out that shell. This then wrote out the .bash_history file in /root. Meanwhile, one of the other admins was doing something repeatedly, and using '!!' to repeat a long command. This works quite well when you're the only one on the system, but once .bash_history got updated, the next '!!' that he typed ran "rm -rf *" instead of the long command he was expecting. It was just fate that his pwd happened to be / at the time.
Needless to say, after this mishap we all are much more careful about using shell shortcuts as root (as well as ganging up on broken servers). Generally we all just gather in one cube with a couple systems in it and let a couple people type so that everybody is on the same page while we're working.
|