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

Core dump when using SVN::Client ls

From: Martin J. Evans <martin.evans_at_easysoft.com>
Date: 2004-05-28 12:42:06 CEST

Hi,

SVN::Client ls appears to core dump if you pass it an empty string (which I did
by accident):

my $url ;
my $ctx = new SVN::Client(
              auth => [SVN::Client::get_simple_provider(),
              SVN::Client::get_simple_prompt_provider(\&simple_prompt,2),
              SVN::Client::get_username_provider()]
              );
my $revision = 'HEAD' ;
my $dirs = $ctx->ls ( $url , $revision, 0 ) ;

(gdb) where
#0 0x404ecac4 in skip_uri_schema (path=0x0)
    at subversion/libsvn_subr/path.c:708
#1 0x404ecb26 in svn_path_is_url (path=0x0)
    at subversion/libsvn_subr/path.c:757
#2 0x40490809 in svn_client_url_from_path (url=0xbfffedc8, path_or_url=0x0,
    pool=0x8261ec0) at subversion/libsvn_client/url.c:41
#3 0x4048ba22 in svn_client_ls (dirents=0xbfffee4c, path_or_url=0x0,
    revision=0xbfffee50, recurse=0, ctx=0x8261f20, pool=0x8261ec0)
    at subversion/libsvn_client/ls.c:86
#4 0x407ee3f9 in _wrap_svn_client_ls (my_perl=0x804bcb8,cv=0x8130790)
    at svn_client.c:5855
#5 0x400a0235 in Perl_pp_entersub (my_perl=0x804bcb8) at pp_hot.c:2781
#6 0x40083a0a in Perl_runops_debug (my_perl=0x804bcb8) at dump.c:1414
#7 0x400379bb in S_run_body (my_perl=0x804bcb8, oldscope=0) at perl.c:1705
#8 0x40037645 in perl_run (my_perl=0x804bcb8) at perl.c:1624
#9 0x080493a3 in main ()
#10 0x42015967 in __libc_start_main () from /lib/i686/libc.so.6

The problem is finally a strlen(0x0) in skip_uri_schema():

/* Examine PATH as a potential URI, and return a substring of PATH
   that immediately follows the (scheme):// portion of the URI, or
   NULL if PATH doesn't appear to be a valid URI. The returned value
   is not alloced -- it shares memory with PATH. */
static const char *
skip_uri_schema (const char *path)
{
  apr_size_t j;
  apr_size_t len = strlen (path);

  /* ### Taking strlen() initially is inefficient. It's a holdover
     from svn_stringbuf_t days. */

but it starts in
wrap_svn_client_ls() which begins with:

  SVN_ERR (svn_client_url_from_path (&url, path_or_url, pool));
                                     ^^^^ this null.

and passes through:

svn_path_is_url (const char *path)
{
  /* ### This function is reaaaaaaaaaaaaaally stupid right now.
     We're just going to look for:

        (scheme)://(optional_stuff)

     Where (scheme) has no ':' or '/' characters.

     Someday it might be nice to have an actual URI parser here.
  */
  return skip_uri_schema (path) ? TRUE : FALSE;
}

Martin

--
Martin J. Evans
Easysoft Ltd, UK
Development
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri May 28 12:43:26 2004

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.