Subject: bug#61809: (gnu home services xdg): Wrong value for $XDG_STATE_HOME

From: Philip McGrath <[email-masked]>
Date: Sun, 26 Feb 2023 06:43:27 -0500

Hi,

The following part of the definition of
`home-xdg-base-directories-configuration` in `(gnu home services xdg)` is 
wrong:

```
  (state-home
   (path "$HOME/.local/var/lib")
   "Base directory for programs to store state files, like databases,
analogus to @file{/var/lib}, but for user.  It is not a part of XDG
Base Directory Specification, but helps to make implementation of home
services more consistent.")
```

First of all, version 0.8 of the XDG Base Directory Specification added a 
specification of $XDG_STATE_HOME in May 2021:
https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.8.html

Unfortunately, "$HOME/.local/var/lib" is not the specified default value: the 
specification says it should be "$HOME/.local/state".

Can we just fix the default value, or do we need a more involved compatibility 
plan? Maybe we should mention it in the channel news? Since the spec says it 
should contain data "that is not important or portable enough to the user that 
it should be stored in $XDG_DATA_HOME", maybe just changing it would be ok.

Moreover, it seems like the actually non-standard variable $XDG_LOG_HOME:

```
(log-home
   (path "$HOME/.local/var/log")
   "Base directory for programs to store log files, analogus to
@file{/var/log}, but for user.  It is not a part of XDG Base Directory
Specification, but helps to make implementation of home services more
consistent.")
```

overlaps with the purposes of $XDG_STATE_HOME, which the spec says:

> 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, …)

Do we really need $XDG_LOG_HOME? It looks like it's currently used only to 
control the locations of "dbus.log", "batsignal.log", "shepherd.log", and 
"mcron.log". Could they just go in $XDG_STATE_HOME?

If there is some compelling need, I think the variable name should not begin 
with XDG.

-Philip