diff options
Diffstat (limited to 'meta-python')
3 files changed, 114 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-m2crypto/0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch b/meta-python/recipes-devtools/python/python3-m2crypto/0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch new file mode 100644 index 0000000000..d49950074f --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-m2crypto/0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch  | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From d123b4ddce99c44f2c290fb3d6cc887de98778e6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haixiao Yan <haixiao.yan.cn@windriver.com> | ||
| 3 | Date: Wed, 22 Oct 2025 15:23:56 +0800 | ||
| 4 | Subject: [PATCH 1/2] fix: allow 64-bit time_t on 32-bit systems in | ||
| 5 | test_is32bit | ||
| 6 | |||
| 7 | Some modern 32-bit Linux systems (e.g. with glibc >= 2.34 or musl time64 ABI) | ||
| 8 | use 64-bit time_t by default when _TIME_BITS=64 is enabled. The original test | ||
| 9 | assumed time_t was always 32-bit on 32-bit architectures, which is no longer | ||
| 10 | true. | ||
| 11 | |||
| 12 | Relax the check to accept both 32-bit and 64-bit time_t values: | ||
| 13 | |||
| 14 | self.assertIn(bit32, (32, 64)) | ||
| 15 | |||
| 16 | This makes the test compatible with both legacy and time64 ABIs. | ||
| 17 | |||
| 18 | Upstream-Status: Backport [https://gitlab.com/m2crypto/m2crypto/-/commit/818c3dfda6ea] | ||
| 19 | |||
| 20 | Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com> | ||
| 21 | --- | ||
| 22 | tests/test_util.py | 2 +- | ||
| 23 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 24 | |||
| 25 | diff --git a/tests/test_util.py b/tests/test_util.py | ||
| 26 | index e925d03b090c..233fb7a099d9 100644 | ||
| 27 | --- a/tests/test_util.py | ||
| 28 | +++ b/tests/test_util.py | ||
| 29 | @@ -26,7 +26,7 @@ class UtilTestCase(unittest.TestCase): | ||
| 30 | not in ["true", "1", "yes"] | ||
| 31 | ) | ||
| 32 | ): | ||
| 33 | - self.assertEqual(bit32, 32) | ||
| 34 | + self.assertIn(bit32, (32, 64)) | ||
| 35 | else: | ||
| 36 | self.assertNotEqual(bit32, 32) | ||
| 37 | self.assertIsInstance(bit32, int) | ||
| 38 | -- | ||
| 39 | 2.34.1 | ||
| 40 | |||
diff --git a/meta-python/recipes-devtools/python/python3-m2crypto/0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch b/meta-python/recipes-devtools/python/python3-m2crypto/0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch new file mode 100644 index 0000000000..c36afa5cc0 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-m2crypto/0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch  | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | From b5dbfca23986429853ccb15a38cc526d9df0dd40 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haixiao Yan <haixiao.yan.cn@windriver.com> | ||
| 3 | Date: Wed, 22 Oct 2025 15:23:57 +0800 | ||
| 4 | Subject: [PATCH 2/2] fix: correct struct packing on 32-bit with _TIME_BITS=64 | ||
| 5 | |||
| 6 | On 32-bit platforms with glibc time64 ABI, time_t is 64-bit wide while | ||
| 7 | `long` remains 32-bit. This causes struct timeval to use two 64-bit fields | ||
| 8 | (tv_sec, tv_usec). The previous code incorrectly packed timeout as "ll", | ||
| 9 | leading to EINVAL in setsockopt(SO_RCVTIMEO). | ||
| 10 | |||
| 11 | Use "qq" instead when m2.time_t_bits() == 64 to match the actual ABI. | ||
| 12 | |||
| 13 | Fixes: https://todo.sr.ht/~mcepl/m2crypto/374 | ||
| 14 | |||
| 15 | Upstream-Status: Backport [https://gitlab.com/m2crypto/m2crypto/-/commit/473de659f78e] | ||
| 16 | |||
| 17 | Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com> | ||
| 18 | --- | ||
| 19 | src/M2Crypto/SSL/timeout.py | 24 ++++++++++++++++++++---- | ||
| 20 | 1 file changed, 20 insertions(+), 4 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/src/M2Crypto/SSL/timeout.py b/src/M2Crypto/SSL/timeout.py | ||
| 23 | index b45f38b1cbdb..5ba52283b6f8 100644 | ||
| 24 | --- a/src/M2Crypto/SSL/timeout.py | ||
| 25 | +++ b/src/M2Crypto/SSL/timeout.py | ||
| 26 | @@ -33,10 +33,14 @@ class timeout(object): | ||
| 27 | millisec = int(self.sec * 1000 + round(float(self.microsec) / 1000)) | ||
| 28 | binstr = struct.pack("l", millisec) | ||
| 29 | else: | ||
| 30 | - if m2.time_t_bits() == 32: | ||
| 31 | + bits = m2.time_t_bits() | ||
| 32 | + if bits == 32: | ||
| 33 | binstr = struct.pack("ii", self.sec, self.microsec) | ||
| 34 | + elif bits == 64: | ||
| 35 | + # handle both 64-bit and 32-bit+TIME_BITS=64 | ||
| 36 | + binstr = struct.pack("qq", self.sec, self.microsec) | ||
| 37 | else: | ||
| 38 | - binstr = struct.pack("ll", self.sec, self.microsec) | ||
| 39 | + raise ValueError(f"Unsupported time_t_bits: {bits}") | ||
| 40 | return binstr | ||
| 41 | |||
| 42 | |||
| 43 | @@ -48,7 +52,13 @@ def struct_to_timeout(binstr: bytes) -> timeout: | ||
| 44 | sec = int(millisec / 1000) | ||
| 45 | microsec = (millisec % 1000) * 1000 | ||
| 46 | else: | ||
| 47 | - (sec, microsec) = struct.unpack("ll", binstr) | ||
| 48 | + bits = m2.time_t_bits() | ||
| 49 | + if bits == 32: | ||
| 50 | + (sec, microsec) = struct.unpack("ii", binstr) | ||
| 51 | + elif bits == 64: | ||
| 52 | + (sec, microsec) = struct.unpack("qq", binstr) | ||
| 53 | + else: | ||
| 54 | + raise ValueError(f"Unsupported time_t_bits: {bits}") | ||
| 55 | return timeout(sec, microsec) | ||
| 56 | |||
| 57 | |||
| 58 | @@ -56,4 +66,10 @@ def struct_size() -> int: | ||
| 59 | if sys.platform == "win32": | ||
| 60 | return struct.calcsize("l") | ||
| 61 | else: | ||
| 62 | - return struct.calcsize("ll") | ||
| 63 | + bits = m2.time_t_bits() | ||
| 64 | + if bits == 32: | ||
| 65 | + return struct.calcsize("ii") | ||
| 66 | + elif bits == 64: | ||
| 67 | + return struct.calcsize("qq") | ||
| 68 | + else: | ||
| 69 | + raise ValueError(f"Unsupported time_t_bits: {bits}") | ||
| 70 | -- | ||
| 71 | 2.34.1 | ||
| 72 | |||
diff --git a/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb b/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb index 0a631c7a07..9aac7b344f 100644 --- a/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb +++ b/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb  | |||
| @@ -8,6 +8,8 @@ SRC_URI[sha256sum] = "13c2fa89562f7b8af40cc74b55f490be5e2ab8ccfb739f11c16d3ce622 | |||
| 8 | 8 | ||
| 9 | SRC_URI += " \ | 9 | SRC_URI += " \ | 
| 10 | file://0001-setup.py-Make-the-cmd-available.patch \ | 10 | file://0001-setup.py-Make-the-cmd-available.patch \ | 
| 11 | file://0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch \ | ||
| 12 | file://0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch \ | ||
| 11 | " | 13 | " | 
| 12 | 14 | ||
| 13 | inherit pypi siteinfo python_setuptools_build_meta | 15 | inherit pypi siteinfo python_setuptools_build_meta | 
