From patchwork Mon Aug 1 10:08:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 41079 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 18D5827BBEA; Mon, 1 Aug 2022 11:09:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6993827BBE9 for ; Mon, 1 Aug 2022 11:09:43 +0100 (BST) Received: from localhost ([::1]:36424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oISMo-0003TO-Fl for patchwork@mira.cbaines.net; Mon, 01 Aug 2022 06:09:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oISMA-0003Qi-IC for guix-patches@gnu.org; Mon, 01 Aug 2022 06:09:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49628) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oISMA-0000nG-8s for guix-patches@gnu.org; Mon, 01 Aug 2022 06:09:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oISMA-0003nT-2f for guix-patches@gnu.org; Mon, 01 Aug 2022 06:09:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56758] [PATCH 0/2] Don't try to mkdir XDG_RUNTIME_DIR Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 01 Aug 2022 10:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56758 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Andrew Tropin Cc: 56758@debbugs.gnu.org Received: via spool by 56758-submit@debbugs.gnu.org id=B56758.165934853414571 (code B ref 56758); Mon, 01 Aug 2022 10:09:02 +0000 Received: (at 56758) by debbugs.gnu.org; 1 Aug 2022 10:08:54 +0000 Received: from localhost ([127.0.0.1]:39377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oISM2-0003mx-0b for submit@debbugs.gnu.org; Mon, 01 Aug 2022 06:08:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oISLx-0003mT-Dc for 56758@debbugs.gnu.org; Mon, 01 Aug 2022 06:08:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oISLr-0000lr-3A; Mon, 01 Aug 2022 06:08:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=kG/7fHYFS55sqAGcqUIEammUMi94hbPZxLdE1Xa3w4w=; b=PVL76ZTwuhwT6yGwdE3g msG+wSmQ3hkuA16VyipC2dV4qUKNKTAr6db2MK4rZCoD5uHEMxZycMok3PQLkSzYejpWV1VNViaRz o5rtQs9qu9Lp++ZdXUD0yCKk1KJq/ss5+jDligPIojIeVe35tv13KVTSe+XnB63l1B08DF10GSTY8 AmWn52Ka8yU9su9sZfTFEfkfxQTb2Z1QslLzUEfGsExDMFLQG0PxGucMjmT/xkOd9oAs5vGhlyBJZ 6eQscuzvzObX2W2dPKxNJCPykMVli1NnByeh+t5SEqhI0aJBMU5mTGkvtQeCNuu4/tUQdusqiH+rw fxp1jYLoh3SZag==; Received: from [193.50.110.235] (port=41056 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oISLp-0006eQ-HZ; Mon, 01 Aug 2022 06:08:41 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= References: <87wnc1zfrh.fsf@trop.in> Date: Mon, 01 Aug 2022 12:08:39 +0200 In-Reply-To: <87wnc1zfrh.fsf@trop.in> (Andrew Tropin's message of "Mon, 25 Jul 2022 12:43:47 +0300") Message-ID: <87r120z36g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi, Andrew Tropin skribis: > From d08ed8de3ead1a704a96e0e6673dffb62f859597 Mon Sep 17 00:00:00 2001 > From: Andrew Tropin > 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. [...] > (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) This change doesn’t hurt but it’s apparently unnecessary. > + (with-imported-modules `((guix build utils) > + ,@(source-module-closure > + '((ice-9 string-fun)))) However this one is incorrect is it would lead (ice-9 string-fun) from the host Guile to be imported into the build environment, thereby making the result dependent on the version of Guile that is used “outside” (you may have seen a warning like “importing (ice-9 string-fun) from the host”.) > From da332f8272ea3c240fc4e3664051da3b3a4e18c6 Mon Sep 17 00:00:00 2001 > From: Andrew Tropin > 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) I tweaked that accordingly (patch attached), but that leads to a test failure in ‘tests/guix-home.sh’ because there’s a warning about XDG_RUNTIME_DIR not existing that goes to standard output of ‘guix home container’: --8<---------------cut here---------------start------------->8--- + guix home container home.scm -- false XDG_RUNTIME_DIR doesn't exists, on-first-login script won't execute anything. You can check if xdg runtime directory exists, XDG_RUNTIME_DIR variable is set to appropriate value and manually execute the script by running '$HOME/.guix-home/on-first-login'++ guix home container home.scm -- echo '$HOME' guix home: warning: only 4.1 GiB of free space available on /gnu/store hint: Consider deleting old profile generations and collecting garbage, along these lines: guix gc --delete-generations=1m + test 'XDG_RUNTIME_DIR doesn'\''t exists, on-first-login script won'\''t execute anything. You can check if xdg runtime directory exists, XDG_RUNTIME_DIR variable is set to appropriate value and manually execute the script by running '\''$HOME/.guix-home/on-first-login'\''/home/ludo' = /home/ludo --8<---------------cut here---------------end--------------->8--- Thoughts? Ludo’. From f6ff733aaaea7e5b8277b65430e7dc090dffa9aa Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Thu, 21 Jul 2022 17:06:24 +0300 Subject: [PATCH] home: xdg: Skip mkdir XDG_RUNTIME_DIR in activation script. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/home/services/xdg.scm (ensure-xdg-base-dirs-on-activation): Skip mkdir XDG_RUNTIME_DIR in activation script. Co-authored-by: Ludovic Courtès --- gnu/home/services/xdg.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm index 71c028c788..0219bc93e0 100644 --- a/gnu/home/services/xdg.scm +++ b/gnu/home/services/xdg.scm @@ -109,12 +109,18 @@ (define (ensure-xdg-base-dirs-on-activation config) ((@@ (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))) + '#$(filter-map + (lambda (field) + (let ((variable + (string-append + "XDG_" + (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" variable)) + variable))) + home-xdg-base-directories-configuration-fields))) (define (last-extension-or-cfg config extensions) "Picks configuration value from last provided extension. If there -- 2.37.1