GNU bug report logs - #53781
[PATCH shepherd] support: Use XDG_STATE_HOME for log files.

Previous Next

Package: guix-patches;

Reported by: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Date: Fri, 4 Feb 2022 16:22:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53781 in the body.
You can then email your comments to 53781 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#53781; Package guix-patches. (Fri, 04 Feb 2022 16:22:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 04 Feb 2022 16:22:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH shepherd] support: Use XDG_STATE_HOME for log files.
Date: Fri, 4 Feb 2022 09:07:09 +0100
As per XDG Base Directory Specification 0.8, "action history" (such as logs)
ought to be stored in $XDG_STATE_HOME, defaulting to $HOME/.local/state.
Respect this specification.

* modules/shepherd/support.scm (%user-log-dir): Define in terms of
XDG_STATE_HOME.
* doc/shepherd.texi: Adjust accordingly.
* tests/basic.sh: Adjust accordingly.
---
 doc/shepherd.texi            | 3 ++-
 modules/shepherd/support.scm | 4 ++--
 tests/basic.sh               | 4 +++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 94f6131..b779a5f 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -419,7 +419,8 @@ permissions are not as expected.
 Log output into @var{file}.
 
 For unprivileged users, the default log file is
-@file{$XDG_DATA_DIR/.local/share/shepherd/shepherd.log}.
+@file{$XDG_STATE_HOME/shepherd/shepherd.log} with @file{$XDG_STATE_HOME}
+defaulting to @file{$HOME/.local/state}.
 
 @cindex syslog
 When running as root, the default behavior is to connect to
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 21c59f7..72b74ba 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -277,8 +277,8 @@ There is NO WARRANTY, to the extent permitted by law.")))
 
 (define %user-log-dir
   ;; Default log directory if shepherd is run as a normal user.
-  (string-append (or (getenv "XDG_DATA_DIR")
-                     (string-append user-homedir "/.local/share"))
+  (string-append (or (getenv "XDG_STATE_HOME")
+                     (string-append user-homedir "/.local/state"))
                  "/shepherd"))
 
 (define %user-runtime-dir
diff --git a/tests/basic.sh b/tests/basic.sh
index 5079aa1..5ef1fb0 100644
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -260,7 +260,9 @@ test -f "$log"
 
 # Set XDG_CONFIG_HOME for configuration files.
 export XDG_CONFIG_HOME=$confdir
-export XDG_DATA_DIR=$datadir
+export XDG_DATA_HOME=$datadir
+# Reuse XDG_DATA_HOME as XDG_STATE_HOME for backwards compatibility.
+export XDG_STATE_HOME=$datadir
 mkdir -p $confdir/shepherd
 mkdir -p $datadir/shepherd
 mv $conf $confdir/shepherd/init.scm
-- 
2.34.0





Information forwarded to guix-patches <at> gnu.org:
bug#53781; Package guix-patches. (Sat, 12 Feb 2022 10:38:01 GMT) Full text and rfc822 format available.

Message #8 received at 53781 <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: 53781 <at> debbugs.gnu.org
Subject: Re: bug#53781: [PATCH shepherd] support: Use XDG_STATE_HOME for log
 files.
Date: Sat, 12 Feb 2022 11:37:26 +0100
Hello Liliana,


Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> As per XDG Base Directory Specification 0.8, "action history" (such as logs)
> ought to be stored in $XDG_STATE_HOME, defaulting to $HOME/.local/state.
> Respect this specification.
>
> * modules/shepherd/support.scm (%user-log-dir): Define in terms of
> XDG_STATE_HOME.
> * doc/shepherd.texi: Adjust accordingly.
> * tests/basic.sh: Adjust accordingly.
> ---
>  doc/shepherd.texi            | 3 ++-
>  modules/shepherd/support.scm | 4 ++--
>  tests/basic.sh               | 4 +++-
>  3 files changed, 7 insertions(+), 4 deletions(-)

[...]

> diff --git a/tests/basic.sh b/tests/basic.sh
> index 5079aa1..5ef1fb0 100644
> --- a/tests/basic.sh
> +++ b/tests/basic.sh
> @@ -260,7 +260,9 @@ test -f "$log"
>  
>  # Set XDG_CONFIG_HOME for configuration files.
>  export XDG_CONFIG_HOME=$confdir
> -export XDG_DATA_DIR=$datadir
> +export XDG_DATA_HOME=$datadir
> +# Reuse XDG_DATA_HOME as XDG_STATE_HOME for backwards compatibility.
> +export XDG_STATE_HOME=$datadir
>  mkdir -p $confdir/shepherd
>  mkdir -p $datadir/shepherd
>  mv $conf $confdir/shepherd/init.scm

I don't get why you define XDG_DATA_HOME here, as it wasn't used before and it
is a test and shouldn't need to be backward compatible except for testing  such
backward compatibility.

Otherwise it LGTM! Thank you for the patch.

Cheers,
- Brice




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 24 Mar 2022 22:11:02 GMT) Full text and rfc822 format available.

Notification sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
bug acknowledged by developer. (Thu, 24 Mar 2022 22:11:02 GMT) Full text and rfc822 format available.

Message #13 received at 53781-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: 53781-done <at> debbugs.gnu.org
Subject: Re: bug#53781: [PATCH shepherd] support: Use XDG_STATE_HOME for log
 files.
Date: Thu, 24 Mar 2022 23:10:30 +0100
Hi,

Liliana Marie Prikler <liliana.prikler <at> gmail.com> skribis:

> As per XDG Base Directory Specification 0.8, "action history" (such as logs)
> ought to be stored in $XDG_STATE_HOME, defaulting to $HOME/.local/state.
> Respect this specification.
>
> * modules/shepherd/support.scm (%user-log-dir): Define in terms of
> XDG_STATE_HOME.
> * doc/shepherd.texi: Adjust accordingly.
> * tests/basic.sh: Adjust accordingly.

Pushed as ec2a0b07a6dedcbec3cf6bb7328b144a117873e8, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 22 Apr 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.