Skip to contentSkip to conversation

package/python3: uClibc-ng doesn't set errno when encryption method is not available

PATCH New Romain Naour 3 participants 6 messages Nov 11, 2020 – Nov 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python3: 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

---
 ...-ng-doesn-t-set-errno-when-encryptio.patch | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 package/python3/0034-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch
package/python3/0034-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch new file +40 -0
new file mode 100644
index 0000000000..880277eb1d
@@ -0,0 +1,40 @@
+From 3c83eedcc2df3ecf6c4a17953ca24dff60c1378e Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+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 <[email protected]>
+---
+ 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
+
Signature · 1 line
2.25.4
#1 lore raw

PATCH 2/2 package/python-lmdb: bump to version 0.99

This version fix the runtime issue with python 3.9 since _Py_ForgetReference() was removed from the limited C API [1].

$ python sample_python_crossbar.py
/usr/bin/python3.9: symbol '_Py_ForgetReference': can't resolve symbol

python-lmbd 0.99 contain a refactoring removing _Py_ForgetReference() from the code.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961
https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979

[1] https://docs.python.org/3/whatsnew/3.9.html#id3
[2] https://github.com/jnwatson/py-lmdb/commit/22a3724bdcda62853e8a250094f512eb20abe01f

---
The version 0.99 is a bug fix release AFAIK.

---
 package/python-lmdb/python-lmdb.hash | 4 ++--
 package/python-lmdb/python-lmdb.mk   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
package/python-lmdb/python-lmdb.hash +2 -2
index 569d1d0bd6..cb28536d3f 100644
@@ -1,5 +1,5 @@
 # md5, sha256 from https://pypi.org/pypi/lmdb/json
-md5	ae2efef18202e51c9e4a807a47900ce2  lmdb-0.98.tar.gz
-sha256	0625bc28bf0893e6000a83be7234f915ca078c32f9e73d8ae48b3508db7af708  lmdb-0.98.tar.gz
+md5	507049767b995c3c6a93b3bd97567c71  lmdb-0.99.tar.gz
+sha256	f9eb844aaaacc8a4bc175e1c1f8a8fb538c330e378fd9eb40e8708d4dca7dc89  lmdb-0.99.tar.gz
 # Locally computed sha256 checksums
 sha256	310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569  LICENSE
package/python-lmdb/python-lmdb.mk +2 -2
index f92c7f775b..bf98ba19c8 100644
@@ -4,9 +4,9 @@
 #
 ################################################################################
 
-PYTHON_LMDB_VERSION = 0.98
+PYTHON_LMDB_VERSION = 0.99
 PYTHON_LMDB_SOURCE = lmdb-$(PYTHON_LMDB_VERSION).tar.gz
-PYTHON_LMDB_SITE = https://files.pythonhosted.org/packages/c0/5c/d56dbc2532ecf14fa004c543927500c0f645eaca8bd7ec39420c7546396a
+PYTHON_LMDB_SITE = https://files.pythonhosted.org/packages/3b/66/aa6f3a3e338a3ca263575ce6f722c2fdcd21039a03b55c722e0ae0b216db
 PYTHON_LMDB_LICENSE = OLDAP-2.8
 PYTHON_LMDB_LICENSE_FILES = LICENSE
 PYTHON_LMDB_SETUP_TYPE = setuptools
Signature · 1 line
2.25.4
#2 lore raw

PATCH 2/2 package/python-lmdb: bump to version 0.99

Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

This version fix the runtime issue with python 3.9 since _Py_ForgetReference() was removed from the limited C API [1].

$ python sample_python_crossbar.py
/usr/bin/python3.9: symbol '_Py_ForgetReference': can't resolve symbol

python-lmbd 0.99 contain a refactoring removing _Py_ForgetReference() from the code.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961
https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979

Quoted 6 lines

[1] https://docs.python.org/3/whatsnew/3.9.html#id3
[2] https://github.com/jnwatson/py-lmdb/commit/22a3724bdcda62853e8a250094f512eb20abe01f

---
The version 0.99 is a bug fix release AFAIK.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/2 package/python3: uClibc-ng doesn't set errno when encryption method is not available

In reply to Romain Naour
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

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].

Quoted 8 lines

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

I've applied this for master to fix the issue for 2020.11, but it would really be good if uClibc-ng could be fixed to set errno to something sensible.

Romain, don't forget to submit the python patch upstream.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/2 package/python3: uClibc-ng doesn't set errno when encryption method is not available

Hello,

Le 12/11/2020 ? 22:31, Peter Korsgaard a ?crit?:

Quoted 10 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

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

Quoted 8 lines
Quoted 4 lines

[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

I've applied this for master to fix the issue for 2020.11, but it would really be good if uClibc-ng could be fixed to set errno to something sensible.

Waldemar, maybe we can just uncomment __set_errno(EINVAL); ?

https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29

Quoted 3 lines

Romain, don't forget to submit the python patch upstream.

Only uClibc-ng trigger such issue. musl and glibc are ok.
Maybe only uclibc-ng need to be fixed but for now all uclibc based toolchain are affected.

Best regards,
Romain

#5 lore raw

PATCH 1/2 package/python3: uClibc-ng doesn't set errno when encryption method is not available

Hi,
Romain Naour wrote,

Quoted 18 lines

Hello,

Le 12/11/2020 ? 22:31, Peter Korsgaard a ?crit?:

Quoted 15 lines
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

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

Quoted 7 lines
Quoted 3 lines

I've applied this for master to fix the issue for 2020.11, but it would really be good if uClibc-ng could be fixed to set errno to something sensible.

Waldemar, maybe we can just uncomment __set_errno(EINVAL); ?

https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29

Okay,

best regards
Waldemar