kumquat-buildroot/package/python3/0032-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch
Vincent Fazio 3fed424566 package/python3: use the provided pyc compiler
Previously, we used support/scripts/pycompile.py to generate the pyc
files for the python libraries.

While the script worked, it did not follow the PEP 3147 layout
requirements for py+pyc deployments.

Now, use the package's own compileall.py script. This will follow
PEP 3147 guidelines. It also supports "legacy" pyc only deployments as
described here:
  https://peps.python.org/pep-3147/#case-4-legacy-pyc-files-and-source-less-imports

With this change, we no longer need to hack support for side-by-side pyc
files because files will be deployed as appropriate.

This also has the added benefit of not requiring python3 on the host to
build host-python3.

Fixes: #14911

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
[yann.morin.1998@free.fr:
  - build-tested in a python-less environment
  - build+run-tested with the runtime-test infra
]
Tested-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-07-23 17:23:57 +02:00

41 lines
1.5 KiB
Diff

From 3c83eedcc2df3ecf6c4a17953ca24dff60c1378e Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Thu, 12 Nov 2020 00:16:18 +0100
Subject: [PATCH] lib/crypt: uClibc-ng doesn't set errno when encryption method
is not available
Since commit [1] in cpython, an exception is raised when an encryption method
is not available. This eception is handled only if errno is set to EINVAL by
crypt() but uClibc-ng doesn't set errno in crypt() [2].
Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961
https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979
[1] https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c
[2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
Lib/crypt.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Lib/crypt.py b/Lib/crypt.py
index 33dbc46bb3..4692a5270c 100644
--- a/Lib/crypt.py
+++ b/Lib/crypt.py
@@ -94,7 +94,9 @@ def _add_method(name, *args, rounds=None):
result = crypt('', salt)
except OSError as e:
# Not all libc libraries support all encryption methods.
- if e.errno == errno.EINVAL:
+ # Not all libc libraries set errno when encryption method is not
+ # available.
+ if e.errno == errno.EINVAL or e.errno == 0:
return False
raise
if result and len(result) == method.total_size:
--
2.25.4