Advertisement
teknoraver

dotfiles history

Jul 4th, 2019
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. A lesson in shortcuts.
  2.  
  3. Long ago, as the design of the Unix file system was being worked out,
  4. the entries . and .. appeared, to make navigation easier.
  5. I'm not sure but I believe .. went in during the Version 2 rewrite,
  6. when the file system became hierarchical (it had a very different structure
  7. early on). When one typed ls, however, these files appeared, so either Ken or
  8. Dennis added a simple test to the program. It was in assembler then, but the
  9. code in question was equivalent to something like this:
  10. if (name[0] == '.') continue;
  11. This statement was a little shorter than what it should have been, which is
  12. if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue;
  13. but hey, it was easy.
  14.  
  15. Two things resulted.
  16.  
  17. First, a bad precedent was set. A lot of other lazy programmers introduced bugs
  18. by making the same simplification. Actual files beginning with periods are often
  19. skipped when they should be counted.
  20.  
  21. Second, and much worse, the idea of a "hidden" or "dot" file was created. As a
  22. consequence, more lazy programmers started dropping files into everyone's home
  23. directory. I don't have all that much stuff installed on the machine I'm using
  24. to type this, but my home directory has about a hundred dot files and I don't
  25. even know what most of them are or whether they're still needed. Every file name
  26. evaluation that goes through my home directory is slowed down by this
  27. accumulated sludge.
  28.  
  29. I'm pretty sure the concept of a hidden file was an unintended consequence.
  30. It was certainly a mistake.
  31.  
  32. How many bugs and wasted CPU cycles and instances of human frustration
  33. (not to mention bad design) have resulted from that one small shortcut
  34. about 40 years ago?
  35.  
  36. Keep that in mind next time you want to cut a corner in your code.
  37.  
  38. (For those who object that dot files serve a purpose, I don't dispute that but
  39. counter that it's the files that serve the purpose, not the convention for their
  40. names. They could just as easily be in $HOME/cfg or $HOME/lib, which is what we
  41. did in Plan 9, which had no dot files. Lessons can be learned.)
  42.  
  43. Rob Pike
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement