GNU bug report logs -
#61982
[PATCH 0/2] Respect XDG Base Directory Specification 0.8.
Previous Next
Reported by: Bruno Victal <mirai <at> makinata.eu>
Date: Sun, 5 Mar 2023 15:18:02 UTC
Severity: normal
Tags: patch
Done: Andrew Tropin <andrew <at> trop.in>
Bug is archived. No further changes may be made.
Full log
Message #26 received at 61982 <at> debbugs.gnu.org (full text, mbox):
Hi,
On Fri, Apr 7, 2023, at 8:46 AM, Andrew Tropin wrote:
> On 2023-04-07 12:47, Bruno Victal wrote:
>
>> Hi Andrew,
>>
>> On 2023-04-07 09:45, Andrew Tropin wrote:
>>> On 2023-03-05 15:19, Bruno Victal wrote:
>>>> --- a/gnu/home/services/desktop.scm
>>>> +++ b/gnu/home/services/desktop.scm
>>>> @@ -206,8 +206,8 @@ (define (home-dbus-shepherd-services config)
>>>> (default-environment-variables))
>>>> #:log-file
>>>> (format #f "~a/dbus.log"
>>>> - (or (getenv "XDG_LOG_HOME")
>>>> - (format #f "~a/.local/var/log"
>>>> + (or (getenv "XDG_STATE_HOME")
>>>> + (format #f "~a/.local/state"
>>>
>>> If we deprecate XDG_LOG_HOME, maybe it's a good idea to make a helper
>>> function, which can be reused across different services?
>>>
>>> Also, how about appending /log subdirectory by default?
>>>> WDYT?
>>
>> I'm wondering if this continued usage of XDG_LOG_HOME was a good idea,
>> maybe the service should just start using XDG_STATE_HOME as soon as possible?
>> (in which case, this patch will have to be reworked to reflect that)
>> This way we avoid introducing yet more code to handle deprecated code.
>>
>> It shouldn't result in any kind of problems, XDG_LOG_HOME will still be set in the meantime
>> for scripts and code that happen to use it and are not part of (upstream) guix.
>>
>> WDYT?
>
> I meant introducing something like this
> (define (get-log-dir)
> (string-append
> (getenv "XDG_STATE_HOME") "/log"))
>
Within the XDG directories, I think (unless perhaps you only use a single file) you are supposed to keep everything in a subdirectory named for your application (or with a well-known name for things shared among multiple applications). For example, on my system, I can find log files in "$XDG_DATA_HOME/akonadi/Akonadi.error", "$XDG_DATA_HOME/akonadi/Akonadi.error.old", "$XDG_DATA_HOME/sddm/wayland-session.log", and "$XDG_DATA_HOME/sddm/xorg-session.log". (Apparently SDDM and Akonadi haven't been updated to use $XDG_STATE_HOME.) I think Guix Home services should follow that convention, rather than putting all logs together in "$XDG_STATE_HOME/log/".
>
> and use it instead of
> (or (getenv "XDG_STATE_HOME")
> (format #f "~a/.local/state" (getenv "HOME")))
>
Perhaps my least-favorite part of the XDG Base Directory specification is having to repeat the default values so many times. But I understood the conclusion from <https://issues.guix.gnu.org/56050#3> to be that Guix should be able to assume that the XDG variables are all explicitly set, either by Guix System or by the installation process for Guix on a foreign distro.
-Philip
This bug report was last modified 2 years and 29 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.