From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id SAY4C6HbimSWTwAASxT56A (envelope-from ) for ; Thu, 15 Jun 2023 11:36:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MKEKC6HbimRJqQAA9RJhRA (envelope-from ) for ; Thu, 15 Jun 2023 11:36:33 +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 AC354380E2 for ; Thu, 15 Jun 2023 11:36:32 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9jOh-0000T7-Cj; Thu, 15 Jun 2023 05:36:07 -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 1q9jOc-0000Qx-VI for guix-patches@gnu.org; Thu, 15 Jun 2023 05:36:03 -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 1q9jOc-000547-BU for guix-patches@gnu.org; Thu, 15 Jun 2023 05:36:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q9jOb-0004Q3-SL for guix-patches@gnu.org; Thu, 15 Jun 2023 05:36:01 -0400 Subject: bug#61982: [PATCH 2/2] home: services: xdg-base-directories: Deprecate XDG_LOG_HOME. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Thu, 15 Jun 2023 09:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61982 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 61982-done@debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Bruno Victal , philip@philipmcgrath.com Mail-Followup-To: 61982@debbugs.gnu.org, andrew@trop.in, mirai@makinata.eu Received: via spool by 61982-done@debbugs.gnu.org id=D61982.168682173916947 (code D ref 61982); Thu, 15 Jun 2023 09:36:01 +0000 Received: (at 61982-done) by debbugs.gnu.org; 15 Jun 2023 09:35:39 +0000 Received: from localhost ([127.0.0.1]:46210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9jOF-0004PG-6Q for submit@debbugs.gnu.org; Thu, 15 Jun 2023 05:35:39 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:53565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9jOD-0004P1-Bu for 61982-done@debbugs.gnu.org; Thu, 15 Jun 2023 05:35:38 -0400 X-GND-Sasl: andrew@trop.in DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1686821731; 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=Fp35buM7r9oG8eVME6ql8OY0Jp7IrfybnJnBKYosRyI=; b=AEx8TjCxXVfYvKzuzjCTjV5c5UFYEZZQlvSGu8yZmxi4Z7fTJlQ5LotR3CanVLMOgVCdSX AwoGJQnBj2ETHkoTjEKByDG0aXAy1KvH9t6l68iQ1hK6nlk+WHN5qEIvwick4H090iFh3w B5sOn3Fidzpn4EqprAeNWulPvH2yryVn1t4vEr5te9VI/pJB+4tubmP6aaqkYIX1pv9DtR 2l/cZrtX+9xce+DbblR/a5ntT3cCyxDxqs0E6c4eYkYKAR7JUqu1mIrkzygiAYd9p6ZYS8 v9uzomunV4CqRCitXTWZFWk5TCEGSRhTaTIaSZ9tSE1ifPy2ZeYYf5TjlYxxqA== X-GND-Sasl: andrew@trop.in X-GND-Sasl: andrew@trop.in X-GND-Sasl: andrew@trop.in X-GND-Sasl: andrew@trop.in Received: by mail.gandi.net (Postfix) with ESMTPSA id 1D9D56000F; Thu, 15 Jun 2023 09:35:29 +0000 (UTC) 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: Thu, 15 Jun 2023 13:35:24 +0400 Message-ID: <87a5x1rrtv.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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1686821793; 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-to: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=Fp35buM7r9oG8eVME6ql8OY0Jp7IrfybnJnBKYosRyI=; b=BKgV0QA4cX+PbWU0+8ALsrmVgJ7GaytIRVE5U6BGrjFUoDlqghW4qYCLt+ba/DEgEssFKt JoE8BTV7myoqTUtnN613S7VOlTrtEyycJxdhqIMAA35ZMHJ3dnDbl8p56chsgMRA1oarkp iIGZy/kyjnoK/DUEJq+7WiMAj4gO26iplrA4gHnM1+EvOVaM37zoYEVfHrCGV8J9D6k2Mp g8zX8go8CEdy108w5+vkM3FIdnp/gqJuW0A2MGiL3RZDUBCvZYxnePiP52MiwVA5LSHwj7 W14SUIirUN+n53fTSygsIC7d7fiDzFJ0kAaRjVUnXGlME+0tteNDiGpgbwCbYw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=AEx8TjCx; 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-Seal: i=1; s=key1; d=yhetil.org; t=1686821793; a=rsa-sha256; cv=none; b=mqLWqQsJS7KP3528ynWzlaBGSasnSH1NyNpJgiL9Hr4qBk8FbyrqvlTZH2GI1U9iS2jbEN EAG/19yS+jZ5wFiiH6I9iAWhtF8P6jGM1tuo3lRgV8CGYfXCw49mR76HfwZRWIpW9hNRpk EsOp50udPJzajPW0j1JW4tUYt6SmR+ZEb/+6lHpPSDah/CKM81McAMe718ATy4dJHs73Za ZaAAERV6UGlsaUDhdfEkajKhUog1C5M03Ab2aDEpcxw3BwfGV25ebdoP7JDw9Md64qVgti GarRWhWCU6Tdp6uzBZfNjaA7OXauNJHGwZQ54h04jij0nOX+oZhud/M5vcJq9A== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.43 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=AEx8TjCx; 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-Migadu-Queue-Id: AC354380E2 X-Spam-Score: -4.43 X-TUID: 2T3N11Kf1Qv2 --=-=-= 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" > (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)."))) Hi Bruno, Applied, added log subdirectory, pushed, thank you for working on it. Hi Ludo, WDYT about adding (home-log-dir) function to (guix build utils)? So we can prevent copypasting the same code all over home modules. Something like: =2D-8<---------------cut here---------------start------------->8--- (define (home-log-dir) "Returns a directory for user applications logs." (string-append (or (getenv "XDG_STATE_HOME") (format #f "~a/.local/state" (getenv "HOME"))) "/log")) =2D-8<---------------cut here---------------end--------------->8--- =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmSK21wACgkQIgjSCVjB 3rB5nQ/+J6ifXaoQOhVxAsGTboPD1vr0SYfc+HXrgfQ0U1DXPXv4nETTuKlzhoU+ YocTjfCPX4Sq4Cqoi88jg5InBBN1jI0XokVOSMj9J64jecIYBNsPBcLmU2T+sn5M rfAgTJ63DJLT2EL+Ahc8HXATkL9fcgSQiGeAdWFO8/6Q15X6ifZpdvUTBE7HNDge AkjzrHOOcYQgpg88RQiGmZ6it3lXg8KLs2z/Y0gGJ7RsdS/yjKYO5ZDJGlkRg8bv 8zmNOxiGFUd17UtOZUI5HvdKdjoEEb9Lz+0sKQncblDrmagChZbn7HvznwCIWOpD Vli4y+7Wdqb3B0QVvoeJWYUTDY96sX9yOKlar+TFguKpsYJ8yRQOYzmIHiwCZ+uw bbAkPFblEkUx6ot30kJSpzKN/anngng5u9MMtgByHUym8FjzUMruGaTK4aRSIx+D wS3OYccSOuLZD93kkeu/pIu7ZYIJ7dSJy/6kX8GelzqUmJwDxGHRzdcjqdd5Xepq 4TCH34xs3Sg5OlxpTBPeHTVmd4t/NwxYR97dztWD5jblGHA9Zn2tNqJpCnc5Dqf2 ab4FtWWv4X21r/Y9MG9wn5mnJ2xgXeHsmX3/WP1I9OnAqFeumsXvLZoGS82APLGD mZNW7cHhetEm2Nsq7Ef6DyGlOifkBCf5gYXNOUzKXIcOckFRr3s= =d6+V -----END PGP SIGNATURE----- --=-=-=--