[systemd] Fix for bug #1026860

Zbigniew Jędrzejewski-Szmek zbyszek at fedoraproject.org
Thu Dec 5 22:13:32 UTC 2013


commit 98947a1bd52bc3dfd3cf028bab2c3534b506b715
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Dec 5 11:05:50 2013 -0500

    Fix for bug #1026860

 ...-a-start-job-for-all-units-specified-with.patch |   49 ++++++++++++++++++++
 ...-device-ignore-SYSTEMD_WANTS-in-user-mode.patch |   28 +++++++++++
 systemd.spec                                       |    7 ++-
 3 files changed, 83 insertions(+), 1 deletions(-)
---
diff --git a/0140-systemd-add-a-start-job-for-all-units-specified-with.patch b/0140-systemd-add-a-start-job-for-all-units-specified-with.patch
new file mode 100644
index 0000000..ebd344d
--- /dev/null
+++ b/0140-systemd-add-a-start-job-for-all-units-specified-with.patch
@@ -0,0 +1,49 @@
+From 043a559ff3732439fc61872a6320ee0a05dd088f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek at in.waw.pl>
+Date: Thu, 5 Dec 2013 00:41:12 -0500
+Subject: [PATCH] systemd: add a start job for all units specified with
+ SYSTEMD_WANTS=
+
+---
+ src/core/device.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/device.c b/src/core/device.c
+index 5397bd6..610fe88 100644
+--- a/src/core/device.c
++++ b/src/core/device.c
+@@ -281,7 +281,8 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
+                         size_t l;
+ 
+                         FOREACH_WORD_QUOTED(w, l, wants, state) {
+-                                char *e, *n;
++                                _cleanup_free_ char *e, *n = NULL;
++                                Unit *other;
+ 
+                                 e = strndup(w, l);
+                                 if (!e) {
+@@ -293,12 +294,19 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
+                                         r = -ENOMEM;
+                                         goto fail;
+                                 }
+-                                free(e);
+ 
+                                 r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
+-                                free(n);
+                                 if (r < 0)
+                                         goto fail;
++
++                                other = manager_get_unit(u->manager, n);
++                                if (!other || !unit_can_start(other))
++                                        continue;
++
++                                r = manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
++                                if (r < 0)
++                                        log_warning("Failed to add job %s/%s, ignoring: %s.",
++                                                    other->id, job_type_to_string(JOB_START), strerror(-r));
+                         }
+                 }
+         }
+-- 
+1.8.4.2
+
diff --git a/0141-core-device-ignore-SYSTEMD_WANTS-in-user-mode.patch b/0141-core-device-ignore-SYSTEMD_WANTS-in-user-mode.patch
new file mode 100644
index 0000000..b28dbfd
--- /dev/null
+++ b/0141-core-device-ignore-SYSTEMD_WANTS-in-user-mode.patch
@@ -0,0 +1,28 @@
+From bd819c6a6761827adc05f15ebc20bd78a1c751dc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek at in.waw.pl>
+Date: Thu, 5 Dec 2013 16:06:04 -0500
+Subject: [PATCH] core/device: ignore SYSTEMD_WANTS= in user mode
+
+---
+ src/core/device.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/device.c b/src/core/device.c
+index 610fe88..e02c207 100644
+--- a/src/core/device.c
++++ b/src/core/device.c
+@@ -275,8 +275,9 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
+                         }
+                 }
+ 
+-                wants = udev_device_get_property_value(dev, "SYSTEMD_WANTS");
+-                if (wants) {
++                if (u->manager->running_as == SYSTEMD_SYSTEM &&
++                    (wants = udev_device_get_property_value(dev, "SYSTEMD_WANTS"))) {
++
+                         char *state, *w;
+                         size_t l;
+ 
+-- 
+1.8.4.2
+
diff --git a/systemd.spec b/systemd.spec
index 6741f6f..152e0d9 100644
--- a/systemd.spec
+++ b/systemd.spec
@@ -16,7 +16,7 @@
 Name:           systemd
 Url:            http://www.freedesktop.org/wiki/Software/systemd
 Version:        208
-Release:        8%{?gitcommit:.git%{gitcommit}}%{?dist}
+Release:        9%{?gitcommit:.git%{gitcommit}}%{?dist}
 # For a breakdown of the licensing, see README
 License:        LGPLv2+ and MIT and GPLv2+
 Summary:        A System and Service Manager
@@ -176,6 +176,8 @@ Patch136:       0136-docs-remove-unneeded-the-s-in-gudev-docs.patch
 Patch137:       0137-man-explicitly-say-when-multiple-units-can-be-specif.patch
 Patch138:       0138-systemd-treat-reload-failure-as-failure.patch
 Patch139:       0139-journal-fail-silently-in-sd_j_sendv-if-journal-is-un.patch
+Patch140:       0140-systemd-add-a-start-job-for-all-units-specified-with.patch
+Patch141:       0141-core-device-ignore-SYSTEMD_WANTS-in-user-mode.patch
 
 # kernel-install patch for grubby, drop if grubby is obsolete
 Patch1000:      kernel-install-grubby.patch
@@ -824,6 +826,9 @@ getent passwd systemd-journal-gateway >/dev/null 2>&1 || useradd -r -l -u 191 -g
 %{_datadir}/systemd/gatewayd
 
 %changelog
+* Tue Dec 03 2013 Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl> - 208-9
+- Apply two patches for #1026860
+
 * Tue Dec 03 2013 Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl> - 208-8
 - Bump release to stay ahead of f20
 


More information about the scm-commits mailing list