[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Bug in svn_repos_find_root_path on Windows?

From: Vlad Georgescu <vgeorgescu_at_gmail.com>
Date: 2006-11-26 22:02:47 CET

Hi,

It seems that, on Windows, svn_repos_find_root_path will get stuck in
an infinite loop if it is given an absolute path that doesn't actually
contain a repository root. I discovered this after mistyping the root
path when invoking svnserve. The relevant code is this:

  while (1)
    {
      /* Try to decode the path, so we don't fail if it contains characters
         that aren't supported by the OS filesystem. The subversion fs
         isn't restricted by the OS filesystem character set. */
      err = svn_utf_cstring_from_utf8(&decoded, candidate, pool);
      if (!err && check_repos_path(candidate, pool))
        break;
      svn_error_clear(err);
      if (candidate[0] == '\0' || strcmp(candidate, "/") == 0)
        return NULL;
      candidate = svn_path_dirname(candidate, pool);
    }

Notice that it only gets out of the loop when it encounters the Unix
root directory. The following patch fixes this problem:

[[[
* subversion/libsvn_repos/repos.c
  (svn_repos_find_root_path): Check that we reached the filesystem
root in a cross-platform
   manner.
]]]

Index: subversion/libsvn_repos/repos.c
===================================================================
--- subversion/libsvn_repos/repos.c (revision 22436)
+++ subversion/libsvn_repos/repos.c (working copy)
@@ -1851,7 +1851,8 @@
       if (!err && check_repos_path(candidate, pool))
         break;
       svn_error_clear(err);
- if (candidate[0] == '\0' || strcmp(candidate, "/") == 0)
+ if (candidate[0] == '\0'
+ || svn_path_is_root(candidate, strlen(candidate), pool))
         return NULL;
       candidate = svn_path_dirname(candidate, pool);
     }

-- 
Vlad
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 26 22:03:05 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.