[PATCH] Add XDG_STATE_HOME

piegames piegames at darmstadt.ccc.de
Wed Nov 6 16:48:10 UTC 2019


Thank you for your reply.

I do not want to simply create more folders and a finer distinction
between them. I want to add directories for types of files that don't
fit really well in the existing structure (see my mail from June; there
are quite a few, but history+logs are the most important to me, and
they can be generalized to "state").

> […] but this does not explain why $XDG_DATA_HOME is unsuited for such
files.

Do you really think applications should store their log files in
$XDG_DATA_HOME? Personally, I don't like this idea at all. Some other
distinctions between data and state:

- State data may not be portable. You wouldn't want it to sync across
machines.
- State data may be less important. A data loss here may be an
annoyance, but nothing as catastrophic as losing config or user data.

I reworded the relevant section of my patch to make it more clear what
the XDG_STATE_FOLDER is about (re-formatted for the email; see the
GitLab link for a full diff):
----
The `$XDG_STATE_HOME` contains state data that should persist between
(application) restarts, but that is not important or portable enough to
the user that it should be stored in `$XDG_DATA_HOME`. It may contain:

- actions history (logs, history, recently used files, …)
- current state of the application that can be reused on a restart
(view, layout, open files, undo history, …)
- connection sockets (ssh, tcp, …) to be reused
----

Regards,
piegames

On Mon, 2019-11-04 at 14:53 +0000, Bollinger, John C wrote:
> I have recently been studying the basedir spec pretty carefully in
> support of work on basedir-related software.  I consider myself to be
> pretty current, though I confess I did not review the XDG_STATE_HOME
> patch request when it came through in August.  Having now given it a
> look, my knee-jerk reaction is "don't make more work for me!", but my
> more considered reaction is to ask what exactly "state-related data"
> is, and how it differs from all four base directory categories that
> already exist.
> 
> The patch speaks to this to some extent: "[It] fits right between
> config and cache. It contains convenience data that should be
> preserved between sessions of a program like logs, history, last
> opened view etc.." I suppose that preservation between program
> sessions is intended to imply preservation between login sessions,
> too, so that $XDG_RUNTIME_DIR is not appropriate, but this does not
> explain why $XDG_DATA_HOME is unsuited for such files.
> 
> Overall, my bias is toward avoiding proliferating base directories
> for more and more nuanced categories of files.  The whole point of
> basedir is to centralize files in a small number of locations instead
> of each program having its own, independent directory(-ies), and
> creating new base directory categories works against that.
> 
> If the concept of state-related data as a category warranting its own
> base directory were accepted then I would have a few things to say
> about the specific wording suggested, but let's not put the cart
> before the horse.
> 
> 
> Regards,
> 
> John Bollinger
> 
> 
> -----Original Message-----
> From: xdg [mailto:xdg-bounces at lists.freedesktop.org] On Behalf Of
> piegames
> Sent: Saturday, November 02, 2019 10:52 AM
> To: xdg at lists.freedesktop.org
> Subject: Re: [PATCH] Add XDG_STATE_HOME
> 
> Caution: External Sender
> 
> 
> Any opinions on this? I need some feedback to get it merged.
> 
> The patch as merge request on Gitlab: <
> https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fxdg%2Fxdg-specs%2Fmerge_requests%2F4&data=01%7C01%7CJohn.Bollinger%40stjude.org%7C3a620a51ef1c4bd8fda108d75fadca0d%7C22340fa892264871b677d3b3e377af72%7C0&sdata=eD7772VsBSkCYGDVSDy0gR4GZVb7zRboMZZI4mFiwxM%3D&reserved=0>
> 
> On Tue, 2019-08-20 at 00:48 +0200, piegames wrote:
> > A few years ago, there was a discussion about an `XDG_STATE_HOME`
> > folder. I also found a patch that adds `XDG_BIN_HOME` deep in the
> > mailing list's archive (which, by the way, is still not merged
> > @maintainer).
> > 
> > I've made a patch similar to the one adding the `bin` directory
> > based
> > on the discussion mentioned above.
> > 
> > Regard,
> > piegames
> > 
> > 
> > ---
> >  basedir/basedir-spec.xml | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> > 
> > diff --git a/basedir/basedir-spec.xml b/basedir/basedir-spec.xml
> > index
> > 8e6fff6..951c493 100644
> > --- a/basedir/basedir-spec.xml
> > +++ b/basedir/basedir-spec.xml
> > @@ -66,6 +66,13 @@
> >              environment variable
> > <literal>$XDG_CONFIG_HOME</literal>.
> >            </para>
> >          </listitem>
> > +        <listitem>
> > +          <para>
> > +            There is a single base directory relative to which
> > user-
> > specific
> > +            state data should be written. This directory is
> > defined
> > by
> > the
> > +            environment variable
> > <literal>$XDG_STATE_HOME</literal>.
> > +          </para>
> > +        </listitem>
> >          <listitem>
> >            <para>
> >              There is a set of preference ordered base directories
> > relative to @@ -121,6 +128,17 @@
> >        <literal>$XDG_CONFIG_HOME</literal> is either not set or
> > empty,
> > a default equal to
> >        <literal>$HOME</literal>/.config should be used.
> >      </para>
> > +    <para>
> > +      <literal>$XDG_STATE_HOME</literal> defines the base
> > directory
> > relative to
> > +      which user-specific state files should be stored. If
> > +      <literal>$XDG_STATE_HOME</literal> is either not set or
> > empty,
> > a
> > default equal to
> > +      <literal>$HOME</literal>/.local/state should be used.
> > +    </para>
> > +    <para>
> > +      The <literal>$XDG_STATE_HOME</literal> fits right between
> > config
> > and cache. It contains
> > +      convenience data that should be preserved between sessions
> > of
> > a
> > program like logs, history,
> > +      last opened view etc.
> > +    </para>
> >      <para>
> >        <literal>$XDG_DATA_DIRS</literal> defines the preference-
> > ordered set of
> >        base directories to search for data files in addition to the
> 
> _______________________________________________
> xdg mailing list
> xdg at lists.freedesktop.org
> https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fxdg&data=01%7C01%7CJohn.Bollinger%40stjude.org%7C3a620a51ef1c4bd8fda108d75fadca0d%7C22340fa892264871b677d3b3e377af72%7C0&sdata=1HPgO1p73vbrjxYyL%2FMG7bSFBRjcTukj2ziaSCphuVY%3D&reserved=0
> 
> ________________________________
> 
> Email Disclaimer: www.stjude.org/emaildisclaimer
> Consultation Disclaimer: www.stjude.org/consultationdisclaimer



More information about the xdg mailing list