GNU bug report logs - #56050
[PATCH] home: services: environment-variables: Fix XDG base directories.

Previous Next

Package: guix-patches;

Reported by: Philip McGrath <philip <at> philipmcgrath.com>

Date: Sat, 18 Jun 2022 05:26:01 UTC

Severity: normal

Tags: moreinfo, patch

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Philip McGrath <philip <at> philipmcgrath.com>
Cc: 56050 <at> debbugs.gnu.org
Subject: [bug#56050] [PATCH] home: services: environment-variables: Fix XDG base directories.
Date: Wed, 22 Jun 2022 22:38:11 +0200
Philip McGrath <philip <at> 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’.




This bug report was last modified 2 years and 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.