You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ryan McLelland <ry...@gmail.com> on 2007/06/25 18:37:28 UTC
segfault in second call to svn_client_list
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
Re: segfault in second call to svn_client_list
Posted by Ryan McLelland <ry...@gmail.com>.
Yeah I just figured it out, it was because I had null for the callback. It
actually wasnt working if the directories were there, I thought it was
because it worked if the file was already in the working copy, in which case
I never checked the repository at all.
Thanks.
On 6/25/07, Karl Fogel <kf...@red-bean.com> wrote:
>
> "Ryan McLelland" <ry...@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
>
Re: segfault in second call to svn_client_list
Posted by Karl Fogel <kf...@red-bean.com>.
"Ryan McLelland" <ry...@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