Cleaning of $XDG_CACHE_HOME and $XDG_CACHE_HOME/thumbnails

Simon McVittie smcv at collabora.com
Wed Feb 26 19:41:15 UTC 2020


On Wed, 26 Feb 2020 at 19:19:29 +0000, Bollinger, John C wrote:
> Let's do get some clarity on this point, as various comments have seemed
> to say different things.  Are you suggesting that the *configuration
> format* consumed by systemd-tempfiles be reused by some desktop
> component, or are you suggesting that cleanup tasks be delegated to
> systemd-tempfiles itself?

(Its name is systemd-tmpfiles.)

The only thing that the XDG_CACHE_HOME specification needs to agree on
is the contents and meaning of whatever file format gets used, not a
concrete implementation of the interpreter for that file format (the
same way freedesktop.org defines what .desktop files contain and mean,
but it's up to projects like GNOME to actually implement them in a
compatible way).

> Even on those systems that have systemd-tempfiles and have it enabled,
> it cannot be relied upon to clean up anything in user directories,
> because such directories may not be accessible to it.  On the systems I
> manage, for example, regular users' home directories reside on a network
> filesystem, and local-machine administrative accounts do not have any
> privileges there.

You're assuming that systemd-tmpfiles is running in system mode, with
privileges, looking at /etc/tmpfiles.d/*.conf, /run/tmpfiles.d/*.conf and
/usr/lib/tmpfiles.d/*.conf only. I agree that that's a non-starter.

However, `systemd-tmpfiles --user` can be invoked as an
ordinary user, unprivileged, to look at various paths including
~/.config/user-tmpfiles.d/*.conf (which is the highest-precedence) and
create/clean per-user directories. I think the suggestion is that desktop
environments like GNOME should periodically run `systemd-tmpfiles --user`,
or a compatible reimplementation, as a way to clean per-user cached files.

See tmpfiles.d(5) (file format) and systemd-tmpfiles(8) (reference
implementation) for more details.

> Why is that a strong argument? Perhaps this is part of the issue.
> I don't see any particular imperative for cleaning up cache files.
...
> users should be responsible for their own usage.
> If they are using too much, then that's what storage quotas are for.

Some cache files (such as thumbnails and web browser caches) are
created by "the system" without the user being particularly aware of
it happening. If these have built up to the extent that they are a
substantial proportion of the available storage (storage quota on a
multi-user system or disk size on a single-user system), then it isn't
at all obvious to a non-knowledgeable user why they have run out of
space or what they should do about it.

That's why the "housekeeping" module of gnome-settings-daemon (which
I think is named for its original purpose, hosting Xsettings, but in
practice is more like a collection of miscellaneous background services
used in GNOME) has traditionally been responsible for cleaning up files
like non-recently-accessed thumbnails.

    smcv


More information about the xdg mailing list