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

Possible access violation in svn_client_copy

From: Michael Pfob <m.pfob_at_3s-software.com>
Date: Fri, 4 Jul 2008 11:56:55 +0200

Hello Subversion Developers,

 

I'm pretty new to the development of an opensource project and for this reason, I hope I give you the correct needed information for the bug I found. If some information is missing, please ask for this information.

I have a project that is based on the subversion libraries running in windows. This project worked correctly with the version 1.4.6 of subversion. Yesterday I did an update to subversion 1.5. After this update I realized that my existing call to svn_client_copy results in an access violation when a parent directory of the copy destination already exists. I was not successful in reproducing this bug with the commandline tool, so maybe some of the parameters I pass to this function are not valid but they worked using svn 1.4.6.

The mentioned access violation results in the following stacktrace:

 

 

 

To reproduce the error, you need to execute the following steps (mentioned in a windows batch file style):

{

REM Assumption: We are in D:\temp

@ECHO create repository

svnadmin create rep

@ECHO create two directories

svn mkdir -m "" file:///D:/temp/rep/dest

svn mkdir -m "" file:///D:/temp/rep/src

@ECHO crash the tool

svncrash

}

 

The tool svncrash can be built using the following source code:

 

// svncrash.cpp : Defines the entry point for the console application.

//

 

#include <svn_client.h>

#include <svn_pools.h>

#include <svn_utf.h>

#include <svn_path.h>

 

// TODO: adapt the path to the extracted repository

#define REPOSITORYPATHPREFIX "file:///d:/temp/rep/"

 

 

 

 

svn_error_t* SimplePrompt(svn_auth_cred_simple_t **cred, void *baton, const char *realm, const char *username, svn_boolean_t may_save, apr_pool_t* pool)

{

      svn_auth_cred_simple_t *ret = (svn_auth_cred_simple_t *)apr_pcalloc (pool, sizeof (*ret));

      ret->username = "test";

      ret->password = "test";

      *cred = ret;

      return SVN_NO_ERROR;

}

 

svn_error_t* UserPrompt(svn_auth_cred_username_t **cred,void *baton,const char *realm,svn_boolean_t may_save,apr_pool_t *pool)

{

      svn_auth_cred_username_t *ret = (svn_auth_cred_username_t *)apr_pcalloc (pool, sizeof (*ret));

      ret->username = "test";

      *cred = ret;

      return SVN_NO_ERROR;

}

 

const char* PstrDupPathEncode(const char* psz, apr_pool_t* pool)

{

      const char* c;

      svn_utf_cstring_to_utf8(&c, psz, pool);

      return svn_path_uri_encode(c, pool);

}

 

int main()

{

      apr_initialize();

 

      apr_pool_t* pPool = svn_pool_create_ex(NULL, NULL);

      svn_client_ctx_t *ctx = NULL;

      svn_client_create_context(&ctx, pPool);

      svn_auth_baton_t *auth_baton;

      svn_auth_provider_object_t *provider;

 

      apr_array_header_t *providers = apr_array_make(pPool, 1, sizeof (svn_auth_provider_object_t *));

      svn_client_get_simple_prompt_provider (&provider, SimplePrompt, NULL, 1, pPool);

      APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider;

      svn_client_get_username_prompt_provider (&provider, UserPrompt, NULL, 1, pPool);

      APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider;

 

      svn_auth_open (&auth_baton, providers, pPool);

      ctx->auth_baton = auth_baton;

      ctx->notify_func2 = NULL;

      ctx->notify_baton2 = NULL;

 

      svn_client_copy_source_t source;

      source.path = PstrDupPathEncode(REPOSITORYPATHPREFIX "src", pPool);

      svn_opt_revision_t rev;

      rev.kind = svn_opt_revision_head;

      source.revision = &rev;

      source.peg_revision = &rev;

 

      apr_array_header_t *sources = apr_array_make(pPool, 1, sizeof(svn_client_copy_source_t*));

      APR_ARRAY_PUSH(sources, svn_client_copy_source_t*) = &source;

 

      svn_commit_info_t *commit_info = NULL;

      /// This line will provoce a crash if the parent directory exists

      svn_error_t* pError = svn_client_copy4(&commit_info, sources, REPOSITORYPATHPREFIX "dest/src/def", false, true, NULL, ctx, pPool);

 

      svn_pool_destroy(pPool);

      apr_terminate();

      return 0;

}

 

I hope this information is enough to reproduce this error:

 

 

Mit freundlichen Grüßen

Michael Pfob

----------------------------------------------------
We software Automation.

3S-Smart Software Solutions GmbH
Michael Pfob
Produktentwicklung
Memminger Str. 151, DE-87439 Kempten
Fon +49-831-54031-0, Fax +49-831-54031-50

Email: m.pfob_at_3s-software.com <mailto:m.pfob_at_3s-software.com>
Web: http://www.3s-software.com <http://www.3s-software.com/>

Besuchen Sie das CoDeSys Internet-Forum unter http://forum.3s-software.com/ <http://forum.3s-software.com/> .

3S-Smart Software Solutions GmbH
Geschäftsführer: Dipl.Inf.Dieter Hess, Dipl.Inf. Manfred Werner
Handelsregister: Kempten HRB 6186
USt-IDNr. DE 167014915

 

 
Received on 2008-07-04 17:43:17 CEST

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.