[git commit master 1/1] depmod.pl: add recursive sanity check

Mike Frysinger vapier at gentoo.org
Tue Nov 16 12:15:00 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=8ce1ad3097ca6b92293ca767f6e4ddd98ad0d90e
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

If modules contain circular dependencies, the depmod script will follow
the circle forever.  So add a simple sanity check to abort rather than
chew up the CPU.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 examples/depmod.pl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/examples/depmod.pl b/examples/depmod.pl
index 8c6548d..f324b12 100755
--- a/examples/depmod.pl
+++ b/examples/depmod.pl
@@ -173,6 +173,9 @@ sub add_mod_deps
 
 	$depth .= " ";
 	warn "${depth}loading deps of module: $this_module\n" if $verbose;
+	if (length($depth) > 50) {
+		die "too much recursion (circular dependencies in modules?)";
+	}
 
 	foreach my $md (keys %{$mod->{$this_module}}) {
 		add_mod_deps ($depth, $mod, $mod2, $module, $md);
-- 
1.7.1



More information about the busybox-cvs mailing list