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 622308 - dconf patches
dconf patches
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Colin Walters
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-06-21 18:00 UTC by Colin Walters
Modified: 2010-06-25 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[gnome-shell.in] Rerun under 'jhbuild run' if started outside jhbuild (1.44 KB, patch)
2010-06-21 18:00 UTC, Colin Walters
none Details | Review
[gnome-shell.in] Start dconf (2.41 KB, patch)
2010-06-21 18:00 UTC, Colin Walters
reviewed Details | Review
Switch to using dconf (6.93 KB, patch)
2010-06-25 14:16 UTC, Owen Taylor
needs-work Details | Review
Switch to using dconf (8.13 KB, patch)
2010-06-25 15:38 UTC, Owen Taylor
committed Details | Review

Description Colin Walters 2010-06-21 18:00:35 UTC
See patches
Comment 1 Colin Walters 2010-06-21 18:00:37 UTC
Created attachment 164235 [details] [review]
[gnome-shell.in] Rerun under 'jhbuild run' if started outside jhbuild

For a future patch, we should ensure we're consistently inside the
jhbuild environment if we're not already in it.  This only applies
when being run from the source tree.
Comment 2 Colin Walters 2010-06-21 18:00:40 UTC
Created attachment 164236 [details] [review]
[gnome-shell.in] Start dconf

This keeps the jhbuild-on-older-OSes working.
Comment 3 Owen Taylor 2010-06-21 18:04:20 UTC
Review of attachment 164235 [details] [review]:

