On Wed, Jul 22, 2009 at 12:45:04AM +0200, Petter Reinholdtsen wrote:
> [Petter Reinholdtsen]
> > This test suite script is able to reproduce it when building for
> > SuSe.  I rewrote it to use only start symlinks in runleve 1, to
> > avoid the areas where SuSe and Debian differ.  Do you see the error
> > in your build too?
> 
> One can even remove the references to mountnfs, and the bug still
> trigger.
> 
> Reading the source and adding some debug output, I am starting to
> suspect the problem is in expand_faci().  I still do not quite
> understand that code, but managed to get the test case working by
> adding this patch.  It causes other test cases to segfault, so it
> isn't the correct fix, but I thought it best to pass on the
> information.
> 
> 
> Index: insserv.c
> ===================================================================
> --- insserv.c   (revision 922)
> +++ insserv.c   (working copy)
> @@ -2043,6 +2106,7 @@
>                         free(rent->r[0].ref);
>                     rent->r[0] = rnxt->r[0];
>                     ++(*rent->r[0].ref);
> +                   insert(&rnxt->r_list, head);
>                 } else {
>                     repl_t *restrict subst;
>                     if (posix_memalign((void*)&subst, sizeof(void*), 
> alignof(repl_t)) != 0)
> 
> This is as far I have have gotten with debugging this issue.

You may try the attached patch, does this solve your problem *and*
outlive all other test cases.

       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-06-29 14:19:42.725901744 +0200
@@ -2058,22 +2058,29 @@ static void expand_faci(list_t *restrict
 	    goto out;
 	}
 
+	if ((*deep)++ > 10) {
+	    warn("The nested level of the system facilities in the insserv.conf file(s) is to large\n");
+	    goto out;
+	}
 
 	list_for_each_safe(tmp, safe, ptr) {
 	    repl_t * rnxt = getrepl(tmp);
 	    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;
-		}
 		expand_faci(tmp, head, deep);
-	    } else if (*deep > 0) {
-		repl_t *restrict subst;
-		if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
-		    error("%s", strerror(errno));
-		insert(&subst->r_list, head->prev);
-		subst->r[0] = rnxt->r[0];
-		(*subst->r[0].ref) = 1;
+	    } else {
+		if (*deep == 1) {
+		    if (--(*rent->r[0].ref) <= 0)
+			free(rent->r[0].ref);
+		    rent->r[0] = rnxt->r[0];
+		    ++(*rent->r[0].ref);
+		} else {
+		    repl_t *restrict subst;
+		    if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
+			error("%s", strerror(errno));
+		    insert(&subst->r_list, head);
+		    subst->r[0] = rnxt->r[0];
+		    ++(*subst->r[0].ref);
+		}
 	    }
 	}
 out:
_______________________________________________
initscripts-ng-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/initscripts-ng-devel

Reply via email to