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 672240 - GDM crashes when systemd is installed but not in use
GDM crashes when systemd is installed but not in use
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: login-screen
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: Ray Strode [halfline]
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-03-16 16:17 UTC by Jan Alexander Steffens (heftig)
Modified: 2012-05-08 20:55 UTC
See Also:
GNOME target: ---
GNOME version: 3.3/3.4


Attachments
patch for issue (1.19 KB, patch)
2012-03-16 16:17 UTC, Jan Alexander Steffens (heftig)
committed Details | Review
powerMenu: Refactor systemd/consolekit code (10.18 KB, patch)
2012-03-16 21:42 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
powerMenu: Refactor systemd/consolekit code (11.40 KB, patch)
2012-03-17 04:02 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review

Description Jan Alexander Steffens (heftig) 2012-03-16 16:17:23 UTC
Created attachment 209939 [details] [review]
patch for issue

If systemd is installed but not in use, gdm gnome-shell crashes:

    JS ERROR: !!!   Exception was: Error: Error invoking Gio.init: Error calling StartServiceByName for org.freedesktop.login1: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1
    JS ERROR: !!!     lineNumber = '0'
    JS ERROR: !!!     fileName = '"gjs_throw"'
    JS ERROR: !!!     stack = '"("Error invoking Gio.init: Error calling StartServiceByName for org.freedesktop.login1: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1")@gjs_throw:0
(null)@/usr/share/gjs-1.0/overrides/Gio.js:242
([object _private_Gio_DBusConnection],"org.freedesktop.login1","/org/freedesktop/login1")@/usr/share/gjs-1.0/overrides/Gio.js:201
SystemdLoginManager()@/usr/share/gnome-shell/js/gdm/systemd.js:26
()@/usr/share/gnome-shell/js/gdm/powerMenu.js:37
wrapper()@/usr/share/gjs-1.0/lang.js:204
()@/usr/share/gjs-1.0/lang.js:145
()@/usr/share/gjs-1.0/lang.js:239
()@/usr/share/gnome-shell/js/ui/panel.js:1113
wrapper()@/usr/share/gjs-1.0/lang.js:204
start()@/usr/share/gnome-shell/js/ui/main.js:219
@<main>:1tg b
"'

The attached patch should fix the issue.
Comment 1 Ray Strode [halfline] 2012-03-16 17:09:45 UTC
Review of attachment 209939 [details] [review]:

Looks good. Please commit!
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-03-16 21:42:38 UTC
Created attachment 209964 [details] [review]
powerMenu: Refactor systemd/consolekit code

Rather than having two very similar implementations inline, stick in a
"PowerMenuBackend" interface that's implemented by both Systemd and
ConsoleKit, in a separate file. This removes a lot of tricky branching
code paths under the name of consolidation.



There's this as well... Completely untested (because I can't figure out how to test GDM), so feedback would be helpful.
Comment 3 Ray Strode [halfline] 2012-03-16 21:51:36 UTC
Review of attachment 209964 [details] [review]:

Certainly the abstraction cleans up the caller code and isn't a bad idea overall.  I don't think we should do it before hard code freeze. Instead we should go with the more surgical patch already mentioned.  Clean ups post release make sense, I think, though.

::: js/gdm/powerMenu.js
@@ +33,3 @@
     _init: function() {
         this.parent('system-shutdown', null);
+        this._powerMenuBackend = new Systemd.SystemdLoginManager();

shouldn't this say PowerMenuBackend?

::: js/gdm/powerMenuBackend.js
@@ +58,3 @@
+        let implMethod = mapping[apiMethod];
+        self[apiMethod + 'Sync'] = self[implMethod + 'Sync'];
+        self[apiMethod + 'Remote'] = self[implMethod + 'Remote'];

eww, i don't like this magic.  Note The methods aren't 1-to-1 compatible, either.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-03-17 04:02:44 UTC
Created attachment 209977 [details] [review]
powerMenu: Refactor systemd/consolekit code

Rather than having two very similar implementations inline, stick in a
"PowerMenuBackend" interface that's implemented by both Systemd and
ConsoleKit, in a separate file. This removes a lot of tricky branching
code paths under the name of consolidation.



ugh, this "refactor" is starting to seem less and less worthwhile. Talking on IRC about Deferreds, well, this:

        this._loginManager.CanRebootRemote(function(result, error) {
            callback((result != 'no'), error);
        });

would become:

        let d = this._loginManager.CanRebootRemote();
        d.addCallback(function(result) {
            return (result != 'no');
        });
        return d;

That is, callback chaining, where the result of one callback gets sent to the next, allowing you to normalize values without the client suspecting it. It would do:

       let d = this._powerMenuBackend.CanReboot();
       d.addCallback(function(result) {
            this._haveSuspend = result;
            this._updateVisibility();
       });
       d.addErrback(function(failure) {
            this._haveSuspend = false;
            this._updateVisibility();
       });

By transforming the two-way call stack into a one-way call stack, things get much simpler, especially with tricks like callback chaining. Again, I wish we had this in GLib/Gio itself. But that's not the task at hand, here...
Comment 5 drago01 2012-03-18 10:56:08 UTC
Review of attachment 209939 [details] [review]:

Pushed this one.