sciencefair-land / sciencefair

The futuristic, fabulous and free desktop app for working with scientific literature :microscope: :book:
https://sciencefair-app.com
MIT License
604 stars 52 forks source link

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

Open ghost opened 7 years ago

ghost commented 7 years ago

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

blahah commented 7 years ago

@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.

ghost commented 7 years ago
$> 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
blahah commented 7 years ago

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 commented 7 years ago

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

blahah commented 7 years ago

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

step21 commented 7 years ago

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...