[sqlite2/el6] Added a patch to avoid segmentation fault of tests on ppc64

Robert Scheck robert at fedoraproject.org
Fri Mar 23 09:54:12 UTC 2012


commit 43091297101ceb0f5cca9017bf9e2cd137996b7b
Author: Robert Scheck <robert at fedoraproject.org>
Date:   Fri Mar 23 10:54:06 2012 +0100

    Added a patch to avoid segmentation fault of tests on ppc64

 sqlite-2.8.17-ppc64.patch |   46 +++++++++++++++++++++++++++++++++++++++++++++
 sqlite2.spec              |    7 +++++-
 2 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/sqlite-2.8.17-ppc64.patch b/sqlite-2.8.17-ppc64.patch
new file mode 100644
index 0000000..89ee467
--- /dev/null
+++ b/sqlite-2.8.17-ppc64.patch
@@ -0,0 +1,46 @@
+Patch by Gustavo Luiz Duarte <gustavold at gmail.com> for sqlite >= 2.8.17,
+which fixes the cast of a pointer to int that causes a segmentation fault
+during the tests. On 64 bit machines, pointers are 64 bit and int is 32
+bit. During casting the pointer is truncated, so the original code could
+potentially also break x86_64, while it is doing not so at the moment.
+
+--- sqlite-2.8.17/src/test2.c		2005-04-24 00:43:22.000000000 +0200
++++ sqlite-2.8.17/src/test2.c.ppc64     2012-03-23 10:47:07.000000000 +0100
+@@ -82,7 +82,7 @@ static int pager_open(
+     Tcl_AppendResult(interp, errorName(rc), 0);
+     return TCL_ERROR;
+   }
+-  sprintf(zBuf,"0x%x",(int)pPager);
++  sprintf(zBuf,"%p", pPager);
+   Tcl_AppendResult(interp, zBuf, 0);
+   return TCL_OK;
+ }
+@@ -334,7 +334,7 @@ static int page_get(
+     Tcl_AppendResult(interp, errorName(rc), 0);
+     return TCL_ERROR;
+   }
+-  sprintf(zBuf,"0x%x",(int)pPage);
++  sprintf(zBuf,"%p", pPage);
+   Tcl_AppendResult(interp, zBuf, 0);
+   return TCL_OK;
+ }
+@@ -364,7 +364,7 @@ static int page_lookup(
+   if( Tcl_GetInt(interp, argv[2], &pgno) ) return TCL_ERROR;
+   pPage = sqlitepager_lookup(pPager, pgno);
+   if( pPage ){
+-    sprintf(zBuf,"0x%x",(int)pPage);
++    sprintf(zBuf,"%p", pPage);
+     Tcl_AppendResult(interp, zBuf, 0);
+   }
+   return TCL_OK;
+--- sqlite-2.8.17/src/test3.c		2005-04-24 00:43:22.000000000 +0200
++++ sqlite-2.8.17/src/test3.c.ppc64	2012-03-23 10:47:03.000000000 +0100
+@@ -534,7 +534,7 @@ static int btree_cursor(
+     Tcl_AppendResult(interp, errorName(rc), 0);
+     return TCL_ERROR;
+   }
+-  sprintf(zBuf,"0x%x", (int)pCur);
++  sprintf(zBuf,"%p", pCur);
+   Tcl_AppendResult(interp, zBuf, 0);
+   return SQLITE_OK;
+ }
diff --git a/sqlite2.spec b/sqlite2.spec
index 95b1aee..b0d2049 100644
--- a/sqlite2.spec
+++ b/sqlite2.spec
@@ -2,7 +2,7 @@
 
 Name:           sqlite2
 Version:        2.8.17
-Release:        7%{?dist}
+Release:        8%{?dist}
 
 Summary:        Embeddable SQL engine in a C library
 Group:          System Environment/Libraries
@@ -16,6 +16,7 @@ Patch4:         sqlite-64bit-fixes.patch
 Patch5:         sqlite-2.8.15-arch-double-differences.patch
 Patch6:         sqlite-2.8.17-test.patch
 Patch7:         sqlite-2.8.17-tcl.patch
+Patch8:         sqlite-2.8.17-ppc64.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  ncurses-devel readline-devel %{_includedir}/tcl.h
@@ -64,6 +65,7 @@ This package contains tcl bindings for sqlite.
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 sed -i.rpath 's!__VERSION__!%{version}!g' Makefile.in
 # Patch additional /usr/lib locations where we don't have $(libdir)
 # to substitute with.
@@ -118,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/tcl%{tclver}/sqlite2
 
 %changelog
+* Fri Mar 23 2012 Robert Scheck <robert at fedoraproject.org> - 2.8.17-8
+- Added a patch to avoid segmentation fault of tests on ppc64
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.8.17-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list