[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: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: Wed, 18 Feb 2009 13:39:50 -0800

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?

--
Joe
[[[
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
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1188225

Received on 2009-02-18 22:40:08 CET

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.