Hello Developers,
I did some debugging now and I think i found the reason for my problems.
The reason was that I did not pass a log_msg_func. The code in
repos_to_repos_copy in my opinion is wrong because the check for
SVN_CLIENT__HAS_LOG_MSG_FUNC executes code with side effects like
filling the table action_hash which leads to problems in my code.
I think such a side effect should not happen in this if-branch.
Additionally I tried to format my original post correctly.
Best Regards,
Michael Pfob
________________________________________
Von: Michael Pfob
Gesendet: Freitag, 4. Juli 2008 12:08
An: dev_at_subversion.tigris.org
Betreff: Possible access violation in svn_client_copy
Hello Subversion Developers,
I possibly found a bug in the implementation of the svn_client_copy method
that leads to an access violation in my application based on subversion.
I try to pass all the information needed for reproducing or finding this
bug. Due to the reason that I am new to open source projects,
please give me a hint if I was missing anything.
The problem occurs when I call svn_client_copy/svn_client_copy4 into
an existing directory. I did not have this problem using the 1.4.6
version of subversion, only since I am linking against 1.5.
I was not able to reproduce this access violation using the
svn commandline tool. For this reason I extracted the necessary
code and build a small tool that can produce this access
violation. The access violation can be seen in the following
stack trace:
-----------------------------------------------------------------
libsvn_client-1.dll!path_driver_cb_func(void * *
dir_baton=0x0012fcac, void * parent_baton=0x00da4650,
void * callback_baton=0x0012fd4c, const char * path=0x00d0f4b0,
apr_pool_t * pool=0x00dac648) Line 605 C
libsvn_delta-1.dll!svn_delta_path_driver(
const svn_delta_editor_t * editor=0x00d4b970, void * edit_baton=0x00d4e3b0,
long revision=2, apr_array_header_t * paths=0x0069b708,
svn_error_t * (void * *, void *, void *, const char *, apr_pool_t *)*
callback_func=0x10008700, void * callback_baton=0x0012fd4c,
apr_pool_t * pool=0x0069b648) Line 246 + 0x17 bytes C
libsvn_client-1.dll!repos_to_repos_copy(
svn_commit_info_t * * commit_info_p=0x0012fde8,
const apr_array_header_t * copy_pairs=0x0069b688, int make_parents=1,
const apr_hash_t * revprop_table=0x00000000, svn_client_ctx_t * ctx=0x00699030,
int is_move=0, apr_pool_t * pool=0x0069b648) Line 1033 + 0x27 bytes C
libsvn_client-1.dll!setup_copy(
svn_commit_info_t * * commit_info_p=0x0012fde8,
const apr_array_header_t * sources=0x0069b688,
const char * dst_path_in=0x00415644, int is_move=0, int force=1,
int make_parents=1, const apr_hash_t * revprop_table=0x00000000,
svn_client_ctx_t * ctx=0x00699030, apr_pool_t * pool=0x0069b648)
Line 1949 + 0x28 bytes C
libsvn_client-1.dll!svn_client_copy4(
svn_commit_info_t * * commit_info_p=0x0012feec,
apr_array_header_t * sources=0x006993f0, const char * dst_path=0x00415644,
int copy_as_child=0, int make_parents=1,
const apr_hash_t * revprop_table=0x00000000, svn_client_ctx_t * ctx=0x00699030,
apr_pool_t * pool=0x00698ff0) Line 1983 + 0x25 bytes C
svncrash.exe!main() Line 72 + 0x20 bytes C++
svncrash.exe!__tmainCRTStartup() Line 586 + 0x19 bytes C
svncrash.exe!mainCRTStartup() Line 403 C
> kernel32.dll!7c816fd7()
-------------------------------------------------------
To reproduce the problem, you need to compile the following source
code into the small test application (svncrash):
---------------------------------------------------------
// 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;
/// the same error occurs when svn_client_copy is called
/// 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;
}
------------------------------------------------
The error can be reproduced by following those steps:
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
I hope this information was enough. Otherwise please
ask me for more details.
Best regards
Michael Pfob
----------------------------------------------------
We software Automation.
3S-Smart Software Solutions GmbH
Michael Pfob
Product Development
Memminger Str. 151, 87439 Kempten / Germany
Phone +49-831-54031-0, Fax +49-831-54031-50
Email: m.pfob_at_3s-software.com
Web: http://www.3s-software.com
Visit the CoDeSys internet forum under http://forum-en.3s-software.com/ .
3S-Smart Software Solutions GmbH
Managing Director: Dipl.Inf.Dieter Hess, Dipl.Inf. Manfred Werner
Commercial Registry: Kempten HRB 6186
VAT No: DE 167014915
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-07-07 11:42:07 CEST