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

[PATCH] Fwd: fix another ruby test failure

From: Peter Samuelson <peter_at_p12n.org>
Date: 2006-09-18 15:51:26 CEST

Roman Zippel <zippel@linux-m68k.org> sent us a patch for the following
ruby test failure:

   1) Error:
 test_apply(SvnDeltaTest):
 ArgumentError: NULL pointer given

He explains:

> The basic problem is that in
> svn_delta.c:_wrap_svn_txdelta_apply_wrapper() the value of temp3 is
> not modified by svn_txdelta_apply_wrapper(), so the return is
> basically random. In this case the stack is clear and
> svn_md5_digest_to_cstring() returns a NULL, which rb_str_new2()
> doesn't like.
>
> The easiest fix is to change the typemap in svn_types.swg so it can
> deal with the NULL pointer. (BTW I tried returning Qnil here, but
> that doesn't work well output_helper.)

[[[
* subversion/bindings/swig/include/svn_types.swg
  (typemap unsigned char digest[], **digest):
  Tolerate NULL pointer return from svn_md5_digest_to_cstring().

Patch by: Roman Zippel <zippel@linux-m68k.org>
]]]

Index: subversion/bindings/swig/include/svn_types.swg
--- subversion/bindings/swig/include/svn_types.swg
+++ subversion/bindings/swig/include/svn_types.swg
@@ -542,7 +542,7 @@
 %typemap(ruby, argout, fragment="output_helper") unsigned char digest[ANY]
 {
   char *digest_string = (char *)svn_md5_digest_to_cstring($1, _global_pool);
- $result = output_helper($result, rb_str_new2(digest_string));
+ $result = output_helper($result, rb_str_new2(digest_string ? digest_string : ""));
 }
 
 
@@ -554,7 +554,7 @@
 %typemap(ruby, argout, fragment="output_helper") unsigned char **digest
 {
   char *digest_string = (char *)svn_md5_digest_to_cstring(*$1, _global_pool);
- $result = output_helper($result, rb_str_new2(digest_string));
+ $result = output_helper($result, rb_str_new2(digest_string ? digest_string : ""));
 }
 
 /* svn_md5_* functions takes const ones as input */

Received on Mon Sep 18 15:51:41 2006

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.