[ros-users] Infinite recursion in dependencies resolution bu…

Top Page
Attachments:
Message as email
+ (text/plain)
+ deps_infinite_recursion.patch (text/x-patch)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: [ros-users] Infinite recursion in dependencies resolution bug + patch
Hello,

I ran into an infinite recursion issue while trying to install packages
with cycles in dependencies.

The attached patch solved the issue for me.


Best regards,
Séverin
Index: core/roslib/src/roslib/packages.py
===================================================================
--- core/roslib/src/roslib/packages.py    (revision 11301)
+++ core/roslib/src/roslib/packages.py    (working copy)
@@ -678,6 +678,10 @@


         if package in self._depends_cache:
             return self._depends_cache[package]
+        
+        #Add the package to the cache, to avoid infinte recursion
+        self._depends_cache[package] = []
+        
         s = set()
         manifests = self.manifests
         # take the union of all dependencies
@@ -742,9 +746,13 @@


         if package in self._rosdeps_cache:
             return self._rosdeps_cache[package]
+        
+        #Add the package to the cache, to avoid infinte recursion
+        self._rosdeps_cache[package] = []
+        
         s = set()
         manifests = self.manifests
         # take the union of all dependencies
Index: tools/rosmake/src/rosmake/rosmake.py
===================================================================
--- tools/rosmake/src/rosmake/rosmake.py    (revision 11301)
+++ tools/rosmake/src/rosmake/rosmake.py    (working copy)
@@ -320,8 +320,6 @@
     def build_or_recurse(self,p):
         if p in self.build_list:
             return
-        for d in self.dependency_tracker.get_deps_1(p):
-            self.build_or_recurse(d)
         try: # append it ot the list only if present
           self.get_path(p)
           self.build_list.append(p)
@@ -331,8 +329,9 @@
             sys.exit(-1)
           else:
             self.printer.print_all("!"*20 + " Package %s does not exist. %s"%(p, ex) + "!"*20)
+        for d in self.dependency_tracker.get_deps_1(p):
+            self.build_or_recurse(d)


     def parallel_build_pkgs(self, build_queue, argument = None, threads = 1):
         self.profile[argument] = {}
         self.output[argument] = {}