When displaying anscestors of an unstatisfied dependency (code from bug
authorZac Medico <zmedico@gentoo.org>
Sun, 23 Nov 2008 00:33:59 +0000 (00:33 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 23 Nov 2008 00:33:59 +0000 (00:33 -0000)
#245358), avoid a potential infinite loop and memory leak triggered by
circular dependencies. Thanks to Peter Weller <welp@g.o> for reporting.
(trunk r12045)

svn path=/main/branches/2.1.6/; revision=12046

pym/_emerge/__init__.py

index e8bcd7cd0f73dca9bef8d0a844b5f559f3d466d8..c69998e67caaff8e9ae7a7d32b22e09c05e56356 100644 (file)
@@ -5388,13 +5388,18 @@ class depgraph(object):
                        print "\nemerge: there are no ebuilds to satisfy "+green(xinfo)+"."
 
                # Show parent nodes and the argument that pulled them in.
+               traversed_nodes = set()
                node = myparent
                msg = []
                while node is not None:
+                       traversed_nodes.add(node)
                        msg.append('(dependency required by "%s" [%s])' % \
                                (colorize('INFORM', str(node.cpv)), node.type_name))
                        parent = None
                        for parent in self.digraph.parent_nodes(node):
+                               if parent in traversed_nodes:
+                                       parent = None
+                                       continue
                                if isinstance(parent, DependencyArg):
                                        msg.append('(dependency required by "%s" [argument])' % \
                                                (colorize('INFORM', str(parent))))