I know, I'm no one to talk. I make dumb coding mistakes too, but recently I ran across a classic.
I was just finishing up a Linux server install for Counterpoint ( /Linux/cp.html). All users had been created, all minor configuration details tweaked, and the system was in the process of doing it's first DVD-RAM backup ( /Reviews/dvdram.html).
It was then that we remembered that the UPS software hadn't been configured. This particular UPS communicated by a USB port, and had Linux software which had already been downloaded. So, while the DVD-RAM backup was running, I installed the downloaded software, but it didn't seem to recognize the possibility of communicating by way of USB. Thinking that perhaps I had missed something or had made some mistake, I decided to run the uninstall script so thoughtfully included with the software.
I was prompted "Do you really want to remove the Belkin Bulldog Plus:!y|n] "
Sure I did. I answered "Y" and just a moment later I saw a rather odd message from rm complaining that it couldn't remove /boot. Huh? What the..
Ayup. This uninstall script had started at / and removed EVERYTHING. I powered off the machine the second I saw that, hoping that disk buffers hadn't yet been flushed, but I was too late: all our hard work was gone. Had the backup perhaps finished? I hoped it had, but no printout had come out yet, so it certainly wasn't completely finished. Ever the optimist, I booted from the DVD and let t restore. Unfortunately, it hadn't even completely finished the base OS stuff, so I had to start over from scratch: reinstall, reconfigure everything. Two extra hours of work and then some.
Later, I looked at the script to see how it screwed up. The basic problem was that it did a
rm -rf $path/*
but unfortunately $path was NOT set, so that ends up as
rm -rf /*
A silly mistake, but one that could have been very costly. Imagine if this server were actually in use when this happened!
Got something to add? Send me email.
More Articles by Tony Lawrence © 2012-07-12 Tony Lawrence
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. (Arthur Conan Doyle)