3 ms·
> Dear everyone writing Unix programs that cache things in dot-directories (.cache, .local, etc): please don't. Create a non-dot directory for it. If it doesn'
by hiccuphippo 2y ago
> Dear everyone writing Unix programs that cache things in dot-directories (.cache, .local, etc): please don't. Create a non-dot directory for it.
If it doesn't live inside ~/.cache or ~/.program/cache then I won't know if I can delete it or not.
If you are not putting your cache in one of those folders, I'd expect the application itself to have a clear-cache option or for it to do it automatically from time to time.
- jmclnx 2y agoTo me, on OpenBSD that kind of breaks the purpose of unveil. Firefox and chrome on OpenBSD is patched to use pledge and unveil. That restricts where these programs can read/write data. I would not want a program to have access to all cache data for every program. To me, if you see dir cache, you can clear it. In fact, I have a cron job to clear cache data older than a week for Firefox. No issues doing this for many years.
- lloeki 2y ago> I would not want a program to have access to all cache data for every program. Then XDG_CACHE_DIR doesn't change anything? The path is going to be $XDG_CACHE_DIR/$PROGRAM which is what would get allowed (and neighbour subdirs disallowed); no program would get to see the others' cache. I just checked and I have a ~/.cache/firefox right there. Having it at a single root point means it's trivial to make all cache ephemeral in any way one chooses.
- jmclnx 2y agoI am not sure if XDG_CACHE_DIR is set or not. But for some reason I think it is unveiled in the firefox config file in /etc. My OpenBSD system is powered down right now so I cannot check.
- rererereferred 2y agoHow do you know it's a cache dir and not configuration or something else? I don't say programs should have access to the cache directories of other programs just to their own inside ~/.cache.
- jmclnx 2y agoIf I see the name cache I hope it is cache :) So far that has not failed me yet, maybe some day I will get burned.
- rererereferred 2y agoI thing there was a confussion. I was arguing against putting it somewhere that is not ~/.cache/program or ~/.program/cache, for example in ~/program, which would not have the string `cache` in the name.
- yjftsjthsd-h 2y agoCan ex. Firefox not unveil($HOME/.cache/firefox) ? Or actually I'd prefer unveil($HOME/.cache/firefox/$PROFILE)
- jmclnx 2y agoNot sure what is being asked. But there is a config file in /etc on OpenBSD that is used to determine what directories are unveiled. I do not remember the name. So you can customize that as you see fit, veiling or unveiling items.
- yjftsjthsd-h 2y agoThat isn't my impression of how it works? https://man.openbsd.org/unveil https://man.openbsd.org/unveil describes a system call that a program uses at runtime, so it should be easy for Firefox to start up and then use unveil() to limit itself to paths it knows it will need (but it can pick those paths dynamically when it starts)
- ignoramous 2y ago> I'd expect the application itself to have a clear-cache option or for it to do it automatically from time to time. Android has this. Though, the reason they included a "cache partition" back in the day was to make sure there was always enough space to download flash system.img over-the-air (as wiping clean the cache partition would provide enough room).