Please consider storing ccache's cache into $XDG_CACHE_DIR/ccache or $HOME/.cache/ccache if former variable not available, provided CCACHE_DIR is not specifically set.
I understand this breaks a decade old default, but I suppose few will disapprove the change — it's only cache. :)
Here are some arguments pro:
I understand you may cater for wider variety of Unices. Surely no one will mind a less polluted home.
(In reply to comment #0)
> Please consider storing ccache's cache into $XDG_CACHE_DIR/ccache or
> $HOME/.cache/ccache if former variable not available, provided CCACHE_DIR
> is not specifically set.
I assume you mean XDG_CACHE_HOME, not XDG_CACHE_DIR?
> I understand this breaks a decade old default, but I suppose few will
> disapprove the change — it's only cache. :)
This sounds like a good idea in general, but I'm still undecided on whether it would be a good fit for ccache. The reason is that the ccache directory is in fact not entirely "only cache"... It holds three kinds of information:
1. Volatile files: temporary files used during compilation and cached compilation results.
2. Statistics of cache hits/misses, etc.
3. Configuration, currently max cache size and max number of files in the cache. The plan for ccache 3.2 is to be able to store a lot more configuration in a configuration file inside $CCACHE_DIR: both configuration related to the actual cache but potentially also any setting (if the user wants). See https://git.samba.org/?p=ccache.git;a=blob;f=MANUAL.txt;h=a36c5050387e591ffb1d0e1fa40a43ce5f6c3005;hb=HEAD#l183 for documentation on this.
I think that it would be acceptable if statistics were thrown away if $XDG_CACHE_HOME was removed, but the configuration would not be OK to lose. If we go the XDG way, we would need to rethink and store configuration in a separate location, which of course would be $XDG_CONFIG_HOME/ccache if CCACHE_DIR is unset. But what should happen if CCACHE_DIR *is* set? I have to think more about this.
> I understand you may cater for wider variety of Unices. Surely no one
> will mind a less polluted home.
To complicate matters, it's not only Unices but also Windows and maybe other operating systems as well.
I've decided to not go with the XDG_CACHE_DIR approach for the following reason:
When using a shared cache, it's important that all users use the same settings, e.g. max_size, umask, compression and cache_dir_levels. Therefore I would like to associate the configuration of a cache with the cache itself so that the settings automatically will apply to all uses of the cache. It must thus be possible to infer the location of the configuration file from the cache location. Storing the configuration inside XDG_CACHE_DIR does not make sense since the configuration is not volatile information. Storing it in something like $XDG_CACHE_DIR/../.config/ccache does not make sense either since it's not guaranteed to work. The configuration would have to be stored in XDG_CONFIG_DIR, but reading configuration from XDG_CONFIG_DIR when CCACHE_DIR is set to a shared directory does not make sense.
I see no reasonable way of using XDG_CACHE_DIR for ccache. I'm open to new ideas regarding how to do it, though. Until then, I'm closing the request as WONTFIX, sorry.
It's a bit late to introduce CCACHE_CONFIG_DIR, I suppose. No biggie. :)
> It's a bit late to introduce CCACHE_CONFIG_DIR, I suppose. No biggie. :)
Well, there is a CCACHE_CONFIGPATH variable already. But I don't want to break backward compatibility for the use case where the user has set CCACHE_DIR to a non-standard location.