[Initscripts-ng-commits] r957 - in /trunk/src/insserv/debian: changelog patches/94_v1_12_2.patch patches/95_stop_all.patch patches/series run-testsuite
pere at users.alioth.debian.org
pere at users.alioth.debian.org
Tue Aug 18 13:00:44 UTC 2009
Author: pere
Date: Tue Aug 18 13:00:44 2009
New Revision: 957
URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=957
Log:
Two new patches from upstream, avoiding endless loops with virtual facilities, warning about indirect dependencies on and making work for stop sequences.
Added:
trunk/src/insserv/debian/patches/94_v1_12_2.patch
trunk/src/insserv/debian/patches/95_stop_all.patch
Modified:
trunk/src/insserv/debian/changelog
trunk/src/insserv/debian/patches/series
trunk/src/insserv/debian/run-testsuite
Modified: trunk/src/insserv/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=957&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Tue Aug 18 13:00:44 2009
@@ -20,11 +20,13 @@
setting (Closes: #540447).
* Add new test case test_override_remove trying to reproduce bug #540866.
No luck so far.
- * Add new test case test_insserv_virt_loop to reproduce a bug reported
- by Raphael Geissert, where an incorrect insserv.conf will make
- insserv hang forever.
+ * Add new test case test_insserv_virt_loop to reproduce a bug #541613
+ reported by Raphael Geissert, where an incorrect insserv.conf will
+ make insserv hang forever. Add new patch 94_v1_12_2.patch from
+ upstream to fix it.
* Correct test test_early_all to fail if $all do not work with stop
- sequences, as documented in #542043.
+ sequences. New 95_stop_all.patch from upstream fixing it (Closes:
+ #542043).
[ Kel Modderman ]
* Add new patch 20_install_perms_fixup.patch to install binary and
Added: trunk/src/insserv/debian/patches/94_v1_12_2.patch
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/94_v1_12_2.patch?rev=957&op=file
==============================================================================
--- trunk/src/insserv/debian/patches/94_v1_12_2.patch (added)
+++ trunk/src/insserv/debian/patches/94_v1_12_2.patch Tue Aug 18 13:00:44 2009
@@ -1,0 +1,62 @@
+Patch from upstream to detect and reject loops in virtual
+facilities (#541613) and warn about indirect dependencies to $all.
+
+--- insserv/insserv.c
++++ insserv/insserv.c 2009-08-17 14:00:25.841900763 +0200
+@@ -222,6 +222,7 @@ typedef struct string {
+
+ typedef struct repl {
+ list_t r_list;
++ ushort flags;
+ string_t r[1];
+ } __align repl_t;
+ #define getrepl(arg) list_entry((arg), struct repl, r_list)
+@@ -2060,13 +2061,19 @@ static void expand_faci(list_t *restrict
+
+ list_for_each_safe(tmp, safe, ptr) {
+ repl_t * rnxt = getrepl(tmp);
++ if (rnxt->flags & 0x0001) {
++ error("Loop detected during expanding system facilities in the insserv.conf file(s): %s\n",
++ rnxt->r[0].name);
++ }
+ if (*rnxt->r[0].name == '$') {
+ if (*deep > 10) {
+ warn("The nested level of the system facilities in the insserv.conf file(s) is to large\n");
+ goto out;
+ }
+ (*deep)++;
++ rnxt->flags |= 0x0001;
+ expand_faci(tmp, head, deep);
++ rnxt->flags &= ~0x0001;
+ (*deep)--;
+ } else if (*deep > 0) {
+ repl_t *restrict subst;
+@@ -2087,9 +2094,12 @@ static inline void expand_conf(void)
+ list_for_each(ptr, sysfaci_start) {
+ list_t * rlist, * safe, * head = &getfaci(ptr)->replace;
+ list_for_each_safe(rlist, safe, head) {
+- if (*getrepl(rlist)->r[0].name == '$') {
++ repl_t * tmp = getrepl(rlist);
++ if (*tmp->r[0].name == '$') {
+ int deep = 0;
++ tmp->flags |= 0x0001;
+ expand_faci(rlist, rlist, &deep);
++ tmp->flags &= ~0x0001;
+ }
+ }
+ }
+--- insserv/listing.c
++++ insserv/listing.c 2009-08-17 14:15:48.893900934 +0200
+@@ -398,6 +399,12 @@ static void __follow (dir_t *restrict di
+ break; /* Loop detected, stop recursion */
+ }
+
++ if ((mode == 'S') && (attof(tmp)->flags & SERV_ALL)) {
++ warn("%s depends on %s and therefore on system facility `$all' which can not be true!\n",
++ target->script ? target->script : target->name, tmp->script ? tmp->script : tmp->name);
++ continue;
++ }
++
+ if (ptrg->deep >= deep) /* Nothing new */
+ continue;
+ /* The inner recursion */
Added: trunk/src/insserv/debian/patches/95_stop_all.patch
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/95_stop_all.patch?rev=957&op=file
==============================================================================
--- trunk/src/insserv/debian/patches/95_stop_all.patch (added)
+++ trunk/src/insserv/debian/patches/95_stop_all.patch Tue Aug 18 13:00:44 2009
@@ -1,0 +1,153 @@
+Patch from upstream making $all work for stop sequences, placing
+scripts first in the stop sequence. This patch invalidates
+60_all_keyword_start_only.patch
+
+Fixes #542043
+
+--- insserv/insserv.c
++++ insserv/insserv.c 2009-08-18 13:26:15.805902273 +0200
+@@ -300,7 +300,10 @@ static void rememberreq(service_t * rest
+ if (strcasecmp(token, "$null") == 0)
+ break;
+ if (strcasecmp(token, "$all") == 0) {
+- serv->attr.flags |= SERV_ALL;
++ if (bit & REQ_KILL)
++ serv->attr.flags |= SERV_FIRST;
++ else
++ serv->attr.flags |= SERV_ALL;
+ break;
+ }
+ /* Expand the `$' token recursively down */
+@@ -622,8 +625,7 @@ static inline void active_script(void)
+ }
+
+ /*
+- * Last but not least the `$all' scripts will be set to the
+- * end of the current start order.
++ * The `$all' scripts will be set to the end of the current start order.
+ */
+ static inline void all_script(void) attribute((always_inline));
+ static inline void all_script(void)
+@@ -680,6 +682,50 @@ static inline void all_script(void)
+ }
+
+ /*
++ * Last but not least the `$all' scripts will be set to the
++ * beginning of the current stop order.
++ */
++static inline void first_script(void) attribute((always_inline));
++static inline void first_script(void)
++{
++ list_t * pos;
++
++ list_for_each(pos, s_start) {
++ service_t * serv = getservice(pos);
++ list_t * tmp;
++
++ if (serv->attr.flags & SERV_DUPLET)
++ continue; /* Duplet */
++
++ if (!(serv->attr.flags & SERV_FIRST))
++ continue;
++
++ if (serv->attr.script == (char*)0)
++ continue;
++
++ list_for_each(tmp, s_start) {
++ service_t * cur = getservice(tmp);
++
++ if (cur->attr.flags & SERV_DUPLET)
++ continue; /* Duplet */
++
++ if ((serv->start->lvl & cur->start->lvl) == 0)
++ continue;
++
++ if (cur == serv)
++ continue;
++
++ if (cur->attr.flags & SERV_FIRST)
++ continue;
++
++ rememberreq(serv, REQ_SHLD|REQ_KILL, cur->name);
++ }
++
++ setorder(serv->attr.script, 'K', 1, false);
++ }
++}
++
++/*
+ * Make the dependency files
+ */
+ static inline void makedep(void) attribute((always_inline));
+@@ -3194,6 +3240,11 @@ int main (int argc, char *argv[])
+ nonlsb_script();
+
+ /*
++ * Move the `$all' stop scripts to the very beginning
++ */
++ first_script();
++
++ /*
+ * Now generate for all scripts the dependencies
+ */
+ follow_all();
+--- insserv/listing.c
++++ insserv/listing.c 2009-08-18 13:53:47.693917907 +0200
+@@ -317,6 +317,7 @@ static void __follow (dir_t *restrict di
+ }
+
+ for (tmp = dir; tmp; tmp = getnextlink(l_list)) {
++ const typeof(attof(tmp)->flags) sflags = attof(tmp)->flags;
+ register boolean recursion = true;
+ handle_t * ptmp = (mode == 'K') ? &tmp->stopp : &tmp->start;
+ uchar * order = &ptmp->deep;
+@@ -382,6 +383,7 @@ static void __follow (dir_t *restrict di
+ np_list_for_each(dent, l_list) {
+ dir_t * target = getlink(dent)->target;
+ handle_t * ptrg = (mode == 'K') ? &target->stopp : &target->start;
++ const typeof(attof(target)->flags) kflags = attof(target)->flags;
+
+ if ((peg->run.lvl & ptrg->run.lvl) == 0)
+ continue; /* Not same boot level */
+@@ -399,10 +401,18 @@ static void __follow (dir_t *restrict di
+ break; /* Loop detected, stop recursion */
+ }
+
+- if ((mode == 'S') && (attof(tmp)->flags & SERV_ALL)) {
+- warn("%s depends on %s and therefore on system facility `$all' which can not be true!\n",
+- target->script ? target->script : target->name, tmp->script ? tmp->script : tmp->name);
+- continue;
++ if (mode == 'K') {
++ if (kflags & SERV_FIRST) {
++ warn("Stopping %s depends on %s and therefore on system facility `$all' which can not be true!\n",
++ tmp->script ? tmp->script : tmp->name, target->script ? target->script : target->name);
++ continue;
++ }
++ } else {
++ if (sflags & SERV_ALL) {
++ warn("Starting %s depends on %s and therefore on system facility `$all' which can not be true!\n",
++ target->script ? target->script : target->name, tmp->script ? tmp->script : tmp->name);
++ continue;
++ }
+ }
+
+ if (ptrg->deep >= deep) /* Nothing new */
+@@ -848,7 +858,7 @@ void follow_all(void)
+ list_for_each(tmp, d_start) {
+ maxorder = &maxstart;
+ guess_order(getdir(tmp), 'S');
+- maxorder = &maxstart;
++ maxorder = &maxstop;
+ guess_order(getdir(tmp), 'K');
+ }
+ }
+--- insserv/listing.h
++++ insserv/listing.h 2009-08-18 12:54:12.185901887 +0200
+@@ -368,6 +368,7 @@ static inline char * xstrdup(const char
+ #define SERV_SCRIPT 0x0080
+ #define SERV_NOSTOP 0x0100
+ #define SERV_CMDLINE 0x0200
++#define SERV_FIRST 0x0400
+
+ /*
+ * Bits of the runlevels
Modified: trunk/src/insserv/debian/patches/series
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/series?rev=957&op=diff
==============================================================================
--- trunk/src/insserv/debian/patches/series (original)
+++ trunk/src/insserv/debian/patches/series Tue Aug 18 13:00:44 2009
@@ -5,7 +5,7 @@
30_deterministic_order.patch
40_badboy_segfault.patch
50_symlink_in_initddir.patch
-60_all_keyword_start_only.patch
+#60_all_keyword_start_only.patch
61_interactive_keyword.patch
70_req_start_all_depends.patch
71_complete_makefile.patch
@@ -14,3 +14,5 @@
91_kfreebsd_nofadvice.patch
92_m68k_alignment.patch
93_hurd_no_path_max.patch
+94_v1_12_2.patch
+95_stop_all.patch
Modified: trunk/src/insserv/debian/run-testsuite
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/run-testsuite?rev=957&op=diff
==============================================================================
--- trunk/src/insserv/debian/run-testsuite (original)
+++ trunk/src/insserv/debian/run-testsuite Tue Aug 18 13:00:44 2009
@@ -2037,5 +2037,4 @@
test_script_in_runlevel
test_x_interactive
test_insserv_conf_makefile
-# Disabled as it uses 100% CPU and unlimited amount of memory forever
-#test_insserv_virt_loop
+test_insserv_virt_loop
More information about the Initscripts-ng-commits
mailing list