On Thu, Jul 23, 2009 at 12:22:13AM +0200, Petter Reinholdtsen wrote:
> [Dr. Werner Fink]
> > You may try the attached patch, does this solve your problem *and*
> > outlive all other test cases.
> 
> Btw, the patch seem a bit strange when I have a closer look.  The deep
> value is increased only when expanding a new virtual facility, but
> decreased every time.  Will this lead to unexpecded behaviour?  I am
> talking about this code:
> 
>         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;
>             }
>         }
> out:
>         (*deep)--;
>         return;
> 
> The else block should probably also increase *deep?  No idea if this
> is a real problem or not.  None of the Debian test cases fail, but we
> have only one testing the content of .depend.* so far.

You're right, good point.  Please apologize and have a look
on the attachment with the corrected patch.

     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-07-23 10:55:54.245901384 +0200
@@ -2058,33 +2058,26 @@ 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 == '$') {
-		expand_faci(tmp, head, deep);
-	    } 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);
+		if (*deep > 10) {
+		    warn("The nested level of the system facilities in the insserv.conf file(s) is to large\n");
+		    goto out;
 		}
+		(*deep)++;
+		expand_faci(tmp, head, deep);
+		(*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;
 	    }
 	}
 out:
-	(*deep)--;
 	return;
 }
 
_______________________________________________
initscripts-ng-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/initscripts-ng-devel

Reply via email to