emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56758: closed ([PATCH 0/2] Don't try to mkdir XDG_RUNTIME_DIR)


From: GNU bug Tracking System
Subject: bug#56758: closed ([PATCH 0/2] Don't try to mkdir XDG_RUNTIME_DIR)
Date: Fri, 05 Aug 2022 09:07:01 +0000

Your message dated Fri, 05 Aug 2022 11:06:07 +0200
with message-id <87y1w3hxfk.fsf@gnu.org>
and subject line Re: [PATCH v2 0/4] Don't try to mkdir XDG_RUNTIME_DIR
has caused the debbugs.gnu.org bug report #56758,
regarding [PATCH 0/2] Don't try to mkdir XDG_RUNTIME_DIR
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
56758: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56758
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH 0/2] Don't try to mkdir XDG_RUNTIME_DIR Date: Mon, 25 Jul 2022 12:43:47 +0300
Andrew Tropin (2):
  home: xdg: Use closures in activation scripts.
  home: xdg: Skip mkdir XDG_RUNTIME_DIR in activation script.

 gnu/home/services/xdg.scm | 46 ++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 18 deletions(-)

-- 
2.37.0

From d08ed8de3ead1a704a96e0e6673dffb62f859597 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
Date: Thu, 21 Jul 2022 15:24:32 +0300
Subject: [PATCH 1/2] home: xdg: Use closures in activation scripts.

* gnu/home/services/xdg.scm (ensure-xdg-base-dirs-on-activation,
home-xdg-user-directories-files-service): Use closures in activation scripts.
---
 gnu/home/services/xdg.scm | 41 ++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm
index 71c028c788..5a41dc4994 100644
--- a/gnu/home/services/xdg.scm
+++ b/gnu/home/services/xdg.scm
@@ -23,6 +23,7 @@ (define-module (gnu home services xdg)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu home services utils)
   #:use-module (guix gexp)
+  #:use-module (guix modules)
   #:use-module (guix records)
   #:use-module (guix i18n)
   #:use-module (guix diagnostics)
@@ -105,16 +106,17 @@ (define 
(home-xdg-base-directories-environment-variables-service config)
    home-xdg-base-directories-configuration-fields))
 
 (define (ensure-xdg-base-dirs-on-activation config)
-  #~(map (lambda (xdg-base-dir-variable)
-           ((@@ (guix build utils) mkdir-p)
-            (getenv
-             xdg-base-dir-variable)))
-         '#$(map (lambda (field)
-                   (format
-                    #f "XDG_~a"
-                    (object->snake-case-string
-                     (configuration-field-name field) 'upper)))
-                 home-xdg-base-directories-configuration-fields)))
+  (with-imported-modules '((guix build utils))
+    #~(map (lambda (xdg-base-dir-variable)
+             ((@ (guix build utils) mkdir-p)
+              (getenv
+               xdg-base-dir-variable)))
+           '#$(map (lambda (field)
+                     (format
+                      #f "XDG_~a"
+                      (object->snake-case-string
+                       (configuration-field-name field) 'upper)))
+                   home-xdg-base-directories-configuration-fields))))
 
 (define (last-extension-or-cfg config extensions)
   "Picks configuration value from last provided extension.  If there
@@ -205,14 +207,17 @@ (define (home-xdg-user-directories-activation-service 
config)
   (let ((dirs (map (lambda (field)
                      ((configuration-field-getter field) config))
                    home-xdg-user-directories-configuration-fields)))
-    #~(let ((ensure-dir
-             (lambda (path)
-               (mkdir-p
-                ((@@ (ice-9 string-fun) string-replace-substring)
-                 path "$HOME" (getenv "HOME"))))))
-        (display "Creating XDG user directories...")
-        (map ensure-dir '#$dirs)
-        (display " done\n"))))
+    (with-imported-modules `((guix build utils)
+                             ,@(source-module-closure
+                                '((ice-9 string-fun))))
+      #~(let ((ensure-dir
+               (lambda (path)
+                 ((@ (guix build utils) mkdir-p)
+                  ((@ (ice-9 string-fun) string-replace-substring)
+                   path "$HOME" (getenv "HOME"))))))
+          (display "Creating XDG user directories...")
+          (map ensure-dir '#$dirs)
+          (display " done\n")))))
 
 (define home-xdg-user-directories-service-type
   (service-type (name 'home-xdg-user-directories)
-- 
2.37.0

From da332f8272ea3c240fc4e3664051da3b3a4e18c6 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
Date: Thu, 21 Jul 2022 17:06:24 +0300
Subject: [PATCH 2/2] home: xdg: Skip mkdir XDG_RUNTIME_DIR in activation
 script.

* gnu/home/services/xdg.scm (ensure-xdg-base-dirs-on-activation): Skip mkdir
XDG_RUNTIME_DIR in activation script.
---
 gnu/home/services/xdg.scm | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm
index 5a41dc4994..541f64a379 100644
--- a/gnu/home/services/xdg.scm
+++ b/gnu/home/services/xdg.scm
@@ -109,13 +109,18 @@ (define (ensure-xdg-base-dirs-on-activation config)
   (with-imported-modules '((guix build utils))
     #~(map (lambda (xdg-base-dir-variable)
              ((@ (guix build utils) mkdir-p)
-              (getenv
-               xdg-base-dir-variable)))
-           '#$(map (lambda (field)
-                     (format
-                      #f "XDG_~a"
-                      (object->snake-case-string
-                       (configuration-field-name field) 'upper)))
+              (getenv xdg-base-dir-variable)))
+           '#$(filter-map
+               (lambda (field)
+                 (let ((env-var-name
+                        (format
+                         #f "XDG_~a"
+                         (object->snake-case-string
+                          (configuration-field-name field) 'upper))))
+                   ;; XDG_RUNTIME_DIR shouldn't be created during activation
+                   ;; and will be provided by elogind or other service.
+                   (and (not (string=? "XDG_RUNTIME_DIR" env-var-name))
+                        env-var-name)))
                    home-xdg-base-directories-configuration-fields))))
 
 (define (last-extension-or-cfg config extensions)
-- 
2.37.0

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message --- Subject: Re: [PATCH v2 0/4] Don't try to mkdir XDG_RUNTIME_DIR Date: Fri, 05 Aug 2022 11:06:07 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)
Hi Andrew,

Andrew Tropin <andrew@trop.in> skribis:

>   home: xdg: Use single @ intsead of @@.
>   home: xdg: Skip mkdir XDG_RUNTIME_DIR in activation script.
>   home: Use warning instead of display.
>   tests: Make tests inside container reproducible.

Applied, thanks!

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]