You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Küng <to...@gmail.com> on 2011/11/16 18:24:21 UTC

Crash when merging

Hi,

A few crash reports for TSVN show a problem in libsvn_client\merge.c, 
function merge_props_changed:

if (strcmp(prop->name, SVN_PROP_MERGEINFO) == 0)
{
   /* Does LOCAL_ABSPATH have any pristine mergeinfo? */
   svn_boolean_t has_pristine_mergeinfo = FALSE;
   apr_hash_t *pristine_props;

   SVN_ERR(svn_wc_get_pristine_props(&pristine_props,
                                     ctx->wc_ctx,
                                     local_abspath,
                                     scratch_pool,
                                     scratch_pool));

   if (apr_hash_get(pristine_props, SVN_PROP_MERGEINFO,
                    APR_HASH_KEY_STRING))
     has_pristine_mergeinfo = TRUE;

The svn_wc_get_pristine_props() sets pristine_props to NULL, which then 
results in a segfault in apr_hash_get().

svn_wc_get_pristine_props() can set pristine_props to NULL and still 
return SVN_NO_ERROR if status is either incomplete, excluded, 
server_excluded or not_present. So it _can_ happen.

Checked the source of the svn trunk: the issue is still there. Haven't 
found an entry in the issue tracker so I'm reporting this here.

Stefan


-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net

Re: Crash when merging

Posted by Paul Burba <pt...@gmail.com>.
On Wed, Nov 16, 2011 at 12:57 PM, Stefan Küng <to...@gmail.com> wrote:
> On 16.11.2011 18:56, Paul Burba wrote:
>>
>> On Wed, Nov 16, 2011 at 12:24 PM, Stefan Küng<to...@gmail.com>
>>  wrote:
>>>
>>> Hi,
>>>
>>> A few crash reports for TSVN show a problem in libsvn_client\merge.c,
>>> function merge_props_changed:
>>>
>>> if (strcmp(prop->name, SVN_PROP_MERGEINFO) == 0)
>>> {
>>>  /* Does LOCAL_ABSPATH have any pristine mergeinfo? */
>>>  svn_boolean_t has_pristine_mergeinfo = FALSE;
>>>  apr_hash_t *pristine_props;
>>>
>>>  SVN_ERR(svn_wc_get_pristine_props(&pristine_props,
>>>                                    ctx->wc_ctx,
>>>                                    local_abspath,
>>>                                    scratch_pool,
>>>                                    scratch_pool));
>>>
>>>  if (apr_hash_get(pristine_props, SVN_PROP_MERGEINFO,
>>>                   APR_HASH_KEY_STRING))
>>>    has_pristine_mergeinfo = TRUE;
>>>
>>> The svn_wc_get_pristine_props() sets pristine_props to NULL, which then
>>> results in a segfault in apr_hash_get().
>>>
>>> svn_wc_get_pristine_props() can set pristine_props to NULL and still
>>> return
>>> SVN_NO_ERROR if status is either incomplete, excluded, server_excluded or
>>> not_present. So it _can_ happen.
>>>
>>> Checked the source of the svn trunk: the issue is still there. Haven't
>>> found
>>> an entry in the issue tracker so I'm reporting this here.
>>
>> Thanks Stefan,
>>
>> Fixed in r1202807and nominated for backport to 1.7.2.
>
> That was fast!

It was just so obviously wrong (and I happen to be working on merge.c
already).  The API is pretty clear:

/** Return the set of "pristine" properties for @a local_abspath.
 *
 * There are node states where properties do not make sense. For these
 * cases, NULL will be returned in @a *props.
           ^^^^^^^^^
...
svn_error_t *
svn_wc_get_pristine_props(apr_hash_t **props,
                          svn_wc_context_t *wc_ctx,
                          const char *local_abspath,
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool);

Paul

> Thanks!
>
> Stefan
>
> --
>       ___
>  oo  // \\      "De Chelonian Mobile"
>  (_,\/ \_/ \     TortoiseSVN
>   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
>   /_/   \_\     http://tortoisesvn.net
>

Re: Crash when merging

Posted by Stefan Küng <to...@gmail.com>.
On 16.11.2011 18:56, Paul Burba wrote:
> On Wed, Nov 16, 2011 at 12:24 PM, Stefan Küng<to...@gmail.com>  wrote:
>> Hi,
>>
>> A few crash reports for TSVN show a problem in libsvn_client\merge.c,
>> function merge_props_changed:
>>
>> if (strcmp(prop->name, SVN_PROP_MERGEINFO) == 0)
>> {
>>   /* Does LOCAL_ABSPATH have any pristine mergeinfo? */
>>   svn_boolean_t has_pristine_mergeinfo = FALSE;
>>   apr_hash_t *pristine_props;
>>
>>   SVN_ERR(svn_wc_get_pristine_props(&pristine_props,
>>                                     ctx->wc_ctx,
>>                                     local_abspath,
>>                                     scratch_pool,
>>                                     scratch_pool));
>>
>>   if (apr_hash_get(pristine_props, SVN_PROP_MERGEINFO,
>>                    APR_HASH_KEY_STRING))
>>     has_pristine_mergeinfo = TRUE;
>>
>> The svn_wc_get_pristine_props() sets pristine_props to NULL, which then
>> results in a segfault in apr_hash_get().
>>
>> svn_wc_get_pristine_props() can set pristine_props to NULL and still return
>> SVN_NO_ERROR if status is either incomplete, excluded, server_excluded or
>> not_present. So it _can_ happen.
>>
>> Checked the source of the svn trunk: the issue is still there. Haven't found
>> an entry in the issue tracker so I'm reporting this here.
>
> Thanks Stefan,
>
> Fixed in r1202807and nominated for backport to 1.7.2.

That was fast!
Thanks!

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net

Re: Crash when merging

Posted by Paul Burba <pt...@gmail.com>.
On Wed, Nov 16, 2011 at 12:24 PM, Stefan Küng <to...@gmail.com> wrote:
> Hi,
>
> A few crash reports for TSVN show a problem in libsvn_client\merge.c,
> function merge_props_changed:
>
> if (strcmp(prop->name, SVN_PROP_MERGEINFO) == 0)
> {
>  /* Does LOCAL_ABSPATH have any pristine mergeinfo? */
>  svn_boolean_t has_pristine_mergeinfo = FALSE;
>  apr_hash_t *pristine_props;
>
>  SVN_ERR(svn_wc_get_pristine_props(&pristine_props,
>                                    ctx->wc_ctx,
>                                    local_abspath,
>                                    scratch_pool,
>                                    scratch_pool));
>
>  if (apr_hash_get(pristine_props, SVN_PROP_MERGEINFO,
>                   APR_HASH_KEY_STRING))
>    has_pristine_mergeinfo = TRUE;
>
> The svn_wc_get_pristine_props() sets pristine_props to NULL, which then
> results in a segfault in apr_hash_get().
>
> svn_wc_get_pristine_props() can set pristine_props to NULL and still return
> SVN_NO_ERROR if status is either incomplete, excluded, server_excluded or
> not_present. So it _can_ happen.
>
> Checked the source of the svn trunk: the issue is still there. Haven't found
> an entry in the issue tracker so I'm reporting this here.

Thanks Stefan,

Fixed in r1202807and nominated for backport to 1.7.2.

Paul

> Stefan
>
>
> --
>       ___
>  oo  // \\      "De Chelonian Mobile"
>  (_,\/ \_/ \     TortoiseSVN
>   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
>   /_/   \_\     http://tortoisesvn.net
>