Skip to content

"/usr/share" appears two times in XDG_DATA_DIRS; "/etc/xdg" appears two times in XDG_CONFIG_DIRS.

Submitted by ngh..@..box.eu

Assigned to Xfce Bug Triage

Link to original bug (#14546)

Description

$ uname -a Linux xx 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ echo $XDG_DATA_DIRS |tr : '\n'
/usr/share/xubuntu
/usr/share/xfce4
/usr/local/share
/usr/share
/var/lib/snapd/desktop
/usr/share    <<<<< SECOND TIME
$ echo $XDG_CONFIG_DIRS |tr : '\n'
/etc/xdg/xdg-xubuntu
/etc/xdg
/etc/xdg    <<<<< SECOND TIME

I have tried to repair startxfce4:

$ diff -u /usr/bin/startxfce4 ~/temp/startxfce4
--- /usr/bin/startxfce4	2018-07-20 19:07:26.000000000 +0200
+++ /home/x/temp/startxfce4	2018-07-20 19:12:33.000000000 +0200
@@ -64,28 +64,12 @@
   BASEDIR="$XDG_CONFIG_HOME/xfce4"
 fi
 
-if test "x$XDG_DATA_DIRS" = "x"
-then
-  if test "x/usr/share" = "x/usr/local/share" -o "x/usr/share" = "x/usr/share"; then
-    XDG_DATA_DIRS="/usr/local/share:/usr/share"
-  else
-    XDG_DATA_DIRS="/usr/share:/usr/local/share:/usr/share"
-  fi
-else
-  XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
-fi
+test -z "$XDG_DATA_DIRS" && XDG_DATA_DIRS=/usr/local/share:/usr/share
+x=":$XDG_DATA_DIRS:" && test "${x##*:/usr/share:*}" && XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
 export XDG_DATA_DIRS
 
-if test "x$XDG_CONFIG_DIRS" = "x"
-then
-  if test "x/etc" = "x/etc"; then
-    XDG_CONFIG_DIRS="/etc/xdg"
-  else
-    XDG_CONFIG_DIRS="/etc/xdg:/etc/xdg"
-  fi
-else
-  XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS:/etc/xdg"
-fi
+test -z "$XDG_CONFIG_DIRS" && XDG_CONFIG_DIRS="/etc/xdg"
+x=":$XDG_CONFIG_DIRS:" && test "${x##*:/etc/xdg:*}" && XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS:/etc/xdg"
 export XDG_CONFIG_DIRS
 
 if test "x$DISPLAY" = "x"

$ sudo cp ~/temp/startxfce4 /usr/bin/startxfce4

--rebooting--

O.K.:

$ echo $XDG_DATA_DIRS |tr : '\n'
/usr/share/xubuntu
/usr/share/xfce4
/usr/local/share
/usr/share
/var/lib/snapd/desktop

$ echo $XDG_CONFIG_DIRS |tr : '\n'
/etc/xdg/xdg-xubuntu
/etc/xdg

Version: Unspecified

Edited by Gaël Bonithon