On Feb 27, 2009, at 12:05 AM, Joe Swatosh wrote:
> Author: joeswatosh
> Date: Thu Feb 26 22:05:28 2009
> New Revision: 36171
>
> Log:
> 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."
>
> Updated to follow djames recommendation to not create an unused
> temporary.
>
> * 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.
>
> Reviewed by: djames
> hwright
Heh. I don't recall actually reviewing this, just saying something
like "if you think it improves the state of the world, it can't hurt."
>
>
> Modified:
> trunk/subversion/bindings/swig/include/svn_types.swg
> trunk/subversion/bindings/swig/ruby/svn/delta.rb
> trunk/subversion/bindings/swig/ruby/test/test_delta.rb
>
> Modified: trunk/subversion/bindings/swig/include/svn_types.swg
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/include/svn_types.swg?pathrev=36171&r1=36170&r2=36171
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/subversion/bindings/swig/include/svn_types.swg Thu Feb 26
> 14:50:13 2009 (r36170)
> +++ trunk/subversion/bindings/swig/include/svn_types.swg Thu Feb 26
> 22:05:28 2009 (r36171)
> @@ -1060,11 +1060,12 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
> %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 = NULL;";
> #endif
>
> #ifdef SWIGPYTHON
>
> Modified: trunk/subversion/bindings/swig/ruby/svn/delta.rb
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/ruby/svn/delta.rb?pathrev=36171&r1=36170&r2=36171
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/subversion/bindings/swig/ruby/svn/delta.rb Thu Feb 26
> 14:50:13 2009 (r36170)
> +++ trunk/subversion/bindings/swig/ruby/svn/delta.rb Thu Feb 26
> 22:05:28 2009 (r36171)
> @@ -52,9 +52,9 @@ module Svn
>
> 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)
>
> Modified: trunk/subversion/bindings/swig/ruby/test/test_delta.rb
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/ruby/test/test_delta.rb?pathrev=36171&r1=36170&r2=36171
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/subversion/bindings/swig/ruby/test/test_delta.rb Thu Feb
> 26 14:50:13 2009 (r36170)
> +++ trunk/subversion/bindings/swig/ruby/test/test_delta.rb Thu Feb
> 26 22:05:28 2009 (r36171)
> @@ -125,17 +125,17 @@ class SvnDeltaTest < Test::Unit::TestCas
> 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)
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1236901
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1239288
Received on 2009-02-27 15:58:30 CET