Making gdmuser fail gracefully



I'm running gnome-shell from jhbuild.  My first runs crashed at startup
with

(mutter:12345): GdmUser-WARNING **: Couldn't connect to system bus:
Failed to connect to socket /opt/gnome/var/run/dbus/system_bus_socket:
No such file or directory

and then a failed assertion,

GdmUser:ERROR:gdmuser/gdm-user-manager.c:2574:load_users: assertion
failed: (manager->priv->accounts_proxy != NULL)

The assertion triggers because the accounts_proxy cannot be created when
the D-Bus connection == NULL.

This is because my jhbuilt libdbus was trying to find the system bus
in /opt/gnome/var/run.  It's not there, of course. The kind people in
#gnome-shell told me to set the DBUS_SYSTEM_BUS_ADDRESS env. var. to
point to my system bus.

While this is kind of a "jhbuild sucks" issue, I'd like to see if
gnome-shell can run with GdmUser mostly failing, at least to make it
easier for people to try.  It also can't hurt to clean up that code
path... the general form of

  connection = gimme_system_bus();
  if (!connection)
     g_warning ("oops");

  ...

  g_assert (connection != NULL);

doesn't make much sense :)

As far as I can tell, statusMenu.js is the only place where GdmUser gets
used.  When D-Bus fails, I'd like to make GdmUser return safe, neutral
values so that the user menu appears not horribly empty, but not fully
functional, either - to make it fail gracefully.

Opinions?  Would a patchset for that be accepted?

(Attached is a tiny memleak fix in gdmuser)

  Federico
>From f131abbf0d6668106fa76b561d2ad4b7cdd38236 Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico gnome org>
Date: Thu, 16 Dec 2010 19:05:52 -0500
Subject: [PATCH] [gdmuser] Don't leak a GError

Signed-off-by: Federico Mena Quintero <federico gnome org>
---
 src/gdmuser/gdm-user.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gdmuser/gdm-user.c b/src/gdmuser/gdm-user.c
index 710510a..40633f0 100644
--- a/src/gdmuser/gdm-user.c
+++ b/src/gdmuser/gdm-user.c
@@ -232,6 +232,7 @@ gdm_user_init (GdmUser *user)
         user->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
         if (user->connection == NULL) {
                 g_warning ("Couldn't connect to system bus: %s", error->message);
+                g_error_free (error);
         }
 }
 
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]