GNU bug report logs -
#43921
[Shepherd PATCH 0/2] Add User Service example.
Previous Next
Reported by: Jan Nieuwenhuizen <janneke <at> gnu.org>
Date: Sun, 11 Oct 2020 09:41:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
* modules/shepherd/support.scm (%user-cache-dir): New variable.
(user-default-log-file): Use it.
* doc/shepherd.texi (Invoking shepherd): Document it.
---
doc/shepherd.texi | 4 +++-
modules/shepherd/support.scm | 11 +++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 696477e..7c9a739 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -417,7 +417,9 @@ 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_HOME/shepherd/shepherd.log}. If the
+@code{XDG_CACHE_HOME} environment variable is not defined,
+@code{$HOME/.cache/shepherd/shepherd.log} is used instead.
@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..fe64a05 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -4,6 +4,7 @@
;; Copyright (C) 2002, 2003 Wolfgang Jährling <wolfgang <at> pro-linux.de>
;; Copyright (C) 2016 Mathieu Lirzin <mthl <at> gnu.org>
;; Copyright (C) 2018 Danny Milosavljevic <dannym <at> scratchpost.org>
+;; Copyright (C) 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
;;
;; This file is part of the GNU Shepherd.
;;
@@ -265,6 +266,12 @@ There is NO WARRANTY, to the extent permitted by law.")))
(false-if-exception (passwd:dir (getpwuid (getuid))))
"/"))
+(define %user-cache-dir
+ ;; Default cache directory if shepherd is run as a normal user.
+ (string-append (or (getenv "XDG_CACHE_HOME")
+ (string-append user-homedir "/.cache"))
+ "/shepherd"))
+
(define %user-config-dir
;; Default config directory if shepherd is run as a normal user.
(string-append (or (getenv "XDG_CONFIG_HOME")
@@ -302,8 +309,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-cache-dir #o700)
+ (string-append %user-cache-dir "/shepherd.log"))
(define default-logfile-date-format
;; 'strftime' format string to prefix each entry in the log.
--
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
This bug report was last modified 4 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.