Fish has incorrect XDG_DATA_DIRS variable

Bug #1957155 reported by Jonathan Coatess
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
snapd
Fix Released
Undecided
Maciej Borzecki
snapd (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

In https://bugs.launchpad.net/snapd/+bug/1951145 and https://github.com/snapcore/snapd/pull/11071, some Fish configuration was added to ensure XDG_DATA_DIRS contains Snap's desktop directory.

However, this does not appear to work on my system, instead XDG_DATA_DIRS ends up with having spaces in it, meaning the applications are not found:

~ ᐅ fish --version
fish, version 3.3.1
~ ᐅ echo $XDG_DATA_DIRS
/usr/local/share/:/usr/share/:/var/lib/snapd/desktop /var/lib/snapd/desktop /var/lib/snapd/desktop
~ ᐅ bash -c 'echo "$XDG_DATA_DIRS"'
/usr/local/share/:/usr/share/:/var/lib/snapd/desktop /var/lib/snapd/desktop /var/lib/snapd/desktop

It appears the original PR was appending the variable to the XDG_DATA_DIRS array. However, in recent versions of Fish, the variable is _not_ an array (see https://github.com/fish-shell/fish-shell/issues/436 I think), and so this is treated as basic string concatenation.

Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

I believe this was addressed in https://github.com/snapcore/snapd/pull/11221 which landed just recently. You can install the snapd snap from edge and then copy /snap/snapd/current/usr/share/fish/vendor_conf.d/snapd.fish to /usr/share/fish/vendor_conf.d/ and verify if that works for you?

Changed in snapd:
status: New → Fix Committed
assignee: nobody → Maciej Borzecki (maciek-borzecki)
Revision history for this message
Jonathan Coatess (squiddev) wrote :

Can confirm this fixes it, thank you very much!

Sorry - searched launchpad, but didn't think to search PRs/check the current state of the tree. Woops!

Changed in snapd:
milestone: none → 2.54
Revision history for this message
Andy Goossens (andygoossens) wrote :

I got hit by the same issue on Ubuntu 21.10 with snapd version 2.54.2+21.10ubuntu1.

Patching the file as described in #1 fixes it for me.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapd (Ubuntu):
status: New → Confirmed
Revision history for this message
Andy Goossens (andygoossens) wrote (last edit ):

Hm, I suspect that the update broke my desktop environment (Plasma Desktop).

Earlier today I received the 2.54.3+21.10.1ubuntu0.1 update. And when I rebooted, my Plasma Desktop was broken. Applications that were still open worked (Firefox, Konsole), but task panel was absent, icons missing, ...

Note that I am using Fish shell as my default shell. When I use Bash however, the Plasma Desktop is working fine.

When logging in on TTY with Bash as default shell:
XDG_DATA_DIRS == /usr/share/local:/usr/share:/usr/lib/snapd/desktop
When I log in with Fish:
XDG_DATA_DIRS == /usr/lib/snapd/desktop

That would explain why my desktop got broken.

To reproduce:
* create a new user account "test"
* start Plasma session with user "test", everything looks fine
* execute: chsh -s /usr/bin/fish
* log out
* log in again, things are broken

Workaround: Use Bash as default shell. Configure your terminal emulator to use Fish.

EDIT:
For good measure: After removing+purging snapd, the desktop starts up properly.
However, executing "echo $XDG_DATA_DIRS" with Fish returns nothing in that case. Not sure what to think about that.

Revision history for this message
Andy Goossens (andygoossens) wrote :

I have created a separate bug report as I am not the only one hitting this issue:
https://bugs.launchpad.net/snapd/+bug/1961791

Changed in snapd:
status: Fix Committed → Fix Released
Changed in snapd (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.