[SCM] Packaging for pytables branch, master, updated. debian/2.3.1-2-16-g984af84

Antonio Valentino antonio.valentino at tiscali.it
Sat Mar 3 12:10:06 UTC 2012


The following commit has been merged in the master branch:
commit 984af8416482005b81466bdc1e6d7e72414d43d7
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date:   Sat Mar 3 12:39:14 2012 +0100

    Patch to avoid unaligned memory access errors on some platforms

diff --git a/debian/changelog b/debian/changelog
index 9ee3be0..a9bcd3f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,12 +8,16 @@ pytables (2.3.1-3) unstable; urgency=low
   * Honor nodoc and noopt DEB_BUILD_OPTIONS (Closes: #660001)
   * Updated copyright format URL
   * Standard version bumped to 3.9.3 (no changes)
+  * Patch fix_unaligned_mem_access to avoid errors related to unaligned
+    memory access on platforms like AMR, etc.
+    The patch has been backported from upstream and originally submtted
+    by juliat Taylor
 
   [ Yaroslav Halchenko ]
   * Patch up_skip_multiprocessing_test_on_gnu to disable test on Hurd and
     kFreeBSD systems -- multiprocessing locking seems to be N/A
 
- -- Antonio Valentino <antonio.valentino at tiscali.it>  Sun, 26 Feb 2012 19:18:47 +0100
+ -- Antonio Valentino <antonio.valentino at tiscali.it>  Sat, 03 Mar 2012 12:34:43 +0100
 
 pytables (2.3.1-2) unstable; urgency=low
 
diff --git a/debian/patches/fix_unaligned_mem_access b/debian/patches/fix_unaligned_mem_access
new file mode 100644
index 0000000..8d090a7
--- /dev/null
+++ b/debian/patches/fix_unaligned_mem_access
@@ -0,0 +1,44 @@
+Fix errors related to unaligned memory access.
+
+Perform an explicit copy of data to avoid errors related to
+unaligned memory access on platforms like AMR, etc.
+
+--- a/src/typeconv.c
++++ b/src/typeconv.c
+@@ -66,25 +66,24 @@
+ 
+   for (record = 0;  record < nrecords;  record++) {
+     for (element = 0;  element < nelements;  element++) {
++      double fb;
++      memcpy(&fb, fieldbase, sizeof(*fieldbase));
+       if (sense == 0) {
+-	/* Convert from float64 to timeval32. */
+-	tv.i64 = (((PY_LONG_LONG)(*fieldbase) << 32)
+-		  | (lround((*fieldbase - (int)(*fieldbase)) * 1e+6)
+-		     & 0x0ffffffff));
+-	*fieldbase = tv.f64;
++        /* Convert from float64 to timeval32. */
++        tv.i64 = (((PY_LONG_LONG)(fb) << 32)
++                  | (lround((fb - (int)(fb)) * 1e+6) & 0x0ffffffff));
++        fb = tv.f64;
+       } else {
+-	/* Convert from timeval32 to float64. */
+-	tv.f64 = *fieldbase;
+-	/* the next computation is 64 bit-platforms aware */
+-	*fieldbase = 1e-6 * (int)tv.i64 + (tv.i64 >> 32);
++        /* Convert from timeval32 to float64. */
++        tv.f64 = fb;
++        /* the next computation is 64 bit-platforms aware */
++        fb = 1e-6 * (int)tv.i64 + (tv.i64 >> 32);
+       }
++      memcpy(fieldbase, &fb, sizeof(*fieldbase));
+       fieldbase++;
+     }
+ 
+     fieldbase = (double *)((unsigned char *)(fieldbase) + gapsize);
+-
+-    /* XXX: Need to check if this works on platforms which require
+-       64-bit data to be aligned.  ivb(2005-01-07) */
+   }
+ 
+   assert(fieldbase == (base + byteoffset + bytestride * nrecords));
diff --git a/debian/patches/series b/debian/patches/series
index 5fa5cc1..a4f72f0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 up_skip_multiprocessing_test_on_gnu
+fix_unaligned_mem_access
+

-- 
Packaging for pytables



More information about the debian-science-commits mailing list