[patch] standard_session_servicedirs (was Re: OLPC and .service files in a users home directory)

John (J5) Palmieri johnp at redhat.com
Wed Nov 1 14:17:54 PST 2006


On Wed, 2006-11-01 at 23:31 +0200, Thiago Macieira wrote:
> Some more comments:
> 
> John (J5) Palmieri wrote:
> >+    case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
> >+      {
> >+        DBusList *link;
> >+        DBusList *dirs;
> >+        dirs = NULL;
> > 
> >+        if (!_dbus_get_standard_session_servicedirs (&dirs))
> >+          goto nomem;
> >+
> >+        while ((link = _dbus_list_pop_first_link (&dirs)))
> >+          service_dirs_append_link_unique_or_free
> > (&parser->service_dirs, link); 
> > +      } 
> >     case ELEMENT_SERVICEDIR:
> 
> Looks like a "break" is missing before the "case" above.
> 
> >+/**
> >+ * Returns the standard directories for a session bus to look for
> > service 
> > + * activation files 
> >+ *
> >+ * On UNIX this should be the standard xdg freedesktop.org data
> > directories: 
> > + * 
> >+ * XDG_DATA_HOME=${XDG_DATA_HOME-$HOME}/.local/share
> >+ * XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/share:/usr/local/share}
> 
> You may as well fix the comment above too. It's:
> 	XDG_DATA_HOME=${XDG_DATA_HOME-$HOME/.local/share}
> 	XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/local/share:/usr/share}
> 
> That is, we don't append ".local/share" to $XDG_DATA_HOME. And /usr has 
> higher priority than /usr/local. Like $PATH, those dirs are searched in 
> order. Unlike $PATH, the latter overrides the former.
> 
> BTW, the specification is here:
> http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
> 
> >+  xdg_data_home = _dbus_getenv ("XDG_DATA_HOME");
> >+  xdg_data_dirs = _dbus_getenv ("XDG_DATA_DIRS");
> >+
> >+  if (xdg_data_home != NULL)
> >+    {
> >+      if (!_dbus_string_append (&servicedir_path, xdg_data_home))
> >+        goto oom;
> >+
> >+      if (!_dbus_string_append (&servicedir_path, ":"))
> >+        goto oom;
> >+    }
> [snip]
> 
> >+  if (xdg_data_dirs != NULL)
> >+    {
> >+      if (!_dbus_string_append (&servicedir_path, xdg_data_dirs))
> >+        goto oom;
> >+    }
> >+  else
> >+    {
> >+      if (!_dbus_string_append (&servicedir_path, "/usr/share:"))
> >+        goto oom;
> >+
> >+      if (!_dbus_string_append (&servicedir_path, "/usr/local/share"))
> >+        goto oom;
> >+    }
> 
> The list is inverted. /usr/local/share should be the first (lowest 
> priority), /usr/share next, $DATADIR next and $XDG_DATA_HOME last 
> (highest priority).

I'm not sure how D-Bus does precedence.  It is not entirely clear in the
code. We want a users HOME to have the most precedence so they can
override with their own service files.  It is easy enough to reorder the
code to generate the string in shell ordering.  The question is do we
reverse the list during parsing.  Havoc do you have any insight?

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list