"Ryan McLelland" <ryan.mclelland@gmail.com> writes:
> 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.
I think the problem is that you're passing NULL for the
svn_client_list_func_t argument. Nothing in the doc string for
svn_client_list() says that that argument can be NULL.
However, it's a mystery to me why the code works if both directories
exist.
It's hard to be sure what's going on without a debugger backtrace.
Have you tried that?
(Note that svn_client_list() has been deprecated and replaced with
svn_client_list2() in the latest Subversion sources. You might want
to start testing with that now.)
-Karl
--
Subversion support & consulting <> http://producingoss.com/consulting.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Jun 25 20:52:28 2007