Bug 35569

Summary: XDG_DATA_HOME read after /usr/share
Product: dbus Reporter: Dan Muresan <danmbox>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED DUPLICATE QA Contact: John (J5) Palmieri <johnp>
Severity: major    
Priority: medium    
Version: 1.4.x   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Dan Muresan 2011-03-22 15:22:51 UTC
Files in $HOME/.local/share/dbus-1/services/ do not override those in /usr/share/dbus-1/services/

This breaks the XDG Base Directory Specification [1] which clearly states

"The base directory defined by $XDG_DATA_HOME is considered more important than any of the base directories defined by $XDG_DATA_DIRS. The base directory defined by $XDG_CONFIG_HOME is considered more important than any of the base directories defined by $XDG_CONFIG_DIRS."

This is a very serious issue that prevents the user from overriding misguided system-wide configuration. Both the 1.2 and 1.4 branches suffer from this.

The bug is quite plain in dbus/dbus-sysdeps-unix.c, line 3502:

  xdg_data_home = _dbus_getenv ("XDG_DATA_HOME");
  xdg_data_dirs = _dbus_getenv ("XDG_DATA_DIRS");

  if (xdg_data_dirs != NULL)
    {
      if (!_dbus_string_append (&servicedir_path, xdg_data_dirs))
        goto oom;

      if (!_dbus_string_append (&servicedir_path, ":"))
        goto oom;
    }
  else
    {
      if (!_dbus_string_append (&servicedir_path, "/usr/local/share:/usr/share:"))
        goto oom;
    }

  /*
   * add configured datadir to defaults
   * this may be the same as an xdg dir
   * however the config parser should take
   * care of duplicates
   */
  if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR":"))
        goto oom;

  if (xdg_data_home != NULL)
    {
      if (!_dbus_string_append (&servicedir_path, xdg_data_home))
        goto oom;
    }


i.e. XDG_DATA_HOME is used AFTER XDG_DATA_DIRS

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Comment 1 Simon McVittie 2011-04-07 04:03:04 UTC
Already fixed in git; will be in 1.4.8, 1.5.0

*** This bug has been marked as a duplicate of bug 34496 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.