Opened 18 years ago

Closed 17 years ago

#2172 closed defect (fixed)

XDG Base Directory Issues

Reported by: Luca Owned by: dnicholson@…
Priority: normal Milestone: 6.2.0
Component: BOOK Version: SVN
Severity: normal Keywords:
Cc:

Description (last modified by dnicholson@…)

Much of the information regarding the XDG Base Directory spec (i.e., the XDG_* variables) is broken or wrong in the book.

Attachments (1)

basedir.diff (4.1 KB ) - added by dnicholson@… 17 years ago.
Expanded basedir info on the desktop-file-utils page

Download all attachments as: .zip

Change History (18)

comment:1 by Luca, 18 years ago

In BLFS-Book Desktop-File-Utils-<version> page should be added the following instructions:

For XFce-4

XDG_DATA_DIRS=/usr/share
XDG_CONFIG_DIRS=/usr/share:/etc/xdg
export XDG_DATA_DIRS XDG_CONFIG_DIRS

comment:2 by Randy McMurchy, 18 years ago

I don't think it would be proper to add this to the Desktop File Utils page unless these XDG_*_DIRS env vars needed to be set global wide. If indeed it is determined that setting these env vars helps the XFce package, then instructions should be placed on the XFce page.

However, because Desktop File Utils isn't mentioned as a dependency or otherwise on the XFce page, why would it need to be mentioned?

I am confused with the entire reasoning in this ticket. Does Desktop File Utils play some part in XFce (run-time, or otherwise)?

comment:3 by Randy McMurchy, 18 years ago

Type: taskdefect

comment:4 by alexander@…, 18 years ago

On the LiveCD, XFCE starts normally without these environment variabls. But the CD doesn't contain desktop-file-utils, so this is not a valid test of the bug. More investigation is needed.

comment:5 by dnicholson@…, 17 years ago

Owner: changed from blfs-book@… to dnicholson@…
Status: newassigned

I think I know the issue and why this doesn't hit LiveCD.

If XDG_CONFIG_DIRS is set, libxfce4util will add ${sysconfdir}/xdg to that path. However, we don't pass --sysconfdir=/etc to libxfce4util in the book. On the LiveCD, a config.site file is used which always passes --sysconfdir=/etc, correct?

Luca, will you try rebuilding libxfce4util with --sysconfdir=/etc? Also, when you set XDG_DATA_DIRS and XDG_CONFIG_DIRS, you have to add in the default directories (I just found this out, it's in the basedir spec).

So, in your profile settings, you should do

export XDG_DATA_DIRS=/some/directory:${XDG_DATA_DIRS-/usr/local/share/:/usr/share/} export XDG_CONFIG_DIRS=/other/directory:${XDG_CONFIG_DIRS-/etc/xdg}

I'll open a separate bug about that.

comment:6 by alexander@…, 17 years ago

The guess is wrong, because on the LiveCD config.site doesn't set sysconfdir. It only compiles everything for i486, puts manual pages in the proper location without the compatibility /usr/man symlink, and disables static libraries. Please see http://wiki.linuxfromscratch.org/livecd/browser/trunk/scripts/config.site

comment:7 by alexander@…, 17 years ago

I take my last comment back. In http://wiki.linuxfromscratch.org/livecd/browser/trunk/packages/xfce/Makefile, sysconfdir is passed to every subpackage. Maybe we just want to do this in the book.

OTOH, is it possible to build KDE and GNOME in such a way that, when installing with the /usr prefix, the XDG_* variables in the environment become unneeded?

comment:8 by Randy McMurchy, 17 years ago

Much of this issue is probably my fault because when I put in the instructions to set XDG* in the desktop-file-utils package and misc places in KDE/GNOME instructions a long time ago. I really never properly researched all about the XDG* stuff, put some stuff in the book and went about my merry way.

FWIW - I use KDE on several machines and find it totally unnecessary to set XDG* when running KDE. KDE is installed in /opt. And everything "just works". *NO* XDG vars are set, or ever set.

When running GNOME I *do* set them. Not sure why, but that is what is in my script that runs the GNOME desktop.

in reply to:  7 comment:9 by dnicholson@…, 17 years ago

Replying to alexander@linuxfromscratch.org:

I take my last comment back. In http://wiki.linuxfromscratch.org/livecd/browser/trunk/packages/xfce/Makefile, sysconfdir is passed to every subpackage. Maybe we just want to do this in the book.

Yes, I think we should. There's absolutely no harm in doing it, and it doesn't break the packages up into groups.

OTOH, is it possible to build KDE and GNOME in such a way that, when installing with the /usr prefix, the XDG_* variables in the environment become unneeded?

I don't know for sure. For GNOME, installing into /usr everything goes to the right place and you don't have to set any variables. I haven't investigated KDE yet. For XFCE, I think it puts stuff in /etc/xfce4/xdg, which would break on GNOME. Can anyone confirm that?

comment:10 by alexander@…, 17 years ago

There is no /etc/xfce4 on the CD. There is, however, /etc/xdg/xfce4, which is OK. So, combining this with your GNOME comment and Randy's KDE observation, the only untested cases which could cause the need for XDG_* variables are:

  • XFCE in a directory other than /usr
  • GNOME in a directory other than /usr

in reply to:  8 comment:11 by dnicholson@…, 17 years ago

Replying to randy@linuxfromscratch.org:

Much of this issue is probably my fault because when I put in the instructions to set XDG* in the desktop-file-utils package and misc places in KDE/GNOME instructions a long time ago. I really never properly researched all about the XDG* stuff, put some stuff in the book and went about my merry way.

Hey, I just understood this yesterday for the first time. It has been a thorn in my side for a long time.

FWIW - I use KDE on several machines and find it totally unnecessary to set XDG* when running KDE. KDE is installed in /opt. And everything "just works". *NO* XDG vars are set, or ever set.

When running GNOME I *do* set them. Not sure why, but that is what is in my script that runs the GNOME desktop.

The problem is that all three systems implement the spec differently. Judging from yours and Alexander's comments, I think I can conclude the following.

XFCE and KDE will both compile in extra paths such as ${sysconfdir}/xdg and ${prefix}/share. GNOME does not do this, and that's why Randy has to set the variables when he builds GNOME (he uses /etc/gnome and /opt/gnome, and I've always used /etc and /usr, presumably).

