all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Zacchaeus Scheffer <zaccysc@gmail.com>
To: 62955@debbugs.gnu.org
Subject: bug#62955: Guix Home Breaks Some Foreign Distros
Date: Wed, 19 Apr 2023 13:50:17 -0700	[thread overview]
Message-ID: <871qkfiol2.fsf@gmail.com> (raw)

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

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html




             reply	other threads:[~2023-04-19 20:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19 20:50 Zacchaeus Scheffer [this message]
2023-04-19 21:05 ` bug#62955: (no subject) Zacchaeus Scheffer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qkfiol2.fsf@gmail.com \
    --to=zaccysc@gmail.com \
    --cc=62955@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.