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

Re: segfault in second call to svn_client_list

From: Ryan McLelland <ryan.mclelland_at_gmail.com>
Date: 2007-06-25 21:03:48 CEST

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 <kfogel@red-bean.com> wrote:
>
> "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
>
Received on Mon Jun 25 21:03:59 2007

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

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