From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YPbZGlbctGIbCAAAbAwnHQ (envelope-from ) for ; Thu, 23 Jun 2022 23:34:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YNnJGlbctGKeDgEA9RJhRA (envelope-from ) for ; Thu, 23 Jun 2022 23:34:14 +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 9980C22CA6 for ; Thu, 23 Jun 2022 23:34:13 +0200 (CEST) Received: from localhost ([::1]:53662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4USq-0003BX-Ek for larch@yhetil.org; Thu, 23 Jun 2022 17:34:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4USg-00039j-RP for guix-patches@gnu.org; Thu, 23 Jun 2022 17:34:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46269) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4USg-0006NZ-J8 for guix-patches@gnu.org; Thu, 23 Jun 2022 17:34:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o4USg-0007qI-Fv for guix-patches@gnu.org; Thu, 23 Jun 2022 17:34:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56050] [PATCH] home: services: environment-variables: Fix XDG base directories. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Jun 2022 21:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56050 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 56050@debbugs.gnu.org Received: via spool by 56050-submit@debbugs.gnu.org id=B56050.165602001730115 (code B ref 56050); Thu, 23 Jun 2022 21:34:02 +0000 Received: (at 56050) by debbugs.gnu.org; 23 Jun 2022 21:33:37 +0000 Received: from localhost ([127.0.0.1]:40166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4USH-0007pe-8O for submit@debbugs.gnu.org; Thu, 23 Jun 2022 17:33:37 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:38485) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4USF-0007pT-No for 56050@debbugs.gnu.org; Thu, 23 Jun 2022 17:33:36 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A3A5B5C0056; Thu, 23 Jun 2022 17:33:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 23 Jun 2022 17:33:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1656020010; x= 1656106410; bh=Vc4OPtEC84JYzJAb+c/O+r/9D1jUSIVf07MBW9gYQec=; b=m 6+za5xOqbCf0Efh88qx+0OqqVdB+hsmSg8KHKvSDbHaaSonNhAfQ6AU1UWqdDLG8 AU70B0hBeEY1k52QdAAub1WpbGseOREr5MCF8qGkmuEJKaMbpj8mWceDbiqPTfJC sF8TPzmiDJpOt/fDf39+0aRf5pkZFegB4jdehi0pWub+3HCUU/XO9xly5J7Kpd34 7Yoph02Cl9OxTaHtJ54hzLGR5s3N6HsEYOeWAWyC+5rstH+9O8HBY6S7H43km0vJ SDbM+80yWtBR6zPQHevcKygB+Ss8C+TdlFTuDr2YDY+imIUSttCvlG2/GfdfARzl 348gLb//Hcgs67py+M1qg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1656020010; x=1656106410; bh=Vc4OPtEC84JYzJAb+c/O+r/9D1jU SIVf07MBW9gYQec=; b=JlNyAQ5Pv9hvhd2aD1Hj4MDpDnsix1ZucdEtABsKJ/8B crm2pZ71u8P+pkjOM5wTTG0i/RXzYi1U1vqCsqdh7JR6bwJ8OHvfGsyRR2wC9uIS KuiYcyP1QGMiAfHIYWstXotfTs+rec8Vh4VXxtogWbhJO4qWBleNLhvagQQvFQBm 0KB4exuJdSlNvv9Q6x42ERbzHMUmcuqrwtmu5Su3oWrDArtMCGtus12re2Wa7w/0 COR5k53tpgR+UDbKuqv5oFSGov5lmBtTr1MKZuMf0O4VxrWC9EcXGBy6BFGBtx75 lF5ORMbq5KVEytfo1tNqSDR38LY5PZQII+ppOSntZw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudefjedgudeifecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkfgjfhggtgesghdtreertddtudenucfhrhhomheprfhhihhl ihhpucfotgfirhgrthhhuceophhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrdgtoh hmqeenucggtffrrghtthgvrhhnpeekgfduteefuefhjeehieeiuefhtdfgtdeuueekledu ffejjeffueehffelhfffkeenucffohhmrghinhepghhnuhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilhhiphesphhhihhl ihhpmhgtghhrrghthhdrtghomh X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Jun 2022 17:33:30 -0400 (EDT) From: Philip McGrath Date: Thu, 23 Jun 2022 17:33:16 -0400 Message-ID: <10145966.nUPlyArG6x@avalon> In-Reply-To: <871qvg303w.fsf@gnu.org> References: <871qvg303w.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2233006.iZASKD2KPV"; 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656020054; 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=Vc4OPtEC84JYzJAb+c/O+r/9D1jUSIVf07MBW9gYQec=; b=mk1xOI7btaGrT4kamG74p2oJITYO/eXMG+bdrZAXR6717yrJipe55IbKtKm9ly+IGiWc8C nVvuu8zROKYpX9lNSdedo7Hek0l0bAoQhmv+q/ZlwbK1jmgr7kkADNmH9lao4HLvtuwzrI uOQcuSeww/j8DVhgIl3Da9x+3f6WCz8x0e7S4ok+fzB3tMbLKWdOErmAx6I3s+YAdXvM9E SWVtJMnsTT+XMqDjQZZ6Wy228TxSAAHiqAmoMYrx7VRzpGzguBCknWPk/uAkIF8QaD4eLA czu43SDJWn64xKn1AMgsdZVEzvu+oB+hFGFGOkxCefKekN5auCr8JsoJXP2Mnw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656020054; a=rsa-sha256; cv=none; b=ZXlidSWbeY9MkLAU7Ferz0Tf9wQWGGAxHGg6y0IIqV3dJRZAyZFOCYQ1cgRKM49PKWsOWv mvZr6lPSPddG0Sa3qJ3edwAdq9QlPk3+Z8DWlaD4DRUxgfrts8ohL6lU8YerM7IUZ0/b25 WCKROC+khMsiwFJenxKq79fq5QUOlPP59QmNvsw15MfxsoyyEIQfEPAop5dwfdJRpsyhcU C1r6caWdEHDlsU6Nlcb9E8vYG8+0ZWIytpADczCGPY57yAscVL/VjRfLvV5Sd4MZ/7zohy jyaibB0OkPHjLk9SaYB31SpI65bOjxQde1IguRglQEtEgaKW8QA6ZF47jAoCSw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b="m 6+za5x"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=JlNyAQ5P; 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-Spam-Score: -2.26 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b="m 6+za5x"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=JlNyAQ5P; 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: 9980C22CA6 X-Spam-Score: -2.26 X-Migadu-Scanner: scn0.migadu.com X-TUID: HB8BVsJxwEnd --nextPart2233006.iZASKD2KPV Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1"; protected-headers="v1" From: Philip McGrath To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Cc: 56050@debbugs.gnu.org Date: Thu, 23 Jun 2022 17:33:16 -0400 Message-ID: <10145966.nUPlyArG6x@avalon> In-Reply-To: <871qvg303w.fsf@gnu.org> On Wednesday, June 22, 2022 4:38:11 PM EDT Ludovic Court=E8s wrote: > Philip McGrath skribis: > > When the environment initialization script is run, XDG_DATA_DIRS and/or > > XDG_CONFIG_DIRS may be empty or unset, in which case we must use their > > respective defaults from the specification, rather than ending the value > > with a trailing ":". For further discussion, see > > . > >=20 > > * gnu/home/services.scm > > (environment-variables->setup-environment-script): Use conditional > > parameter expansion for XDG_DATA_DIRS and XDG_CONFIG_DIRS. >=20 > [...] >=20 > > +++ b/gnu/home/services.scm > > @@ -208,7 +208,7 @@ (define > > (environment-variables->setup-environment-script vars)>=20 > > case $XDG_DATA_DIRS in > > =20 > > *$HOME_ENVIRONMENT/profile/share*) ;; > >=20 > > - *) export XDG_DATA_DIRS=3D$HOME_ENVIRONMENT/profile/share:$XDG_DATA_= DIRS > > ;; + *) export > > XDG_DATA_DIRS=3D$HOME_ENVIRONMENT/profile/share:${XDG_DATA_DIRS:-/usr/l= ocal > > /share/:/usr/share/} ;; > What about doing it this way: >=20 > export > "XDG_DATA_DIRS=3D$HOME_ENVIRONMENT/profile/share${XDG_DATA_DIRS:+:}$XDG_D= ATA_ > DIRS" >=20 > That would avoid adding /usr, which makes little sense for Guix and > could lead to bad surprises on foreign distros, such as loading > incompatible data from the host distro. >=20 > WDYT? >=20 > > case $XDG_CONFIG_DIRS in > > =20 > > *$HOME_ENVIRONMENT/profile/etc/xdg*) ;; > >=20 > > - *) export > > XDG_CONFIG_DIRS=3D$HOME_ENVIRONMENT/profile/etc/xdg:$XDG_CONFIG_DIRS ;;= +=20 > > *) export > > XDG_CONFIG_DIRS=3D$HOME_ENVIRONMENT/profile/etc/xdg:${XDG_CONFIG_DIRS:-= /etc > > /xdg} ;; > Same question here, though /etc/xdg is a bit less problematic as it > could exist on Guix System too. >=20 Unfortunately this doesn't work: on a foreign distro (concretely, for me, K= ubuntu 22.04) when XDG_CONFIG_DIRS isn't set globally, this would expand eq= uivalent to just: XDG_CONFIG_DIRS=3D$HOME_ENVIRONMENT/profile/etc/xdg Arguably, that's slightly better than ending with a trailing ":", since the= semantics of an empty element in or at the end of the path list doesn't se= em to be defined by the specification. However, it leaves me with the same = problem: SDDM can't find the configuration it needs to start my KDE Plasma = session successfully. I do see how /usr would not make a lot of sense for Guix System. Since thos= e paths are written into the spec for empty or unset variables, it seems li= ke Guix System probably should arrange for all of the XDG variables to be s= et to something non-empty very early, maybe in /etc/profile itself. I based this patch on the file that gets installed as /etc/profile.d/guix.s= h (I haven't found its source yet). Maybe we could leave this code alone if= we change that file, instead? Then, both on Guix System and on foreign dis= tros, some system-wide code would be responsible for initializing these sea= rch paths, and we could assume in contexts like this that they are explicit= ly set and not empty. One catch is that, right now, this is what was installed for me into /etc/p= rofile.d/guix.sh: ``` # _GUIX_PROFILE: `guix pull` profile _GUIX_PROFILE=3D"$HOME/.config/guix/current" if [ -L $_GUIX_PROFILE ]; then export PATH=3D"$_GUIX_PROFILE/bin${PATH:+:}$PATH" # Export INFOPATH so that the updated info pages can be found # and read by both /usr/bin/info and/or $GUIX_PROFILE/bin/info # When INFOPATH is unset, add a trailing colon so that Emacs # searches 'Info-default-directory-list'. export INFOPATH=3D"$_GUIX_PROFILE/share/info:$INFOPATH" fi # GUIX_PROFILE: User's default profile GUIX_PROFILE=3D"$HOME/.guix-profile" [ -L $GUIX_PROFILE ] || return GUIX_LOCPATH=3D"$GUIX_PROFILE/lib/locale" export GUIX_PROFILE GUIX_LOCPATH [ -f "$GUIX_PROFILE/etc/profile" ] && . "$GUIX_PROFILE/etc/profile" # set XDG_DATA_DIRS to include Guix installations export XDG_DATA_DIRS=3D"$GUIX_PROFILE/share:${XDG_DATA_DIRS:-/usr/local/sha= re/:/usr/share/}" ``` but $HOME/.guix-profile doesn't exist for me (only $HOME/.guix-home), so th= is script exits without setting GUIX_LOCPATH or XDG_DATA_DIRS. Maybe someth= ing about that should change? =2DPhilip --nextPart2233006.iZASKD2KPV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE9GWrrNY3rqwUFVXPygNjjfo/HHoFAmK03BwACgkQygNjjfo/ HHpzdQ/+LLJJdwhXvKCVZEacdIOCoOsyOPerGZkKTCEKSzauB84iBt/rBtA7TJIO 0xTp8PDNF2x/wE/UzLpd4RShwrummsxkSeVVo1fys7Kjf30/1fn2cHMjqGn2oORK XGkN7eX+pIjQntjUP5hrf7Xi47uyp/F4zCFTFT1SceJ+FUghGtDRI8K61a+ktguD Qf5Q4R0sE8heuX3+l5CPGoNt2Zq0O0LQ6OJqGM9tsjlGqG3FJrrLbAqiR0cqsweA ea54z1bgJeZzwBKjNpztCy+JamuueVoAw7IwF3wge2DIkO5II41G9usHM0rBIMFK t3rlS4JELRkNfBykZVvG6krAAfXKweQrI6AgeKP8puXRGzkXPdfQ8H9SL1IL0Dat IbZmgxydav2oHVeW9a9Q0ryph2zeZBwe5XicbjBRQKPMHO4NnIa/Cl7Tch9kaw8i cwAVjE/7vbqj9xiCavoZpMkLbAS7VtgoddxBJgk7+SZD49L4JmnOwqBSv1Uss6nk ADw+GgAjEB8nghHfBqwe0n5TC3glSET3rJ8iID7TAJKwj+1LQK7epLNaBtaaQSvy K3ZJM+Su7W3Dtnmce5HitGy8lanD8I068zLaCPmr3//7eJCNYXkPoQ5/MZ4w5iv9 QUOyMfeKQiGK8UtFe20lv58ztrLNjDOrhE1TvS2oGVM+BfAxWWY= =w65O -----END PGP SIGNATURE----- --nextPart2233006.iZASKD2KPV--