Subject: [bug#49123] [PATCH 09/24] gnu: python-hyperframe: Update to 6.0.1.

From: Maxime Devos <[email-masked]>
Date: Sat, 24 Jul 2021 17:22:30 +0200

slg via Guix-patches via schreef op za 19-06-2021 om 22:07 [-0300]:
> * gnu/packages/python-web.scm (python-hyperframe): Update to 6.0.1.
> ---
>  gnu/packages/python-web.scm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
> index 86a732fa1b..1a391a5060 100644
> --- a/gnu/packages/python-web.scm
> +++ b/gnu/packages/python-web.scm
> @@ -829,13 +829,13 @@ follow links and submit forms.  It doesn’t do JavaScript.")
>  (define-public python-hyperframe
>    (package
>      (name "python-hyperframe")
> -    (version "5.2.0")
> +    (version "6.0.1")
>      (source
>       (origin
>         (method url-fetch)
>         (uri (pypi-uri "hyperframe" version))
>         (sha256
> -        (base32 "07xlf44l1cw0ghxx46sbmkgzil8vqv8kxwy42ywikiy35izw3xd9"))))
> +        (base32 "055951gyhnjqpa2al52rj34g8yrls9inyn56n7nfkj0x4d300ldf"))))

The package builds reproducibly, and looking at the diff of the tarball
for 5.2.0 and 6.0.1, no malware appears to have been introduced.  The
dependency 'python-hypercorn' now fails to compile (*).  Aside from that, this
patch LGTM.  This build failure seems to be caused by the update of python-h11
(and not python-hyperframe), however.

Greetings,
Maxime.

(*): Relevant part of the build log:

