GNU bug report logs - #43920
[SHEPHERD PATCH] shepherd: Move log file to XDG_CACHE_DIR.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Efraim Flashner <efraim@HIDDEN>; Keywords: patch; dated Sun, 11 Oct 2020 09:22:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 43920 <at> debbugs.gnu.org:


Received: (at 43920) by debbugs.gnu.org; 22 Oct 2020 14:24:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 22 10:24:08 2020
Received: from localhost ([127.0.0.1]:53298 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVbVf-0003JW-Us
	for submit <at> debbugs.gnu.org; Thu, 22 Oct 2020 10:24:08 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48136)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kVbVe-0003J1-Fx
 for 43920 <at> debbugs.gnu.org; Thu, 22 Oct 2020 10:24:07 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:43922)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kVbVY-0002uV-Qu; Thu, 22 Oct 2020 10:24:00 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51302 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kVbVY-0001a0-CF; Thu, 22 Oct 2020 10:24:00 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Efraim Flashner <efraim@HIDDEN>
Subject: Re: [bug#43920] [SHEPHERD PATCH] shepherd: Move log file to
 XDG_CACHE_DIR.
References: <20201011092017.31901-1-efraim@HIDDEN>
Date: Thu, 22 Oct 2020 16:23:57 +0200
In-Reply-To: <20201011092017.31901-1-efraim@HIDDEN> (Efraim Flashner's
 message of "Sun, 11 Oct 2020 12:20:17 +0300")
Message-ID: <87imb2tk3m.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43920
Cc: 43920 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Efraim Flashner <efraim@HIDDEN> skribis:

> * modules/shepherd/support.scm (%user-log-dir): New variable.
> (user-default-log-file): Use it.
> * doc/shepherd.texi: (Invoking shepherd): Adjust listed default log
> file.
> * tests/basic.sh: Adjust for separate log directory.

[...]

>  For unprivileged users, the default log file is
> -@file{$XDG_CONFIG_HOME/shepherd/shepherd.log}.
> +@file{$XDG_CACHE_DIR/shepherd/shepherd.log}.

The previous location wasn=E2=80=99t perfect, but the proposed one isn=E2=
=80=99t great
either: one can generally assume =E2=80=9Crm -rf ~/.cache=E2=80=9D won=E2=
=80=99t lose anything
that cannot be reconstructed, and the log is something that cannot be
reconstructed.

Do the XDG spec have something else that might be more appropriate?

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#43920; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Oct 2020 09:21:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 11 05:21:32 2020
Received: from localhost ([127.0.0.1]:39130 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kRXXo-00067o-78
	for submit <at> debbugs.gnu.org; Sun, 11 Oct 2020 05:21:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:43280)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <efraim@HIDDEN>) id 1kRXXl-00067g-HZ
 for submit <at> debbugs.gnu.org; Sun, 11 Oct 2020 05:21:31 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:48952)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <efraim@HIDDEN>)
 id 1kRXXl-0005lQ-Bv
 for guix-patches@HIDDEN; Sun, 11 Oct 2020 05:21:29 -0400
Received: from flashner.co.il ([178.62.234.194]:45238)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <efraim@HIDDEN>) id 1kRXXj-0005Ct-Ic
 for guix-patches@HIDDEN; Sun, 11 Oct 2020 05:21:29 -0400
Received: from localhost (unknown [141.226.15.20])
 by flashner.co.il (Postfix) with ESMTPSA id 4B378401E5;
 Sun, 11 Oct 2020 09:20:54 +0000 (UTC)
From: Efraim Flashner <efraim@HIDDEN>
To: guix-patches@HIDDEN
Subject: [SHEPHERD PATCH] shepherd: Move log file to XDG_CACHE_DIR.
Date: Sun, 11 Oct 2020 12:20:17 +0300
Message-Id: <20201011092017.31901-1-efraim@HIDDEN>
X-Mailer: git-send-email 2.28.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=178.62.234.194;
 envelope-from=efraim@HIDDEN; helo=flashner.co.il
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/11 05:20:54
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Efraim Flashner <efraim@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

* modules/shepherd/support.scm (%user-log-dir): New variable.
(user-default-log-file): Use it.
* doc/shepherd.texi: (Invoking shepherd): Adjust listed default log
file.
* tests/basic.sh: Adjust for separate log directory.
---
 doc/shepherd.texi            |  2 +-
 modules/shepherd/support.scm | 10 ++++++++--
 tests/basic.sh               |  4 ++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 696477e..0c3901e 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -417,7 +417,7 @@ permissions are not as expected.
 Log output into @var{file}.
 
 For unprivileged users, the default log file is
-@file{$XDG_CONFIG_HOME/shepherd/shepherd.log}.
+@file{$XDG_CACHE_DIR/shepherd/shepherd.log}.
 
 @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 cdb7b35..008b280 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -271,6 +271,12 @@ There is NO WARRANTY, to the extent permitted by law.")))
                      (string-append user-homedir "/.config"))
                  "/shepherd"))
 
+(define %user-log-dir
+  ;; Default log directory if shepherd is run as a normal user.
+  (string-append (or (getenv "XDG_CACHE_DIR")
+                     (string-append user-homedir "/.cache"))
+                 "/shepherd"))
+
 (define %user-runtime-dir
   ;; Default runtime directory if shepherd is run as a normal user.
   (string-append (or (getenv "XDG_RUNTIME_DIR")
@@ -302,8 +308,8 @@ TARGET should be a string representing a filepath + name."
 ;; Logging.
 (define (user-default-log-file)
   "Return the file name of the user's default log file."
-  (mkdir-p %user-config-dir #o700)
-  (string-append %user-config-dir "/shepherd.log"))
+  (mkdir-p %user-log-dir #o700)
+  (string-append %user-log-dir "/shepherd.log"))
 
 (define default-logfile-date-format
   ;; 'strftime' format string to prefix each entry in the log.
diff --git a/tests/basic.sh b/tests/basic.sh
index a6148fc..145c0d3 100644
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -24,6 +24,7 @@ herd --version
 socket="t-socket-$$"
 conf="t-conf-$$"
 confdir="t-confdir-$$"
+cachedir="t-cachedir-$$"
 log="t-log-$$"
 stamp="t-stamp-$$"
 pid="t-pid-$$"
@@ -259,7 +260,9 @@ test -f "$log"
 
 # Set XDG_CONFIG_HOME for configuration files.
 export XDG_CONFIG_HOME=$confdir
+export XDG_CACHE_DIR=$cachedir
 mkdir -p $confdir/shepherd
+mkdir -p $cachedir/shepherd
 mv $conf $confdir/shepherd/init.scm
 rm -f "$pid" "$socket"
 shepherd -I -s "$socket" --pid="$pid" &
@@ -281,3 +284,4 @@ $herd stop root
 ! kill -0 $shepherd_pid
 
 rm -rf $confdir
+rm -rf $cachedir
-- 
2.28.0





Acknowledgement sent to Efraim Flashner <efraim@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#43920; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 22 Oct 2020 14:30:02 UTC

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