! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
startxfce4 losts XDG_DATA_DIRS variable
Status:
RESOLVED: FIXED
Product:
Xfce-utils
Component:
General

Comments

Description Samuli Suominen 2007-03-03 01:22:31 CET
Distribution or User wants to set his own XDG_DATA_DIRS but he can't because startxfce4 overwrites the variable.

Reproducing:

1. Close X. Close Xfce4. Back to Console.
2. export XDG_DATA_DIRS="/usr/kde/3.5/share"
3. startxfce4 (or startx)
4. echo $XDG_DATA_DIRS

It's gone now and xfdesktop does not find .desktop files from /usr/kde/3.5/share/applications.

startxfce4 seems to do some weird checking.. including a simple patch to fix this issue.
Comment 1 Samuli Suominen 2007-03-03 01:23:43 CET
Created attachment 1016 
xfce-utils-4.4.0-xdg_data_dirs.patch
Comment 2 Brian J. Tarricone (not reading bugmail) 2007-03-03 01:29:58 CET
In the case where XDG_DATA_DIRS is not set, your patch causes the value to be invalid, with two consecutive colons.

Not sure what the problem is, anyway: it should have the correct behavior as-is.
Comment 3 Olivier Fourdan editbugs 2007-03-03 08:32:52 CET
Works just fine here. What's your system, can you check the link /bin/sh? Debian based system uses /bin/dash which seems to cause some trouble
Comment 4 Olivier Fourdan editbugs 2007-03-03 08:51:25 CET
Created attachment 1017 
Syntax tweaking

I personally prefer the syntax "x" rather than x"", although it should not make any difference. Does that patch make any difference in your case?
Comment 5 Samuli Suominen 2007-03-03 15:39:53 CET
Nice Olivier, it works. 

drac@unique ~ $ echo $XDG_DATA_DIRS
/usr/kde/3.5/share:/usr/share