starting phase `check'
============================= test session starts ==============================
platform linux -- Python 3.8.2, pytest-5.3.5, py-1.8.1, pluggy-0.13.1 -- /gnu/store/f8s95qc6dfhl0r45m70hczw5zip0xjxq-python-wrapper-3.8.2/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/tmp/guix-build-python-hypercorn-0.10.2.drv-0/Hypercorn-0.10.2/.hypothesis/examples')
rootdir: /tmp/guix-build-python-hypercorn-0.10.2.drv-0/Hypercorn-0.10.2, inifile: setup.cfg, testpaths: tests
plugins: hypothesis-5.4.1, asyncio-0.10.0, cov-2.8.1, trio-0.6.0
collecting ... collected 170 items

[...]

tests/middleware/test_wsgi.py::test_build_environ_encoding PASSED        [ 44%]
tests/protocol/test_h11.py::test_protocol_send_response Task was destroyed but it is pending!
task: <Task pending name='Task-42' coro=<TCPServer.run() running at /gnu/store/4abyp273l559v0adf65grkvsz3s1d9bc-python-hypercorn-0.10.2/lib/python3.8/site-packages/hypercorn/asyncio/tcp_server.py:79>
wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7ffff58a4610>()]>>
Exception ignored in: <coroutine object TCPServer._read_data at 0x7ffff57f0340>
Traceback (most recent call last):
  File "/gnu/store/4abyp273l559v0adf65grkvsz3s1d9bc-python-hypercorn-0.10.2/lib/python3.8/site-packages/hypercorn/asyncio/tcp_server.py", line 103, in _read_data
    data = await self.reader.read(MAX_RECV)
  File "/tmp/guix-build-python-hypercorn-0.10.2.drv-0/Hypercorn-0.10.2/tests/asyncio/helpers.py", line 21, in read
    return await self.data.get()
  File "/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/asyncio/queues.py", line 165, in get
    getter.cancel()  # Just in case getter is not done yet.
  File "/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/asyncio/base_events.py", line 719, in call_soon
    self._check_closed()
  File "/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/asyncio/base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-45' coro=<_call_later() running at /gnu/store/4abyp273l559v0adf65grkvsz3s1d9bc-python-hypercorn-0.10.2/lib/python3.8/site-packages/hypercorn/asyncio/tcp_server.py:149>
wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7ffff58a4670>()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-53' coro=<TCPServer.run() running at /gnu/store/4abyp273l559v0adf65grkvsz3s1d9bc-python-hypercorn-0.10.2/lib/python3.8/site-packages/hypercorn/asyncio/tcp_server.py:79>
wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7ffff58848e0>()]>>
Exception ignored in: <coroutine object TCPServer._read_data at 0x7ffff57b0940>
Traceback (most recent call last):
  File "/gnu/store/4abyp273l559v0adf65grkvsz3s1d9bc-python-hypercorn-0.10.2/lib/python3.8/site-packages/hypercorn/asyncio/tcp_server.py", line 103, in _read_data
    data = await self.reader.read(MAX_RECV)
  File "/tmp/guix-build-python-hypercorn-0.10.2.drv-0/Hypercorn-0.10.2/tests/asyncio/helpers.py", line 21, in read
    return await self.data.get()
  File "/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/asyncio/queues.py", line 165, in get
    getter.cancel()  # Just in case getter is not done yet.
  File "/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/asyncio/base_events.py", line 719, in call_soon
    self._check_closed()
  File "/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/asyncio/base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-55' coro=<H2Protocol.send_task() running at /gnu/store/4abyp273l559v0adf65grkvsz3s1d9bc-python-hypercorn-0.10.2/lib/python3.8/site-packages/hypercorn/protocol/h2.py:144> 
wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7ffff58fc790>()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-60' coro=<_call_later() running at /gnu/store/4abyp273l559v0adf65grkvsz3s1d9bc-python-hypercorn-0.10.2/lib/python3.8/site-packages/hypercorn/asyncio/tcp_server.py:149>
wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7ffff589b220>()]>>
FAILED           [ 45%]
tests/protocol/test_h11.py::test_protocol_send_data PASSED               [ 45%]
tests/protocol/test_h11.py::test_protocol_send_body FAILED               [ 46%]
tests/protocol/test_h11.py::test_protocol_send_stream_closed[True-expected0] PASSED [ 47%]
tests/protocol/test_h11.py::test_protocol_send_stream_closed[False-expected1] PASSED [ 47%]
tests/protocol/test_h11.py::test_protocol_instant_recycle PASSED         [ 48%]
tests/protocol/test_h11.py::test_protocol_send_end_data PASSED           [ 48%]
tests/protocol/test_h11.py::test_protocol_handle_closed PASSED           [ 49%]
tests/protocol/test_h11.py::test_protocol_handle_request PASSED          [ 50%]
tests/protocol/test_h11.py::test_protocol_handle_protocol_error PASSED   [ 50%]
tests/protocol/test_h11.py::test_protocol_handle_send_client_error PASSED [ 51%]
tests/protocol/test_h11.py::test_protocol_handle_pipelining PASSED       [ 51%]
tests/protocol/test_h11.py::test_protocol_handle_continue_request PASSED [ 52%]
tests/protocol/test_h11.py::test_protocol_handle_max_incomplete PASSED   [ 52%]
tests/protocol/test_h11.py::test_protocol_handle_h2c_upgrade PASSED      [ 53%]
tests/protocol/test_h11.py::test_protocol_handle_h2_prior PASSED         [ 54%]
tests/protocol/test_h11.py::test_protocol_handle_data_post_response PASSED [ 54%]
tests/protocol/test_h11.py::test_protocol_handle_data_post_end PASSED    [ 55%]
tests/protocol/test_h11.py::test_protocol_handle_data_post_close PASSED  [ 55%]
tests/protocol/test_h2.py::test_stream_buffer_push_and_pop PASSED        [ 56%]
tests/protocol/test_h2.py::test_stream_buffer_drain PASSED               [ 57%]
tests/protocol/test_h2.py::test_stream_buffer_closed PASSED              [ 57%]
tests/protocol/test_h2.py::test_stream_buffer_complete PASSED            [ 58%]
tests/protocol/test_h2.py::test_protocol_handle_protocol_error PASSED    [ 58%]
tests/protocol/test_http_stream.py::test_handle_request_http_1[1.0] PASSED [ 59%]
tests/protocol/test_http_stream.py::test_handle_request_http_1[1.1] PASSED [ 60%]
tests/protocol/test_http_stream.py::test_handle_request_http_2 PASSED    [ 60%]
tests/protocol/test_http_stream.py::test_handle_body PASSED              [ 61%]
tests/protocol/test_http_stream.py::test_handle_end_body PASSED          [ 61%]
tests/protocol/test_http_stream.py::test_handle_closed PASSED            [ 62%]
tests/protocol/test_http_stream.py::test_send_response PASSED            [ 62%]
tests/protocol/test_http_stream.py::test_invalid_server_name PASSED      [ 63%]
tests/protocol/test_http_stream.py::test_send_push PASSED                [ 64%]
tests/protocol/test_http_stream.py::test_send_app_error PASSED           [ 64%]
tests/protocol/test_http_stream.py::test_send_invalid_message_given_state[ASGIHTTPState.REQUEST-not_a_real_type] PASSED [ 65%]
tests/protocol/test_http_stream.py::test_send_invalid_message_given_state[ASGIHTTPState.RESPONSE-http.response.start] PASSED [ 65%]
tests/protocol/test_http_stream.py::test_send_invalid_message_given_state[ASGIHTTPState.CLOSED-http.response.start] PASSED [ 66%]
tests/protocol/test_http_stream.py::test_send_invalid_message_given_state[ASGIHTTPState.CLOSED-http.response.body] PASSED [ 67%]
tests/protocol/test_http_stream.py::test_send_invalid_message[201 NO CONTENT-headers0-] PASSED [ 67%]
tests/protocol/test_http_stream.py::test_send_invalid_message[200-headers1-] PASSED [ 68%]
tests/protocol/test_http_stream.py::test_send_invalid_message[200-headers2-Body] PASSED [ 68%]
tests/protocol/test_http_stream.py::test_stream_idle PASSED              [ 69%]
tests/protocol/test_http_stream.py::test_closure PASSED                  [ 70%]
tests/protocol/test_http_stream.py::test_closed_app_send_noop PASSED     [ 70%]
tests/protocol/test_ws_stream.py::test_buffer PASSED                     [ 71%]
tests/protocol/test_ws_stream.py::test_buffer_frame_too_large PASSED     [ 71%]
tests/protocol/test_ws_stream.py::test_buffer_mixed_types[data0] PASSED  [ 72%]
tests/protocol/test_ws_stream.py::test_buffer_mixed_types[data1] PASSED  [ 72%]
tests/protocol/test_ws_stream.py::test_handshake_validity[headers0-1.0-False] PASSED [ 73%]
tests/protocol/test_ws_stream.py::test_handshake_validity[headers1-1.1-True] PASSED [ 74%]
tests/protocol/test_ws_stream.py::test_handshake_validity[headers2-1.1-False] PASSED [ 74%]
tests/protocol/test_ws_stream.py::test_handshake_validity[headers3-1.1-False] PASSED [ 75%]
tests/protocol/test_ws_stream.py::test_handshake_validity[headers4-2-True] PASSED [ 75%]
tests/protocol/test_ws_stream.py::test_handshake_validity[headers5-2-False] PASSED [ 76%]
tests/protocol/test_ws_stream.py::test_handshake_accept_http1 PASSED     [ 77%]
tests/protocol/test_ws_stream.py::test_handshake_accept_http2 PASSED     [ 77%]
tests/protocol/test_ws_stream.py::test_handle_request PASSED             [ 78%]
tests/protocol/test_ws_stream.py::test_handle_connection PASSED          [ 78%]
tests/protocol/test_ws_stream.py::test_handle_closed PASSED              [ 79%]
tests/protocol/test_ws_stream.py::test_send_accept PASSED                [ 80%]
tests/protocol/test_ws_stream.py::test_send_reject PASSED                [ 80%]
tests/protocol/test_ws_stream.py::test_invalid_server_name PASSED        [ 81%]
tests/protocol/test_ws_stream.py::test_send_app_error_handshake PASSED   [ 81%]
tests/protocol/test_ws_stream.py::test_send_app_error_connected PASSED   [ 82%]
tests/protocol/test_ws_stream.py::test_send_connection PASSED            [ 82%]
tests/protocol/test_ws_stream.py::test_pings PASSED                      [ 83%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.HANDSHAKE-websocket.send] PASSED [ 84%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.RESPONSE-websocket.accept] PASSED [ 84%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.RESPONSE-websocket.send] PASSED [ 85%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.CONNECTED-websocket.http.response.start] PASSED [ 85%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.CONNECTED-websocket.http.response.body] PASSED [ 86%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.CLOSED-websocket.send] PASSED [ 87%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.CLOSED-websocket.http.response.start] PASSED [ 87%]
tests/protocol/test_ws_stream.py::test_send_invalid_message_given_state[ASGIWebsocketState.CLOSED-websocket.http.response.body] PASSED [ 88%]
tests/protocol/test_ws_stream.py::test_send_invalid_http_message[201 NO CONTENT-headers0-] PASSED [ 88%]
tests/protocol/test_ws_stream.py::test_send_invalid_http_message[200-headers1-] PASSED [ 89%]
tests/protocol/test_ws_stream.py::test_send_invalid_http_message[200-headers2-Body] PASSED [ 90%]
tests/protocol/test_ws_stream.py::test_stream_idle[ASGIWebsocketState.HANDSHAKE-False] PASSED [ 90%]
tests/protocol/test_ws_stream.py::test_stream_idle[ASGIWebsocketState.CONNECTED-False] PASSED [ 91%]
tests/protocol/test_ws_stream.py::test_stream_idle[ASGIWebsocketState.RESPONSE-False] PASSED [ 91%]
tests/protocol/test_ws_stream.py::test_stream_idle[ASGIWebsocketState.CLOSED-True] PASSED [ 92%]
tests/protocol/test_ws_stream.py::test_stream_idle[ASGIWebsocketState.HTTPCLOSED-True] PASSED [ 92%]
tests/protocol/test_ws_stream.py::test_closure PASSED                    [ 93%]
tests/protocol/test_ws_stream.py::test_closed_app_send_noop PASSED       [ 94%]
tests/trio/test_keep_alive.py::test_http1_keep_alive_pre_request PASSED  [ 94%]
tests/trio/test_keep_alive.py::test_http1_keep_alive_during PASSED       [ 95%]
tests/trio/test_keep_alive.py::test_http1_keep_alive PASSED              [ 95%]
tests/trio/test_keep_alive.py::test_http1_keep_alive_pipelining PASSED   [ 96%]
tests/trio/test_lifespan.py::test_startup_timeout_error PASSED           [ 97%]
tests/trio/test_lifespan.py::test_startup_failure PASSED                 [ 97%]
tests/trio/test_sanity.py::test_http1_request PASSED                     [ 98%]
tests/trio/test_sanity.py::test_http1_websocket PASSED                   [ 98%]
tests/trio/test_sanity.py::test_http2_request PASSED                     [ 99%]
tests/trio/test_sanity.py::test_http2_websocket PASSED                   [100%]

=================================== FAILURES ===================================
_________________________ test_protocol_send_response __________________________

protocol = <hypercorn.protocol.h11.H11Protocol object at 0x7ffff5802730>

    @pytest.mark.asyncio
    async def test_protocol_send_response(protocol: H11Protocol) -> None:
        await protocol.stream_send(Response(stream_id=1, status_code=201, headers=[]))
        protocol.send.assert_called()
>       assert protocol.send.call_args_list == [
            call(
                RawData(
                    data=(
                        b"HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\n"
                        b"server: hypercorn-h11\r\nconnection: close\r\n\r\n"
                    )
                )
            )
        ]
E       AssertionError: assert [call(RawData(data=b'HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nConnection: close\r\n\r\n', address=None))] ==
[call(RawData(data=b'HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nconnection: close\r\n\r\n', address=None))]
E         At index 0 diff: call(RawData(data=b'HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nConnection: close\r\n\r\n', address=None)) !=
call(RawData(data=b'HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nconnection: close\r\n\r\n', address=None))
E         Full diff:
E         - [call(RawData(data=b'HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nConnection: close\r\n\r\n', address=None))]
E         ?                                                                                                       ^
E         + [call(RawData(data=b'HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nconnection: close\r\n\r\n', address=None))]
E         ?                                                                                                       ^

protocol   = <hypercorn.protocol.h11.H11Protocol object at 0x7ffff5802730>

tests/protocol/test_h11.py:42: AssertionError
___________________________ test_protocol_send_body ____________________________

protocol = <hypercorn.protocol.h11.H11Protocol object at 0x7ffff4661ee0>

    @pytest.mark.asyncio
    async def test_protocol_send_body(protocol: H11Protocol) -> None:
        await protocol.handle(
            RawData(data=b"GET / HTTP/1.1\r\nHost: hypercorn\r\nConnection: close\r\n\r\n")
        )
        await protocol.stream_send(
            Response(stream_id=1, status_code=200, headers=[(b"content-length", b"5")])
        )
        await protocol.stream_send(Body(stream_id=1, data=b"hello"))
        protocol.send.assert_called()
>       assert protocol.send.call_args_list == [
            call(
                RawData(
                    data=b"HTTP/1.1 200 \r\ncontent-length: 5\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nconnection: close\r\n\r\n"  # noqa: E501
                )
            ),
            call(RawData(data=b"hello")),
        ]
E       AssertionError: assert [call(RawData(data=b'HTTP/1.1 200 \r\ncontent-length: 5\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nConnection: close\r\n\r\n', address=None)),\n
call(RawData(data=b'hello', address=None))] == [call(RawData(data=b'HTTP/1.1 200 \r\ncontent-length: 5\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nconnection: close\r\n\r\n',
address=None)),\n call(RawData(data=b'hello', address=None))]
E         At index 0 diff: call(RawData(data=b'HTTP/1.1 200 \r\ncontent-length: 5\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nConnection: close\r\n\r\n', address=None)) !=
call(RawData(data=b'HTTP/1.1 200 \r\ncontent-length: 5\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nconnection: close\r\n\r\n', address=None))
E         Full diff:
E           [
E         -  call(RawData(data=b'HTTP/1.1 200 \r\ncontent-length: 5\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nConnection: close\r\n\r\n', address=None)),
E         ?                                                                                                                            ^
E         +  call(RawData(data=b'HTTP/1.1 200 \r\ncontent-length: 5\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\nconnection: close\r\n\r\n', address=None)),
E         ?                                                                                                                            ^
E            call(RawData(data=b'hello', address=None)),
E           ]

protocol   = <hypercorn.protocol.h11.H11Protocol object at 0x7ffff4661ee0>

tests/protocol/test_h11.py:71: AssertionError
=============================== warnings summary ===============================
tests/protocol/test_h2.py::test_protocol_handle_protocol_error
  /gnu/store/436410968f8mpdlsn1pw456mpgwmbh4m-python-pytest-5.3.5/lib/python3.8/site-packages/_pytest/runner.py:105: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    item.funcargs = None

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=================== 2 failed, 168 passed, 1 warning in 2.69s ===================
command "pytest" "-vv" failed with status 1
builder for `/gnu/store/wbp6s3l9wspmi6lbkhzhx5m93lqrfdm2-python-hypercorn-0.10.2.drv' failed with exit code 1
build of /gnu/store/wbp6s3l9wspmi6lbkhzhx5m93lqrfdm2-python-hypercorn-0.10.2.drv failed
View build log at '/var/log/guix/drvs/wb/p6s3l9wspmi6lbkhzhx5m93lqrfdm2-python-hypercorn-0.10.2.drv.bz2'.
guix build: error: build of `/gnu/store/wbp6s3l9wspmi6lbkhzhx5m93lqrfdm2-python-hypercorn-0.10.2.drv' failed
sylviidae@butterfly ~/guix/git/guix [env]$