Uoti rightfully pointed out, that the commit message is bogus. The
incorrect orderings are not due to
services which failed to load, but rather use before initialization.

 A proper explanation goes like this:

sysv-generator: initialize units before use to ensure correct
 ordering

The original loop called fix_order() on each service immediately after
loading it, but fix_order() would reference other units which were not
loaded yet.
This resulted in bogus and unnecessary orderings based on the static
start priorities.

Therefore call load_sysv() for every init script when traversing them in
enumerate_sysv().  This ensures all units are loaded when fix_order() is
called.

Bug-Debian: https://bugs.debian.org/771118



I've updated the commit message accordingly. See attached patch.



2015-01-06 17:58 GMT+01:00 Martin Pitt <martin.p...@ubuntu.com>:
> Hello all,
>
> Michael Biebl [2015-01-05 10:51 +0100]:
>> If a service fails to load, we skip fix_order() and the generator uses
>> the static start priorities. This induces bogus orderings against
>> unrelated services. So instead, just don't add a service to the
>> all_services hash_map, if it fails to load.
>>
>> Bug-Debian: https://bugs.debian.org/771118
>
> Just saying that Debian/Ubuntu has that patch in production since Nov
> 28 without any problems, and it's quite easy to reproduce.
>
> Thanks Michael!
>
> Martin
>
> --
> Martin Pitt                        | http://www.piware.de
> Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From 8b33d9935d346f4f7c6997fd8c8bd56bfca54c66 Mon Sep 17 00:00:00 2001
From: Michael Biebl <bi...@debian.org>
Date: Fri, 28 Nov 2014 06:04:48 +0100
Subject: [PATCH] sysv-generator: initialize units before use to ensure correct
 ordering

The original loop called fix_order() on each service immediately after
loading it, but fix_order() would reference other units which were not
loaded yet.
This resulted in bogus and unnecessary orderings based on the static
start priorities.

Therefore call load_sysv() for every init script when traversing them in
enumerate_sysv().  This ensures all units are loaded when fix_order() is
called.

Bug-Debian: https://bugs.debian.org/771118
---
 src/sysv-generator/sysv-generator.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index f78ddeb..2f24ef2 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -755,6 +755,10 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
                         service->name = name;
                         service->path = fpath;
 
+                        r = load_sysv(service);
+                        if (r < 0)
+                                continue;
+
                         r = hashmap_put(all_services, service->name, service);
                         if (r < 0)
                                 return log_oom();
@@ -939,10 +943,6 @@ int main(int argc, char *argv[]) {
         }
 
         HASHMAP_FOREACH(service, all_services, j) {
-                q = load_sysv(service);
-                if (q < 0)
-                        continue;
-
                 q = fix_order(service, all_services);
                 if (q < 0)
                         continue;
-- 
2.1.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to