Someone should try to get all three environments installed simultaneously (preferably to non-/usr) and see what happens with the menus with various values in XDG_DATA_DIRS and XDG_CONFIG_DIRS. I rarely build XFCE or KDE, but I could try soon.

comment:12 by dnicholson@…, 17 years ago

I think the safest thing to do right now is to change the blurbs in the various "Configuring" sections to say something like

If you installed desktop X, ensure that the menu hierarchy is created correctly by adding the following variables to the system-wide profile or your personal profile:

export XDG_DATA_DIRS=$DESKTOP_PREFIX/share:${XDG_DATA_DIRS-/usr/local/share:/usr/share}
export XDG_CONFIG_DIRS=/etc/$DESKTOP/xdg:${XDG_CONFIG_DIRS-/etc/xdg}

See the [XDG Base Directory Specification http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html]
for more details.

Substituting $DESKTOP for GNOME, KDE, or XFCE. That way, things should always work, independent of how they've decided to implement the basedir spec. Except that for xfce, the second one wouldn't be needed since it puts it config files in /etc/xdg. But gnome and kde put them in /etc/gnome/xdg and /etc/kde/xdg, respectively.

comment:13 by dnicholson@…, 17 years ago

Description: modified (diff)
Summary: XFce-4.2.3.2 sessionXDG Base Directory Issues

comment:14 by dnicholson@…, 17 years ago

I've moved the XFCE specific issue to #2227. That should be resolved soon. This one is trickier, but I'll attach a patch soon that should help some.

by dnicholson@…, 17 years ago

Attachment: basedir.diff added

Expanded basedir info on the desktop-file-utils page

comment:15 by dnicholson@…, 17 years ago

Attached a patch which tries to add the information from the basedir spec and the proper environment variable settings for the desktop environments. I added the information the desktop-file-utils page since that's where the info currently is. It might be better to add a separate page specifically about the basedir spec since desktop-file-utils is really a different topic.

comment:16 by dnicholson@…, 17 years ago

No one has commented, so I'm committing the attached patch.

comment:17 by dnicholson@…, 17 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r6483. Although, the issue of enabling multiple desktop environments' menus through the XDG_* variables isn't really resolved. That will have to be addressed another time.

Note: See TracTickets for help on using tickets.