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

Re: SEGFAULTs with Python bindings and generators

From: Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>
Date: Wed, 30 Sep 2020 04:59:32 +0900

On 2020/09/29 22:35, C. Michael Pilato wrote:
> Sorry for the self-reply, but I thought I'd note that if I tweak
> pysvnget thusly, the SEGFAULTs stop:
>
> --- pysvnget 2020-09-29 09:34:07.918002584 -0400
>> +++ pysvnget.pools 2020-09-29 09:33:54.278153037 -0400
>> @@ -21,17 +21,17 @@
>> yield chunk
>> svn.core.svn_stream_close(self.stream)
>>
>> -def get_generator(repos_path, peg_revision, path):
>> - fs = svn.repos.fs(svn.repos.open(repos_path))
>> +def get_generator(repos_path, peg_revision, path, pool):
>> + fs = svn.repos.fs(svn.repos.open(repos_path, pool))

The pool used by fs comes from temporary svn_repos_t *repos object.
However, svn.repos.fs wrapper function doesn't have a special
treatment about it in current implementation, so it is nothing
to do with the pool.

If you don't want to use a pool explicitly, you need to keep the
svn_repos_t wrapper object created by svn.repos.open() while
fs object exists, like this.

[[[
--- pysvnget.orig 2020-09-29 22:00:40.000000000 +0900
+++ pysvnget 2020-09-30 04:41:33.419721000 +0900
@@ -22,7 +22,9 @@
       svn.core.svn_stream_close(self.stream)
 
 def get_generator(repos_path, peg_revision, path):
- fs = svn.repos.fs(svn.repos.open(repos_path))
+ repos = svn.repos.open(repos_path)
+ fs = svn.repos.fs(repos)
+ fs.repos = repos
     peg_revision = peg_revision or svn.fs.youngest_rev(fs)
     fsroot = svn.fs.revision_root(fs, peg_revision)
     return SvnContentProxy(fsroot, path).get_generator()
]]]

Cheers,

-- 
Yasuhito FUTATSUKI <futatuki_at_yf.bsclub.org>
Received on 2020-09-29 22:01:29 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.