Ugh. if necessary we could jbuild run the DConf daemon, which would be 100x cleaner.
Comment 4 Colin Walters 2010-06-21 18:05:51 UTC
(In reply to comment #3)
> Review of attachment 164235 [details] [review]:
> 
> Ugh. if necessary we could jbuild run the DConf daemon, which would be 100x
> cleaner.

I'd still need to know to only do that in the uninstalled case.
Comment 5 Owen Taylor 2010-06-21 18:20:32 UTC
Review of attachment 164236 [details] [review]:

"older-OSes" being every single released operating system...

::: src/gnome-shell.in
@@ +131,3 @@
 
+def start_dconf_await_service():
+    import dbus, gobject

There's no point in having lazy imports if the function using them is always called (if changing that, fix the other function that does a local lazy import of dbus)

@@ +133,3 @@
+    import dbus, gobject
+    from dbus.mainloop.glib import DBusGMainLoop
+    loop = gobject.MainLoop()

This variable would be clearer if it's down with the "wait to start" code

@@ +139,3 @@
+    bus_iface = dbus.Interface(bus_proxy, 'org.freedesktop.DBus')
+
+    # This is racy actually, but also really horrible to try to fix here...

Not worried about the race condition of dconf just about to exit - in production we are counting on D-Bus activation

@@ +142,3 @@
+    names = bus_iface.ListNames()
+    if 'ca.desrt.dconf' in names:
+        print "Dconf already running"

This is not an error, and will always occur on production systems, it must not print anything

@@ +146,3 @@
+
+    dconf_path = None
+    for dirname in os.environ['PATH'].split(':'):

I think I'd just use the logic:

 - If the service isn't already running
 - And $libexecdir/dconf-service exists
 - Run it

Looking in the path only make sense if we consider someone who has multiple non-system prefixes mised together, which is almost impossible to get right. We are already making 'installed to the same prefix' assumptions for other things like GSettings. (OK, maybe just for that... can't find other examples.)

@@ +156,3 @@
+    if not dconf_path:
+        raise SystemExit("Couldn't find dconf-service")
+    subprocess.Popen([dconf_path])

As mentioned in the bug, you should pass --keep-alive to dconf-service

@@ +162,3 @@
+        loop.quit()
+    def on_timeout():
+        raise SystemExit("Failed to start dconf-service; timed out")

timeouts should always return an explicit False, counting on None being False isn't good

@@ +165,3 @@
+    gobject.timeout_add_seconds(7, on_timeout)
+    bus_iface.connect_to_signal('NameOwnerChanged', on_name_owner_changed)
+    loop.run()

Disconnect from NameOwnerChanged here?
Comment 6 Owen Taylor 2010-06-21 18:26:41 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Review of attachment 164235 [details] [review] [details]:
> > 
> > Ugh. if necessary we could jbuild run the DConf daemon, which would be 100x
> > cleaner.
> 
> I'd still need to know to only do that in the uninstalled case.

Why only in the uninstalled case? it's intentional that you can symlink your gnome-shell desktop file into ~/.config/autostart and have it work.

Basically, we discussed the use 'jhbuild run' option when Dan originally wrote the environment munging code, and the outcome was that (because of rpaths, etc), we only had to set a very limited set of variables and it was easier not to get jhbuild into the picture.
Comment 7 Colin Walters 2010-06-21 20:59:17 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Review of attachment 164235 [details] [review] [details] [details]:
> > > 
> > > Ugh. if necessary we could jbuild run the DConf daemon, which would be 100x
> > > cleaner.
> > 
> > I'd still need to know to only do that in the uninstalled case.
> 
> Why only in the uninstalled case? it's intentional that you can symlink your
> gnome-shell desktop file into ~/.config/autostart and have it work.

It's really crazy how many different ways we have to run the shell...(and all of them pessimize the normal case by leaving around a python process).

> Basically, we discussed the use 'jhbuild run' option when Dan originally wrote
> the environment munging code, and the outcome was that (because of rpaths,
> etc), we only had to set a very limited set of variables and it was easier not
> to get jhbuild into the picture.

So...hm, we don't need LD_LIBRARY_PATH set because mutter has an rpath?
Comment 8 Dan Winship 2010-06-22 18:27:36 UTC
(In reply to comment #7)
> > Basically, we discussed the use 'jhbuild run' option when Dan originally wrote
> > the environment munging code, and the outcome was that (because of rpaths,
> > etc), we only had to set a very limited set of variables and it was easier not
> > to get jhbuild into the picture.
> 
> So...hm, we don't need LD_LIBRARY_PATH set because mutter has an rpath?

That's the theory. Discussion in bug 572916.

Also:

+        args = ['jhbuild', 'run'] + sys.argv
+        os.execvp('jhbuild', args)

FWIW, that would fail for me; my default .jhbuildrc is the GNOME one, and I have an alias for "jhbuild -f ~/.jhbuildrc-gs" for gnome-shell.
Comment 9 Owen Taylor 2010-06-25 12:37:33 UTC
(In reply to comment #4)

> > Basically, we discussed the use 'jhbuild run' option when Dan originally wrote
> > the environment munging code, and the outcome was that (because of rpaths,
> > etc), we only had to set a very limited set of variables and it was easier not
> > to get jhbuild into the picture.
> 
> So...hm, we don't need LD_LIBRARY_PATH set because mutter has an rpath?

I've verified that running:

 $libexecdir/dconf-service

outside the jhbuild environment works correctly and links to the jhbuild GLib.
 
I'll see if I can come up with a revised patch based on your patch and the simpler approach - I'd like to get the DConf switch in before I roll tarballs today so people using tarballs don't lose there settings once with the switching to GSettings and a second time with the switch to DConf.
Comment 10 Owen Taylor 2010-06-25 14:16:42 UTC
Created attachment 164624 [details] [review]
Switch to using dconf

Here's a full patch that I think should work pretty well.

I switched the approach for D-Bus a bit - instead of looking
for the bus name before trying to start I try to ping the
service.

The reason for this is to handle the case where:

 - We have a system install of DConf
 - It's not running at the moment (exited from a timeout or whatever)

And only do manual activation if we really need to. There may
be problems in the future with JHBuild dconf module not working
with system DConf daemon, but if that becomes a problem, we will
need to actively kill the system DConf daemon. After 3.0 is out
we will presumably just rely on system DConf and not jhbuild it.
Comment 11 Owen Taylor 2010-06-25 14:22:24 UTC
Assigning to walters for review, since the most tricky parts are likely the D-Bus parts.
Comment 12 Milan Bouchet-Valat 2010-06-25 14:52:34 UTC
Review of attachment 164624 [details] [review]:

Actually I had prepared the same patch, just waiting for the D-Bus parts. But that was not a lot of work, apart from debugging dconf. BTW, I'm running the Shell with dconf here and it works fine.

So, not reviewing the D-Bus parts, I have the joy to mark your patch as 'needs-work' ;-) :
- you need to remove GSETTINGS_BACKEND=gconf from gnome-shell-clock-preferences too.
- I think dconf requires libxml2 development files, which you didn't add to the build setup script (on Debian this is libxml2-dev)
- it might be good to find what packages we need for SuSE and Mandriva, before people come and complain this doesn't work ;-)
- valac in most distributions is too old for dconf (I tried and experienced GLib API issues), which needs 0.9.2. The best is likely to use that version instead of relying on git master, to avoid adding more bugs. So from the official GNOME modulesets:
  <tarball id="vala" version="0.9.2" autogenargs="--enable-vapigen">
    <source href="http://ftp.gnome.org/pub/GNOME/sources/vala/0.9/vala-0.9.2.tar.bz2"
            hash="sha256:22e1e224790663929f5df8b0611bd4928c065a8354ee7cdd2c97b6b37ed33c1d"
            md5sum="583f2c46da49f54e4f639eb706475abe" size="2358061"/>
    <dependencies>
      <dep package="glib"/>
    </dependencies>
  </tarball>
Comment 13 Owen Taylor 2010-06-25 15:38:31 UTC
Created attachment 164630 [details] [review]
Switch to using dconf

Thanks for the comments; should be fixed here. I went ahead and
added vala and libgee to the moduleset, since it appears that
a newer vala is needed at least on Ubuntu, though the 0.8.1
on Fedora worked fine for me. I left the Mandriva and SuSE
parts of gnome-shell-build-setup.sh untouched, since they
are otherwise way out of date, and if they break, and
someone complains, it's a good opportunity to ask them to
fix the breakage.
Comment 14 Colin Walters 2010-06-25 15:49:44 UTC
Review of attachment 164630 [details] [review]:

Looks okayish to me, two really minor comments.

::: src/gnome-shell.in
@@ +152,3 @@
+        subprocess.Popen([dconf_path, '--keep-alive'])
+    except OSError, e:
+        print "\nFailed to start %s: %s" % (dconf_path, e)

Should probably >>sys.stderr,

@@ +161,3 @@
+
+    def on_name_owner_changed(name, prev_owner, new_owner):
+        if not (name == 'ca.desrt.dconf' and new_owner != ''):

Might make a local variable for ca.desrt.dconf
Comment 15 Colin Walters 2010-06-25 15:49:46 UTC
Review of attachment 164630 [details] [review]:

Looks okayish to me, two really minor comments.

::: src/gnome-shell.in
@@ +152,3 @@
+    except OSError, e:
+        print "\nFailed to start %s: %s" % (dconf_path, e)
+def start_dconf_await_service():

Should probably >>sys.stderr,

@@ +161,3 @@
+
+    def on_name_owner_changed(name, prev_owner, new_owner):
+        if not (name == 'ca.desrt.dconf' and new_owner != ''):

Might make a local variable for ca.desrt.dconf
Comment 16 Owen Taylor 2010-06-25 16:49:42 UTC
Attachment 164630 [details] pushed as e8b72a2 - Switch to using dconf