From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id /xoPBVvYL2Sf1gAASxT56A (envelope-from ) for ; Fri, 07 Apr 2023 10:46:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0B0UA1vYL2RXTAAAauVa8A (envelope-from ) for ; Fri, 07 Apr 2023 10:46:19 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4DD083A423 for ; Fri, 7 Apr 2023 10:46:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkhjW-0005XW-Jo; Fri, 07 Apr 2023 04:46:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pkhjP-0005VZ-I1 for guix-patches@gnu.org; Fri, 07 Apr 2023 04:46:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkhjO-0002JM-Ci for guix-patches@gnu.org; Fri, 07 Apr 2023 04:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pkhjN-00020b-JZ for guix-patches@gnu.org; Fri, 07 Apr 2023 04:46:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#61982] [PATCH 2/2] home: services: xdg-base-directories: Deprecate XDG_LOG_HOME. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 07 Apr 2023 08:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61982 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 61982@debbugs.gnu.org Cc: Bruno Victal , philip@philipmcgrath.com Received: via spool by 61982-submit@debbugs.gnu.org id=B61982.16808571397686 (code B ref 61982); Fri, 07 Apr 2023 08:46:01 +0000 Received: (at 61982) by debbugs.gnu.org; 7 Apr 2023 08:45:39 +0000 Received: from localhost ([127.0.0.1]:55671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkhj0-0001zt-RX for submit@debbugs.gnu.org; Fri, 07 Apr 2023 04:45:39 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:40927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkhiy-0001ze-Gs for 61982@debbugs.gnu.org; Fri, 07 Apr 2023 04:45:37 -0400 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 0C33BFF809; Fri, 7 Apr 2023 08:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1680857130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vaGDBHGTucabtKl3s/x+n4lQS8S58uidCyAVmarGIWM=; b=eu4Ui6JjIoD/RREPpM1iid18SW1Du6KeRdOcbKv7wbAI98eETMd851pcJItzC/E2Sp6BJ2 QH/40Ud/O3YltOCzwWadIqDf2UcceqY+oQxYh0O4vIFEi2TsVR4MsxyhGUrEDCzpGdIRzf ItU2r4NPf5qmmWLafm+Cvqta5WT78PxqaQRaKJUDBC2FkeOr4fZzfCR500aOIor4RFMwog QCS4fvpXvvN+uarL4nvgchv7wbKpj9WbwnogApz9IUsqVMLQHEKUt2lvPPAUkv/rA+DqAd UJUdG1W1qwaOhX9GMsGgBu8qTv19+OfFPcNSg29w0PM+17jQfbpEn7XLknHxzw== From: Andrew Tropin In-Reply-To: <0a0764da3fa04f9a02f37a7960a0c9608782854d.1678029530.git.mirai@makinata.eu> References: <3005f8a58ec5afc447f2baf40958956bd0d16099.1678029530.git.mirai@makinata.eu> <0a0764da3fa04f9a02f37a7960a0c9608782854d.1678029530.git.mirai@makinata.eu> Date: Fri, 07 Apr 2023 12:45:15 +0400 Message-ID: <87cz4gw06c.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680857178; a=rsa-sha256; cv=none; b=GmTgzO6L3zPHCLwTe+0mg3iNM4LHM7/xUMz+jKyIwX/XyGGV6kcUulxOgy/pCnRl6qA2CW kaPPoQ48ym3ftelGGUnq5vZtyVb2J79ofeDqsIvW4PmK9TbXdau+II7WYxhOprVYcMRwNC ytOnL23TKJsQnaWQ0xnqnA72CTeYaGr1Eh5ZLuh+VOEz/UK/erLa2a7hFLNQq4QCew4Px7 8Gk/puoqnpSKz+u+Pq2TMH4RKRgb/jvCMlzQVkjfsCBYsLWdZd9xBuGn/vOiprlJYa1/kw cSZNCL8sM9c/aNAxivYHuLjpZnA3q0OcxnoAaGrS8zXcRJbyV3WRVnaG0oYIgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=eu4Ui6Jj; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680857178; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=vaGDBHGTucabtKl3s/x+n4lQS8S58uidCyAVmarGIWM=; b=pZxeF2FUTsp8EtrpjIeF68d33JV0uDgChZ+AadOK0uYH8Ub21WYeMYloJdM4ScECGtB91Y DAa/aPsmLI2N2cwd7956ebm5E+Ia53k7WGzCk2sBhCI+hqns1N5oM7O6PyxUWVl0KrISDP I5kHXGHBiJEAnNUe8foqN6LdPzf8jMqGC69ggI0dIynSUbwsy4ggLmt10FWco6PRCZ/5Ca d2m9D5A37BiQF8vKyzBd+hESqlNCr4ymDXoNw2gi2zDV8ZVAtlpqYWRgqDBU7tiSJubV1H G6PyvV5v+IahEeq78ibLLVAVsYzq2mnUdTr7gmW6mD16DD23qYdswVmFtBxbGw== X-Migadu-Spam-Score: 0.08 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=eu4Ui6Jj; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Spam-Score: 0.08 X-Migadu-Queue-Id: 4DD083A423 X-TUID: jJ4PNqDghyfM --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-03-05 15:19, Bruno Victal wrote: > XDG_LOG_HOME is non-standard and log files should go to XDG_STATE_HOME > according to the XDG Base Directory Specification. > > Fixes . > > * gnu/home/services/desktop.scm (home-dbus-shepherd-services): Log to XDG= _STATE_HOME. > * gnu/home/services/mcron.scm (home-mcron-shepherd-services): Ditto. > * gnu/home/services/pm.scm (home-batsignal-shepherd-services): Ditto. > * gnu/home/services/shepherd.scm (launch-shepherd-gexp): Ditto. > * gnu/home/services/xdg.scm > (home-xdg-base-directories-configuration)[log-home]: Deprecate and unset = default value. > (home-xdg-base-directories-environment-variables-service) > (ensure-xdg-base-dirs-on-activation): Handle field deprecation. > (home-xdg-base-directories-service-type): Update description. > --- > gnu/home/services/desktop.scm | 4 ++-- > gnu/home/services/mcron.scm | 4 ++-- > gnu/home/services/pm.scm | 6 +++--- > gnu/home/services/shepherd.scm | 4 ++-- > gnu/home/services/xdg.scm | 36 +++++++++++++++++++++++++--------- > 5 files changed, 36 insertions(+), 18 deletions(-) > > diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm > index cb25b03b64..76df7b30a2 100644 > --- a/gnu/home/services/desktop.scm > +++ b/gnu/home/services/desktop.scm > @@ -206,8 +206,8 @@ (define (home-dbus-shepherd-services config) > (default-environment-variables)) > #:log-file > (format #f "~a/dbus.log" > - (or (getenv "XDG_LOG_HOME") > - (format #f "~a/.local/var/log" > + (or (getenv "XDG_STATE_HOME") > + (format #f "~a/.local/state" If we deprecate XDG_LOG_HOME, maybe it's a good idea to make a helper function, which can be reused across different services?=20=20 Also, how about appending /log subdirectory by default? WDYT? > (getenv "HOME")))))) > (stop #~(make-kill-destructor))))) >=20=20 > diff --git a/gnu/home/services/mcron.scm b/gnu/home/services/mcron.scm > index 5f35bfe054..69c7f9faa6 100644 > --- a/gnu/home/services/mcron.scm > +++ b/gnu/home/services/mcron.scm > @@ -99,8 +99,8 @@ (define (home-mcron-shepherd-services config) > #~()) > #$@files) > #:log-file (string-append > - (or (getenv "XDG_LOG_HOME") > - (format #f "~a/.local/var/log" > + (or (getenv "XDG_STATE_HOME") > + (format #f "~a/.local/state" > (getenv "HOME"))) > "/mcron.log"))) > (stop #~(make-kill-destructor)) > diff --git a/gnu/home/services/pm.scm b/gnu/home/services/pm.scm > index 5f09941827..274ab2303c 100644 > --- a/gnu/home/services/pm.scm > +++ b/gnu/home/services/pm.scm > @@ -128,9 +128,9 @@ (define (home-batsignal-shepherd-services config) > (list "-i") > (list))) > #:log-file (string-append > - (or (getenv "XDG_LOG_HOME") > - (format #f "~a/.local/var/log" > - (getenv "HOME"))) > + (or (getenv "XDG_STATE_HOME") > + (format #f "~a/.local/state" > + (getenv "HOME"))) > "/batsignal.log"))) > (stop #~(make-kill-destructor)))))) >=20=20 > diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.= scm > index 1a70a220f0..825cf66f05 100644 > --- a/gnu/home/services/shepherd.scm > +++ b/gnu/home/services/shepherd.scm > @@ -108,8 +108,8 @@ (define (launch-shepherd-gexp config) > (or (getenv "XDG_RUNTIME_DIR") > (format #f "/run/user/~a" (getuid))) > "/shepherd/socket")) > - (let ((log-dir (or (getenv "XDG_LOG_HOME") > - (format #f "~a/.local/var/log" > + (let ((log-dir (or (getenv "XDG_STATE_HOME") > + (format #f "~a/.local/state" > (getenv "HOME"))))) > ;; TODO: Remove it, 0.9.2 creates it automatically? > ((@ (guix build utils) mkdir-p) log-dir) > diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm > index ac557b4c3d..958772696b 100644 > --- a/gnu/home/services/xdg.scm > +++ b/gnu/home/services/xdg.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2021, 2022 Andrew Tropin > ;;; Copyright =C2=A9 2021 Xinglu Chen > +;;; Copyright =C2=A9 2023 Bruno Victal > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -22,6 +23,7 @@ (define-module (gnu home services xdg) > #:use-module (gnu home services) > #:use-module (gnu packages freedesktop) > #:use-module (gnu home services utils) > + #:use-module (guix deprecation) > #:use-module (guix gexp) > #:use-module (guix modules) > #:use-module (guix records) > @@ -39,7 +41,7 @@ (define-module (gnu home services xdg) > home-xdg-base-directories-configuration-config-home > home-xdg-base-directories-configuration-data-home > home-xdg-base-directories-configuration-state-home > - home-xdg-base-directories-configuration-log-home > + home-xdg-base-directories-configuration-log-home ; deprecat= ed > home-xdg-base-directories-configuration-runtime-dir >=20=20 > home-xdg-user-directories-service-type > @@ -77,6 +79,7 @@ (define-module (gnu home services xdg) >=20=20 > (define (serialize-path field-name val) "") > (define path? string?) > +(define-maybe path) >=20=20 > (define-configuration home-xdg-base-directories-configuration > (cache-home > @@ -97,12 +100,17 @@ (define-configuration home-xdg-base-directories-conf= iguration > (path "${XDG_RUNTIME_DIR:-/run/user/$UID}") > "Base directory for programs to store user-specific runtime files, > like sockets.") > + ;; TODO: deprecated field, use $XDG_STATE_HOME(/log) instead. > (log-home > - (path "$HOME/.local/var/log") > + maybe-path > "Base directory for programs to store log files, analogus to > @file{/var/log}, but for user. It is not a part of XDG Base Directory > Specification, but helps to make implementation of home services more > -consistent.") > +consistent." > + (lambda (field-name val) > + (when (maybe-value-set? val) > + (warn-about-deprecation field-name #f #:replacement 'state-home)) > + (serialize-path field-name val))) > (state-home > (path "$HOME/.local/state") > "Base directory for programs to store state data that should persist > @@ -117,7 +125,13 @@ (define (home-xdg-base-directories-environment-varia= bles-service config) > #f "XDG_~a" > (object->snake-case-string (configuration-field-name field) = 'upper)) > ((configuration-field-getter field) config))) > - home-xdg-base-directories-configuration-fields)) > + ;; XXX: deprecated field, remove later > + (if (maybe-value-set? > + (home-xdg-base-directories-configuration-log-home config)) > + home-xdg-base-directories-configuration-fields > + (filter-configuration-fields > + home-xdg-base-directories-configuration-fields > + '(log-home) #t)))) >=20=20 > (define (ensure-xdg-base-dirs-on-activation config) > (with-imported-modules '((guix build utils)) > @@ -138,7 +152,14 @@ (define (ensure-xdg-base-dirs-on-activation config) > ;; and will be provided by elogind or other service. > (and (not (string=3D? "XDG_RUNTIME_DIR" variable)) > variable))) > - home-xdg-base-directories-configuration-fields))))) > + ;; XXX: deprecated field, remove later > + (if (maybe-value-set? > + (home-xdg-base-directories-configuration-log-home > + config)) > + home-xdg-base-directories-configuration-fields > + (filter-configuration-fields > + home-xdg-base-directories-configuration-fields > + '(log-home) #t))))))) >=20=20 > (define (last-extension-or-cfg config extensions) > "Picks configuration value from last provided extension. If there > @@ -157,10 +178,7 @@ (define home-xdg-base-directories-service-type > (default-value (home-xdg-base-directories-configuration)) > (compose identity) > (extend last-extension-or-cfg) > - (description "Configure XDG base directories. This > -service introduces an additional @env{XDG_LOG_HOME} variable. It's not > -a part of XDG specification, at least yet, but are convenient to have, > -it improves the consistency between different home services. The > + (description "Configure XDG base directories. The > services of this service-type is instantiated by default, to provide > non-default value, extend the service-type (using @code{simple-service} > for example)."))) Overall LGTM, let me know what you think on a few comments above. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmQv2BsACgkQIgjSCVjB 3rDrhw//cWndPui+Kl5k5KEkufH933IXT/qy8Y4yefqd9MJLAIbhfqTwsjz4v52P YBeYAJb0vx0Vh9Cq22clzvFq3w9wbVsaKeDkC2sL1Xk3vATRxSuvMI6gcAw8M4Hh 3jc1Lbxv4rv3181d3Qjq+hV665gCSpEDb/gp2dBieGpMRhFPloDdjPkIoebtk9B+ rhngsrvlV67mZl5HDJai91+7BSsBKY2mMxnQ6WOgvFoRUP14YEQ0YM2iikOpnvp+ 2Gjw6WIMRJC4CILglqf2mfLcBbxS6ivrgukOcvlpb0WR9wa7OlFpTZsARC39JPrd DoB54HvmiJzs7cN/gbxfST35rZA/O6P6VnbFjjlIyFrtVr6s2+ORTDfz4k20tSia hd83o6Z0jMrSr0x1PH9xjPCZ/2bKLiqGzpgvcP0cxl6yttiItojpSrXtBANTsT1Q AzKYk43QO09hlJvIWYj7NXZvwB4Tlq+5/Uu8XQr6/K472OvUgc1+0BGcjxWtEWnY F0/3i9d2OUdUJBqUi87j/2pN+C4bBZnJ7KPA/gCdJS2agPMN+88gybj0JBDKbePC EMcKI91iWPV0vv2VsRMpTeTQZ8WZTZo7KCq49IwsdqBdK2Cj4RgGbb+8sbDPK4/6 C7DRl6O0sh7+ilcuEg8QeUGqz+FhR68uzP6LG+o/8lDOlvhKhwE= =ijCt -----END PGP SIGNATURE----- --=-=-=--