tags 497953 upstream fixed-upstream
thanks

[Joachim Breitner]
> cd a/
> svn mv b X
> cd X/c
> svn mv d Y
> and then svn just sat there, eating memory until the kernel had to call
> the OOM hitman.

Sorry for the late reply.  This bug is fixed upstream - attached is the
patch that will probably be in 1.5.3, to be released in about 2 weeks.

Thanks,
-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/
--- subversion/libsvn_wc/copy.c
+++ subversion/libsvn_wc/copy.c
@@ -316,8 +316,15 @@
                                 svn_wc_adm_access_t *src_access,
                                 apr_pool_t *pool)
 {
-  const char *parent_path = svn_path_dirname(src_path, pool);
-  const char *rest = svn_path_basename(src_path, pool);
+  const char *parent_path;
+  const char *rest;
+  const char *abs_src_path;
+
+  SVN_ERR(svn_path_get_absolute(&abs_src_path, src_path, pool));
+
+  parent_path = svn_path_dirname(abs_src_path, pool);
+  rest = svn_path_basename(abs_src_path, pool);
+
   *copyfrom_url = NULL;
 
   while (! *copyfrom_url)
@@ -353,9 +360,25 @@
         }
       else
         {
+          const char *last_parent_path = parent_path;
+
           rest = svn_path_join(svn_path_basename(parent_path, pool),
                                rest, pool);
           parent_path = svn_path_dirname(parent_path, pool);
+
+          if (strcmp(parent_path, last_parent_path) == 0)
+            {
+              /* If this happens, it probably means that parent_path is "".
+                 But there's no reason to limit ourselves to just that case;
+                 given everything else that's going on in this function, a
+                 strcmp() is pretty cheap, and the result we're trying to
+                 prevent is an infinite loop if svn_path_dirname() returns
+                 its input unchanged. */
+              return svn_error_createf
+                (SVN_ERR_WC_COPYFROM_PATH_NOT_FOUND, NULL,
+                 _("no parent with copyfrom information found above '%s'"),
+                 svn_path_local_style(src_path, pool));
+            }
         }
     }
 

Reply via email to