[python] fix dbm_contains on 64bit-bigendian (patch 126; rhbz#626756)

dmalcolm dmalcolm at fedoraproject.org
Fri Sep 24 23:12:53 UTC 2010


commit e8c4a5d5d2828c105ba45e358503bbbf5130d241
Author: David Malcolm <dmalcolm at redhat.com>
Date:   Fri Sep 24 19:09:23 2010 -0400

    fix dbm_contains on 64bit-bigendian (patch 126; rhbz#626756)

 fix-dbm_contains-on-64bit-bigendian.patch |   25 +++++++++++++++++++++++++
 python.spec                               |   10 +++++++++-
 2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/fix-dbm_contains-on-64bit-bigendian.patch b/fix-dbm_contains-on-64bit-bigendian.patch
new file mode 100644
index 0000000..e9ed979
--- /dev/null
+++ b/fix-dbm_contains-on-64bit-bigendian.patch
@@ -0,0 +1,25 @@
+Index: Modules/dbmmodule.c
+===================================================================
+--- Modules/dbmmodule.c	(revision 84317)
++++ Modules/dbmmodule.c	(working copy)
+@@ -168,12 +168,18 @@
+ dbm_contains(register dbmobject *dp, PyObject *v)
+ {
+     datum key, val;
++    Py_ssize_t dsize;
+ 
+-    if (PyString_AsStringAndSize(v, (char **)&key.dptr,
+-                                 (Py_ssize_t *)&key.dsize)) {
++    if (PyString_AsStringAndSize(v, (char **)&key.dptr, &dsize)) {
+         return -1;
+     }
+ 
++    /* Coerce from Py_ssize_t down to int: */
++    if (dsize > INT_MAX) {
++        return -1;
++    }
++    key.dsize = dsize;
++
+     /* Expand check_dbmobject_open to return -1 */
+     if (dp->di_dbm == NULL) {
+         PyErr_SetString(DbmError, "DBM object has already been closed");
diff --git a/python.spec b/python.spec
index e10de18..e54d1ad 100644
--- a/python.spec
+++ b/python.spec
@@ -94,7 +94,7 @@ Summary: An interpreted, interactive, object-oriented programming language
 Name: %{python}
 # Remember to also rebase python-docs when changing this:
 Version: 2.7
-Release: 10%{?dist}
+Release: 11%{?dist}
 License: Python
 Group: Development/Languages
 Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@@ -436,6 +436,10 @@ Patch124: fix-test_commands-expected-ls-output-issue7108.patch
 # Not yet sent upstream:
 Patch125: less-verbose-COUNT_ALLOCS.patch
 
+# Fix dbm module on big-endian 64-bit
+# Sent upstream as http://bugs.python.org/issue9687 (rhbz#626756)
+Patch126: fix-dbm_contains-on-64bit-bigendian.patch
+
 # This is the generated patch to "configure"; see the description of
 #   %{regenerate_autotooling_patch}
 # above:
@@ -686,6 +690,7 @@ pushd Lib
 popd
 %patch124 -p1
 %patch125 -p1 -b .less-verbose-COUNT_ALLOCS
+%patch126 -p0 -b .fix-dbm_contains-on-64bit-bigendian
 
 # This shouldn't be necesarry, but is right now (2.2a3)
 find -name "*~" |xargs rm -f
@@ -1632,6 +1637,9 @@ rm -fr %{buildroot}
 # payload file would be unpackaged)
 
 %changelog
+* Fri Sep 24 2010 David Malcolm <dmalcolm at redhat.com> - 2.7-11
+- fix dbm_contains on 64bit-bigendian (patch 126; rhbz#626756)
+
 * Thu Sep 16 2010 Toshio Kuratomi <toshio at fedoraproject.org> - 2.7-10
 - backport a patch to fix a change in behaviour in configparse.
 


More information about the scm-commits mailing list