[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#56050] [PATCH] home: services: environment-variables: Fix XDG base
From: |
Ludovic Courtès |
Subject: |
[bug#56050] [PATCH] home: services: environment-variables: Fix XDG base directories. |
Date: |
Wed, 22 Jun 2022 22:38:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
Philip McGrath <philip@philipmcgrath.com> 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
> <https://lists.gnu.org/archive/html/help-guix/2022-05/msg00147.html>.
>
> * gnu/home/services.scm
> (environment-variables->setup-environment-script): Use conditional
> parameter expansion for XDG_DATA_DIRS and XDG_CONFIG_DIRS.
[...]
> +++ b/gnu/home/services.scm
> @@ -208,7 +208,7 @@ (define (environment-variables->setup-environment-script
> vars)
>
> case $XDG_DATA_DIRS in
> *$HOME_ENVIRONMENT/profile/share*) ;;
> - *) export XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:$XDG_DATA_DIRS ;;
> + *) export
> XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
> ;;
What about doing it this way:
export
"XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"
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.
WDYT?
> case $XDG_CONFIG_DIRS in
> *$HOME_ENVIRONMENT/profile/etc/xdg*) ;;
> - *) export
> XDG_CONFIG_DIRS=$HOME_ENVIRONMENT/profile/etc/xdg:$XDG_CONFIG_DIRS ;;
> + *) export
> XDG_CONFIG_DIRS=$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.
Thanks,
Ludo’.