[Pkg-sysvinit-devel] Bug#609959: Info received (Bug#609959: initscripts: "too many loops!" when bootlogd is enabled)

Francis Russell francis+dbts at unchartedbackwaters.co.uk
Mon Mar 21 22:54:53 UTC 2011


Hi,

I'm attaching a patch against startpar, specifically makeboot.{h,c}. It
should be able to drop into the debian/startpar/patches folder (but
needs offset adjusting) and is intended to obsolete
04_makeboot_loop_upper_bound.patch.

The check of the variable 'loop' in the original code is quite strange.
The dependency graph has no loops by construction, so I can only assume
that it was intended to catch an error on the part of the programmer,
rather a loop in the makefile dependencies itself. Anyway, the patch
still guarantees that check_loop will terminate since it cannot
recursively call itself more than the number of nodes in the dependency
graph.

The other problem with the original code is the efficiency of
check_loop. It treats the dependency graph as a tree instead of a DAG,
and therefore repeatedly checks the same parts of the graph multiple
times (hence the massive values for loop). I've avoided this by using a
flag variable that is set when a node is visited. Instead of having to
clear these flags, which is difficult to do in a depth-first
implementation anyway, that flag variable is an integer which changes
value on each call to check_loop.

Summing across /etc/init.d/.depend.{boot,start,stop} on my system, this
patch reduces the number of calls to check_loop from 3331320 to 8233
(0.25% of original).

Please let me know if you have any questions,

Francis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makeboot.diff
Type: text/x-patch
Size: 2011 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-sysvinit-devel/attachments/20110321/a1e6b954/attachment.bin>


More information about the Pkg-sysvinit-devel mailing list