From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 08D3A158087 for ; Thu, 20 Jan 2022 12:36:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 375442BC009; Thu, 20 Jan 2022 12:36:08 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B66B3E077A for ; Thu, 20 Jan 2022 12:36:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DDF2A343346 for ; Thu, 20 Jan 2022 12:36:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 797692A3 for ; Thu, 20 Jan 2022 12:36:04 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1642682131.43fd8ae135f9d301246b5450ddf521138158e91a.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/uwsgi/, www-servers/uwsgi/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: www-servers/uwsgi/files/uwsgi-2.0.19.1-py310-fix.patch www-servers/uwsgi/files/uwsgi-2.0.19.1-pynode-compile.patch www-servers/uwsgi/uwsgi-2.0.19.1-r107.ebuild www-servers/uwsgi/uwsgi-2.0.19.1-r108.ebuild X-VCS-Directories: www-servers/uwsgi/files/ www-servers/uwsgi/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 43fd8ae135f9d301246b5450ddf521138158e91a X-VCS-Branch: master Date: Thu, 20 Jan 2022 12:36:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 61e66e2a-fd5d-4ac5-9bac-1aa9694f80e5 X-Archives-Hash: 3dee566f6322221b6f0d3f72e1736415 commit: 43fd8ae135f9d301246b5450ddf521138158e91a Author: Thomas Bettler gmail com> AuthorDate: Tue Dec 14 19:51:20 2021 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jan 20 12:35:31 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43fd8ae1 www-servers/uwsgi: fix python 3.10 (upstream patches) [sam: revbump to propagate fixes.] Closes: https://bugs.gentoo.org/829204 Closes: https://github.com/gentoo/gentoo/pull/23301 Signed-off-by: Thomas Bettler gmail.com> Signed-off-by: Sam James gentoo.org> .../uwsgi/files/uwsgi-2.0.19.1-py310-fix.patch | 36 ++++++ .../files/uwsgi-2.0.19.1-pynode-compile.patch | 123 +++++++++++++++++++++ ...19.1-r107.ebuild => uwsgi-2.0.19.1-r108.ebuild} | 5 + 3 files changed, 164 insertions(+) diff --git a/www-servers/uwsgi/files/uwsgi-2.0.19.1-py310-fix.patch b/www-servers/uwsgi/files/uwsgi-2.0.19.1-py310-fix.patch new file mode 100644 index 000000000000..8fe64d1b3d3b --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi-2.0.19.1-py310-fix.patch @@ -0,0 +1,36 @@ +https://github.com/unbit/uwsgi/commit/c8c4bd1b5439217f2cb2f146caf162de69638bc1 + +From c8c4bd1b5439217f2cb2f146caf162de69638bc1 Mon Sep 17 00:00:00 2001 +From: Cyrille Pontvieux +Date: Thu, 1 Jul 2021 12:45:29 +0200 +Subject: [PATCH] Allow to compile on Python versions with more that two digits + (Python 3.10) + +--- + plugins/python/pyloader.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/plugins/python/pyloader.c b/plugins/python/pyloader.c +index d8ab6fe35..3a1465d67 100644 +--- a/plugins/python/pyloader.c ++++ b/plugins/python/pyloader.c +@@ -22,7 +22,7 @@ PyMethodDef uwsgi_eventfd_write_method[] = { {"uwsgi_eventfd_write", py_eventfd_ + void set_dyn_pyhome(char *home, uint16_t pyhome_len) { + + +- char venv_version[15]; ++ char venv_version[30]; + PyObject *site_module; + + PyObject *pysys_dict = get_uwsgi_pydict("sys"); +@@ -45,8 +45,8 @@ void set_dyn_pyhome(char *home, uint16_t pyhome_len) { + PyDict_SetItemString(pysys_dict, "prefix", venv_path); + PyDict_SetItemString(pysys_dict, "exec_prefix", venv_path); + +- venv_version[14] = 0; +- if (snprintf(venv_version, 15, "/lib/python%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION) == -1) { ++ bzero(venv_version, 30); ++ if (snprintf(venv_version, 30, "/lib/python%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION) == -1) { + return; + } + diff --git a/www-servers/uwsgi/files/uwsgi-2.0.19.1-pynode-compile.patch b/www-servers/uwsgi/files/uwsgi-2.0.19.1-pynode-compile.patch new file mode 100644 index 000000000000..6bcf04ae2bc3 --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi-2.0.19.1-pynode-compile.patch @@ -0,0 +1,123 @@ +https://github.com/unbit/uwsgi/commit/8c890c84604a0477b46a66eab8a620733f596cc8 + +From 8c890c84604a0477b46a66eab8a620733f596cc8 Mon Sep 17 00:00:00 2001 +From: Riccardo Magliocchetti +Date: Sun, 22 Nov 2020 18:20:19 +0100 +Subject: [PATCH] plugins/python: use Py_CompileString + +Instead of the deprecated PyParser_SimpleParseString, PyParser_SimpleParseFile +and PyNode_Compile. +While at it fixup a possible null pointer dereference when uwsgi_open_and_read +returns an empty string. + +See https://bugs.python.org/issue40939 +--- + plugins/python/pyloader.c | 12 +----------- + plugins/python/python_plugin.c | 36 ++++++++++++++-------------------- + 2 files changed, 16 insertions(+), 32 deletions(-) + +diff --git a/plugins/python/pyloader.c b/plugins/python/pyloader.c +index a63c375b5..d8ab6fe35 100644 +--- a/plugins/python/pyloader.c ++++ b/plugins/python/pyloader.c +@@ -757,25 +757,15 @@ PyObject *uwsgi_eval_loader(void *arg1) { + + PyObject *wsgi_eval_module, *wsgi_eval_callable = NULL; + +- struct _node *wsgi_eval_node = NULL; + PyObject *wsgi_compiled_node; + +- wsgi_eval_node = PyParser_SimpleParseString(code, Py_file_input); +- if (!wsgi_eval_node) { +- PyErr_Print(); +- uwsgi_log( "failed to parse code\n"); +- exit(UWSGI_FAILED_APP_CODE); +- } +- +- wsgi_compiled_node = (PyObject *) PyNode_Compile(wsgi_eval_node, "uwsgi_eval_config"); +- ++ wsgi_compiled_node = Py_CompileString(code, "uwsgi_eval_config", Py_file_input); + if (!wsgi_compiled_node) { + PyErr_Print(); + uwsgi_log( "failed to compile eval code\n"); + exit(UWSGI_FAILED_APP_CODE); + } + +- + wsgi_eval_module = PyImport_ExecCodeModule("uwsgi_eval_config", wsgi_compiled_node); + if (!wsgi_eval_module) { + PyErr_Print(); +diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c +index 37d0b7bbf..79f29d43c 100644 +--- a/plugins/python/python_plugin.c ++++ b/plugins/python/python_plugin.c +@@ -473,8 +473,7 @@ UWSGI_RELEASE_GIL + + PyObject *uwsgi_pyimport_by_filename(char *name, char *filename) { + +- FILE *pyfile; +- struct _node *py_file_node = NULL; ++ char *pycontent; + PyObject *py_compiled_node, *py_file_module; + int is_a_package = 0; + struct stat pystat; +@@ -483,7 +482,7 @@ PyObject *uwsgi_pyimport_by_filename(char *name, char *filename) { + + if (!uwsgi_check_scheme(filename)) { + +- pyfile = fopen(filename, "r"); ++ FILE *pyfile = fopen(filename, "r"); + if (!pyfile) { + uwsgi_log("failed to open python file %s\n", filename); + return NULL; +@@ -507,37 +506,32 @@ PyObject *uwsgi_pyimport_by_filename(char *name, char *filename) { + } + } + +- py_file_node = PyParser_SimpleParseFile(pyfile, real_filename, Py_file_input); +- if (!py_file_node) { +- PyErr_Print(); +- uwsgi_log("failed to parse file %s\n", real_filename); +- if (is_a_package) ++ fclose(pyfile); ++ pycontent = uwsgi_simple_file_read(real_filename); ++ ++ if (!pycontent) { ++ if (is_a_package) { + free(real_filename); +- fclose(pyfile); ++ } ++ uwsgi_log("no data read from file %s\n", real_filename); + return NULL; + } + +- fclose(pyfile); + } + else { + size_t pycontent_size = 0; +- char *pycontent = uwsgi_open_and_read(filename, &pycontent_size, 1, NULL); ++ pycontent = uwsgi_open_and_read(filename, &pycontent_size, 1, NULL); + +- if (pycontent) { +- py_file_node = PyParser_SimpleParseString(pycontent, Py_file_input); +- if (!py_file_node) { +- PyErr_Print(); +- uwsgi_log("failed to parse url %s\n", real_filename); +- return NULL; +- } ++ if (!pycontent) { ++ uwsgi_log("no data read from url %s\n", real_filename); ++ return NULL; + } + } + +- py_compiled_node = (PyObject *) PyNode_Compile(py_file_node, real_filename); +- ++ py_compiled_node = Py_CompileString(pycontent, real_filename, Py_file_input); + if (!py_compiled_node) { + PyErr_Print(); +- uwsgi_log("failed to compile python file %s\n", real_filename); ++ uwsgi_log("failed to compile %s\n", real_filename); + return NULL; + } + diff --git a/www-servers/uwsgi/uwsgi-2.0.19.1-r107.ebuild b/www-servers/uwsgi/uwsgi-2.0.19.1-r108.ebuild similarity index 99% rename from www-servers/uwsgi/uwsgi-2.0.19.1-r107.ebuild rename to www-servers/uwsgi/uwsgi-2.0.19.1-r108.ebuild index c418baa38343..c547c3316a71 100644 --- a/www-servers/uwsgi/uwsgi-2.0.19.1-r107.ebuild +++ b/www-servers/uwsgi/uwsgi-2.0.19.1-r108.ebuild @@ -128,6 +128,11 @@ RDEPEND="${CDEPEND} uwsgi_plugins_rrdtool? ( net-analyzer/rrdtool )" BDEPEND="virtual/pkgconfig" +PATCHES=( + "${FILESDIR}/${P}-py310-fix.patch" + "${FILESDIR}/${P}-pynode-compile.patch" +) + S="${WORKDIR}/${MY_P}" src_unpack() {