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

Re: Segfault in ruby tests

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: Tue, 24 Feb 2009 16:34:50 -0600

On Feb 18, 2009, at 3:39 PM, Joe Swatosh wrote:

> On Wed, Feb 18, 2009 at 12:41 PM, Joe Swatosh
> <joe.swatosh_at_gmail.com> wrote:
>> On Wed, Feb 18, 2009 at 12:35 PM, Joe Swatosh
>> <joe.swatosh_at_gmail.com> wrote:
>>
>>
>>>
>>> I have 3 ideas:
>>>
>>> 1) Follow the precedent of the Python bindings and just remove the
>>> digest.
>
> Delete bad ideas 2 and 3....
>
>>>
>>> I'm thinking 1 is quickest and has a precedent. 2 and 3 might be
>>> over my head.
>>>
>>
>
> Hyrum,
>
> This passes locally, but of course it was passing locally without it.
> Could you please give it a try to see if it helps?

The only place I see this particular failure is the buildbot. I can't
even reproduce it locally on the same box, using the same setup as the
buildbot. I've applied the patch locally, but get the same no-failure
result as I do without the patch. Funny business indeed.

That being said, if you think this patch improve the state of the
world, I see no reason it shouldn't be committed.

Also, there are currently *two* binding failures on the buildbot, one
of which is the mystery failure, and another which is quite
reproducible:

Started
..............................................................E
............................................................................................................................................................
Finished in 525.856881 seconds.

   1) Error:
test_status_with_depth(SvnClientTest):
Svn::Error::WcNotLocked:
subversion/libsvn_wc/lock.c:910: Svn::Error::WcNotLocked: Unable to
lock 'wc-tmp/wc/A/B'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/svn/util.rb:
86:in `svn_client_status3'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/svn/util.rb:
86:in `status3'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/svn/
client.rb:176:in `status'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/test/
test_client.rb:469:in `test_status_with_depth'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/test/
test_client.rb:468:in `each'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/test/
test_client.rb:468:in `test_status_with_depth'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/test/util.rb:
181:in `make_context'
/home/hwright/dev/svn-trunk/subversion/bindings/swig/ruby/test/
test_client.rb:463:in `test_status_with_depth'

> [[[
>
> Fix failing Ruby bindings test in the spirit of the fix for Python
> in r21423:
> "Fix segfault in Python tests by deleting the broken argout typemap
> for the
> 'result_digest' parameter in svn_txdelta_apply. Instead, ignore the
> parameter
> altogether."
>
> * subversion/bindings/swig/include/svn_types.swg
> (result_digest): Remove typemap for Ruby. Instead, ignore
> the parameter.
>
> * subversion/bindings/swig/ruby/svn/delta.rb
> (Svn::Delta.apply): Don't expect a digest to be returned by
> Svn::Delta.txdelta_apply_wrapper and don't return it.
>
> * subversion/bindings/swig/ruby/test/test_delta.rb
> (SvnDeltaTest#test_apply): Don't expect a digest returned with the
> handler
> from Svn::Delta.apply.
>
> ]]]
>
>
> Index: subversion/bindings/swig/ruby/test/test_delta.rb
> ===================================================================
> --- subversion/bindings/swig/ruby/test/test_delta.rb (revision 35962)
> +++ subversion/bindings/swig/ruby/test/test_delta.rb (working copy)
> @@ -125,17 +125,17 @@
> apply_source = StringIO.new(source_text)
> apply_result = StringIO.new("")
>
> - handler, digest = Svn::Delta.apply(apply_source, apply_result)
> + handler = Svn::Delta.apply(apply_source, apply_result)
> handler.send(stream)
> apply_result.rewind
> assert_equal(target_text, apply_result.read)
>
> - handler, digest = Svn::Delta.apply(apply_source, apply_result)
> + handler = Svn::Delta.apply(apply_source, apply_result)
> handler.send(target_text)
> apply_result.rewind
> assert_equal(target_text * 2, apply_result.read)
>
> - handler, digest = Svn::Delta.apply(apply_source, apply_result)
> + handler = Svn::Delta.apply(apply_source, apply_result)
> handler.send(StringIO.new(target_text))
> apply_result.rewind
> assert_equal(target_text * 3, apply_result.read)
> Index: subversion/bindings/swig/ruby/svn/delta.rb
> ===================================================================
> --- subversion/bindings/swig/ruby/svn/delta.rb (revision 35962)
> +++ subversion/bindings/swig/ruby/svn/delta.rb (working copy)
> @@ -52,9 +52,9 @@
>
> def apply(source, target, error_info=nil)
> result = Delta.txdelta_apply_wrapper(source, target, error_info)
> - digest, handler, handler_baton = result
> + handler, handler_baton = result
> handler.baton = handler_baton
> - [handler, digest]
> + handler
> end
>
> def parse_svndiff(error_on_early_close=true, &handler)
> Index: subversion/bindings/swig/include/svn_types.swg
> ===================================================================
> --- subversion/bindings/swig/include/svn_types.swg (revision 35962)
> +++ subversion/bindings/swig/include/svn_types.swg (working copy)
> @@ -1060,11 +1060,12 @@
> %apply unsigned char digest[ANY] { unsigned char *digest };
>
> #ifdef SWIGRUBY
> -/* FIXME: This typemap doesn't work, because svn_txdelta_apply saves
> - * away this local pointer to be used later. When the pointer
> - * is finally used, we get memory corruption / segfaults.
> +/*
> + * Skip the md5sum
> + * FIXME: Wrap the md5sum
> */
> -%apply unsigned char digest[ANY] { unsigned char *result_digest };
> +%typemap(in, numinputs=0) unsigned char *result_digest
> + ($*1_type temp[APR_MD5_DIGESTSIZE]) "$1 = NULL;";
> #endif
>
> #ifdef SWIGPYTHON
> <ruby-segfault.patch>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1223031
Received on 2009-02-24 23:35:17 CET

This is an archived mail posted to the Subversion Dev mailing list.