[DRE-maint] Unblock or t-p-u upload for libxml-ruby

Michael Schutte michi at uiae.at
Thu Sep 4 13:17:29 UTC 2008


Hey,

The revision of libxml-ruby currently in unstable fixes an important
bug.  The boring changelog:

| libxml-ruby (0.8.3-1) unstable; urgency=low
|
|   * New upstream version (closes: #485738).

The changes are big, but this version has been in the archive for a
month and now new bugs have been filed since then.

Still, because I assume that you do not want to let new upstream
releases in at this point, I attach the debdiff for a possible t-p-u
upload backporting the required fix.

Please let me know which way you prefer.

Best regards,
-- 
Michael Schutte <michi at uiae.at>
-------------- next part --------------
diff -u libxml-ruby-0.5.2.0/debian/control libxml-ruby-0.5.2.0/debian/control
--- libxml-ruby-0.5.2.0/debian/control
+++ libxml-ruby-0.5.2.0/debian/control
@@ -2,9 +2,9 @@
 Section: libs
 Priority: optional
 Maintainer: Filipe Lautert <filipe at icewall.org>
-Uploaders: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>, Paul van Tilburg <paulvt at debian.org>
+Uploaders: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>, Paul van Tilburg <paulvt at debian.org>, Michael Schutte <m.schutte.jr at gmail.com>
 Build-Depends: debhelper (>> 4.1.0), cdbs, ruby-pkg-tools (>= 0.8), ruby, ruby1.8-dev, libxml2-dev, libxslt1-dev, zlib1g-dev
-Standards-Version: 3.7.3
+Standards-Version: 3.8.0
 XS-Dm-Upload-Allowed: yes
 Homepage: http://libxml.rubyforge.org/
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-ruby-extras/packages/libxml-ruby/
diff -u libxml-ruby-0.5.2.0/debian/changelog libxml-ruby-0.5.2.0/debian/changelog
--- libxml-ruby-0.5.2.0/debian/changelog
+++ libxml-ruby-0.5.2.0/debian/changelog
@@ -1,3 +1,12 @@
+libxml-ruby (0.5.2.0-3+lenny1) testing-proposed-updates; urgency=low
+
+  * Backport a patch from upstream SVN (r319) to fix an ?object allocation
+    during GC phase? bug, closes: #485738.
+  * Bump Standards-Version to 3.8.0 (no changes needed).
+  * Add myself to Uploaders.
+
+ -- Michael Schutte <m.schutte.jr at gmail.com>  Thu, 04 Sep 2008 14:50:51 +0200
+
 libxml-ruby (0.5.2.0-3) unstable; urgency=low
 
   * Set section to "libs" instead of "interpreters". This is a library.
only in patch2:
unchanged:
--- libxml-ruby-0.5.2.0.orig/debian/patches/10-object_allocation_in_gc_phase.diff
+++ libxml-ruby-0.5.2.0/debian/patches/10-object_allocation_in_gc_phase.diff
@@ -0,0 +1,377 @@
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_document.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_document.c	2007-09-28 19:13:58.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_document.c	2008-09-04 14:22:48.000000000 +0200
+@@ -438,7 +438,7 @@
+ ruby_xml_document_mark(ruby_xml_document_t *rxd) {
+   // will mark parsers and source types
+   // I do not thing doc->parent has anything useful in it.
+-  ruby_xml_state_marker();
++  rb_gc_mark(LIBXML_STATE);
+ }
+ 
+ /*
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_ns.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_ns.c	2007-08-29 19:30:11.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_ns.c	2008-09-04 14:22:48.000000000 +0200
+@@ -55,7 +55,8 @@
+ static void
+ ruby_xml_ns_mark(ruby_xml_ns *rxns) {
+   if (rxns == NULL) return;
+-  if (!NIL_P(rxns->xd)) rb_gc_mark(rxns->xd);
++  if (!NIL_P(rxns->xd))
++    rb_gc_mark(rxns->xd);
+ }
+ 
+ 
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_html_parser.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_html_parser.c	2007-09-26 17:04:48.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_html_parser.c	2008-09-04 14:22:48.000000000 +0200
+@@ -63,7 +63,7 @@
+     return(Qnil);
+   }
+ 
+-  rxp->ctxt = ruby_xml_parser_context_new3();
++  rxp->ctxt = ruby_xml_parser_context_new();
+   data = (rx_file_data *)rxp->data;
+   data->filename = filename;
+ 
+@@ -159,7 +159,7 @@
+     return(Qnil);
+   }
+ 
+-  rxp->ctxt = ruby_xml_parser_context_new3();
++  rxp->ctxt = ruby_xml_parser_context_new();
+   data = (rx_io_data *)rxp->data;
+   data->io = io;
+ 
+@@ -181,9 +181,10 @@
+ void
+ ruby_xml_html_parser_mark(ruby_xml_html_parser *rxp) {
+   if (rxp == NULL) return;
+-  if (!NIL_P(rxp->ctxt)) rb_gc_mark(rxp->ctxt);
++  if (!NIL_P(rxp->ctxt))
++    rb_gc_mark(rxp->ctxt);
+ 
+-  ruby_xml_state_marker();
++  rb_gc_mark(LIBXML_STATE);
+ 
+   switch(rxp->data_type) {
+   case RUBY_LIBXML_SRC_TYPE_NULL:
+@@ -411,7 +412,7 @@
+     return(Qnil);
+   }
+ 
+-  rxp->ctxt = ruby_xml_parser_context_new3();
++  rxp->ctxt = ruby_xml_parser_context_new();
+   data = (rx_string_data *)rxp->data;
+   data->str = str;
+ 
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_parser.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_parser.c	2007-10-10 13:07:13.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_parser.c	2008-09-04 14:22:48.000000000 +0200
+@@ -779,7 +779,7 @@
+     return(Qnil);
+   }
+ 
+-  rxp->ctxt = ruby_xml_parser_context_new3();
++  rxp->ctxt = ruby_xml_parser_context_new();
+   data = (rx_file_data *)rxp->data;
+   data->filename = filename;
+ 
+@@ -910,7 +910,7 @@
+     return(Qnil);
+   }
+ 
+-  rxp->ctxt = ruby_xml_parser_context_new3();
++  rxp->ctxt = ruby_xml_parser_context_new();
+   data = (rx_io_data *)rxp->data;
+   data->io = io;
+ 
+@@ -932,9 +932,10 @@
+ void
+ ruby_xml_parser_mark(ruby_xml_parser *rxp) {
+   if (rxp == NULL) return;
+-  if (!NIL_P(rxp->ctxt)) rb_gc_mark(rxp->ctxt);
++  if (!NIL_P(rxp->ctxt))
++    rb_gc_mark(rxp->ctxt);
+ 
+-  ruby_xml_state_marker();
++  rb_gc_mark(LIBXML_STATE);
+ 
+   switch(rxp->data_type) {
+   case RUBY_LIBXML_SRC_TYPE_NULL:
+@@ -1208,7 +1209,7 @@
+     return(Qnil);
+   }
+ 
+-  rxp->ctxt = ruby_xml_parser_context_new3();
++  rxp->ctxt = ruby_xml_parser_context_new();
+   data = (rx_string_data *)rxp->data;
+   data->str = str;
+ 
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_state.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_state.c	2007-10-10 13:07:13.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_state.c	2008-09-04 14:30:56.000000000 +0200
+@@ -3,96 +3,28 @@
+ #include "libxml.h"
+ 
+ VALUE cXMLState;
+-static VALUE weak_holder;
+-static int id_inst;
++VALUE LIBXML_STATE = Qnil;
+ 
+-ID id_state;
+-
+-#undef DEBUG
++static int dummy;
+ 
+ void
+-ruby_xml_state_free(int * dummy) {
+-  if ( dummy==NULL ) return;
++ruby_xml_state_free(int dummy) {
+   xmlCleanupParser();
+-  free(dummy);
+-  dummy=NULL;
+-  weak_holder=Qnil;
+-  rb_ivar_set(cXMLState,id_state,Qnil);
+-}
+-
+-void
+-ruby_xml_state_mark(void * a) {
+-#ifdef DEBUG
+-  fprintf(stderr,"marked 0x%x\n",NUM2INT(rb_ivar_get(cXMLState,id_state)));
+-#endif
+-}
+-
+-VALUE
+-ruby_xml_state_object() {
+-  VALUE obj,id;
+-  int *dummy;
+-
+-  id=rb_ivar_get(cXMLState,id_state);
+-  if (NIL_P(id)) {
+-    obj = Data_Make_Struct(cXMLState, int,
+-			   ruby_xml_state_mark,
+-			   ruby_xml_state_free,
+-			   dummy);
+-    rb_ivar_set(cXMLState,id_state,id=rb_obj_id(obj));
+-    *dummy=0;
+-    weak_holder=obj;
+-    return obj;
+-  }
+-
+-#ifdef DEBUG
+-  fprintf(stderr,"getting 0x%x\n",NUM2INT(id));
+-#endif
+-  return weak_holder;
+-
+-  return rb_funcall(rb_const_get(rb_cModule,rb_intern("ObjectSpace")),
+-		    rb_intern("_id2ref"),
+-		    1,
+-		    id);
++  LIBXML_STATE = Qnil;
+ }
+ 
+ VALUE
+-ruby_xml_state_object_find_aux(VALUE id) {
+-  rb_funcall(rb_const_get(rb_cModule,rb_intern("ObjectSpace")),
+-	     rb_intern("_id2ref"),
+-	     1,
+-	     id);
+-}
+-
+-
+-static VALUE
+-find_failed() {
+-  return Qnil;
+-}
+-
+-VALUE
+-ruby_xml_state_object_find(VALUE id) {
+-  return rb_rescue(ruby_xml_state_object_find_aux, id, find_failed, 0);
+-}
+-/*
+- * This will establish a use and mark it or mark an existing use.
+- * should be called by parser.mark and document.mark
+- */
+-void
+-ruby_xml_state_marker(void) {
+-  ruby_xml_state_object();
+-  rb_gc_mark(weak_holder);
+-}
+-
+-VALUE
+-ruby_xml_state_used_p(VALUE klass)
+-{
+-  return rb_ivar_get(cXMLState,id_state);
+-}
+-
+-VALUE
+-ruby_xml_state_use(VALUE klass)
+-{
+-  return ruby_xml_state_object();
++ruby_xml_state_alloc() {
++  #ifdef DEBUG
++  fprintf(stderr, "Allocating state");
++  #endif
++  
++  xmlInitParser();
++  
++  return Data_Make_Struct(cXMLState, int,
++			  NULL,
++			  ruby_xml_state_free,
++			  dummy);
+ }
+ 
+ // Rdoc needs to know 
+@@ -103,12 +35,20 @@
+ 
+ void
+ ruby_init_state(void) {	
++  VALUE rb_mSingleton;
+   cXMLState = rb_define_class_under(mXML, "State", rb_cObject);
+-
+-  rb_define_singleton_method(cXMLState, "used?",
+-			     ruby_xml_state_used_p, 0);
+-  rb_define_singleton_method(cXMLState, "use",
+-			     ruby_xml_state_use, 0);
+-
+-  rb_ivar_set(cXMLState, id_state=rb_intern("@stateid"), Qnil);
++  
++  /* Mixin singleton so only one xml state object can be created. */
++  rb_require("singleton");
++  rb_mSingleton = rb_const_get(rb_cObject, rb_intern("Singleton"));
++  rb_include_module(cXMLState, rb_mSingleton);
++
++  rb_define_alloc_func(cXMLState, ruby_xml_state_alloc);
++
++  /* Create one instance of the state object that is used
++     to initalize and cleanup libxml. Then register it with
++     the garbage collector so its not freed until the process
++     exists.*/
++  LIBXML_STATE = rb_class_new_instance(0, NULL, cXMLState);
++  rb_global_variable(&LIBXML_STATE);
+ }
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_state.h
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_state.h	2007-09-25 21:14:10.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_state.h	2008-09-04 14:31:27.000000000 +0200
+@@ -4,8 +4,6 @@
+ #define __RUBY_XML_STATE__
+ 
+ extern VALUE cXMLState;
+-
+-void ruby_xml_state_marker(void);
+-VALUE ruby_xml_state_object_find(VALUE id);
++extern VALUE LIBXML_STATE;
+ 
+ #endif
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_parser_context.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_parser_context.c	2007-09-26 17:04:48.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_parser_context.c	2008-09-04 14:36:40.000000000 +0200
+@@ -148,11 +148,6 @@
+   free(rxpc);
+ }
+ 
+-void
+-ruby_xml_parser_context_mark(void *v) {
+-  if ( v == NULL ) return;
+-  ruby_xml_state_marker();
+-}
+ 
+ /*
+  * call-seq:
+@@ -367,31 +362,15 @@
+ 
+ 
+ VALUE
+-ruby_xml_parser_context_new(VALUE class, xmlParserCtxtPtr ctxt) {
+-  ruby_xml_parser_context *rxpc;
+-
+-  rxpc = ALLOC(ruby_xml_parser_context);
+-
+-  rxpc->ctxt = ctxt;
+-  return Data_Wrap_Struct(class,
+-			  ruby_xml_parser_context_mark,
++ruby_xml_parser_context_new() {
++  ruby_xml_parser_context *rxpc = ALLOC(ruby_xml_parser_context);
++  return Data_Wrap_Struct(cXMLParserContext,
++			  NULL,
+ 			  ruby_xml_parser_context_free,
+ 			  rxpc);
+ }
+ 
+ 
+-VALUE
+-ruby_xml_parser_context_new2(VALUE class) {
+-  return(ruby_xml_parser_context_new(class, NULL));
+-}
+-
+-
+-VALUE
+-ruby_xml_parser_context_new3() {
+-  return(ruby_xml_parser_context_new2(cXMLParserContext));
+-}
+-
+-
+ /*
+  * call-seq:
+  *    context.replace_entities? => (true|false)
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_node_set.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_node_set.c	2007-10-10 13:07:13.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_node_set.c	2008-09-04 14:22:48.000000000 +0200
+@@ -96,7 +96,8 @@
+ 
+ static void
+ ruby_xml_node_set_mark(ruby_xml_node_set *rxnset) {
+-  if (!NIL_P(rxnset->rxpop)) rb_gc_mark(rxnset->rxpop);
++  if (!NIL_P(rxnset->rxpop))
++    rb_gc_mark(rxnset->rxpop);
+ }
+ 
+ static void
+Index: libxml-ruby-0.5.2.0/ext/xml/ruby_xml_parser_context.h
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/ruby_xml_parser_context.h	2007-08-29 19:35:27.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/ruby_xml_parser_context.h	2008-09-04 14:22:48.000000000 +0200
+@@ -14,9 +14,7 @@
+ 
+ void ruby_xml_parser_context_free(ruby_xml_parser_context *ctxt);
+ void ruby_init_xml_parser_context(void);
+-VALUE ruby_xml_parser_context_new(VALUE class, xmlParserCtxtPtr ctxt);
+-VALUE ruby_xml_parser_context_new2(VALUE class);
+-VALUE ruby_xml_parser_context_new3();
++VALUE ruby_xml_parser_context_new();
+ VALUE ruby_xml_parser_context_each(VALUE self);
+ 
+ #endif
+Index: libxml-ruby-0.5.2.0/ext/xml/libxml.c
+===================================================================
+--- libxml-ruby-0.5.2.0.orig/ext/xml/libxml.c	2007-09-26 17:04:48.000000000 +0200
++++ libxml-ruby-0.5.2.0/ext/xml/libxml.c	2008-09-04 14:22:48.000000000 +0200
+@@ -41,10 +41,6 @@
+ VALUE mXML;
+ VALUE eXMLError;
+ 
+-static xmlFreeFunc freeFunc = NULL;
+-static xmlMallocFunc mallocFunc = NULL;
+-static xmlReallocFunc reallocFunc = NULL;
+-static xmlStrdupFunc strdupFunc = NULL;
+ 
+ void
+ Init_libxml_so(void) {
+@@ -59,7 +55,6 @@
+                   (xmlReallocFunc)RubyMemRealloc, (xmlStrdupFunc)RubyMemStrdup) != 0)
+     rb_fatal("could not install the memory handlers for libxml");
+ #endif
+-  xmlInitParser();
+ 
+   mXML = rb_define_module("XML");
+   eXMLError = rb_define_class_under(mXML, "Error", rb_eRuntimeError);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20080904/46576903/attachment.pgp 


More information about the Pkg-ruby-extras-maintainers mailing list