INTERCAL justifies its existence

(This is a repost. The original went of on 2010-11-14, a few hours before the spambot rape.)

Last night I made a classic n00b mistake. I was in a rush to get a test finished because my wife had just gotten home and it was time for us to haul off for the weekly Friday night with the regulars at our friendly local game store. I typed the rm -fr * to clear a scratch directory in the wrong window.

“Huh…” I thought, “that’s taking longer than it should have…” then realized with horror that it was clobbering my home directory and hastily interrupted it. Fortunately, I had a full backup on my laptop. Unfortunately, the full backup was ten days old; I stood to lose a lot of recent email and work.

Instead of gaming, I spent the next couple of hours recovering from this. I pulled the backup onto a scratch directory on my main machine, made file lists of the damaged $HOME and the backup with find(1), diffed them, and braced myself to discover how much I had irretrievably lost.

Nothing, as it turns out. I interrupted the rm -fr as it was still chewing through the alphabetically low directories under $HOME. The big one was dead.projects, my archival graveyard of superannuated stuff. When I killed it, it was busily munching on the huge directory full of tarballs and archives that I pulled together during the great INTERCAL Reconstruction Massacree.

Yes, that’s right. INTERCAL saved my butt, preoccupying the grim reaper rm just long enough

In the end, no harm done except Cathy and I didn’t get our weekly gaming debauch – I urged her to go without me but she went all wifely and supportive and stuff.

Lessons: Make backups early and often. And instead of throwing old code away, archive it where rm -fr will hit it first – because you never know, someday it might interpose its body between you and the deadliest typo.