Cleaning of $XDG_CACHE_HOME and $XDG_CACHE_HOME/thumbnails

Soni L. fakedme+xdg at gmail.com
Wed Feb 26 13:58:33 UTC 2020



On 2020-02-26 10:39 a.m., Benjamin Berg wrote:
> 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?

Oh sorry, I should've been more specific. I use it in the program I make 
https://ganarchy.autistic.space/project/385e734a52e13949a7a5c71827f6de920dbfea43/

>
> > 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.

I believe git won't necessarily touch old object files such as those 
from really old commits, so that might still break stuff. Unless I'm 
misunderstanding something here and it's meant to be all-or-nothing.

>
> 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



More information about the xdg mailing list