#18 F34: Fix FTBFS on ppc64le and x86-64
Merged 3 years ago by churchyard. Opened 3 years ago by churchyard.

@@ -0,0 +1,52 @@ 

+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001

+ From: Victor Stinner <vstinner@redhat.com>

+ Date: Tue, 19 Jun 2018 18:19:23 +0200

+ Subject: [PATCH] 00311: Fix test_dbm_gnu for gdbm 1.15

+ 

+ Fix test_dbm_gnu.test_reorganize() on ppc64le with gdbm 1.15: add a

+ larger value to make sure that the file size changes.

+ (cherry picked from commit 13c79c677f9ec9437c82eda72fa1c2d288d8fceb)

+ ---

+  Lib/test/test_dbm_gnu.py                              | 11 ++++++++---

+  .../Tests/2018-06-19-14-04-21.bpo-33901.OFW1Sr.rst    |  2 ++

+  2 files changed, 10 insertions(+), 3 deletions(-)

+  create mode 100644 Misc/NEWS.d/next/Tests/2018-06-19-14-04-21.bpo-33901.OFW1Sr.rst

+ 

+ diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py

+ index a7808f51c7..0a48a6df8e 100644

+ --- a/Lib/test/test_dbm_gnu.py

+ +++ b/Lib/test/test_dbm_gnu.py

+ @@ -69,9 +69,13 @@ class TestGdbm(unittest.TestCase):

+          self.g = gdbm.open(filename, 'c')

+          size0 = os.path.getsize(filename)

+  

+ -        self.g['x'] = 'x' * 10000

+ +        # bpo-33901: on macOS with gdbm 1.15, an empty database uses 16 MiB

+ +        # and adding an entry of 10,000 B has no effect on the file size.

+ +        # Add size0 bytes to make sure that the file size changes.

+ +        value_size = max(size0, 10000)

+ +        self.g['x'] = 'x' * value_size

+          size1 = os.path.getsize(filename)

+ -        self.assertTrue(size0 < size1)

+ +        self.assertGreater(size1, size0)

+  

+          del self.g['x']

+          # 'size' is supposed to be the same even after deleting an entry.

+ @@ -79,7 +83,8 @@ class TestGdbm(unittest.TestCase):

+  

+          self.g.reorganize()

+          size2 = os.path.getsize(filename)

+ -        self.assertTrue(size1 > size2 >= size0)

+ +        self.assertLess(size2, size1)

+ +        self.assertGreaterEqual(size2, size0)

+  

+      def test_context_manager(self):

+          with gdbm.open(filename, 'c') as db:

+ diff --git a/Misc/NEWS.d/next/Tests/2018-06-19-14-04-21.bpo-33901.OFW1Sr.rst b/Misc/NEWS.d/next/Tests/2018-06-19-14-04-21.bpo-33901.OFW1Sr.rst

+ new file mode 100644

+ index 0000000000..2a2dec3e9f

+ --- /dev/null

+ +++ b/Misc/NEWS.d/next/Tests/2018-06-19-14-04-21.bpo-33901.OFW1Sr.rst

+ @@ -0,0 +1,2 @@

+ +Fix test_dbm_gnu on macOS with gdbm 1.15: add a larger value to make sure that

+ +the file size changes.

@@ -0,0 +1,74 @@ 

+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001

+ From: Inada Naoki <songofacandy@gmail.com>

+ Date: Mon, 3 Jun 2019 10:51:32 +0900

+ Subject: [PATCH] 00358: align allocations and PyGC_Head to 16 bytes on 64-bit

+  platforms

+ 

+ Upstream bug: https://bugs.python.org/issue27987

+ Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1923658

+ 

+ Combination of two upstream commits:

+ - 1b85f4ec45a5d63188ee3866bd55eb29fdec7fbf

+ - 8766cb74e186d3820db0a855ccd780d6d84461f7

+ ---

+  Include/objimpl.h                                           | 6 +++++-

+  .../2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst                | 3 +++

+  .../2019-05-15-18-28-43.bpo-27987.FaxuLy.rst                | 2 ++

+  Objects/obmalloc.c                                          | 6 ++++++

+  4 files changed, 16 insertions(+), 1 deletion(-)

+  create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst

+  create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst

+ 

+ diff --git a/Include/objimpl.h b/Include/objimpl.h

+ index 65b6d91c36..eaf57975c8 100644

+ --- a/Include/objimpl.h

+ +++ b/Include/objimpl.h

