From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aAAtJLsXw2IfKgEAbAwnHQ (envelope-from ) for ; Mon, 04 Jul 2022 18:39:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UJoUJLsXw2I5PQEA9RJhRA (envelope-from ) for ; Mon, 04 Jul 2022 18:39:23 +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 C223B12FD3 for ; Mon, 4 Jul 2022 18:39:22 +0200 (CEST) Received: from localhost ([::1]:46492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8P6X-0001cl-UC for larch@yhetil.org; Mon, 04 Jul 2022 12:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8P6L-0001cc-2l for guix-patches@gnu.org; Mon, 04 Jul 2022 12:39:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8P6D-0006K7-Q7 for guix-patches@gnu.org; Mon, 04 Jul 2022 12:39:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o8P6D-0002tE-MN for guix-patches@gnu.org; Mon, 04 Jul 2022 12:39:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56050] [PATCH v2 1/2] etc/guix-install.sh: Initialize XDG base directories. Resent-From: "Philip McGrath" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Jul 2022 16:39:01 +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.165695269611051 (code B ref 56050); Mon, 04 Jul 2022 16:39:01 +0000 Received: (at 56050) by debbugs.gnu.org; 4 Jul 2022 16:38:16 +0000 Received: from localhost ([127.0.0.1]:48559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8P5P-0002s6-KP for submit@debbugs.gnu.org; Mon, 04 Jul 2022 12:38:15 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:55017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8P5L-0002rd-OL for 56050@debbugs.gnu.org; Mon, 04 Jul 2022 12:38:10 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id CBB70320096F; Mon, 4 Jul 2022 12:38:00 -0400 (EDT) Received: from imap52 ([10.202.2.102]) by compute4.internal (MEProxy); Mon, 04 Jul 2022 12:38:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:cc:content-transfer-encoding :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=1656952680; x=1657039080; bh=ew/U6UYTB8 KpeBuejPXlCx1Y+B3unqoDGP/K25C53bk=; b=SAyHcJH7mMsP5KsSYQ01deM1+C u1sLJSg3P2Qy0pf1l3HB+d1IOwStVpgBxEAs+tza0JE2YB2W5ncRWrKT9Dq81Ijm /NVEnNRf7xLUiKKZfPPk988qUFnVDEZp5YTfbiJoeI/6cLpNnShgiWCdM4pr7QAd DilWlV8kvhXGtXQs7rNkcZbEy8msJuidNImztOKDtV1dgnfDVM2Pc+cXtKNlXR8D 8WqQM3Xo9AEieG9gOvGtw/dyxLjxJHO2fDJ5Fuo3nnJEtqt7ltEYNvHywn/Pc0qd bZTTQkSnsPHKZ53Gp0kFIjxuQCc1yd6C5GEFFe4VjDN55o3XShqo3ZRXyIBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=1656952680; x= 1657039080; bh=ew/U6UYTB8KpeBuejPXlCx1Y+B3unqoDGP/K25C53bk=; b=L te9Fk8rtiiCvNOH3rK1z6HyttSvrD9r9UiyJy8RR+uyZtnV4FNVSZBdXHLX4VmEw 77mmOeCUDaKcUVM9eFQvm/lG6RlFivEcvxk2BkZEffYde8/wKlNpgLPlnGWa0mwZ esUeJaVfDceCvl/Vn9ev5pEQv/ENyRPDvaQRGE4x5fKG2WbOyP2mLKfT2jY3VEGv yZj5lXohvRfcpUx2jIq6Coch46l0tSijCVMF2rj9yjYGFIHADiLoc9xRw2/nwJii eJQ+i4mp2XoHZgYShMRVvi9zXLgmqTf4udG9KqX2AWb32Wa6F1h6aOZ9Nvpe45zs q3E+RJH9DkYFsNq5tQung== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehledguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedf rfhhihhlihhpucfotgfirhgrthhhfdcuoehphhhilhhiphesphhhihhlihhpmhgtghhrrg hthhdrtghomheqnecuggftrfgrthhtvghrnhepfefhgedtheejhffgteejvddttdejtdev leegvdefteelkeekffdvhfeggeetkeefnecuffhomhgrihhnpehgnhhurdhorhhgpdhhoh hmvgdrlhhotggrlhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehphhhilhhiphesphhhihhlihhpmhgtghhrrghthhdrtghomh X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 01737C6008B; Mon, 4 Jul 2022 12:37:59 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-713-g1f035dc716-fm-20220617.001-g1f035dc7 Mime-Version: 1.0 Message-Id: <99286d24-c62d-4506-b172-dbac712acf9e@www.fastmail.com> In-Reply-To: <877d4tgs2u.fsf@gnu.org> References: <605a74b1f064e2b057f6c9d57692dda5bccf8edf.1656899134.git.philip@philipmcgrath.com> <877d4tgs2u.fsf@gnu.org> Date: Mon, 04 Jul 2022 12:36:44 -0400 From: "Philip McGrath" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=1656952763; 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: content-transfer-encoding:content-transfer-encoding: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=ew/U6UYTB8KpeBuejPXlCx1Y+B3unqoDGP/K25C53bk=; b=Bi4PewyK/4aTBdGX2D613uxuXazmMU9kH1z29fLJgBlCOYdfMVUNC5DUDHs1WkdlWdl7/P 2enSJPwGQbL8im4+upkyfvIeabYzCRIWVjOCmZUjF/bAibVwv2CYLmvCVu0J+hdweyWMdu J2EBEqB2BQ8dHc/AefhEU7RXtQnrcXxR2qHsOHRYpkV8GDzJPNHmZOlibr3Gye/eXj2Kb4 EE325vnMIYlfQCHm/XCtWdQPLU3inttMwQiAU1L4yw70KePJOuftoY1KFDDBk1PekiUQ/F cJxux0z9Dhb6qyZAii7ZLLj/vEpZfZkhHjfFg9cwSXDIsgkzikzCC4kbMqRA/A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656952763; a=rsa-sha256; cv=none; b=FaJeMmk5Vx5AQ++9LWKCVpOEZvaoCOc7Ah1g02/cy98z6NnNFQLhlKNPsCC2IJy/AC2dq3 GsrGbn1yAZh4CDAN8SzqGaoEecB2aUc9ax7V24QSKoYtpHpqvUC/RZR7swgKhS/4i9CAH8 cf98OSsVKZKw6ybwiXbzNW6qfg+VVmgwbIJf9pgBkNuJTEUDkAf0RyoNNSzSHelJQtyMEz 6S5uQPOSpPOKgFH2IM0FAyG0sZ3YNl13MWKPOFBvxBvst7eyCwYOFkfbk6dfZ+8wj7L457 5IuHbsgNdLgs3ASAlEOK4FX7EjiPm9lYyjL1uItkTYKkbEJ1RiZ32qPKvqzCEw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b=SAyHcJH7; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="L te9Fk8"; 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: 1.96 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b=SAyHcJH7; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="L te9Fk8"; 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: C223B12FD3 X-Spam-Score: 1.96 X-Migadu-Scanner: scn1.migadu.com X-TUID: IZJiD242jTUY Hi, On Mon, Jul 4, 2022, at 5:11 AM, Ludovic Court=C3=A8s wrote: > Hi! > > Philip McGrath skribis: > >> The default values from the XDG base directory specification make lit= tle >> sense for Guix System, and some scripts in Guix assume that they are = not >> "empty or unset": for example, see . >> On foreign distros, however, omitting the default values is likely to >> break software from the distro, perhaps even preventing the desktop >> environment from starting. To smooth over the difference, use the >> system-wide configuration to ensure the environment variables are alw= ays >> explicitly set on foreign distros. >> >> * etc/guix-install.sh (sys_create_init_profile): Explicitly initialize >> XDG base directory variables. > > [...] > >> +# Explicitly initialize XDG base directory variables to ease compati= bility >> +# with Guix System: see . >> +export XDG_DATA_HOME=3D"${XDG_DATA_HOME:-$HOME/.local/share}" >> +export XDG_CONFIG_HOME=3D"${XDG_CONFIG_HOME:-$HOME/.config}" > > I think variable expansion happens at the wrong time: > > --8<---------------cut here---------------start------------->8--- > $ cat > /tmp/t <> export PATH=3D"$PATH:foobar" >> EOF > $ cat /tmp/t > export=20 > PATH=3D"/gnu/store/lq7ysaq5qbxh9xavx1zffgwrg4r8yhsy-profile/bin:/gnu/s= tore/lq7ysaq5qbxh9xavx1zffgwrg4r8yhsy-profile/sbin:/home/ludo/.guix-home= /profile/bin:/home/ludo/.guix-home/profile/sbin:/home/ludo/.guix-home/pr= ofile/bin:/home/ludo/.guix-home/profile/sbin:/run/setuid-programs:/home/= ludo/.config/guix/current/bin:/home/ludo/.guix-profile/bin:/home/ludo/.g= uix-profile/sbin:/run/current-system/profile/bin:/run/current-system/pro= file/sbin:/gnu/store/0c1yfbxyv877mlgychfgvmk5ha2jqh52-gzip-1.10/bin:/gnu= /store/8fpk2cja3f07xls48jfnpgrzrljpqivr-coreutils-8.32/bin:foobar" > --8<---------------cut here---------------end--------------->8--- > > (The problem already exists, and should be fixed, but it=E2=80=99s abo= ut > variables that are less likely to be used.) > > Could you address that by escaping dollars? > > Otherwise LGTM. > AFAICT, this seems to work. I think this is because of a rule I didn't k= now about before from the section "Here Documents" under `info "(bash)Re= directions"`: > If any part of *word* is quoted, the *delimiter* is the result of > quote removal on *word*, and the lines in the here-document > are not expanded. and the beginning EOF is quoted, so it works like this: --8<---------------cut here---------------start------------->8--- $ cat quoted-here-doc.sh=20 #!/bin/sh cat <<"EOF" > out.sh export PATH=3D"$PATH:foobar" EOF $ ./quoted-here-doc.sh=20 $ cat out.sh=20 export PATH=3D"$PATH:foobar" --8<---------------cut here---------------end--------------->8--- I'm certainly no expert on shell quoting, though. -Philip