Section 5.5 of the FHS says (quoted in its entirety), > /var/cache is intended for cached data from applications. Such data > is locally generated as a result of time-consuming I/O or > calculation. The application must be able to regenerate or restore > the data. Unlike /var/spool, the cached files can be deleted without > data loss. The data must remain valid between invocations of the > application and rebooting the system. > > Files located under /var/cache may be expired in an application > specific manner, by the system administrator, or both. The > application must always be able to recover from manual deletion of > these files (generally because of a disk space shortage). No other > requirements are made on the data format of the cache directories.
My question is: how should we interpret this with respect to top-level *directories* in /var/cache? The spec says "files... may be expired," but of course on UNIX everything is a file -- especially directories. Can top-level directories be deleted without warning, too? This becomes important when you consider that many applications that might make use of /var/cache run as an unprivileged user, and that /var/cache itself is writable only by the superuser. If the "foo" daemon runs as the "foo" user, and if it wants to utilize /var/cache, the natural thing to do is to create /var/cache/foo as root, and give ownership of it to the "foo" user. But as a packager or administrator, when do I do that? If the "foo" package creates the directory, then it gets created once, when the package is installed. If /var/cache/foo may then be deleted, we have a problem. The alternative is to treat /var/cache like we do /run, and to require the service manager (systemd, OpenRC, etc.) to create the directory at some point with the correct ownership. This is also problematic if the directory can be deleted -- it only gets recreated when the server is rebooted. This somewhat violates the wording of the specification, because while the application can regenerate that data, it can't regenerate it in the right place; so every application needs to be able to fall back to a second location if /var/cache/<pkg> is inaccessible. Thus my common sense tells me that maybe top-level directories should not be deleted, but it's unclear if I'm justified in that belief. And of course, not everyone agrees -- currently, everyone picks their own interpretation and runs with it. What's the intention here? _______________________________________________ fhs-discuss mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/fhs-discuss
