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

Re: crash fetching status

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Mon, 2 Jan 2012 18:35:04 +0100

On Thu, Dec 29, 2011 at 16:57, Stefan Küng <tortoisesvn_at_gmail.com> wrote:
> On 29.12.2011 16:43, Hyrum K Wright wrote:
>>
>> On Wed, Dec 28, 2011 at 1:01 AM, Stefan Küng<tortoisesvn_at_gmail.com>
>>  wrote:
>
>
>> I looked at similar places elsewhere, and they seemed to follow a
>> pattern.  The following patch is in a similar vein:
>>
>> [[[
>> Index: subversion/libsvn_wc/status.c
>> ===================================================================
>> --- subversion/libsvn_wc/status.c       (revision 1225565)
>> +++ subversion/libsvn_wc/status.c       (working copy)
>> @@ -1795,6 +1795,7 @@
>>    struct dir_baton *pb = parent_dir_baton;
>>    struct edit_baton *eb = pb->edit_baton;
>>    struct file_baton *f = apr_pcalloc(pool, sizeof(*f));
>> +  const char *dir_repos_relpath;
>>
>>    /* Finish populating the baton members. */
>>    f->local_abspath = svn_dirent_join(eb->anchor_abspath, path, pool);
>> @@ -1804,8 +1805,13 @@
>>    f->edit_baton = eb;
>>    f->ood_changed_rev = SVN_INVALID_REVNUM;
>>    f->ood_changed_date = 0;
>> -  f->repos_relpath = svn_relpath_join(find_dir_repos_relpath(pb, pool),
>> -                                      f->name, pool);
>> +
>> +  dir_repos_relpath = find_dir_repos_relpath(pb, pool);
>> +  if (dir_repos_relpath)
>> +    f->repos_relpath = svn_relpath_join(dir_repos_relpath, f->name,
>> pool);
>> +  else
>> +    f->repos_relpath = apr_pstrdup(pool, f->name);
>> +
>>    f->ood_kind = svn_node_file;
>>    f->ood_changed_author = NULL;
>>    return f;
>> ]]]
>>
>> All the tests pass, though I'm not sure if there are other correctness
>> issues here or not, so I haven't committed this.
>
>
> Just a thought:
> svn_relpath_join() joins two path/url parts. If one is an empty string, it
> still works. But it crashes when one of the parts is NULL instead of an
> empty string.
> Maybe just rewrite svn_relpath_join() so that NULL is treated as an empty
> string? My thought is that this would be what's intended in those situations
> anyway?

I think this would be the best solution: there's a comment in
svn_relpath_join() that says:
/* If either is empty return the other */
So it really is intended to work this way. Treating a NULL string as
an empty string should work best IMHO.

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
Received on 2012-01-02 18:36:00 CET

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.