drac@unique ~ $ bash --version
GNU bash, version 3.2.9(1)-release (i686-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

drac@unique ~ $ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2007-01-01 09:03 /bin/sh -> bash

Thanks again, drac
Comment 6 Samuli Suominen 2007-03-03 15:42:05 CET
Also, when you commit that change I'd suggest you include ~/.local/share and /usr/local/share in XDG_DATA_DIRS too.

They are part of the f.d.o spec.

Thanks, drac
Comment 7 Olivier Fourdan editbugs 2007-03-03 21:06:00 CET
(In reply to comment #6)
> Also, when you commit that change I'd suggest you include ~/.local/share and
> /usr/local/share in XDG_DATA_DIRS too.
> 
> They are part of the f.d.o spec.

Not sure, according to the spec[1],  there is no mention of ~/.local/share, just /usr/local/share/ and /usr/share/ which are the ones we list.

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
Comment 8 Samuli Suominen 2007-03-20 18:51:55 CET
You're right, ~/.local/share/applications is $XDG_DATA_HOME but

<quote>
$XDG_DATA_DIRS defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory. The directories in $XDG_DATA_DIRS should be seperated with a colon ':'.
</quote>

Which seems to return nothing. Does xfdesktop still read .desktop files from ~/.local/share/applications?

Comment 9 Samuli Suominen 2007-03-20 18:57:36 CET
Meh, asking stupid. Allready answered to myself, yes it does read ~/.local/share/applications.

But XDG_DATA_DIR check startxfce4 uses /usr/local only in one count now, it should 
include it in both counts. Otherwise your patch is fine.
Comment 10 Brian J. Tarricone (not reading bugmail) 2007-03-20 19:03:31 CET
(In reply to comment #9)

> But XDG_DATA_DIR check startxfce4 uses /usr/local only in one count now, it
> should include it in both counts.

Sorry, I don't know what you're trying to say here.
Comment 11 Samuli Suominen 2007-03-20 19:09:27 CET
(In reply to comment #10)
> (In reply to comment #9)
> 
> > But XDG_DATA_DIR check startxfce4 uses /usr/local only in one count now, it
> > should include it in both counts.
> 
> Sorry, I don't know what you're trying to say here.
> 

Is now,

if test "x$XDG_DATA_DIRS" = "x"
then
  XDG_DATA_DIRS="/usr/share:/usr/local/share:/usr/share"
else
  XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
fi
export XDG_DATA_DIRS

Should be,

if test "x$XDG_DATA_DIRS" = "x"
then
  XDG_DATA_DIRS="/usr/local/share:/usr/share:@datadir@"
else
  XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/local/share:/usr/share:@datadir@"
fi
export XDG_DATA_DIRS


Include allways /usr/local and before /usr, in same order $PATH acts.
Comment 12 Brian J. Tarricone (not reading bugmail) 2007-03-20 19:32:29 CET
Right, you're correct, /usr/local should be first (but it has nothing to do with $PATH; the XDG basedir spec says /usr/local should be first).
Comment 13 Samuli Suominen 2007-03-20 19:45:48 CET
(In reply to comment #12)
> Right, you're correct, /usr/local should be first (but it has nothing to do
> with $PATH; the XDG basedir spec says /usr/local should be first).
> 

Yeah.. $PATH was poor example, has nothing do with it.. ;)
Comment 14 Samuli Suominen 2007-03-21 14:41:38 CET
Created attachment 1049 
xfce-utils-4.4.0-xdg_data_dirs.patch

Upsdate to previous "Syntax tweaking" patch so that it allways includes /usr/local and before /usr as per freedesktop.org basedir specification.

Only problem now is that it adds /usr and /usr/local twice if @datadir@ is same but that's no regression to what it allready does. Cosmetic problem.
Comment 15 Olivier Fourdan editbugs 2007-03-21 16:56:14 CET
That patch won't apply because syntax tweaking patch has been already applied to SVN. But beside that, I'm not very confirtable with that patch, precisely because it adds /usr and /usr/local to the already set $XDG_DATA_DIRS.

The spec says:

"If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used."

Therefore I think that if the user sets $XDG_DATA_DIRS, (s)he is supposed to set it correctly and therefore include /usr and /usr/local in the list.

I mean, if the user sets the variable on purpose, it's up to him/her to make sure (s)he set it correctly. The script should not change what the user has specified except add the part that strictly necessary for the installation of xfce. Think of regular PATH here, a script doesn't add /bin and /usr/local/bin to a user set PATH.
Comment 16 Olivier Fourdan editbugs 2007-03-31 20:28:18 CEST
/usr/local/share is now first in list as per comment #12.
Comment 17 Samuli Suominen 2007-04-13 19:53:55 CEST
As of recent change it appears now:

if test "x$XDG_DATA_DIRS" = "x"
then
  XDG_DATA_DIRS="usr/local/share:/usr/share://usr/share"
else
  XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
fi
export XDG_DATA_DIRS

drac@unique ~ $ echo $XDG_DATA_DIRS
usr/local/share:/usr/share://usr/share

So it's missing a / and another one has double //
Comment 18 Olivier Fourdan editbugs 2007-04-13 20:07:06 CEST
Meuuuuuh, it's a stupid typo... Fixed in rev. 25536

Bug #2967

Reported by:
Samuli Suominen
Reported on: 2007-03-03
Last modified on: 2009-07-14

People

Assignee:
Xfce Bug Triage
CC List:
0 users

Version

Attachments

xfce-utils-4.4.0-xdg_data_dirs.patch (598 bytes, patch)
2007-03-03 01:23 CET , Samuli Suominen
no flags
Syntax tweaking (1.13 KB, patch)
2007-03-03 08:51 CET , Olivier Fourdan
no flags
xfce-utils-4.4.0-xdg_data_dirs.patch (1.38 KB, patch)
2007-03-21 14:41 CET , Samuli Suominen
no flags

Additional information