On Mon, Aug 17, 2009 at 02:25:13PM +0200, Werner Fink wrote:
> On Sat, Aug 15, 2009 at 05:19:41PM +0200, Petter Reinholdtsen wrote:
> > [Raphael Geissert]
> > > As mentioned on IRC, when a virtual facility depends on itself
> > > insserv enters an infinite loop and starts leaking memory.
> > 
> > Thank you.  I've written this test case to reproduce the problem.  CC
> > to upstream to let him know about the problem.
> 
> OK, I've added a check to avoid such loops and also check to
> avoid that a scripts depends on a scripts which uses the
> system facility `$all' in its Required-Start.
> 
> Does this work for you?

It hadn't worked for my on x86_64 due not initialized flags.
Please apply the following patch on top of the last patched
version to fix this.


       Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
--- insserv.c
+++ insserv.c	2009-08-18 11:36:07.000000000 +0200
@@ -222,8 +222,8 @@ typedef struct string {
 
 typedef struct repl {
     list_t     r_list;
-    ushort	flags;
     string_t	 r[1];
+    ushort	flags;
 } __align repl_t;
 #define getrepl(arg)	list_entry((arg), struct repl, r_list)
 
@@ -1880,6 +1880,7 @@ static void scan_conf_file(const char *r
 				if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
 				    error("%s", strerror(errno));
 				insert(&subst->r_list, r_list->prev);
+				subst->flags = 0;
 				r = &subst->r[0];
 				if (posix_memalign((void*)&r->ref, sizeof(void*), alignof(typeof(r->ref))+strsize(token)) != 0)
 				    error("%s", strerror(errno));
@@ -1909,6 +1910,7 @@ static void scan_conf_file(const char *r
 				error("%s", strerror(errno));
 			    insert(&subst->r_list, r_list->prev);
 			    r = &subst->r[0];
+			    subst->flags = 0;
 			    if (posix_memalign((void*)&r->ref, sizeof(void*), alignof(typeof(r->ref))+strsize(token)) != 0)
 				error("%s", strerror(errno));
 			    *r->ref = 1;

Reply via email to