`snapd` and `flatpak` packages together produces duplicating entries in `$XDG_DATA_DIRS`

...which produces duplicating entries in "Choose an application" dialog (at least when it opens from Double Commander).

I've checked /usr/share/applications/ and ~/.local/share/applications alreay, it's all OK

Screenshot_2020-05-05_23-59-32

On my laptop (works under Manjaro 20.0 Lysia) I've installed pamac-snap-plugin and flatpak.

pamac-snap-plugin requires snapd, which profile is located at /etc/profile.d/snapd.sh. Flatpak profile is /etc/profile.d/flatpak.sh. I can't get how they affects $XDG_DATA_DIRS at the end, but resulting $XDG_DATA_DIRS contains two /usr/share entries :

/home/user/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share

...which in turn leads to duplicating entries in "Choose an application" dialog.


I don't know how to fix it without escaping pamac-snap-plugin or flatpak. What should I do? Is it packaging bug?

UPD: duplication of /usr/share occurs even if I install flatpak or snapd separately. The problem in their /etc/profile.d/ scripts.

So it is a problem with flatpak and snapd packages and not with the pamac plug-ins?

Yes, pamac-snap-plugin does not affect $XDG_DATA_DIRS by itself, but snapd package does.

There are very strange lines in /usr/bin/startxfce4:

67 if test "x$XDG_DATA_DIRS" = "x"                                                 
68 then                                                                            
69   if test "x/usr/share" = "x/usr/local/share" -o "x/usr/share" = "x/usr/share"; then
70     XDG_DATA_DIRS="/usr/local/share:/usr/share"                                 
71   else                                                                          
72     XDG_DATA_DIRS="/usr/share:/usr/local/share:/usr/share"                      
73   fi                                                                            
74 else                                                                            
75   XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"                                     
76 fi                                                                              
77 export XDG_DATA_DIRS                                                                             

Why these doubling /usr/share in 72 line?

By checking snapd and flatpak /etc/profile.d/ scripts, they do nothing wrong, they just add some entries in XDG_DATA_DIRS variable but don't double the /usr/share one.
What make you say the problem comes from them ?

I've uninstalled them, and after re-login variable $XDG_DATA_DIRS have /usr/local/share:/usr/share -- no dups. This value is given by /usr/bin/startxfce4, which modifies $XDG_DATA_DIRS in 67..77 lines:

 67 if test "x$XDG_DATA_DIRS" = "x"                                                 
 68 then                                                                            
 69   if test "x/usr/share" = "x/usr/local/share" -o "x/usr/share" = "x/usr/share"; then
 70     XDG_DATA_DIRS="/usr/local/share:/usr/share"                                 
 71   else                                                                          
 72     XDG_DATA_DIRS="/usr/share:/usr/local/share:/usr/share"                      
 73   fi                                                                            
 74 else                                                                            
 75   XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"                                     
 76 fi                                                                              
 77 export XDG_DATA_DIRS                                                            

I study further.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by