Subject: Re: [PATCH v2 1/2] etc/guix-install.sh: Initialize XDG base directories.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 04 Jul 2022 11:11:53 +0200

Hi!

Philip McGrath <[email-masked]> skribis:

> The default values from the XDG base directory specification make little
> sense for Guix System, and some scripts in Guix assume that they are not
> "empty or unset": for example, see <https://issues.guix.gnu.org/56050>.
> 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 always
> 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 compatibility
> +# with Guix System: see <https://issues.guix.gnu.org/56050#3>.
> +export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
> +export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"

I think variable expansion happens at the wrong time:

--8<---------------cut here---------------start------------->8---
$ cat > /tmp/t <<EOF
> export PATH="$PATH:foobar"
> EOF
$ cat /tmp/t
export PATH="/gnu/store/lq7ysaq5qbxh9xavx1zffgwrg4r8yhsy-profile/bin:/gnu/store/lq7ysaq5qbxh9xavx1zffgwrg4r8yhsy-profile/sbin:/home/ludo/.guix-home/profile/bin:/home/ludo/.guix-home/profile/sbin:/home/ludo/.guix-home/profile/bin:/home/ludo/.guix-home/profile/sbin:/run/setuid-programs:/home/ludo/.config/guix/current/bin:/home/ludo/.guix-profile/bin:/home/ludo/.guix-profile/sbin:/run/current-system/profile/bin:/run/current-system/profile/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’s about
variables that are less likely to be used.)

Could you address that by escaping dollars?

Otherwise LGTM.

Thanks,
Ludo’.