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/08/08 18:47:40 UTC

Segfault when upgrading

Hi,

I've now analyzed the fifth crash report for TSVN that shows a segfault 
when upgrading a working copy. The crash happens here:

libsvn_wc\upgrade.c, line 1111

         info = apr_hash_get(*text_bases_info, versioned_file_name,
                             APR_HASH_KEY_STRING);

with 'versioned_file_name' being NULL.
(ok, the crash is in the hash function in the apr lib, but it crashes 
because the key string is NULL).

Problem is I have no idea why that would be NULL, it gets set a few 
lines above by the 'remove_suffix()' function which only returns NULL if 
either the filename is too short or the extension doesn't match - which 
I can't see why this would ever happen.

Anyone got any ideas?
I've asked those who sent those reports, but they have no idea what's 
different about their working copies. All of them had several working 
copies, and the crash happens only with one or maybe two of them, but 
not all of the working copies they upgrade.

Stefan

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

Re: Segfault when upgrading

Posted by Philip Martin <ph...@wandisco.com>.
Stefan Küng <to...@gmail.com> writes:

> Hi,
>
> I've now analyzed the fifth crash report for TSVN that shows a
> segfault when upgrading a working copy. The crash happens here:
>
> libsvn_wc\upgrade.c, line 1111
>
>         info = apr_hash_get(*text_bases_info, versioned_file_name,
>                             APR_HASH_KEY_STRING);
>
> with 'versioned_file_name' being NULL.
> (ok, the crash is in the hash function in the apr lib, but it crashes
> because the key string is NULL).
>
> Problem is I have no idea why that would be NULL, it gets set a few
> lines above by the 'remove_suffix()' function which only returns NULL
> if either the filename is too short or the extension doesn't match -
> which I can't see why this would ever happen.
>
> Anyone got any ideas?

A stray file in .svn/text-base:

$ rm -rf repo wc
$ svnadmin create repo
$ svn-1.6 co file://`pwd`/repo wc
$ touch wc/.svn/text-base/x.x
$ svn-1.7 upgrade wc
Segmentation fault

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com

Re: Segfault when upgrading

Posted by Julian Foad <ju...@wandisco.com>.
Stefan Küng wrote:
> I've now analyzed the fifth crash report for TSVN that shows a segfault 
> when upgrading a working copy. The crash happens here:
> 
> libsvn_wc\upgrade.c, line 1111
> 
>          info = apr_hash_get(*text_bases_info, versioned_file_name,
>                              APR_HASH_KEY_STRING);
> 
> with 'versioned_file_name' being NULL.
> (ok, the crash is in the hash function in the apr lib, but it crashes 
> because the key string is NULL).
> 
> Problem is I have no idea why that would be NULL, it gets set a few 
> lines above by the 'remove_suffix()' function which only returns NULL if 
> either the filename is too short or the extension doesn't match - which 
> I can't see why this would ever happen.
> 
> Anyone got any ideas?
> I've asked those who sent those reports, but they have no idea what's 
> different about their working copies. All of them had several working 
> copies, and the crash happens only with one or maybe two of them, but 
> not all of the working copies they upgrade.

Looks like that could happen if the text-base directory contains a file
that's not a Subversion text-base filename.  This might fix it:

[[[
Index: subversion/libsvn_wc/upgrade.c
===================================================================
--- subversion/libsvn_wc/upgrade.c	(revision 1154861)
+++ subversion/libsvn_wc/upgrade.c	(working copy)
@@ -1102,12 +1102,17 @@ migrate_text_bases(apr_hash_t **text_bas
         else
           {
             versioned_file_name = remove_suffix(text_base_basename,
                                                 SVN_WC__BASE_EXT, result_pool);
             is_revert_base = FALSE;
           }
+        if (! versioned_file_name)
+          {
+            SVN_DBG(("ignoring non-text-base file '%s'\n", text_base_basename));
+            continue;
+          }
 
         /* Create a new info struct for this versioned file, or fill in the
          * existing one if this is the second text-base we've found for it. */
         info = apr_hash_get(*text_bases_info, versioned_file_name,
                             APR_HASH_KEY_STRING);
         if (info == NULL)
]]]

- Julian