You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by SteveKing <st...@gmx.ch> on 2005/06/23 17:38:47 UTC

Crash in svn_client_switch()

Hi,

another crashreport sent for TSVN, but happens actually in the 
Subversion lib:

svn_client_switch() (switch.c: line 154)
  svn_wc_crawl_revisions2() (adm_crawler.c: line 489)

The reason for the crash:
the line 489 in adm_crawler.c reads
  base_rev = parent_entry->revision;
and 'parent_entry' is NULL.

The 'parent_entry' should be set in svn_wc_entry(), but obviously it 
isn't and no error is returned. I've looked that that function:
...
   if (dir_access)
     {
       apr_hash_t *entries;
       SVN_ERR (svn_wc_entries_read (&entries, dir_access, show_hidden, 
pool));
       *entry = apr_hash_get (entries, entry_name, APR_HASH_KEY_STRING);
     }
...

the line *entry = apr_hash_get (...) seems the reason for this.
apr_hash_get can return NULL if the hash wasn't found (for whatever 
reason), and that return value is not checked. And even though this 
function returns NO_ERROR, the apr_hash_get() function could have failed.

Stefan

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Crash in svn_client_switch()

Posted by SteveKing <st...@gmx.ch>.
Philip Martin wrote:
> SteveKing <st...@gmx.ch> writes:
> 
> 
>>another crashreport sent for TSVN, but happens actually in the
>>Subversion lib:
>>
>>svn_client_switch() (switch.c: line 154)
>>  svn_wc_crawl_revisions2() (adm_crawler.c: line 489)
>>
>>The reason for the crash:
>>the line 489 in adm_crawler.c reads
>>  base_rev = parent_entry->revision;
>>and 'parent_entry' is NULL.
>>
>>The 'parent_entry' should be set in svn_wc_entry(), but obviously it
>>isn't and no error is returned.
> 
> 
> svn_wc_entry documents when NULL will be returned, it's not an error.

Well, then you should check if 'parent_entry' is NULL  before you access 
a member of it.

> The question (as always) is how do you trigger this crash.  Can you

That's (as always) the problem. You see, I just receive crashreports, 
i.e. dump files automatically generated, by mail. And even though we 
tell users to describe what they were doing when the crash happened and 
what their working copy looked like, ... they don't do that. Mostly 
because they don't speak english. For example, this crashreport was sent 
from a .ru domain, so no chance for me to get an answer.

> describe the working copy state and the switch parameters?  If we
> decide to trap the NULL, which looks like a reasonable thing to do to
> me, then I guess we simply return an ENTRY_NOT_FOUND error which means
> the switch will fail.

 From the paths used (which are sometimes visible in the crashreport, 
depending on where the crash happened) I figure it's a nested wc layout. 
The path was c:/dev/<some utf8 chars>/nested_2/ - so I guess the 
'nested_2' indicates another working copy inside the real working copy.

I think for situations like this, where we can't be sure why a crash 
happens I suggest to insert an svnassert() function which returns an 
error with a text like
"a situation occured which shouldn't have. Please report this on the 
Subversion mailing list, and include the command you used, what your 
working copy looks like, ... and be prepared to answer questions from 
the developers trying to fix this issue"

That way, a crash can be avoided, and the users know that they should 
report this on the mailing list for further investigation.

Stefan

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Crash in svn_client_switch()

Posted by Philip Martin <ph...@codematters.co.uk>.
SteveKing <st...@gmx.ch> writes:

> another crashreport sent for TSVN, but happens actually in the
> Subversion lib:
>
> svn_client_switch() (switch.c: line 154)
>   svn_wc_crawl_revisions2() (adm_crawler.c: line 489)
>
> The reason for the crash:
> the line 489 in adm_crawler.c reads
>   base_rev = parent_entry->revision;
> and 'parent_entry' is NULL.
>
> The 'parent_entry' should be set in svn_wc_entry(), but obviously it
> isn't and no error is returned.

svn_wc_entry documents when NULL will be returned, it's not an error.

The question (as always) is how do you trigger this crash.  Can you
describe the working copy state and the switch parameters?  If we
decide to trap the NULL, which looks like a reasonable thing to do to
me, then I guess we simply return an ENTRY_NOT_FOUND error which means
the switch will fail.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org