Thanks for the reply.  And I see what you're trying to do there, but in
practice it doesn't seem to work.  The swig proxy object doesn't allow
arbitrary attribute creation:

AttributeError: You cannot add instance attributes to <libsvn.fs.svn_fs_t;
> proxy of <Swig Object of type 'svn_fs_t *' at 0x7f83bd4be420> >


I tried to work around this using this construct:

-    fs.repos = repos
> +    fs.__dict__['repos'] = repos


...and that avoids the AttributeError, but alas the code still SEGFAULTs.
I'm attaching a(n edited for readability) log from a gdb session.

-- Mike

On Tue, Sep 29, 2020 at 4:01 PM Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>
wrote:

> 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 <futat...@yf.bsclub.org>
>
gracelyn:~/tests/pysvnget $ gdb python3

(gdb) run pysvnget test-repos file.txt
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6cad8d3 in svn_fs_fs__is_packed_rev (fs=0x7ffff7411050, rev=13) at 
subversion/libsvn_fs_fs/util.c:43
43        return (rev < ffd->min_unpacked_rev);

(gdb) info locals
ffd = 0x0

(gdb) bt
#0  0x00007ffff6cad8d3 in svn_fs_fs__is_packed_rev (fs=0x7ffff7411050, rev=13) 
at subversion/libsvn_fs_fs/util.c:43
#1  0x00007ffff6c8cee1 in open_pack_or_rev_file (file=0x7ffff63e5168, 
fs=0x7ffff7411050, rev=13, writable=0, result_pool=0x7ffff63d0028, 
    scratch_pool=0x7ffff63d0028) at subversion/libsvn_fs_fs/rev_file.c:161
#2  0x00007ffff6c8d0de in svn_fs_fs__open_pack_or_rev_file 
(file=0x7fffffffd2b8, fs=0x7ffff7411050, rev=13, result_pool=0x7ffff63d0028, 
    scratch_pool=0x7ffff63d0028) at subversion/libsvn_fs_fs/rev_file.c:212
#3  0x00007ffff6c5b45a in open_and_seek_revision (file=0x7ffff63e5148, 
fs=0x7ffff7411050, rev=13, item=0, pool=0x7ffff63d0028)
    at subversion/libsvn_fs_fs/cached_data.c:226
#4  0x00007ffff6c5b6e8 in open_and_seek_representation (file_p=0x7ffff63e5148, 
fs=0x7ffff7411050, rep=0x7fffffffd520, pool=0x7ffff63d0028)
    at subversion/libsvn_fs_fs/cached_data.c:267
#5  0x00007ffff6c5d095 in create_rep_state_body (rep_state=0x7fffffffd4e8, 
rep_header=0x7fffffffd4f0, shared_file=0x7fffffffd4f8, rep=0x7fffffffd520, 
    fs=0x7ffff7411050, result_pool=0x7ffff63d0028, scratch_pool=0x7ffff63e2028) 
at subversion/libsvn_fs_fs/cached_data.c:938
#6  0x00007ffff6c5d396 in create_rep_state (rep_state=0x7fffffffd4e8, 
rep_header=0x7fffffffd4f0, shared_file=0x7fffffffd4f8, rep=0x7fffffffd520, 
    fs=0x7ffff7411050, result_pool=0x7ffff63d0028, scratch_pool=0x7ffff63e2028) 
at subversion/libsvn_fs_fs/cached_data.c:997
#7  0x00007ffff6c5e1dc in build_rep_list (list=0x7ffff63e0678, 
window_p=0x7ffff63e0670, src_state=0x7ffff63e0680, fs=0x7ffff7411050, 
first_rep=0x7ffff63e0600, 
    pool=0x7ffff63d0028) at subversion/libsvn_fs_fs/cached_data.c:1461
#8  0x00007ffff6c5fe10 in rep_read_contents (baton=0x7ffff63e05f8, buf=0xaea900 
"", len=0x7fffffffd6f8) at subversion/libsvn_fs_fs/cached_data.c:2133
#9  0x00007ffff71e9622 in svn_stream_read_full (stream=0x7ffff63e0780, 
buffer=0xaea900 "", len=0x7fffffffd6f8) at subversion/libsvn_subr/stream.c:194
#10 0x00007ffff7116ad8 in svn_stream_read (stream=0x7ffff63e0780, 
buffer=0xaea900 "", len=0x7fffffffd6f8) at 
subversion/libsvn_subr/deprecated.c:1525
#11 0x00007ffff72b44a3 in _wrap_svn_stream_read (self=0x7ffff736f4a0, 
args=0x7ffff747cd80) at subversion/bindings/swig/python/core.c:31244
#12 0x00000000005f188a in PyCFunction_Call ()
#13 0x00000000005f2406 in _PyObject_MakeTpCall ()
#14 0x000000000056cb23 in _PyEval_EvalFrameDefault ()
#15 0x00000000005f1b8b in _PyFunction_Vectorcall ()
#16 0x000000000056c475 in _PyEval_EvalFrameDefault ()
#17 0x00000000004fd5b3 in ?? ()
#18 0x000000000050f8d8 in PySequence_List ()
#19 0x000000000050fc4e in PySequence_Fast ()
#20 0x00000000006ac15a in ?? ()
#21 0x0000000000500e06 in ?? ()
#22 0x00000000005677c7 in _PyEval_EvalFrameDefault ()
#23 0x0000000000565972 in _PyEval_EvalCodeWithName ()
#24 0x0000000000686053 in PyEval_EvalCode ()
#25 0x00000000006753d1 in ?? ()
#26 0x000000000067544f in ?? ()
#27 0x0000000000675507 in PyRun_FileExFlags ()
#28 0x000000000067758a in PyRun_SimpleFileExFlags ()
#29 0x00000000006ae99e in Py_RunMain ()
#30 0x00000000006aed29 in Py_BytesMain ()
#31 0x00007ffff7ddf0b3 in __libc_start_main (main=0x4ebd20 <main>, argc=4, 
argv=0x7fffffffe428, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffe418) at 
../csu/libc-start.c:308
#32 0x00000000005f62ee in _start ()
(gdb) 

Reply via email to