+ @@ -250,7 +250,11 @@ typedef union _gc_head {

+          union _gc_head *gc_prev;

+          Py_ssize_t gc_refs;

+      } gc;

+ -    double dummy;  /* force worst-case alignment */

+ +    long double dummy;  /* force worst-case alignment */

+ +    // malloc returns memory block aligned for any built-in types and

+ +    // long double is the largest standard C type.

+ +    // On amd64 linux, long double requires 16 byte alignment.

+ +    // See bpo-27987 for more discussion.

+  } PyGC_Head;

+  

+  extern PyGC_Head *_PyGC_generation0;

+ diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst

+ new file mode 100644

+ index 0000000000..b0f32a5c6c

+ --- /dev/null

+ +++ b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst	

+ @@ -0,0 +1,3 @@

+ +pymalloc returns memory blocks aligned by 16 bytes, instead of 8 bytes, on

+ +64-bit platforms to conform x86-64 ABI. Recent compilers assume this alignment

+ +more often. Patch by Inada Naoki.

+ diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst

+ new file mode 100644

+ index 0000000000..98073471ca

+ --- /dev/null

+ +++ b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst	

+ @@ -0,0 +1,2 @@

+ +``PyGC_Head`` structure is aligned to ``long double``.  This is needed to

+ +ensure GC-ed objects are aligned properly.  Patch by Inada Naoki.

+ diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c

+ index 9dd8421a33..da9029c4a6 100644

+ --- a/Objects/obmalloc.c

+ +++ b/Objects/obmalloc.c

+ @@ -540,8 +540,14 @@ static int running_on_valgrind = -1;

+   *

+   * You shouldn't change this unless you know what you are doing.

+   */

+ +

+ +#if SIZEOF_VOID_P > 4

+ +#define ALIGNMENT              16               /* must be 2^N */

+ +#define ALIGNMENT_SHIFT         4

+ +#else

+  #define ALIGNMENT               8               /* must be 2^N */

+  #define ALIGNMENT_SHIFT         3

+ +#endif

+  

+  /* Return the number of bytes in size class I, as a uint. */

+  #define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)

file modified
+24 -1
@@ -113,7 +113,7 @@ 

  #global prerel ...

  %global upstream_version %{general_version}%{?prerel}

  Version: %{general_version}%{?prerel:~%{prerel}}

- Release: 4%{?dist}

+ Release: 5%{?dist}

  License: Python

  

  # Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
@@ -418,6 +418,13 @@ 

  # Fixed upstream: https://bugs.python.org/issue32635

  Patch290: 00290-cryptmodule-Include-crypt.h-for-declaration-of-crypt.patch

  

+ # 00311 # d44b3cffd18f91aaa3cd66813d4a42954ec73826

+ # Fix test_dbm_gnu for gdbm 1.15

+ #

+ # Fix test_dbm_gnu.test_reorganize() on ppc64le with gdbm 1.15: add a

+ # larger value to make sure that the file size changes.

+ Patch311: 00311-fix-test_dbm_gnu-for-gdbm-1-15.patch

+ 

  # 00315 # 3958b022be96dd973bf0f0ac81a6411b5553649f

  # Fix mktime() error in test_email

  #
@@ -475,6 +482,17 @@ 

  # a nightmare because it's basically a binary file.

  Patch353: 00353-architecture-names-upstream-downstream.patch

  

+ # 00358 # 937df294129317b376689976f242058efee2ce98

+ # align allocations and PyGC_Head to 16 bytes on 64-bit platforms

+ #

+ # Upstream bug: https://bugs.python.org/issue27987

+ # Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1923658

+ #

+ # Combination of two upstream commits:

+ # - 1b85f4ec45a5d63188ee3866bd55eb29fdec7fbf

+ # - 8766cb74e186d3820db0a855ccd780d6d84461f7

+ Patch358: 00358-align-allocations-and-pygc_head-to-16-bytes-on-64-bit-platforms.patch

+ 

  # (New patches go here ^^^)

  #

  # When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@@ -1136,6 +1154,11 @@ 

  # ======================================================

  

  %changelog

+ * Fri Feb 19 2021 Petr Viktorin <pviktori@redhat.com> - 3.5.10-5

+ - Fix FTBFS on ppc64le and x86-64

+   Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1923654

+   Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1923658

+ 

  * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.10-4

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

  

no initial comment

Build succeeded.

Pull-Request has been merged by churchyard

3 years ago