Guix Home Breaks Some Foreign Distros

  • Open
  • quality assurance status badge
Details
One participant
  • Zacchaeus Scheffer
Owner
unassigned
Submitted by
Zacchaeus Scheffer
Severity
normal

Debbugs page

Zacchaeus Scheffer wrote 2 years ago
(address . bug-guix@gnu.org)
871qkfiol2.fsf@gmail.com
Hi all!

$HOME/PROFILE/setup-environment contains the following lines:

case $XDG_CONFIG_DIRS in
*$HOME_ENVIRONMENT/profile/etc/xdg*) ;;
*) export XDG_CONFIG_DIRS=$HOME_ENVIRONMENT/profile/etc/xdg:$XDG_CONFIG_DIRS ;;
esac

There are two bugs in this code. Both bugs revolve around what happens
if XDG_CONFIG_DIRS is unset, as is the case in some foreign distros.

The first problem is if, XDG_CONFIG_DIRS is unset, and
$HOME_ENVIRONMENT/profile/etc/xdg does not exist, then the conditional
resolves to "is the empty string in the empty string", so
XDG_CONFIG_DIRS is prepended with $HOME_ENVIRONMENT/profile/etc/xdg,
despite it not existing. I'm not sure if incuding a nonexistant path in
XDG_CONFIG_DIRS should cause problems, but this scenario is not
mentioned in the XDG specifications[1], so some programs are bound to
crash because of this.

The second problem (more important) relates to how XDG_CONFIG_DIRS is
interpreted if empty vs set to a value. As per the xdg
specifications[1], if XDG_CONFIG_DIRS is unset, then a value of /etc/xdg
should be used. When an empty XDG_CONFIG_DIRS is set by guix home,
programs find a non-empty value and ignore /etc/xdg.

The above problem means that when I do a guix home reconfigure on my
Librem 5 running PureOS, I get a black screen as Phosh fails to start as
it needs files in /etc/xdg. I can fix it by adding:

XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS:/etc/xdg"

to my .zlogin. A similar issue can be seen with the lines regarding
XDG_DATA_DIRS in $HOME/PROFILE/setup-environment. I think a good step
to resovling this issue is to set empty variables to their default value
first. Maybe something like the following in gnu/home/services.scm:267

...
[ -f $PROFILE_FILE ] && . $PROFILE_FILE
[ -z "$XDG_DATA_DIRS"] && XDG_DATA_DIRS=/usr/local/share/:/usr/share/
[ -z "$XDG_CONFIG_DIRS"] && XDG_CONFIG_DIRS=/etc/xdg
case $XDG_DATA_DIRS in
...

This addresses the second problem, but not the first. Someone may find
a more elegant way to deal with both issues.

-Zacchae

Zacchaeus Scheffer wrote 2 years ago
(no subject)
(address . 62955@debbugs.gnu.org)
87wn27h9av.fsf@gmail.com
And just like that, i find there is already a discussion of some of this
in 56050, though the fact that non-existant paths can be added by guix
home to those variables is seems to be missing from that discussion.
Could someone merge the threads? (I assume I can't do that.)

-Zacchae
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 62955@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 62955
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help