tags 570727 +patch
thanks

Hi,

The problem seems to be caused by id() calculation bug in the C
extension part of xmldiff.

xmldiff constructs a tuple like this:

  #define KEYSHAPE "(i,i)"

  PyObject *node1, ...;
  key = Py_BuildValue(KEYSHAPE, (size_t)node1, ...) ;

and its Python part refers to the tuple as (id(node1), ...).

This is problematic because the return value of id() would either be an
Int (fixed size) or a Long (arbitrary precision) object.  I think the
original problem can also observed on 64bit systems, but more likely on
32bit systems.

The attached patch will fix the problem (I'll notify the upstream
shortly).

Attachment: pgpkqZu5ZcytW.pgp
Description: PGP signature

diff -u xmldiff-0.6.8/debian/changelog xmldiff-0.6.8/debian/changelog
--- xmldiff-0.6.8/debian/changelog
+++ xmldiff-0.6.8/debian/changelog
@@ -1,3 +1,10 @@
+xmldiff (0.6.8-4.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix id() calculation in extensions/maplookup.c (Closes: #570727)
+
+ -- Daiki Ueno <u...@unixuser.org>  Mon, 15 Mar 2010 17:16:23 +0700
+
 xmldiff (0.6.8-4.1) unstable; urgency=low
 
   * Non-maintainer upload.
only in patch2:
unchanged:
--- xmldiff-0.6.8.orig/extensions/maplookup.c
+++ xmldiff-0.6.8/extensions/maplookup.c
@@ -40,12 +40,6 @@
 
 
 /******************* functions specific to the fmes algorithm *****************/
-#if __WORDSIZE == 64
-#define KEYSHAPE "(l,l)"
-#else
-#define KEYSHAPE "(i,i)"
-#endif
-
 static short N_ISSUE = 5 ;
 
 /* function to init objects for the next functions
@@ -162,11 +156,17 @@
 	{
 		PyObject *key ;
 		couple = PyList_GET_ITEM(_mapping, i) ;
-                key = Py_BuildValue(KEYSHAPE, (size_t)node1, (size_t)PyTuple_GET_ITEM(couple, 0)) ;
+		key = PyTuple_New(2);
+		Py_INCREF(key);
+		PyTuple_SET_ITEM(key, 0, PyLong_FromVoidPtr(node1));
+		PyTuple_SET_ITEM(key, 1, PyLong_FromVoidPtr(PyTuple_GET_ITEM(couple, 0)));
 		if (PyDict_GetItem(_dict1, key) != NULL)
 		{
 			Py_DECREF(key) ;
-                        key = Py_BuildValue(KEYSHAPE, (size_t)node2, (size_t)PyTuple_GET_ITEM(couple, 1)) ;
+			key = PyTuple_New(2);
+			Py_INCREF(key);
+			PyTuple_SET_ITEM(key, 0, PyLong_FromVoidPtr(node2));
+			PyTuple_SET_ITEM(key, 1, PyLong_FromVoidPtr(PyTuple_GET_ITEM(couple, 1)));
 			if (PyDict_GetItem(_dict2, key) != NULL)
 			{
 				seq_num += 1 ;
Sent from Thailand Mini-DebCamp 2010 BSP:
http://wiki.debian.org/DebianThailand/MiniDebCamp2010/BSP

Regards,
-- 
Daiki Ueno

Reply via email to