Sync’ up! … without getting drained

may 10

No itch to scratch

Long ago, Bill Joy came up with an idea and bundled it into his Csh project. It was called scratch files, though it seems as though the idea was either ditched before it was fully realized, or was quietly deprecated over the life of Csh’s evolution.

Scratch files were a type of file that had a unique feature to them. After a window of time, these files would be cleaned up and removed, a little like how files in the Unix ‘/tmp’ directory behave (though, presumably, scratch files didn’t wait for system reboots/logouts in order to be removed).

The idea was simple enough, and the syntax of the idea was quite clever. Any file that had a hash prefix, or ‘scratch’ prefix, would unlock this almost easter-egg behavior. To demonstrate:

#NOTES
#system.out
#httpd.conf.bak

are all examples of scratch files. To be clear, these files needn’t live in ‘/tmp,’ they were assumed to live anywhere in the file system.

The homological feature

I use Csh as my shell/command interpreter on all my systems now. When I learned about scratch files, I tried it all out, but nothing worked.

Specifically, I created some scratch files in various home directories on a few different OSs (OpenBSD, and flavors of Linux). Despite my eagerness for my scratch files to simply vanish after some time, they simply remained — many months later.

I came to the conclusion that the scratch feature was dead; especially since it’s not mentioned in any of the modern Csh manuals. In fact, any mention of it is hard to come by, though it does appear in this FreeBSD Csh paper.

History hacking

Files that are effervescent are a tremendously interesting idea, and there’s quite a few ways I can see how to implement it. I wonder how Bill coded it to be?

It could prove to be quite fun to perform a dive into the last version of Csh source code that supported this feature to unveil the mechanisms that handled file-cleanup, as well as the timing specifics (how much time needed to elapse before such files succumbed to garbage collection).

Alas, this lost peculiarity would be a welcome feature to the quirky world of Csh. I truly wish it still worked; where did it go? Perhaps Bill jotted an important phone number to a scratch file one day. Then, some days later, when it was time to return the call phone call, Bill reached for the file and much to his dismay, realized the file had vanished.

Perhaps Bill was annoyed at his Frankenstein-Monster — perhaps he flipped out, went into one of his notorious hacking tornadoes, and ripped the scratch file functionality right out of Csh in one fell swoop.

(Or perhaps, scratch files still work, but you have to wait until the year 2038 for them to be garbage collected.)