GDesktopAppInfo: support bus activation with '-'

Desktop / GNOME / GLib - Allison Ryan Lortie [desrt.ca] - 25 April 2016 02:19 UTC

GApplication has accepted any valid bus name as an application ID since before the time of D-Bus activation. This includes bus names with '-'. Several applications have even attempted support bus activation with these names, going as far as installing D-Bus service files, without realising that they are silently falling back to fork()/exec() on account of the name containing a dash.

The reason for the problem is that D-Bus object paths cannot contain dashes. We solved this problem privately in an unspecified way inside of GApplication but substituting '_' in this case, but never made this part of the Desktop Entry Specification.

The fact that these apps with '-' in the desktop file names aren't actually using D-Bus activation is beside the point: their intent here was clear. Let's avoid forcing them to rename their desktop files again by simply accepting '-' in desktop file names and munging the path in the way that GApplication did so historically.

The new path escaping code here has been copied more or less verbatim from GApplication's own code for the same purpose, with only the removal of one irrelevant part.

An update to the desktop entry specification will follow.

https://bugzilla.gnome.org/show_bug.cgi?id=764754

3301b85 GDesktopAppInfo: support bus activation with '-'
gio/gdesktopappinfo.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)

Upstream: git.gnome.org


  • Share