Well folks, as mentioned in How To Learn From Your Programming Mistakes, here it is.
The story that still makes me shudder when I think about it.
When it comes to all time, super-duper cock-ups, this is one I will never forget.
Strictly speaking I wasn’t actually trying to program anything when it happened. I was trying to…
Oh let’s just start from the beginning shall we?
The danger of embedded systems
Not long out of university, I was working on an embedded linux platform. The embedded OS, or target, was accessed via telnet from Linux desktop machines. At any one time your terminal window could be logged into your desktop, or into the embedded Linux platform (can you see where this is going?).
I was asked to help out a colleague who was having trouble getting his target up and running.
He pointed me to his machine in the lab, and then disappeared, leaving me to it.
Straight away I could see that the embedded board he was using was in a mess. Files were missing, some were corrupt, and it was basically unrecoverable.
I had several terminal windows open at the same time, and I was switching rapidly between them to check build version, firmware version, and to access my own machine remotely. I downloaded the latest build from my machine and logged into the target to reinstall it.
At least, I thought I did.
I typed:
rm -rf /
to delete everything, so I could start the install from scratch[1].
But as I pressed the return key, I realised I was using the terminal window for his desktop machine.
And I was logged in as root.
If I had to describe that moment using a movie scene, it would look like this[2]:
I cancelled the process immediately, but it was too late. I had totally destroyed his filesystem. Now he had no target and no desktop computer either.
What did I do?
After I’d finished reeling from the massive mistake I’d just made, I gathered myself together, went to find my poor victim and confessed.
And apologized.
A lot.
He very graciously took it in his stride (since there was bugger all he could do about it, I guess), and seemed happy enough once I promised I would immediately reinstall his operating system AND fix the target, as I had originally intended.
Now, to save face (and enhance my career prospects), I suppose I could have done the reinstall in secret, and feigned ignorance if he had asked where his local files had gone.
But I owned up, and it wasn’t as bad as I thought it would be.
And now I can laugh about it (just).
And of course, I have NEVER made the same mistake again.
[1] The command I used, for those of you that aren’t familiar with Linux, is the equivalent of selecting your hard drive and pressing the delete key.
[2] Jaws contains a classic example of the Dolly Zoom: that wonderfully abused effect where the background moves away while the actor appears to loom larger, usually accompanied by some tense string music.
I bet you think twice before logging in as root now!
Like in IM-client 🙂
“Sorry, not this window”