You won’t believe what you’re reading right now, but one of the original UNIX hackers has actually admitted that UNIX hidden files and folders were not even supposed to exist as designed!
The original message Rob Pike wrote about this matter was from 2012. So while it was obliterated along with the rest of Google+, a copy of it still exists on Xahlee’s blog post – also from 2012. So let’s see what this archivist has to chronicle about Rob Pike.
Who is Rob Pike?
Rob Pike is a computer scientist and more notably a hacker. His time was before the media started calling anyone with destructive capabilities rivaling those of any super villain a “hacker”.
Among other things, Pike created Go, Limbo, Unicode, and an (in my opinion) ugly-looking OS called Plan 9. It has taken its place in the museums along with the Apple IIs and IBM-compatible DOS pointers of glowing chalk pieces.
In a way, I’m kind of glad that Plan 9 never really got a following. Who knows what kind of cyborg that Linux would’ve turned out as if it had been influenced by Plan 9?
However, this article is not about bashing Plan 9, it is bashing UNIX. According to Pike’s post, that’s the word he’d have used. But even then, it is only roasting one particular feature of UNIX: “dot” hidden files and folders.
Dot Files? Say What?
Now before you grab your pitchforks to roast Rob Pike, let’s see what he has actually said which sounds so controversial to many. And why the internet has exploded over it only after 11 years.
The following is an excerpt of Rob Pike’s quotation:
Long ago, as the design of the Unix file system was being worked out, the entriesRob Pike
..appeared, to make navigation easier. I’m not sure but I believe
..went in during the Version 2 rewrite, when the file system became hierarchical (it had a very different structure early on). When one typed ls, however, these files appeared, so either Ken or Dennis added a simple test to the program.
He then proceeds to list the code snippet that they added:
if (name == '.')
Versus the code it was supposed to be, and intended:
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
What’s the problem here?
One would think there’s not much of a problem here, but then again, catastrophic errors have happened from more subtle changes.
In the second code snippet above, it compares whether the file or folder name is
.. , and then hides it accordingly. The other version, the one that was coded, checks if the file starts with a dot. This meant that all files and folders starting with a dot were hidden by default.
What Does Rob Pike Think About This?
Well, he thinks it’s a dumpster fire, apparently:
Two things resulted.
First, a bad precedent was set. A lot of other lazy programmers introduced bugs by making the same simplification. Actual files beginning with periods are often skipped when they should be counted.
Second, and much worse, the idea of a “hidden” or “dot” file was created. As a consequence, more lazy programmers started dropping files into everyone’s home directory. I don’t have all that much stuff installed on the machine I’m using to type this, but my home directory has about a hundred dot files and I don’t even know what most of them are or whether they’re still needed. Every file name evaluation that goes through my home directory is slowed down by this accumulated sludge.
I’m pretty sure the concept of a hidden file was an unintended consequence. It was certainly a mistake.
How many bugs and wasted CPU cycles and instances of human frustration (not to mention bad design) have resulted from that one small shortcut about 40 years ago?
Keep that in mind next time you want to cut a corner in your code.Rob Pike
I guess we should all be grateful for this particular instance pervasive and permanent UNIX damage to the tech industry, otherwise we’d all be using Registry files for our settings, or even worse: Binary files.