- Add gh122136-test_asyncio-kernel-buffer-data.patch fixing

gh#python/cpython#122136 (changes in kernel provide different
  amount of data in the socket buffers).
- Remove skip_test_abort_clients.patch, which is not needed any
  more.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python313?expand=0&rev=41
This commit is contained in:
Matej Cepl 2024-08-29 14:47:46 +00:00 committed by Git OBS Bridge
parent 0a0564a0e9
commit 59a4965535
4 changed files with 60 additions and 19 deletions

View File

@ -0,0 +1,48 @@
From 235fbc05dcbca5cb5f7f0cd836317b8426e33243 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <encukou@gmail.com>
Date: Wed, 28 Aug 2024 22:36:42 +0200
Subject: [PATCH] gh-122136: test_asyncio: Don't fail if the kernel buffers
more data than advertised (GH-123423) (cherry picked from commit
b379f1b26c1e89c8e9160b4dede61b980cc77be6)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
---
Lib/test/test_asyncio/test_server.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/Lib/test/test_asyncio/test_server.py b/Lib/test/test_asyncio/test_server.py
index 4ca8a166a0f1a1..60a40cc8349fed 100644
--- a/Lib/test/test_asyncio/test_server.py
+++ b/Lib/test/test_asyncio/test_server.py
@@ -227,7 +227,7 @@ async def serve(rd, wr):
(s_rd, s_wr) = await fut
- # Limit the socket buffers so we can reliably overfill them
+ # Limit the socket buffers so we can more reliably overfill them
s_sock = s_wr.get_extra_info('socket')
s_sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 65536)
c_sock = c_wr.get_extra_info('socket')
@@ -242,10 +242,18 @@ async def serve(rd, wr):
await asyncio.sleep(0)
# Get the writer in a waiting state by sending data until the
- # socket buffers are full on both server and client sockets and
- # the kernel stops accepting more data
- s_wr.write(b'a' * c_sock.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF))
- s_wr.write(b'a' * s_sock.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF))
+ # kernel stops accepting more data in the send buffer.
+ # gh-122136: getsockopt() does not reliably report the buffer size
+ # available for message content.
+ # We loop until we start filling up the asyncio buffer.
+ # To avoid an infinite loop we cap at 10 times the expected value
+ c_bufsize = c_sock.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF)
+ s_bufsize = s_sock.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF)
+ for i in range(10):
+ s_wr.write(b'a' * c_bufsize)
+ s_wr.write(b'a' * s_bufsize)
+ if s_wr.transport.get_write_buffer_size() > 0:
+ break
self.assertNotEqual(s_wr.transport.get_write_buffer_size(), 0)
task = asyncio.create_task(srv.wait_closed())

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Aug 29 14:46:39 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Add gh122136-test_asyncio-kernel-buffer-data.patch fixing
gh#python/cpython#122136 (changes in kernel provide different
amount of data in the socket buffers).
- Remove skip_test_abort_clients.patch, which is not needed any
more.
-------------------------------------------------------------------
Wed Aug 28 16:54:34 UTC 2024 - Matej Cepl <mcepl@cepl.eu>

View File

@ -177,9 +177,6 @@ Patch09: skip-test_pyobject_freed_is_freed.patch
# PATCH-FIX-SLE fix_configure_rst.patch bpo#43774 mcepl@suse.com
# remove duplicate link targets and make documentation with old Sphinx in SLE
Patch10: fix_configure_rst.patch
# PATCH-FIX-UPSTREAM skip_test_abort_clients.patch gh#python/cpython#122136 mcepl@suse.com
# Not yet fixed failing test
Patch11: skip_test_abort_clients.patch
# PATCH-FIX-UPSTREAM CVE-2024-6923-email-hdr-inject.patch bsc#1228780 mcepl@suse.com
# prevent email header injection, patch from gh#python/cpython!122608
Patch12: CVE-2024-6923-email-hdr-inject.patch
@ -189,6 +186,9 @@ Patch13: bso1227999-reproducible-builds.patch
# PATCH-FIX-UPSTREAM CVE-2024-8088-inf-loop-zipfile_Path.patch bsc#1229704 mcepl@suse.com
# avoid denial of service in zipfile
Patch14: CVE-2024-8088-inf-loop-zipfile_Path.patch
# PATCH-FIX-UPSTREAM gh122136-test_asyncio-kernel-buffer-data.patch gh#python/cpython#122136 mcepl@suse.com
# test.test_asyncio.test_server.TestServer2.test_abort_clients fails because of changes in the kernel
Patch15: gh122136-test_asyncio-kernel-buffer-data.patch
BuildRequires: autoconf-archive
BuildRequires: automake
BuildRequires: fdupes

View File

@ -1,16 +0,0 @@
---
Lib/test/test_asyncio/test_server.py | 1 +
1 file changed, 1 insertion(+)
Index: Python-3.13.0rc1/Lib/test/test_asyncio/test_server.py
===================================================================
--- Python-3.13.0rc1.orig/Lib/test/test_asyncio/test_server.py
+++ Python-3.13.0rc1/Lib/test/test_asyncio/test_server.py
@@ -212,6 +212,7 @@ class TestServer2(unittest.IsolatedAsync
await asyncio.sleep(0)
self.assertTrue(task.done())
+ @unittest.skip('Failing test gh#python/cpython#122136')
async def test_abort_clients(self):
async def serve(rd, wr):
fut.set_result((rd, wr))