]> Git Repo - buildroot-mgba.git/blame - package/python3/0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch
package/python3: drop unnecessary patches
[buildroot-mgba.git] / package / python3 / 0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch
CommitLineData
fb6274f5 1From 3edeed879871a10acbe802f4a68cff3d4869dbde Mon Sep 17 00:00:00 2001
5333ada9
RN
2From: Romain Naour <[email protected]>
3Date: Thu, 12 Nov 2020 00:16:18 +0100
4Subject: [PATCH] lib/crypt: uClibc-ng doesn't set errno when encryption method
5 is not available
6
7Since commit [1] in cpython, an exception is raised when an encryption method
8is not available. This eception is handled only if errno is set to EINVAL by
9crypt() but uClibc-ng doesn't set errno in crypt() [2].
10
11Fixes:
12https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961
13https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979
14
15[1] https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c
16[2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29
17
18Signed-off-by: Romain Naour <[email protected]>
c0ee83d1
LD
19[Daniel: updated for 3.10.7]
20Signed-off-by: Daniel Lang <[email protected]>
5333ada9
RN
21---
22 Lib/crypt.py | 4 +++-
23 1 file changed, 3 insertions(+), 1 deletion(-)
24
25diff --git a/Lib/crypt.py b/Lib/crypt.py
fb6274f5 26index de4a14a388..ba482487a7 100644
5333ada9
RN
27--- a/Lib/crypt.py
28+++ b/Lib/crypt.py
738500c2 29@@ -98,7 +98,9 @@ def _add_method(name, *args, rounds=None):
5333ada9
RN
30 result = crypt('', salt)
31 except OSError as e:
32 # Not all libc libraries support all encryption methods.
c0ee83d1 33- if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS}:
5333ada9
RN
34+ # Not all libc libraries set errno when encryption method is not
35+ # available.
c0ee83d1 36+ if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS} or e.errno == 0:
5333ada9
RN
37 return False
38 raise
39 if result and len(result) == method.total_size:
40--
fb6274f5 412.34.1
5333ada9 42
This page took 4.300276 seconds and 4 git commands to generate.