Merge lp:~mterry/lightdm/shut-down-dbus into lp:lightdm

Proposed by Michael Terry
Status: Rejected
Rejected by: Robert Ancell
Proposed branch: lp:~mterry/lightdm/shut-down-dbus
Merge into: lp:lightdm
Diff against target: 80 lines (+44/-0)
4 files modified
src/Makefile.am (+1/-0)
src/display.c (+6/-0)
utils/Makefile.am (+1/-0)
utils/lightdm-greeter-session (+36/-0)
To merge this branch: bzr merge lp:~mterry/lightdm/shut-down-dbus
Reviewer Review Type Date Requested Status
Robert Ancell Needs Fixing
Review via email: mp+72779@code.launchpad.net

Description of the change

Greeters like to autostart dbus by making dbus calls. This normally works fine, because such autostarted sessions are closed when X is. But since lightdm re-uses X, the dbus-daemon and its spawn were surviving login.

This branch adds a wrapper for greeter sessions that ensures everything is cleaned up correctly.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Ech. LightDM really doesn't know (or care) what the greeter is so doing this is making big assumptions about the greeter behaviour. All processes spawned by the greeter should be killed, but this is probably better solved using cgroups.

We should move this into the gtk-greeter / Unity greeter, as hacks are OK there, but I'd like to keep this sort of thing out of lightdm core.

review: Needs Fixing
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I'm closing this merge request because the daemon doesn't know about what the sessions are doing and it is their responsibility to clean up.

Unmerged revisions

1069. By Michael Terry

use wrapper for greeter to ensure that dbus dies when the greeter does

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Makefile.am'
2--- src/Makefile.am 2011-08-23 01:59:52 +0000
3+++ src/Makefile.am 2011-08-24 19:31:24 +0000
4@@ -73,6 +73,7 @@
5 lightdm_CFLAGS = \
6 $(LIGHTDM_CFLAGS) \
7 $(WARN_CFLAGS) \
8+ -DLIBEXEC_DIR=\"$(libexecdir)\" \
9 -DPKGLIBEXEC_DIR=\"$(pkglibexecdir)\" \
10 -DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
11 -DLOG_DIR=\"$(localstatedir)/log/lightdm\" \
12
13=== modified file 'src/display.c'
14--- src/display.c 2011-08-23 01:59:52 +0000
15+++ src/display.c 2011-08-24 19:31:24 +0000
16@@ -460,6 +460,12 @@
17 g_free (wrapper);
18 }
19 }
20+ else if (is_greeter)
21+ {
22+ gchar *t = command;
23+ command = g_strdup_printf ("%s/lightdm-greeter-session '%s'", LIBEXEC_DIR, command);
24+ g_free (t);
25+ }
26
27 session = DISPLAY_GET_CLASS (display)->create_session (display);
28 g_return_val_if_fail (session != NULL, NULL);
29
30=== modified file 'utils/Makefile.am'
31--- utils/Makefile.am 2011-08-17 02:16:56 +0000
32+++ utils/Makefile.am 2011-08-24 19:31:24 +0000
33@@ -1,5 +1,6 @@
34 bin_PROGRAMS = dm-tool
35 libexec_PROGRAMS = lightdm-set-defaults
36+dist_libexec_SCRIPTS = lightdm-greeter-session
37 dist_pkglibexec_SCRIPTS = gdmflexiserver
38
39 dm_tool_SOURCES = \
40
41=== added file 'utils/lightdm-greeter-session'
42--- utils/lightdm-greeter-session 1970-01-01 00:00:00 +0000
43+++ utils/lightdm-greeter-session 2011-08-24 19:31:24 +0000
44@@ -0,0 +1,36 @@
45+#!/bin/sh
46+# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
47+#
48+# Copyright (C) 2011 Canonical Ltd
49+# Author: Michael Terry <michael.terry@canonical.com>
50+#
51+# This program is free software: you can redistribute it and/or modify it under
52+# the terms of the GNU General Public License as published by the Free Software
53+# Foundation, version 3 of the License.
54+#
55+# See http://www.gnu.org/copyleft/gpl.html the full text of the license.
56+
57+# This wrapper merely ensures that dbus-daemon lives only as long as this
58+# script does. Otherwise, it's very easy for dbus-daemon to be autolaunched
59+# and detached from the greeter.
60+
61+trap cleanup TERM EXIT
62+
63+cleanup()
64+{
65+ trap - TERM EXIT
66+ if [ -n "$DBUS_SESSION_BUS_PID" ]; then
67+ kill "$DBUS_SESSION_BUS_PID"
68+ fi
69+ if [ -n "$CMD_PID" ]; then
70+ kill "$CMD_PID"
71+ fi
72+ exit 0
73+}
74+
75+eval `dbus-launch --sh-syntax`
76+
77+exec $@ &
78+CMD_PID=$!
79+wait $CMD_PID
80+CMD_PID=

Subscribers

People subscribed via source and target branches