diff -Nru dbus-1.4.1/debian/changelog dbus-1.4.1/debian/changelog --- dbus-1.4.1/debian/changelog 2010-12-21 13:43:27.000000000 +0000 +++ dbus-1.4.1/debian/changelog 2010-12-22 17:00:18.000000000 +0000 @@ -1,3 +1,10 @@ +dbus (1.4.1-0ubuntu2) natty; urgency=low + + * Apply patches to implement Upstart service activation. + * Switch to using Upstart activation for the system bus. + + -- Scott James Remnant Wed, 22 Dec 2010 17:00:17 +0000 + dbus (1.4.1-0ubuntu1) natty; urgency=low * New upstream release: diff -Nru dbus-1.4.1/debian/dbus.upstart dbus-1.4.1/debian/dbus.upstart --- dbus-1.4.1/debian/dbus.upstart 2010-12-21 13:08:29.000000000 +0000 +++ dbus-1.4.1/debian/dbus.upstart 2010-12-22 14:40:00.000000000 +0000 @@ -18,6 +18,6 @@ exec dbus-uuidgen --ensure end script -exec dbus-daemon --system --fork +exec dbus-daemon --system --fork --activation=upstart post-start exec kill -USR1 1 diff -Nru dbus-1.4.1/debian/patches/0001-activation-allow-for-more-variation-than-just-system.patch dbus-1.4.1/debian/patches/0001-activation-allow-for-more-variation-than-just-system.patch --- dbus-1.4.1/debian/patches/0001-activation-allow-for-more-variation-than-just-system.patch 1970-01-01 00:00:00.000000000 +0000 +++ dbus-1.4.1/debian/patches/0001-activation-allow-for-more-variation-than-just-system.patch 2010-12-22 14:35:03.000000000 +0000 @@ -0,0 +1,184 @@ +From 28b76a197d13fefa9a89e1ba9ca402130247c6c9 Mon Sep 17 00:00:00 2001 +From: Scott James Remnant +Date: Tue, 21 Dec 2010 15:41:16 +0000 +Subject: [PATCH 1/5] activation: allow for more variation than just "systemd" + +Implementing systemd_activation as a bool means we'd end up with +dozens of bools here if every init daemon decided to take over +bus activation. + +Turn it into an enum instead. +--- + bus/activation.c | 2 +- + bus/bus.c | 16 ++++++++-------- + bus/bus.h | 12 +++++++++--- + bus/main.c | 8 ++++---- + 4 files changed, 22 insertions(+), 16 deletions(-) + +diff --git a/bus/activation.c b/bus/activation.c +index ee5efa8..7d15910 100644 +--- a/bus/activation.c ++++ b/bus/activation.c +@@ -1898,7 +1898,7 @@ bus_activation_activate_service (BusActivation *activation, + if (activated) + return TRUE; + +- if (bus_context_get_systemd_activation (activation->context)) ++ if (bus_context_get_activation_type (activation->context) == ACTIVATION_SYSTEMD) + { + if (strcmp (service_name, "org.freedesktop.systemd1") == 0) + /* systemd itself is missing apparently. That can happen +diff --git a/bus/bus.c b/bus/bus.c +index e8276af..8a5532a 100644 +--- a/bus/bus.c ++++ b/bus/bus.c +@@ -51,6 +51,7 @@ struct BusContext + char *pidfile; + char *user; + char *log_prefix; ++ ActivationType activation_type; + DBusLoop *loop; + DBusList *servers; + BusConnections *connections; +@@ -63,7 +64,6 @@ struct BusContext + unsigned int syslog : 1; + unsigned int keep_umask : 1; + unsigned int allow_anonymous : 1; +- unsigned int systemd_activation : 1; + }; + + static dbus_int32_t server_data_slot = -1; +@@ -280,7 +280,7 @@ static dbus_bool_t + process_config_first_time_only (BusContext *context, + BusConfigParser *parser, + const DBusString *address, +- dbus_bool_t systemd_activation, ++ ActivationType activation_type, + DBusError *error) + { + DBusString log_prefix; +@@ -297,7 +297,7 @@ process_config_first_time_only (BusContext *context, + retval = FALSE; + auth_mechanisms = NULL; + +- context->systemd_activation = systemd_activation; ++ context->activation_type = activation_type; + + /* Check for an existing pid file. Of course this is a race; + * we'd have to use fcntl() locks on the pid file to +@@ -678,7 +678,7 @@ bus_context_new (const DBusString *config_file, + DBusPipe *print_addr_pipe, + DBusPipe *print_pid_pipe, + const DBusString *address, +- dbus_bool_t systemd_activation, ++ ActivationType activation_type, + DBusError *error) + { + DBusString log_prefix; +@@ -733,12 +733,12 @@ bus_context_new (const DBusString *config_file, + goto failed; + } + +- if (!process_config_first_time_only (context, parser, address, systemd_activation, error)) ++ if (!process_config_first_time_only (context, parser, address, activation_type, error)) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + goto failed; + } +- if (!process_config_every_time (context, parser, FALSE, error)) ++ if (!process_config_every_time (context, parser, FALSE, error)) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + goto failed; +@@ -1112,9 +1112,9 @@ bus_context_get_servicehelper (BusContext *context) + } + + dbus_bool_t +-bus_context_get_systemd_activation (BusContext *context) ++bus_context_get_activation_type (BusContext *context) + { +- return context->systemd_activation; ++ return context->activation_type; + } + + BusRegistry* +diff --git a/bus/bus.h b/bus/bus.h +index ebef17c..b4ea9e6 100644 +--- a/bus/bus.h ++++ b/bus/bus.h +@@ -71,15 +71,21 @@ typedef enum + FORK_NEVER + } ForceForkSetting; + ++typedef enum ++{ ++ ACTIVATION_DEFAULT, ++ ACTIVATION_SYSTEMD ++} ActivationType; ++ + BusContext* bus_context_new (const DBusString *config_file, + ForceForkSetting force_fork, + DBusPipe *print_addr_pipe, + DBusPipe *print_pid_pipe, + const DBusString *address, +- dbus_bool_t systemd_activation, ++ ActivationType activation_type, + DBusError *error); + dbus_bool_t bus_context_reload_config (BusContext *context, +- DBusError *error); ++ DBusError *error); + void bus_context_shutdown (BusContext *context); + BusContext* bus_context_ref (BusContext *context); + void bus_context_unref (BusContext *context); +@@ -88,7 +94,7 @@ dbus_bool_t bus_context_get_id (BusContext + const char* bus_context_get_type (BusContext *context); + const char* bus_context_get_address (BusContext *context); + const char* bus_context_get_servicehelper (BusContext *context); +-dbus_bool_t bus_context_get_systemd_activation (BusContext *context); ++ActivationType bus_context_get_activation_type (BusContext *context); + BusRegistry* bus_context_get_registry (BusContext *context); + BusConnections* bus_context_get_connections (BusContext *context); + BusActivation* bus_context_get_activation (BusContext *context); +diff --git a/bus/main.c b/bus/main.c +index 53038db..f158d0f 100644 +--- a/bus/main.c ++++ b/bus/main.c +@@ -274,7 +274,7 @@ main (int argc, char **argv) + dbus_bool_t print_pid; + dbus_bool_t is_session_bus; + int force_fork; +- dbus_bool_t systemd_activation; ++ ActivationType activation_type; + + if (!_dbus_string_init (&config_file)) + return 1; +@@ -292,7 +292,7 @@ main (int argc, char **argv) + print_pid = FALSE; + is_session_bus = FALSE; + force_fork = FORK_FOLLOW_CONFIG_FILE; +- systemd_activation = FALSE; ++ activation_type = ACTIVATION_DEFAULT; + + prev_arg = NULL; + i = 1; +@@ -313,7 +313,7 @@ main (int argc, char **argv) + else if (strcmp (arg, "--fork") == 0) + force_fork = FORK_ALWAYS; + else if (strcmp (arg, "--systemd-activation") == 0) +- systemd_activation = TRUE; ++ activation_type = ACTIVATION_SYSTEMD; + else if (strcmp (arg, "--system") == 0) + { + check_two_config_files (&config_file, "system"); +@@ -492,7 +492,7 @@ main (int argc, char **argv) + context = bus_context_new (&config_file, force_fork, + &print_addr_pipe, &print_pid_pipe, + _dbus_string_get_length(&address) > 0 ? &address : NULL, +- systemd_activation, ++ activation_type, + &error); + _dbus_string_free (&config_file); + if (context == NULL) +-- +1.7.1 + diff -Nru dbus-1.4.1/debian/patches/0002-bus-change-systemd-activation-to-activation-systemd.patch dbus-1.4.1/debian/patches/0002-bus-change-systemd-activation-to-activation-systemd.patch --- dbus-1.4.1/debian/patches/0002-bus-change-systemd-activation-to-activation-systemd.patch 1970-01-01 00:00:00.000000000 +0000 +++ dbus-1.4.1/debian/patches/0002-bus-change-systemd-activation-to-activation-systemd.patch 2010-12-22 14:36:21.000000000 +0000 @@ -0,0 +1,79 @@ +From f4a24b6062122f324c6cc7c0f33f955f649deb2f Mon Sep 17 00:00:00 2001 +From: Scott James Remnant +Date: Tue, 21 Dec 2010 15:47:33 +0000 +Subject: [PATCH 2/5] bus: change --systemd-activation to --activation=systemd + +In the same spirit as the previous patch, rather than adding a new +command-line option for each activation type, take a parameter to +choose between them. + +The old option has been left in as an undocumented equivalent for +compatibility. +--- + bus/dbus.service.in | 2 +- + bus/main.c | 17 ++++++++++++++++- + doc/dbus-daemon.1.in | 2 +- + 3 files changed, 18 insertions(+), 3 deletions(-) + +diff --git a/bus/dbus.service.in b/bus/dbus.service.in +index 399306f..4d9e101 100644 +--- a/bus/dbus.service.in ++++ b/bus/dbus.service.in +@@ -6,5 +6,5 @@ After=syslog.target + [Service] + ExecStartPre=@EXPANDED_BINDIR@/dbus-uuidgen --ensure + ExecStartPre=-/bin/rm -f @DBUS_SYSTEM_PID_FILE@ +-ExecStart=@EXPANDED_BINDIR@/dbus-daemon --system --address=systemd: --nofork --systemd-activation ++ExecStart=@EXPANDED_BINDIR@/dbus-daemon --system --address=systemd: --nofork --activation=systemd + ExecReload=@EXPANDED_BINDIR@/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig +diff --git a/bus/main.c b/bus/main.c +index f158d0f..601d4b4 100644 +--- a/bus/main.c ++++ b/bus/main.c +@@ -75,7 +75,7 @@ signal_handler (int sig) + static void + usage (void) + { +- fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect] [--address=ADDRESS] [--systemd-activation]\n"); ++ fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect] [--address=ADDRESS] [--activation=systemd]\n"); + exit (1); + } + +@@ -314,6 +314,21 @@ main (int argc, char **argv) + force_fork = FORK_ALWAYS; + else if (strcmp (arg, "--systemd-activation") == 0) + activation_type = ACTIVATION_SYSTEMD; ++ else if (strstr (arg, "--activation=") == arg) ++ { ++ const char *activation; ++ ++ activation = strchr (arg, '='); ++ ++activation; ++ ++ if (strcmp (activation, "systemd") == 0) ++ activation_type = ACTIVATION_SYSTEMD; ++ else ++ { ++ fprintf (stderr, "Unknown activation type: %s.\n", activation); ++ usage (); ++ } ++ } + else if (strcmp (arg, "--system") == 0) + { + check_two_config_files (&config_file, "system"); +diff --git a/doc/dbus-daemon.1.in b/doc/dbus-daemon.1.in +index a54f863..9aaa316 100644 +--- a/doc/dbus-daemon.1.in ++++ b/doc/dbus-daemon.1.in +@@ -91,7 +91,7 @@ Print the introspection information for all D-Bus internal interfaces. + Set the address to listen on. This option overrides the address + configured in the configuration file. + .TP +-.I "--systemd-activation" ++.I "--activation=systemd" + Enable systemd-style service activation. Only useful in conjunction + with the systemd system and session manager on Linux. + +-- +1.7.1 + diff -Nru dbus-1.4.1/debian/patches/0003-upstart-add-upstart-as-a-possible-activation-type.patch dbus-1.4.1/debian/patches/0003-upstart-add-upstart-as-a-possible-activation-type.patch --- dbus-1.4.1/debian/patches/0003-upstart-add-upstart-as-a-possible-activation-type.patch 1970-01-01 00:00:00.000000000 +0000 +++ dbus-1.4.1/debian/patches/0003-upstart-add-upstart-as-a-possible-activation-type.patch 2010-12-22 14:36:25.000000000 +0000 @@ -0,0 +1,67 @@ +From 3decca8e0ac801cf9c5985bfdd9b00e3e56a6643 Mon Sep 17 00:00:00 2001 +From: Scott James Remnant +Date: Tue, 21 Dec 2010 15:54:32 +0000 +Subject: [PATCH 3/5] upstart: add upstart as a possible activation type + +Add upstart as a possible value for the enum and the command-line +option. +--- + bus/bus.h | 3 ++- + bus/main.c | 4 +++- + doc/dbus-daemon.1.in | 4 ++++ + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/bus/bus.h b/bus/bus.h +index b4ea9e6..2bd5a04 100644 +--- a/bus/bus.h ++++ b/bus/bus.h +@@ -74,7 +74,8 @@ typedef enum + typedef enum + { + ACTIVATION_DEFAULT, +- ACTIVATION_SYSTEMD ++ ACTIVATION_SYSTEMD, ++ ACTIVATION_UPSTART + } ActivationType; + + BusContext* bus_context_new (const DBusString *config_file, +diff --git a/bus/main.c b/bus/main.c +index 601d4b4..ebf6d42 100644 +--- a/bus/main.c ++++ b/bus/main.c +@@ -75,7 +75,7 @@ signal_handler (int sig) + static void + usage (void) + { +- fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect] [--address=ADDRESS] [--activation=systemd]\n"); ++ fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect] [--address=ADDRESS] [--activation=systemd|upstart]\n"); + exit (1); + } + +@@ -323,6 +323,8 @@ main (int argc, char **argv) + + if (strcmp (activation, "systemd") == 0) + activation_type = ACTIVATION_SYSTEMD; ++ else if (strcmp (activation, "upstart") == 0) ++ activation_type = ACTIVATION_UPSTART; + else + { + fprintf (stderr, "Unknown activation type: %s.\n", activation); +diff --git a/doc/dbus-daemon.1.in b/doc/dbus-daemon.1.in +index 9aaa316..cc1019e 100644 +--- a/doc/dbus-daemon.1.in ++++ b/doc/dbus-daemon.1.in +@@ -94,6 +94,10 @@ configured in the configuration file. + .I "--activation=systemd" + Enable systemd-style service activation. Only useful in conjunction + with the systemd system and session manager on Linux. ++.TP ++.I "--activation=upstart" ++Enable upstart-style service activation. Only useful in conjunction ++with the Upstart init daemon on Linux. + + .SH CONFIGURATION FILE + +-- +1.7.1 + diff -Nru dbus-1.4.1/debian/patches/0004-upstart-add-UpstartJob-to-service-desktop-files.patch dbus-1.4.1/debian/patches/0004-upstart-add-UpstartJob-to-service-desktop-files.patch --- dbus-1.4.1/debian/patches/0004-upstart-add-UpstartJob-to-service-desktop-files.patch 1970-01-01 00:00:00.000000000 +0000 +++ dbus-1.4.1/debian/patches/0004-upstart-add-UpstartJob-to-service-desktop-files.patch 2010-12-22 14:36:29.000000000 +0000 @@ -0,0 +1,108 @@ +From 186818fa7a3af63178f68778555c87321505fd34 Mon Sep 17 00:00:00 2001 +From: Scott James Remnant +Date: Tue, 21 Dec 2010 16:00:42 +0000 +Subject: [PATCH 4/5] upstart: add UpstartJob= to service desktop files + +Add a field to service desktop files to specify that there is an +equivalent Upstart job for this service; unlike the systemd stuff, +this doesn't need to name that job so it's just a flag. +--- + bus/activation.c | 20 ++++++++++++++++++++ + bus/desktop-file.h | 1 + + 2 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/bus/activation.c b/bus/activation.c +index 7d15910..978fa00 100644 +--- a/bus/activation.c ++++ b/bus/activation.c +@@ -74,6 +74,7 @@ typedef struct + unsigned long mtime; + BusServiceDirectory *s_dir; + char *filename; ++ unsigned int upstart_job : 1; + } BusActivationEntry; + + typedef struct BusPendingActivationEntry BusPendingActivationEntry; +@@ -98,6 +99,7 @@ typedef struct + DBusBabysitter *babysitter; + DBusTimeout *timeout; + unsigned int timeout_added : 1; ++ unsigned int upstart_job : 1; + } BusPendingActivation; + + #if 0 +@@ -260,6 +262,8 @@ update_desktop_file_entry (BusActivation *activation, + DBusError *error) + { + char *name, *exec, *user, *exec_tmp, *systemd_service; ++ const char *upstart_job_raw; ++ int upstart_job; + BusActivationEntry *entry; + DBusStat stat_buf; + DBusString file_path; +@@ -273,6 +277,8 @@ update_desktop_file_entry (BusActivation *activation, + exec_tmp = NULL; + entry = NULL; + systemd_service = NULL; ++ upstart_job_raw = NULL; ++ upstart_job = FALSE; + + dbus_error_init (&tmp_error); + +@@ -355,6 +361,16 @@ update_desktop_file_entry (BusActivation *activation, + } + } + ++ /* upstart job is never required */ ++ if (bus_desktop_file_get_raw (desktop_file, ++ DBUS_SERVICE_SECTION, ++ DBUS_SERVICE_UPSTART_JOB, ++ &upstart_job_raw)) ++ { ++ if (strchr ("YyTt", upstart_job_raw[0])) ++ upstart_job = TRUE; ++ } ++ + _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error); + + entry = _dbus_hash_table_lookup_string (s_dir->entries, +@@ -385,6 +401,7 @@ update_desktop_file_entry (BusActivation *activation, + entry->exec = exec; + entry->user = user; + entry->systemd_service = systemd_service; ++ entry->upstart_job = upstart_job; + entry->refcount = 1; + + entry->s_dir = s_dir; +@@ -428,6 +445,7 @@ update_desktop_file_entry (BusActivation *activation, + dbus_free (entry->user); + dbus_free (entry->systemd_service); + entry->systemd_service = systemd_service; ++ entry->upstart_job = upstart_job; + entry->name = name; + entry->exec = exec; + entry->user = user; +@@ -1816,6 +1834,8 @@ bus_activation_activate_service (BusActivation *activation, + } + } + ++ pending_activation->upstart_job = entry->upstart_job; ++ + pending_activation->timeout = + _dbus_timeout_new (bus_context_get_activation_timeout (activation->context), + pending_activation_timed_out, +diff --git a/bus/desktop-file.h b/bus/desktop-file.h +index 58e78e8..d78e24f 100644 +--- a/bus/desktop-file.h ++++ b/bus/desktop-file.h +@@ -36,6 +36,7 @@ + #define DBUS_SERVICE_USER "User" + #define DBUS_SERVICE_GROUP "Group" + #define DBUS_SERVICE_SYSTEMD_SERVICE "SystemdService" ++#define DBUS_SERVICE_UPSTART_JOB "UpstartJob" + + typedef struct BusDesktopFile BusDesktopFile; + +-- +1.7.1 + diff -Nru dbus-1.4.1/debian/patches/0005-activation-implement-upstart-activation.patch dbus-1.4.1/debian/patches/0005-activation-implement-upstart-activation.patch --- dbus-1.4.1/debian/patches/0005-activation-implement-upstart-activation.patch 1970-01-01 00:00:00.000000000 +0000 +++ dbus-1.4.1/debian/patches/0005-activation-implement-upstart-activation.patch 2010-12-22 14:36:34.000000000 +0000 @@ -0,0 +1,199 @@ +From d713b4bed89486d9c164168517b20223c2bbece5 Mon Sep 17 00:00:00 2001 +From: Scott James Remnant +Date: Wed, 22 Dec 2010 14:08:14 +0000 +Subject: [PATCH 5/5] activation: implement upstart activation + +Upstart activation is performed by emitting a dbus-activation event +within Upstart, and then simply expecting the appropriate bus name +to appear. e.g. + + start on dbus-activation org.freedesktop.UDisks + exec /usr/lib/udisks/udsks-daemon +--- + bus/activation.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 170 insertions(+), 0 deletions(-) + +diff --git a/bus/activation.c b/bus/activation.c +index 978fa00..198d6bf 100644 +--- a/bus/activation.c ++++ b/bus/activation.c +@@ -1918,6 +1918,176 @@ bus_activation_activate_service (BusActivation *activation, + if (activated) + return TRUE; + ++ if (bus_context_get_activation_type (activation->context) == ACTIVATION_UPSTART) ++ { ++ BusRegistry *registry; ++ DBusString service_string; ++ BusService *service; ++ ++ /* Check whether Upstart is connected */ ++ registry = bus_connection_get_registry (connection); ++ _dbus_string_init_const (&service_string, "com.ubuntu.Upstart"); ++ service = bus_registry_lookup (registry, &service_string); ++ ++ if (entry->upstart_job ++ && (service != NULL)) ++ { ++ BusTransaction *activation_transaction; ++ DBusMessageIter iter; ++ const char *event_name; ++ int wait_for_event; ++ DBusMessageIter array_iter; ++ DBusString entry; ++ const char *entry_str; ++ char **e; ++ ++ /* Upstart activation is done by event; rather than naming a ++ job, we name the bus name to be activated; this is included ++ in the event environment along with the activation environment ++ so that gets passed correctly to jobs. */ ++ ++ /* Create the message */ ++ message = dbus_message_new_method_call ("com.ubuntu.Upstart", ++ "/com/ubuntu/Upstart", ++ "com.ubuntu.Upstart0_6", ++ "EmitEvent"); ++ if (!message) ++ { ++ _dbus_verbose ("No memory to create activation message\n"); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS)) ++ { ++ _dbus_verbose ("No memory to set sender of activation message\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ dbus_message_iter_init_append (message, &iter); ++ ++ event_name = "dbus-activation"; ++ if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &event_name)) ++ { ++ _dbus_verbose ("No memory to set args of activation message\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, ++ &array_iter)) ++ { ++ _dbus_verbose ("No memory to set args of activation message\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ if (!_dbus_string_init (&entry)) ++ { ++ _dbus_verbose ("No memory to create activation message environment\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ if (!_dbus_string_append_printf (&entry, "SERVICE=%s", service_name)) ++ { ++ _dbus_verbose ("No memory to create activation message environment\n"); ++ _dbus_string_free (&entry); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ entry_str = _dbus_string_get_data (&entry); ++ ++ if (!dbus_message_iter_append_basic (&array_iter, DBUS_TYPE_STRING, &entry_str)) ++ { ++ _dbus_verbose ("No memory to set args of activation message\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ _dbus_string_free (&entry); ++ ++ ++ envp = bus_activation_get_environment (activation); ++ ++ if (envp == NULL) ++ { ++ _dbus_verbose ("No memory to get environment for activation message\n"); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ for (e = envp; *e; e++) ++ { ++ if (!dbus_message_iter_append_basic (&array_iter, DBUS_TYPE_STRING, e)) ++ { ++ _dbus_verbose ("No memory to set args of activation message\n"); ++ dbus_message_unref (message); ++ dbus_free_string_array (envp); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ } ++ ++ dbus_free_string_array (envp); ++ ++ if (!dbus_message_iter_close_container (&iter, &array_iter)) ++ { ++ _dbus_verbose ("No memory to set args of activation message\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ wait_for_event = FALSE; ++ if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &wait_for_event)) ++ { ++ _dbus_verbose ("No memory to set args of activation message\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ /* Create the transaction */ ++ activation_transaction = bus_transaction_new (activation->context); ++ if (activation_transaction == NULL) ++ { ++ _dbus_verbose ("No memory to create activation transaction\n"); ++ dbus_message_unref (message); ++ BUS_SET_OOM (error); ++ return FALSE; ++ } ++ ++ retval = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service), ++ message, error); ++ dbus_message_unref (message); ++ ++ if (!retval) ++ { ++ _DBUS_ASSERT_ERROR_IS_SET (error); ++ _dbus_verbose ("failed to send activation message: %s\n", error->name); ++ bus_transaction_cancel_and_free (activation_transaction); ++ return FALSE; ++ } ++ ++ bus_transaction_execute_and_free (activation_transaction); ++ ++ /* Now we just wait for the bus name to appear */ ++ return TRUE; ++ } ++ ++ /* Configured service without UpstartJob=, fallback to traditional ++ activation. */ ++ } ++ + if (bus_context_get_activation_type (activation->context) == ACTIVATION_SYSTEMD) + { + if (strcmp (service_name, "org.freedesktop.systemd1") == 0) +-- +1.7.1 + diff -Nru dbus-1.4.1/debian/patches/series dbus-1.4.1/debian/patches/series --- dbus-1.4.1/debian/patches/series 2010-12-21 13:15:01.000000000 +0000 +++ dbus-1.4.1/debian/patches/series 2010-12-22 14:37:27.000000000 +0000 @@ -3,3 +3,8 @@ 10_dbus-1.0.1-generate-xml-docs.patch 20_system_conf_limit.patch 81-session.conf-timeout.patch +0001-activation-allow-for-more-variation-than-just-system.patch +0002-bus-change-systemd-activation-to-activation-systemd.patch +0003-upstart-add-upstart-as-a-possible-activation-type.patch +0004-upstart-add-UpstartJob-to-service-desktop-files.patch +0005-activation-implement-upstart-activation.patch