After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677718 - GDBusProxy: treat org.freedesktop.systemd1.Masked error as non-fatal
GDBusProxy: treat org.freedesktop.systemd1.Masked error as non-fatal
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-06-08 17:08 UTC by David Zeuthen (not reading bugmail)
Modified: 2012-06-08 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Zeuthen (not reading bugmail) 2012-06-08 17:08:52 UTC
The way GDBusProxy work is pretty nice, you can get a GDBusProxy even if the service doesn't exist and just wait until :g-name-owner is set to non-NULL if the service is started.

This is helpful because it relieves the application programmer from watching names and creating/destroying proxies himself. See [1] for an example.

However, if you mask a service using systemd then this fails e.g. GDBusProxy construction fails, see [2]

Therefore, I think we should probably treat StartServiceByName() erroring out with the error

 org.freedesktop.systemd1.Masked

the same way we handle the error

 org.freedesktop.DBus.Error.ServiceUnknown

e.g. we should continue proxy construction including watching the name, see

 http://git.gnome.org/browse/glib/tree/gio/gdbusproxy.c?id=2.33.2#n1592

That way we'll work a lot better with masked D-Bus services...

--

gdbus-example-watch-proxy is this program: http://developer.gnome.org/gio/unstable/GDBusProxy.html#gdbus-wellknown-proxy


[1] :

$ ./gdbus-example-watch-proxy -n foo.bar -o /foo/bar -i foo.bar
--- Proxy object is inert - there is no name owner for the name
    bus:          Session Bus
    name:         foo.bar
    object path:  /foo/bar
    interface:    foo.bar


[2] :

$ ./gdbus-example-watch-proxy -s -n org.freedesktop.PolicyKit1 -o /org/freedesktop/PolicyKit1/Authority -i org.freedesktop.PolicyKit1.Authority
+++ Proxy object points to remote object owned by :1.6
    bus:          System Bus
    name:         org.freedesktop.PolicyKit1
    object path:  /org/freedesktop/PolicyKit1/Authority
    interface:    org.freedesktop.PolicyKit1.Authority
    properties:
      BackendFeatures -> uint32 1
      BackendName -> 'js'
      BackendVersion -> '0.106'
^C

$ sudo systemctl stop polkit.service

$ sudo systemctl mask polkit.service
ln -s '/dev/null' '/etc/systemd/system/polkit.service'

$ ./gdbus-example-watch-proxy -s -n org.freedesktop.PolicyKit1 -o /org/freedesktop/PolicyKit1/Authority -i org.freedesktop.PolicyKit1.Authority
Error creating proxy: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.systemd1.Masked: Unit polkit.service is masked.
[davidz@thinkpad tests]$
Comment 2 David Zeuthen (not reading bugmail) 2012-06-08 17:45:19 UTC
This change actually has some interesting (and useful) implications for polkit users, see

 http://cgit.freedesktop.org/polkit/commit/?id=acf3a06e55f9ca8a7f7bfa012c24e8794d27c85f
 http://cgit.freedesktop.org/udisks/commit/?id=f66346217c233f9689c3ad73312597821da94a82