diff -Nru python3.10-3.10.4/debian/changelog python3.10-3.10.4/debian/changelog --- python3.10-3.10.4/debian/changelog 2022-03-24 13:15:43.000000000 +0000 +++ python3.10-3.10.4/debian/changelog 2022-04-02 09:04:19.000000000 +0000 @@ -1,10 +1,22 @@ -python3.10 (3.10.4-1ubuntu1) jammy; urgency=medium +python3.10 (3.10.4-3) unstable; urgency=medium * Build a python3.10-nopie package, diverting the python3.10 executable. - * Build the python3.10 interpreter with PIE enabled. LP: #1452115. + * Build the python3.10 interpreter with PIE enabled. Closes: ##919134. + LP: #1452115. + * Fix build on ia64 (Adrian Glaubitz). Closes: #1008576. - -- Matthias Klose Thu, 24 Mar 2022 14:15:43 +0100 + -- Matthias Klose Sat, 02 Apr 2022 11:04:19 +0200 + +python3.10 (3.10.4-2) unstable; urgency=medium + + [ Stefano Rivera ] + * Avoid infinite recursion in _distutils_system_mod when + SETUPTOOLS_USE_DISTUTILS=local. + * Avoid crashing in `_distutils_system_mod` if we find an older version of + distutils (from before `_distutils_system_mod` was implemented). + + -- Matthias Klose Fri, 01 Apr 2022 17:03:31 +0200 python3.10 (3.10.4-1) unstable; urgency=medium diff -Nru python3.10-3.10.4/debian/control python3.10-3.10.4/debian/control --- python3.10-3.10.4/debian/control 2022-03-24 13:15:43.000000000 +0000 +++ python3.10-3.10.4/debian/control 2022-04-02 09:04:19.000000000 +0000 @@ -1,8 +1,7 @@ Source: python3.10 Section: python Priority: optional -Maintainer: Ubuntu Core Developers -XSBC-Original-Maintainer: Matthias Klose +Maintainer: Matthias Klose Build-Depends: debhelper (>= 11), dpkg-dev (>= 1.17.11), quilt, autoconf, lsb-release, sharutils, @@ -96,7 +95,7 @@ Architecture: any Multi-Arch: allowed Priority: optional -Depends: python3.10 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Depends: python3.10-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Description: Python interpreter linked without PIE (version 3.10) This package contains the interpreter not built as position independent executable. This interpreter is diverting the python3.10 executable, and making diff -Nru python3.10-3.10.4/debian/control.in python3.10-3.10.4/debian/control.in --- python3.10-3.10.4/debian/control.in 2022-03-24 13:15:43.000000000 +0000 +++ python3.10-3.10.4/debian/control.in 2022-04-02 09:04:19.000000000 +0000 @@ -95,7 +95,7 @@ Architecture: any Multi-Arch: allowed Priority: @MINPRIO@ -Depends: @PVER@ (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Depends: @PVER@-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Description: Python interpreter linked without PIE (version @VER@) This package contains the interpreter not built as position independent executable. This interpreter is diverting the @PVER@ executable, and making diff -Nru python3.10-3.10.4/debian/patches/distutils-install-layout.diff python3.10-3.10.4/debian/patches/distutils-install-layout.diff --- python3.10-3.10.4/debian/patches/distutils-install-layout.diff 2022-03-24 09:38:58.000000000 +0000 +++ python3.10-3.10.4/debian/patches/distutils-install-layout.diff 2022-04-01 15:05:03.000000000 +0000 @@ -302,7 +302,7 @@ def test_debug_mode(self): --- a/Lib/pydoc.py +++ b/Lib/pydoc.py -@@ -505,6 +505,7 @@ +@@ -509,6 +509,7 @@ 'marshal', 'posix', 'signal', 'sys', '_thread', 'zipimport') or (file.startswith(basedir) and @@ -312,7 +312,7 @@ if docloc.startswith(("http://", "https://")): --- /dev/null +++ b/Lib/_distutils_system_mod.py -@@ -0,0 +1,154 @@ +@@ -0,0 +1,180 @@ +""" +Apply Debian-specific patches to distutils commands. + @@ -325,6 +325,7 @@ + +import os +import sys ++import sysconfig + +import distutils.sysconfig +import distutils.command.install as orig_install @@ -423,21 +424,30 @@ + if standard_lib: + return libpython + elif is_default_prefix and not is_virtual_environment(): -+ return os.path.join(prefix, "lib", "python3", "dist-packages") ++ return os.path.join(prefix, "lib", "python3", "dist-packages") + else: + return os.path.join(libpython, "site-packages") + + +def _inject_headers(name, scheme): + """ -+ Default headers to the include path in sysconfig. -+ See: pypa/distutils#88 ++ Given a scheme name and the resolved scheme, ++ if the scheme does not include headers, resolve ++ the fallback scheme for the name and use headers ++ from it. pypa/distutils#88 ++ ++ headers: module headers install location (posix_local is /local/ prefixed) ++ include: cpython headers (Python.h) ++ See also: bpo-44445 + """ + if 'headers' not in scheme: -+ if 'include' in scheme and name != 'posix_local': -+ scheme['headers'] = scheme['include'] ++ if name == 'posix_prefix': ++ headers = scheme['include'] + else: -+ scheme['headers'] = orig_install._load_schemes()['posix_prefix']['headers'] ++ headers = orig_install.INSTALL_SCHEMES['posix_prefix']['headers'] ++ if name == 'posix_local' and '/local/' not in headers: ++ headers = headers.replace('/include/', '/local/include/') ++ scheme['headers'] = headers + return scheme + + @@ -454,16 +464,32 @@ + return wrapped_load_schemes + + ++def add_debian_schemes(schemes): ++ """ ++ Ensure that the custom schemes we refer to above are present in schemes. ++ """ ++ for name in ('posix_prefix', 'posix_local', 'deb_system'): ++ if name not in schemes: ++ scheme = sysconfig.get_paths(name, expand=False) ++ schemes[name] = _inject_headers(name, scheme) ++ ++ +def apply_customizations(): + orig_install.install = install ++ orig_install_egg_info.install_egg_info = install_egg_info ++ distutils.sysconfig._posix_lib = _posix_lib ++ + if hasattr(orig_install, '_inject_headers'): + # setuptools-bundled distutils >= 60.0.5 + orig_install._inject_headers = _inject_headers -+ else: -+ # Py 3.10 and older ++ elif hasattr(orig_install, '_load_schemes'): ++ # setuptools-bundled distutils >= 59.2.0 + orig_install._load_schemes = load_schemes_wrapper(orig_install._load_schemes) -+ orig_install_egg_info.install_egg_info = install_egg_info -+ distutils.sysconfig._posix_lib = _posix_lib ++ else: ++ # older version with only statically defined schemes ++ # this includes the version bundled with Python 3.10 that has our ++ # schemes already included ++ add_debian_schemes(orig_install.INSTALL_SCHEMES) + + +apply_customizations() diff -Nru python3.10-3.10.4/debian/patches/fix-ia64.diff python3.10-3.10.4/debian/patches/fix-ia64.diff --- python3.10-3.10.4/debian/patches/fix-ia64.diff 1970-01-01 00:00:00.000000000 +0000 +++ python3.10-3.10.4/debian/patches/fix-ia64.diff 2022-04-02 09:04:19.000000000 +0000 @@ -0,0 +1,134 @@ +From 0224b7180b280794b9fba62057b278ffb536c86f Mon Sep 17 00:00:00 2001 +From: Neil Schemenauer +Date: Thu, 21 Oct 2021 14:05:46 -0700 +Subject: [PATCH] bpo-45526: obmalloc radix use 64 addr bits (GH-29062) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Co-authored-by: Ɓukasz Langa +--- + .../2021-10-19-10-29-47.bpo-45526.WQnvW9.rst | 3 + + Objects/obmalloc.c | 55 ++++++++++++------- + 2 files changed, 38 insertions(+), 20 deletions(-) + create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-10-19-10-29-47.bpo-45526.WQnvW9.rst + +diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c +index 2eddb2cafd..4e17bf44b4 100644 +--- a/Objects/obmalloc.c ++++ b/Objects/obmalloc.c +@@ -1280,21 +1280,30 @@ _Py_GetAllocatedBlocks(void) + + #if WITH_PYMALLOC_RADIX_TREE + /*==========================================================================*/ +-/* radix tree for tracking arena usage ++/* radix tree for tracking arena usage. If enabled, used to implement ++ address_in_range(). + +- bit allocation for keys ++ memory address bit allocation for keys + +- 64-bit pointers and 2^20 arena size: +- 16 -> ignored (POINTER_BITS - ADDRESS_BITS) +- 10 -> MAP_TOP +- 10 -> MAP_MID +- 8 -> MAP_BOT ++ 64-bit pointers, IGNORE_BITS=0 and 2^20 arena size: ++ 15 -> MAP_TOP_BITS ++ 15 -> MAP_MID_BITS ++ 14 -> MAP_BOT_BITS ++ 20 -> ideal aligned arena ++ ---- ++ 64 ++ ++ 64-bit pointers, IGNORE_BITS=16, and 2^20 arena size: ++ 16 -> IGNORE_BITS ++ 10 -> MAP_TOP_BITS ++ 10 -> MAP_MID_BITS ++ 8 -> MAP_BOT_BITS + 20 -> ideal aligned arena + ---- + 64 + + 32-bit pointers and 2^18 arena size: +- 14 -> MAP_BOT ++ 14 -> MAP_BOT_BITS + 18 -> ideal aligned arena + ---- + 32 +@@ -1306,11 +1315,16 @@ _Py_GetAllocatedBlocks(void) + /* number of bits in a pointer */ + #define POINTER_BITS 64 + +-/* Current 64-bit processors are limited to 48-bit physical addresses. For +- * now, the top 17 bits of addresses will all be equal to bit 2**47. If that +- * changes in the future, this must be adjusted upwards. ++/* High bits of memory addresses that will be ignored when indexing into the ++ * radix tree. Setting this to zero is the safe default. For most 64-bit ++ * machines, setting this to 16 would be safe. The kernel would not give ++ * user-space virtual memory addresses that have significant information in ++ * those high bits. The main advantage to setting IGNORE_BITS > 0 is that less ++ * virtual memory will be used for the top and middle radix tree arrays. Those ++ * arrays are allocated in the BSS segment and so will typically consume real ++ * memory only if actually accessed. + */ +-#define ADDRESS_BITS 48 ++#define IGNORE_BITS 0 + + /* use the top and mid layers of the radix tree */ + #define USE_INTERIOR_NODES +@@ -1318,7 +1332,7 @@ _Py_GetAllocatedBlocks(void) + #elif SIZEOF_VOID_P == 4 + + #define POINTER_BITS 32 +-#define ADDRESS_BITS 32 ++#define IGNORE_BITS 0 + + #else + +@@ -1332,6 +1346,9 @@ _Py_GetAllocatedBlocks(void) + # error "arena size must be < 2^32" + #endif + ++/* the lower bits of the address that are not ignored */ ++#define ADDRESS_BITS (POINTER_BITS - IGNORE_BITS) ++ + #ifdef USE_INTERIOR_NODES + /* number of bits used for MAP_TOP and MAP_MID nodes */ + #define INTERIOR_BITS ((ADDRESS_BITS - ARENA_BITS + 2) / 3) +@@ -1360,11 +1377,9 @@ _Py_GetAllocatedBlocks(void) + #define MAP_MID_INDEX(p) ((AS_UINT(p) >> MAP_MID_SHIFT) & MAP_MID_MASK) + #define MAP_TOP_INDEX(p) ((AS_UINT(p) >> MAP_TOP_SHIFT) & MAP_TOP_MASK) + +-#if ADDRESS_BITS > POINTER_BITS +-/* Return non-physical address bits of a pointer. Those bits should be same +- * for all valid pointers if ADDRESS_BITS set correctly. Linux has support for +- * 57-bit address space (Intel 5-level paging) but will not currently give +- * those addresses to user space. ++#if IGNORE_BITS > 0 ++/* Return the ignored part of the pointer address. Those bits should be same ++ * for all valid pointers if IGNORE_BITS is set correctly. + */ + #define HIGH_BITS(p) (AS_UINT(p) >> ADDRESS_BITS) + #else +@@ -1416,7 +1431,7 @@ static arena_map_bot_t * + arena_map_get(block *p, int create) + { + #ifdef USE_INTERIOR_NODES +- /* sanity check that ADDRESS_BITS is correct */ ++ /* sanity check that IGNORE_BITS is correct */ + assert(HIGH_BITS(p) == HIGH_BITS(&arena_map_root)); + int i1 = MAP_TOP_INDEX(p); + if (arena_map_root.ptrs[i1] == NULL) { +@@ -1476,7 +1491,7 @@ arena_map_get(block *p, int create) + static int + arena_map_mark_used(uintptr_t arena_base, int is_used) + { +- /* sanity check that ADDRESS_BITS is correct */ ++ /* sanity check that IGNORE_BITS is correct */ + assert(HIGH_BITS(arena_base) == HIGH_BITS(&arena_map_root)); + arena_map_bot_t *n_hi = arena_map_get((block *)arena_base, is_used); + if (n_hi == NULL) { +-- +2.34.1 + diff -Nru python3.10-3.10.4/debian/patches/series python3.10-3.10.4/debian/patches/series --- python3.10-3.10.4/debian/patches/series 2022-03-16 17:19:40.000000000 +0000 +++ python3.10-3.10.4/debian/patches/series 2022-04-02 09:04:19.000000000 +0000 @@ -38,3 +38,4 @@ destshared-location.diff fix-py_compile.diff reproducible-pyc.diff +fix-ia64.diff diff -Nru python3.10-3.10.4/debian/rules python3.10-3.10.4/debian/rules --- python3.10-3.10.4/debian/rules 2022-03-24 11:43:22.000000000 +0000 +++ python3.10-3.10.4/debian/rules 2022-04-02 09:04:19.000000000 +0000 @@ -80,11 +80,9 @@ dpkg_buildflags = DEB_BUILD_MAINT_OPTIONS=hardening=-pie dpkg-buildflags dpkg_pieflags = DEB_BUILD_MAINT_OPTIONS=hardening=-pie dpkg-buildflags -ifeq ($(derivative),Ubuntu) - ifeq (,$(filter $(distrelease),trusty xenial bionic focal impish)) - with_nopie := yes - dpkg_pieflags = dpkg-buildflags - endif +ifeq (,$(filter $(distrelease),stretch buster bullseye trusty xenial bionic focal impish)) + with_nopie := yes + dpkg_pieflags = dpkg-buildflags endif # FIXME: remove sid when uploading to unstable, after bookworm is released diff -Nru python3.10-3.10.4/debian/tests/module-install-local python3.10-3.10.4/debian/tests/module-install-local --- python3.10-3.10.4/debian/tests/module-install-local 2022-03-14 03:41:27.000000000 +0000 +++ python3.10-3.10.4/debian/tests/module-install-local 2022-04-01 15:05:03.000000000 +0000 @@ -64,4 +64,15 @@ assertEquals 'Correct result' 8 "$stdout" } +testFibPyDistutilsLocal() { + cd "$AUTOPKGTEST_TMP/packages/fibpy" + SETUPTOOLS_USE_DISTUTILS=local python3.10 setup.py install + assertTrue 'Install fibpy in /usr/local' $? + assertTrue 'fibpy was installed to /usr/local' "[ -e $dist_packages/fibpy-*.egg ]" + cd "$AUTOPKGTEST_TMP" + stdout=$(python3.10 -m fibpy 5) + assertTrue 'Execute fibpy from /usr/local' $? + assertEquals 'Correct result' 8 "$stdout" +} + . shunit2 diff -Nru python3.10-3.10.4/debian/tests/module-install-user python3.10-3.10.4/debian/tests/module-install-user --- python3.10-3.10.4/debian/tests/module-install-user 2022-03-14 03:41:27.000000000 +0000 +++ python3.10-3.10.4/debian/tests/module-install-user 2022-04-01 15:05:03.000000000 +0000 @@ -66,4 +66,15 @@ assertEquals 'Correct result' 8 "$stdout" } +testFibPyDistutilsLocal() { + cd "$AUTOPKGTEST_TMP/packages/fibpy" + SETUPTOOLS_USE_DISTUTILS=local python3.10 setup.py install --user + assertTrue 'Install fibpy in --user' $? + assertTrue 'fibpy was installed to ~/.local' "[ -e $site_packages/fibpy-*.egg ]" + cd "$AUTOPKGTEST_TMP" + stdout=$(python3.10 -m fibpy 5) + assertTrue 'Execute fibpy from ~/.local' $? + assertEquals 'Correct result' 8 "$stdout" +} + . shunit2 diff -Nru python3.10-3.10.4/debian/tests/module-install-venv python3.10-3.10.4/debian/tests/module-install-venv --- python3.10-3.10.4/debian/tests/module-install-venv 2022-03-14 03:41:27.000000000 +0000 +++ python3.10-3.10.4/debian/tests/module-install-venv 2022-04-01 15:05:03.000000000 +0000 @@ -74,4 +74,15 @@ assertEquals 'Correct result' 8 "$stdout" } +testFibPyDistutilsLocal() { + cd "$AUTOPKGTEST_TMP/packages/fibpy" + SETUPTOOLS_USE_DISTUTILS=local $VP setup.py install + assertTrue 'Install fibpy in a virtualenv' $? + assertTrue 'fibpy was installed to virtualenv' "[ -e $site_packages/fibpy-*.egg ]" + cd "$AUTOPKGTEST_TMP" + stdout=$($VP -m fibpy 5) + assertTrue 'Execute fibpy from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + . shunit2 diff -Nru python3.10-3.10.4/debian/tests/module-install-virtualenv python3.10-3.10.4/debian/tests/module-install-virtualenv --- python3.10-3.10.4/debian/tests/module-install-virtualenv 2022-03-14 03:41:27.000000000 +0000 +++ python3.10-3.10.4/debian/tests/module-install-virtualenv 2022-04-01 15:05:03.000000000 +0000 @@ -72,4 +72,15 @@ assertEquals 'Correct result' 8 "$stdout" } +testFibPyDistutilsLocal() { + cd "$AUTOPKGTEST_TMP/packages/fibpy" + SETUPTOOLS_USE_DISTUTILS=local $VP setup.py install + assertTrue 'Install fibpy in a virtualenv' $? + assertTrue 'fibpy was installed to virtualenv' "[ -e $site_packages/fibpy-*.egg ]" + cd "$AUTOPKGTEST_TMP" + stdout=$($VP -m fibpy 5) + assertTrue 'Execute fibpy from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + . shunit2