Cleaning of $XDG_CACHE_HOME and $XDG_CACHE_HOME/thumbnails

Benjamin Berg benjamin at sipsolutions.net
Wed Feb 26 13:39:06 UTC 2020


On Wed, 2020-02-26 at 10:25 -0300, Soni L. wrote:
> I use XDG_CACHE_HOME to store git repos. While it's definitely
> possible to nuke them to save space... it'll just re-fetch everything
> next time it runs.

I don't think that $XDG_CACHE_HOME is designed to be used directly by
users. And if it is an application which generates those repositories,
then again, it can just drop-in the appropriate configuration to
prevent cleaning.

The only reason I see right now for a user to store data in
$XDG_CACHE_HOME is if their backup system does not easily allow
excluding further directories. But that seems like a rather odd reason
for a user to put data into $XDG_CACHE_HOME.

Am I missing something obvious?

> Besides, what if you nuke it *while* the thing is running? That
> doesn't sound like a good idea.

This seems like a rather unlikely corner case. In particular as the
atime is taken into account by tmpfiles.d. So there should be no need
to worry about files being deleted that have been used in the last 30
days or so.

Benjamin

> On 2020-02-26 9:45 a.m., Benjamin Berg wrote:
> > Hi,
> > 
> > so I looked at gsd-housekeeping the other day. With systemd-
> > tempfiles,
> > it only has two purposes these days:
> > 
> >  1. Cleaning $XDG_CACHE_HOME/thumbnails after 30 days
> >  2. Cleaning the trash directories after a configurable time
> > 
> > Currently it also tries to clean /tmp and /var/tmp, but doing so is
> > really dangerous compared to just leaving it up to systemd-
> > tempfiles (I
> > have filed an MR to disable the logic if we are systemd booted).
> > 
> > 
> > Now, systemd-tempfiles can already clean up everything except for
> > the
> > trash. And considering that $XDG_CACHE_HOME is non-essential by
> > definition, I think it might be sane to use systemd-tempfiles not
> > only
> > to clean the thumbnails but the entirety of $XDG_CACHE_HOME in the
> > future. So I am thinking that we could do the following:
> > 
> >    1. Specify that we use the systemd tmpfiles.d configuration
> > format for
> >       cleaning $XDG_CACHE_HOME. Also specify that $XDG_CACHE_HOME
> > will be
> >       cleaned automatically after e.g. 30 days unless otherwise
> > configured
> >       by an application.
> >    2. Add some reference to this to the thumbnail specification.
> >    3. Tell application maintainers that they need to ship a
> > configuration
> >       if they want to keep files longer (likely candidates are e.g.
> > email
> >       clients).
> >    4. As a start, add a "xdg-thumbnails.conf" systemd-tempfiles
> >       configuration to systemd that cleans
> > $XDG_CACHE_HOME/thumbnails
> >       after 30 days.
> >    5. After a grace period, add "xdg-cache.conf" to clean
> > $XDG_CACHE_HOME
> >       and remove "xdg-thumbnails.conf" again (similar to how
> >       /usr/lib/tmpfiles.d/tmp.conf does it for /var/tmp and /tmp)
> > 
> > Is it reasonable to standardise on the systemd tmpfiles.d format?
> > Is it OK to clean $XDG_CACHE_HOME after a fixed time period by
> > default?
> > Other thoughts?
> > 
> > Benjamin
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > xdg mailing list
> > xdg at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/xdg
>  
> _______________________________________________
> xdg mailing list
> xdg at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/xdg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20200226/1efd8fff/attachment.sig>


More information about the xdg mailing list