chore: Add Cache Directory Tagging Specification
This pull requests closes #9054 implementing the format specification found at https://bford.info/cachedir/.
I opted to follow @Alizter's specification in the issue only creating the CACHEDIR.TAG file when the default directory for the dune cache is being used. So if the environment variable DUNE_CACHE_ROOT is set this file will not be generated! Additionally, I omitted adding comments to the file but the specification does say that comments beginning with a # character are permitted after the signature, giving the following example:
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by (application name).
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/
out of curiosity, what tool do you use that honors this specification?
My original motivation was rsync
the spec says rsync could one day use this, but it doesn't seem that it has ever been implemented.
out of curiosity, what tool do you use that honors this specification?
I used tar on Linux with each of the following commands to package up my whole cache folder:
--exclude-caches--exclude-caches-all--exclude-caches-under
I'm not opposed to that feature if there's actual demand for it and it fixes a use case, but at the moment it looks like the spec is only implemented by gnu tar, and there are other ways to achieve this without modifying dune (in particular, since it's only added when the cache is in XDG_CACHE_HOME, why not ignore the whole cache dir?).
To put it differently, the issue is tagged good-first-issue but I think this requires some validation first.
Yea.. I totally see what you mean. There could be an argument made that it makes more sense to include the tagging file when the cache directory is moved from its default. I don't think I can provide much more validation, I mostly went after this issue since it was marked good-first-issue.
Popular backup tools like restic (since 2017), borg (since 2014) and duplicati (since 2018) support CACHEDIR.TAG.
It should always be added when the dune cache directory is created, no matter whether in the default or custom location.
No objection to this feature if anybody cares enough to revive it.