python3-gevent: fix syntax error in cve patch
PATCH 1/2 python3-gevent: fix syntax error in cve patch
Signed-off-by Gyorgy Sarvari <[email protected]>
--- .../recipes-devtools/python/python3-gevent/CVE-2023-41419.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-python/recipes-devtools/python/python3-gevent/CVE-2023-41419.patch +1 -1
@@ -356,7 +356,7 @@ index 0ebe095..078398a 100644 + # we can't be sure we can synchronize and properly parse the next + # request. + raise -+ except socket.error ++ except socket.error: + # Don't let socket exceptions during discarding # input override any exception that may have been # raised by the application, such as our own _InvalidClientInput.
PATCH 2/2 python3-gunicorn: add patch work with geventlet
python3-gunicorn depends on python3-geventlet. geventlet has made some breaking changes (which is part of meta-oe/kirkstone), however gunicorn wasn't adapted to this, and it broke some features (at least ptests).
This patch backports the change that adapts gunicorn to the used version of geventlet.
Signed-off-by Gyorgy Sarvari <[email protected]>
--- ...et-worker-ALREADY_HANDLED-WSGI_LOCAL.patch | 54 +++++++++++++++++++ .../python/python3-gunicorn_20.1.0.bb | 3 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 meta-python/recipes-devtools/python/python3-gunicorn/eventlet-worker-ALREADY_HANDLED-WSGI_LOCAL.patch
meta-python/recipes-devtools/python/python3-gunicorn/eventlet-worker-ALREADY_HANDLED-WSGI_LOCAL.patch new file +54 -0
@@ -0,0 +1,54 @@ +From 6a8ebb4844b2f28596ffe7421eb9f7d08c8dc4d8 Mon Sep 17 00:00:00 2001 +From: Sergey Shepelev <[email protected]> +Date: Thu, 6 May 2021 12:54:06 +0300 +Subject: [PATCH] eventlet worker: ALREADY_HANDLED -> WSGI_LOCAL + +Eventlet v0.30.3+ removed wsgi.ALREADY_HANDLED in favor of +`wsgi.WSGI_LOCAL.already_handled: bool` + +Sorry, this breaking change happened during only patch +version increase 0.30.2 -> 0.30.3 + +https://github.com/eventlet/eventlet/issues/543 +https://github.com/eventlet/eventlet/pull/544 + +Upstream-Status: Backport [https://github.com/benoitc/gunicorn/commit/6a8ebb4844b2f28596ffe7421eb9f7d08c8dc4d8] +Signed-off-by: Gyorgy Sarvari <[email protected]> + +--- + gunicorn/workers/geventlet.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/gunicorn/workers/geventlet.py b/gunicorn/workers/geventlet.py +index ffdb206c0..ea82f3d62 100644 +--- a/gunicorn/workers/geventlet.py ++++ b/gunicorn/workers/geventlet.py +@@ -17,11 +17,16 @@ + + from eventlet import hubs, greenthread + from eventlet.greenio import GreenSocket +-from eventlet.wsgi import ALREADY_HANDLED as EVENTLET_ALREADY_HANDLED ++import eventlet.wsgi + import greenlet + + from gunicorn.workers.base_async import AsyncWorker + ++# ALREADY_HANDLED is removed in 0.30.3+ now it's `WSGI_LOCAL.already_handled: bool` ++# https://github.com/eventlet/eventlet/pull/544 ++EVENTLET_WSGI_LOCAL = getattr(eventlet.wsgi, "WSGI_LOCAL", None) ++EVENTLET_ALREADY_HANDLED = getattr(eventlet.wsgi, "ALREADY_HANDLED", None) ++ + + def _eventlet_socket_sendfile(self, file, offset=0, count=None): + # Based on the implementation in gevent which in turn is slightly +@@ -125,6 +130,10 @@ def patch(self): + patch_sendfile() + + def is_already_handled(self, respiter): ++ # eventlet >= 0.30.3 ++ if getattr(EVENTLET_WSGI_LOCAL, "already_handled", None): ++ raise StopIteration() ++ # eventlet < 0.30.3 + if respiter == EVENTLET_ALREADY_HANDLED: + raise StopIteration() + return super().is_already_handled(respiter)
meta-python/recipes-devtools/python/python3-gunicorn_20.1.0.bb +2 -1
@@ -9,12 +9,13 @@ inherit pypi setuptools3 ptest SRC_URI += " \ file://run-ptest \ + file://eventlet-worker-ALREADY_HANDLED-WSGI_LOCAL.patch \ " RDEPENDS:${PN}-ptest += " \ ${PYTHON_PN}-eventlet \ ${PYTHON_PN}-gevent \ - ${PYTHON_PN}-pytest \ + ${PYTHON_PN}-pytest \ " do_install_ptest() {