My personal blog hauleth.dev
blog
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

article: Stop Spreading C**p at my HOME

+144
+144
content/post/stop-spreading-crap-at-my-home.md
··· 1 + --- 2 + title: "Stop Spreading C\\*\\*p at My `$HOME`" 3 + date: 2020-04-15T12:00:19+02:00 4 + tags: 5 + - programming 6 + - culture 7 + --- 8 + 9 + **Disclaimer:** Yes, this is a rant. Yes, I am displeased with state of 10 + software. And yes, I can use some harsh words. You were warned. 11 + 12 + For a some time now we have [Filesystem Hierarchy Standard][fhs] which describes 13 + which data goes where in your \*nix installation. In fact we have that for 28 14 + years, which is almost as long as I live. This is quite some time. But for 15 + whatever reason we apply that only for the system hierarchy and we cannot have 16 + the same for something much closer to our heart - our dear `$HOME`. 17 + 18 + Common practice for storing all the stuff for different applications is to use 19 + dot files stored in `$HOME`. These are files or directories starting with dot in 20 + their name which makes such files "hidden" on Unix systems. There is problem 21 + though. First let me show you all the files starting with dot in my `$HOME`: 22 + 23 + ``` 24 + -r-------- 1 hauleth staff 9 Mar 30 2019 .CFUserTextEncoding 25 + -rw-r--r-- 1 hauleth staff 16388 Apr 9 11:46 .DS_Store 26 + drwx------ 2 hauleth staff 64 Apr 13 20:54 .Trash 27 + -rw------- 1 hauleth staff 17835 Apr 10 21:17 .bash_history 28 + drwx------ 12 hauleth staff 384 Mar 30 2019 .bash_sessions 29 + drwxr-xr-x 13 hauleth staff 416 Mar 26 14:02 .cache 30 + lrwxr-xr-x 1 hauleth staff 40 Aug 21 2019 .chunkwmrc 31 + drwxr-xr-x 20 hauleth staff 640 Apr 15 21:59 .config 32 + drwx------ 3 hauleth staff 96 Apr 20 2019 .cups 33 + lrwxr-xr-x 1 hauleth staff 39 Aug 21 2019 .curlrc 34 + lrwxr-xr-x 1 hauleth staff 43 Aug 21 2019 .dir_colors 35 + -rw-r--r-- 1 hauleth staff 2587 Sep 10 2019 .direnvrc 36 + drwxr-xr-x 6 hauleth staff 192 Apr 14 18:27 .docker 37 + drwx------ 14 hauleth staff 448 Oct 1 2019 .dropbox 38 + -r-------- 1 hauleth staff 20 Apr 1 2019 .erlang.cookie 39 + drwxr-xr-x 3 hauleth staff 96 Jul 1 2019 .gem 40 + -rw-r--r-- 1 hauleth staff 518 Mar 25 22:44 .gitconfig 41 + drwx------ 14 hauleth staff 448 Apr 15 22:03 .gnupg 42 + drwxr-xr-x 4 hauleth staff 128 Apr 2 2019 .hammerspoon 43 + drwxr-xr-x 5 hauleth staff 160 Apr 14 19:39 .hex 44 + drwx------ 3 hauleth staff 96 Apr 26 2019 .httpie 45 + -rw-r--r-- 1 hauleth staff 165 Feb 22 13:50 .jlassetregistry.json 46 + drwxr-xr-x 3 hauleth staff 96 Nov 29 22:13 .jssc 47 + drwxr-xr-x 9 hauleth staff 288 Feb 21 17:46 .julia 48 + drwx------ 14 hauleth staff 448 Oct 2 2019 .keychain 49 + drwxr-x--- 5 hauleth staff 160 Jan 24 12:20 .kube 50 + -rw------- 1 hauleth staff 720 Apr 15 16:29 .lesshst 51 + drwxr-x--- 3 root staff 96 Apr 3 2019 .lldb 52 + drwx------ 4 hauleth staff 128 Dec 18 14:16 .local 53 + drwxr-xr-x 8 hauleth staff 256 Mar 20 12:29 .mitmproxy 54 + drwxr-xr-x 18 hauleth staff 576 Apr 13 14:36 .mix 55 + -rw-r--r-- 1 hauleth staff 116 Apr 13 20:59 .nix-channels 56 + drwxr-xr-x 4 hauleth staff 128 Apr 14 13:47 .nix-defexpr 57 + lrwxr-xr-x 1 hauleth staff 46 Feb 1 22:13 .nix-profile 58 + drwxr-xr-x 3 hauleth staff 96 Sep 27 2019 .npm 59 + drwxr-xr-x 3 hauleth staff 96 Dec 19 14:05 .pex 60 + -rw-r--r-- 1 hauleth staff 183 May 2 2019 .profile 61 + drwxr-xr-x 5 hauleth staff 160 Mar 20 16:27 .proxyman 62 + drwxr-xr-x 2 hauleth staff 64 Feb 17 14:09 .proxyman-data 63 + -rw------- 1 hauleth staff 1391 Jan 22 11:46 .psql_history 64 + -rw------- 1 hauleth staff 1950 Feb 19 12:42 .python_history 65 + lrwxr-xr-x 1 hauleth staff 37 Aug 21 2019 .skhdrc 66 + drwx------ 11 hauleth staff 352 Oct 2 2019 .ssh 67 + drwxr-xr-x 4 hauleth staff 128 May 8 2019 .terraform.d 68 + drwxr-xr-x 4 hauleth staff 128 Dec 1 21:52 .thumbnails 69 + drwxr-xr-x 9 hauleth staff 288 Mar 9 17:14 .vagrant.d 70 + -rw------- 1 hauleth staff 11124 Apr 13 20:21 .viminfo 71 + lrwxr-xr-x 1 hauleth staff 37 Aug 21 2019 .vimrc 72 + drwx------ 4 hauleth staff 128 Nov 8 16:51 .w3m 73 + drwxr-xr-x 37 hauleth staff 1184 Apr 13 21:21 .weechat 74 + ``` 75 + 76 + As you can see, there is bunch of them, some are linked to my dotfiles 77 + repository, but most are not. What is the problem there? 78 + 79 + The spread. 80 + 81 + All of the data is smeared between gazillion of different filed with different 82 + types of data. This causes headaches because: 83 + 84 + - I cannot easily backup all the configuration as I need to check each file 85 + independently to check if this is configuration file or it is data 86 + - I cannot exclude data from my backups in a uniform way. I need to check each 87 + file independently and exclude it, remembering to do that for each new tool 88 + that I add. Alternatively I can use whitelist instead of blacklist of paths 89 + that I want to backup, but that pretty much defies the idea of having 90 + automatic backup. 91 + - Cleaning up the old caches and data is troublesome as user need to review all 92 + the folders and know what data they see mean. 93 + 94 + But what We can do? Well, the macOS and Windows got it somewhat right, these 95 + OSes provide special paths for storing all configuration, caches, user-data, 96 + etc. in special, dedicated, and well known locations within user directories. It 97 + is like mentioned earlier FHS but for `$HOME`. 98 + 99 + Unfortunately no other OS out there had: 100 + 101 + 1. Power to force developers to behave reasonably 102 + 2. Standard to which developers should adhere to 103 + 104 + Unfortunately the 1st point is still true, but the 2nd one is somewhat resolved 105 + in form of [XDG Base Directory Specification][xdg]. This is pretty short, 106 + simple, and straightforward spec where which data should go. 107 + 108 + This makes life so much easier: 109 + 110 + - Want to have backup your configuration? Just copy `$HOME/.config` where you 111 + want. 112 + - Want to reset your configuration to base one? Just delete `$HOME/.config`. 113 + - Want to cleanup caches? Remove `$HOME/.cache`. 114 + - Etc. 115 + 116 + It makes your `$HOME` much cleaner, much more manageable, much more like your 117 + place, where you are the ruler, not as a manager of the bulletin board or the 118 + storage house. 119 + 120 + At one point I was even considering to have approach similar to [one taken by 121 + Graham Christensen][delete-your-darlings], but that would make my life even more 122 + miserable instead of forcing developers to fix their software. 123 + 124 + Just in case, this is not only mine view on the state of configuration files, 125 + just see [old Google+ post by Rob Pike][pike] where he states exactly the same 126 + thing that FreeDesktop team try to address. I may not agree on all the concepts 127 + with Commander, but this one I vote all-fours. 128 + 129 + For these who want to stop that madness and fix at least some software out there 130 + that is broken, you can check out [my script][xdg-please] that tries to fix 131 + (at least partially) non-conforming software. 132 + 133 + --- 134 + 135 + **TL;DR** 136 + 137 + Please, stop leaving your c\*\*p in my `$HOME` and call it "installation". If 138 + you want that, then I think you should find nearest Modern Art Gallery. 139 + 140 + [fhs]: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard 141 + [xdg]: https://specifications.freedesktop.org/basedir-spec/latest/index.html 142 + [delete-your-darlings]: https://grahamc.com/blog/erase-your-darlings 143 + [pike]: https://web.archive.org/web/20180827160401/plus.google.com/+RobPikeTheHuman/posts/R58WgWwN9jp 144 + [xdg-please]: https://github.com/hauleth/xdg-rlz