sciencefair icon indicating copy to clipboard operation
sciencefair copied to clipboard

Do not use ~/.config on Linux to store cache and local information

Open ghost opened this issue 7 years ago • 6 comments

The ~/.config directory (or whatever $XDG_CONFIG_HOMEis set to) on Linux is designed to be a place where configuration files are stored; this makes it easy to back up the configuration of many installed programs at once.

At the moment, Sciencefair seems to store a large amount of cache and user data in this directory. This might be experienced as a nuisance by users who rely on the relevant conventions, because it contaminates their backups with non-config data. It might be better to store cache and user data in directories which are intended for that purpose ($XDG_DATA_HOME / ~/.local/shareand $XDG_CACHE_HOME / ~/.cache, respectively).

More information about these directories can be found here: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

ghost avatar Jul 08 '17 17:07 ghost

@mrbiber can you please paste an ls -alh of what's in the sciencefair dir in ~/.config (after redacting anything sensitive)? AFAIK we shouldn't be storing things there, so this seems like a bug.

blahah avatar Jul 08 '17 17:07 blahah

$> find .config/sciencefair -printf '%s %p\n' 
4096 .config/sciencefair
4096 .config/sciencefair/Cache
8192 .config/sciencefair/Cache/data_2
524656 .config/sciencefair/Cache/index
270336 .config/sciencefair/Cache/data_1
8192 .config/sciencefair/Cache/data_0
8192 .config/sciencefair/Cache/data_3
7168 .config/sciencefair/Cookies
69 .config/sciencefair/Preferences
0 .config/sciencefair/Cookies-journal
4096 .config/sciencefair/Local Storage
3072 .config/sciencefair/Local Storage/file__0.localstorage
0 .config/sciencefair/Local Storage/file__0.localstorage-journal
4096 .config/sciencefair/GPUCache
8192 .config/sciencefair/GPUCache/data_2
262512 .config/sciencefair/GPUCache/index
270336 .config/sciencefair/GPUCache/data_1
8192 .config/sciencefair/GPUCache/data_0
8192 .config/sciencefair/GPUCache/data_3

ghost avatar Jul 08 '17 17:07 ghost

thanks @mrbiber - it looks like this is where Electron stores its chromium config and cache, and it's a known (and widely discussed) issue: https://github.com/atom/atom/issues/8281

blahah avatar Jul 08 '17 17:07 blahah

@mrbiber I'm going to fix this with a module that sets sane paths for electron's cache, config etc., as suggested here.

blahah avatar Jul 08 '17 17:07 blahah

Actually, it seems this might currently not be possible. Chromium is setting those caches: https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#User-Cache-Directory. It ignores Electron's cache path config for the browser cache.

Electron issue here: https://github.com/electron/electron/issues/8124

blahah avatar Jul 08 '17 18:07 blahah

Additionally, apart from the issues with electron/chromium itself - most electron apps have the same issues and many/some other apps also do not stick to this convention. F.e. Virtualbox keeps its logs there and the Guest Additions iso (plus some other stuff) - which you might want to back up, but they are not configuration. So I maybe wouldn't make this a high priority...

step21 avatar Aug 18 '17 16:08 step21