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

segfault in second call to svn_client_list

From: Ryan McLelland <ryan.mclelland_at_gmail.com>
Date: 2007-06-25 20:37:28 CEST

Hi,
I'm trying to develop a backend svn client using the c++ apis, and am
running into this issue. My repository is organized as
repo_root/user_dir/project_dir, with each user having their own user_dir.
The svn aspect of this needs to be hidden, so on a checkout I check things
out into a general working copy, and then transmit the file to the user who
requested it. Basically my problem comes when I'm trying to check if the
user's directories are already set up in the repository as follows:

for two directories set up as repo_root/dir1/dir2 i have the following code
to check if each dir exists, and create whichever ones do not already exist.

    err = svn_client_list ( path_to_dir2, &rev, &rev, FALSE, NULL, FALSE,
NULL, NULL, ctx, pool );

    if(err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
    {
         targets = apr_array_make(pool, 1, sizeof(const char*));

         err = svn_client_list(path_to_dir1, &rev, &rev, FALSE, NULL, FALSE,
NULL, NULL, ctx, pool);

        if(err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
        {
                *(const char **)apr_array_push(targets) =
svn_path_canonicalize(svn_path_uri_encode(path_to_dir1, pool), pool);
                err = svn_client_mkdir2(&cmt_info, targets, ctx, pool);
                if(err)
                   return;

                apr_array_pop(targets);
        }

          *(const char **)apr_array_push(targets) =
svn_path_canonicalize(svn_path_uri_encode(path_to_dir2, pool), pool);
          err = svn_client_mkdir2(&cmt_info, targets, ctx, pool);
    }

If neither of the two directories exists in the repository then this works,
it creates both directories, and if they both exist then it works (does
nothing). If dir1 exists and dir2 does not, however, I get a segmentation
fault inside the second call to svn_client_list, and I have no idea why. Any
help would be much appreciated.

-Ryan
Received on Mon Jun 25 20:37:34 2007

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