Control: tags 1042342 + patch
Control: tags 1042342 + pending

Dear maintainer,

I've pushed a commit using a patch cherry-picked from upstream[0] to fix this 
issue.

If you don't object, I'll make a team upload of yarl (versioned as 1.8.2-2) with
this fix.

Regards,

[0] https://github.com/aio-libs/yarl/pull/882

diff -Nru yarl-1.8.2/debian/changelog yarl-1.8.2/debian/changelog
--- yarl-1.8.2/debian/changelog 2023-01-17 20:02:27.000000000 +0100
+++ yarl-1.8.2/debian/changelog 2023-09-13 17:23:01.000000000 +0200
@@ -1,3 +1,11 @@
+yarl (1.8.2-2) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * d/patches/square_bracket_handling.patch: cherry-picked from upstream.
+    Fixes FTBFS. Closes: #1042342
+
+ -- Michael R. Crusoe <cru...@debian.org>  Wed, 13 Sep 2023 17:23:01 +0200
+
 yarl (1.8.2-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru yarl-1.8.2/debian/patches/series yarl-1.8.2/debian/patches/series
--- yarl-1.8.2/debian/patches/series    2023-01-17 20:02:27.000000000 +0100
+++ yarl-1.8.2/debian/patches/series    2023-09-13 17:21:57.000000000 +0200
@@ -1,3 +1,4 @@
+square_bracket_handling.patch
 0001-do-not-add-changelog-to-long-description.patch
 0002-docs-disable-intersphinx.patch
 0003-docs-disable-sidebar_collapse-option.patch
diff -Nru yarl-1.8.2/debian/patches/square_bracket_handling.patch 
yarl-1.8.2/debian/patches/square_bracket_handling.patch
--- yarl-1.8.2/debian/patches/square_bracket_handling.patch     1970-01-01 
01:00:00.000000000 +0100
+++ yarl-1.8.2/debian/patches/square_bracket_handling.patch     2023-09-13 
17:22:02.000000000 +0200
@@ -0,0 +1,125 @@
+From 5c977b52a33bf58f016e5968934c3fcb8b49b239 Mon Sep 17 00:00:00 2001
+From: Martijn Pieters <m...@zopatista.com>
+Date: Tue, 6 Jun 2023 17:38:47 +0100
+Subject: [PATCH] Correct square bracket handling in URL netloc
+
+- The human representation of usernames and passwords should percent-
+  encode square brackets.
+- Clean up the test suite to remove tests that use invalid hostnames
+  (square brackets in a host name must only be used for IPv6 addresses).
+- Rename the remaining test using IPvFuture address syntax to make this
+  explicit.
+- Drop a test for IPv6 addresses with a zone id; zone id support is
+  controversial and expilictly excluded from the WHATWG URL standard.
+  Zone ids *without percent characters in their name* continue to work
+  as long as urllib.parse.urlsplit() accepts them but this is not
+  something that yarl.URL() needs to support explicitly.
+---
+ CHANGES/876.bugfix.rst    |  1 +
+ tests/test_url.py         | 10 ++--------
+ tests/test_url_parsing.py | 28 ++--------------------------
+ yarl/_url.py              |  4 ++--
+ 4 files changed, 7 insertions(+), 36 deletions(-)
+ create mode 100644 CHANGES/876.bugfix.rst
+
+--- /dev/null
++++ yarl/CHANGES/876.bugfix.rst
+@@ -0,0 +1 @@
++Fixed the human representation of URLs with square brackets in usernames and 
passwords.
+--- yarl.orig/tests/test_url.py
++++ yarl/tests/test_url.py
+@@ -235,12 +235,6 @@
+     assert url.host == url.raw_host
+ 
+ 
+-def test_ipv6_zone():
+-    url = URL("http://[fe80::822a:a8ff:fe49:470c%тест%42]:123";)
+-    assert url.raw_host == "fe80::822a:a8ff:fe49:470c%тест%42"
+-    assert url.host == url.raw_host
+-
+-
+ def test_ipv4_zone():
+     # I'm unsure if it is correct.
+     url = URL("http://1.2.3.4%тест%42:123";)
+@@ -1514,8 +1508,8 @@
+     s = url.human_repr()
+     assert URL(s) == url
+     assert (
+-        s == "http:// !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40[\\]^_`{|}~"
+-        ": !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40[\\]^_`{|}~"
++        s == "http:// !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40%5B\\%5D^_`{|}~"
++        ": !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40%5B\\%5D^_`{|}~"
+         "@хост.домен:8080"
+         "/ !\"%23$%25&'()*+,-./:;<=>%3F@[\\]^_`{|}~"
+         "? !\"%23$%25%26'()*%2B,-./:%3B<%3D>?@[\\]^_`{|}~"
+--- yarl.orig/tests/test_url_parsing.py
++++ yarl/tests/test_url_parsing.py
+@@ -178,14 +178,6 @@
+         assert u.query_string == ""
+         assert u.fragment == ""
+ 
+-    def test_masked_ipv4(self):
+-        u = URL("//[127.0.0.1]/")
+-        assert u.scheme == ""
+-        assert u.host == "127.0.0.1"
+-        assert u.path == "/"
+-        assert u.query_string == ""
+-        assert u.fragment == ""
+-
+     def test_ipv6(self):
+         u = URL("//[::1]/")
+         assert u.scheme == ""
+@@ -194,15 +186,7 @@
+         assert u.query_string == ""
+         assert u.fragment == ""
+ 
+-    def test_strange_ip(self):
+-        u = URL("//[-1]/")
+-        assert u.scheme == ""
+-        assert u.host == "-1"
+-        assert u.path == "/"
+-        assert u.query_string == ""
+-        assert u.fragment == ""
+-
+-    def test_strange_ip_2(self):
++    def test_ipvfuture_address(self):
+         u = URL("//[v1.-1]/")
+         assert u.scheme == ""
+         assert u.host == "v1.-1"
+@@ -210,14 +194,6 @@
+         assert u.query_string == ""
+         assert u.fragment == ""
+ 
+-    def test_strange_ip_3(self):
+-        u = URL("//v1.[::1]/")
+-        assert u.scheme == ""
+-        assert u.host == "::1"
+-        assert u.path == "/"
+-        assert u.query_string == ""
+-        assert u.fragment == ""
+-
+ 
+ class TestPort:
+     def test_canonical(self):
+@@ -320,7 +296,7 @@
+         assert u.fragment == ""
+ 
+     def test_weird_user3(self):
+-        u = URL("//[some]@host")
++        u = URL("//%5Bsome%5D@host")
+         assert u.scheme == ""
+         assert u.user == "[some]"
+         assert u.password is None
+--- yarl.orig/yarl/_url.py
++++ yarl/yarl/_url.py
+@@ -1079,8 +1079,8 @@
+ 
+     def human_repr(self):
+         """Return decoded human readable string for URL representation."""
+-        user = _human_quote(self.user, "#/:?@")
+-        password = _human_quote(self.password, "#/:?@")
++        user = _human_quote(self.user, "#/:?@[]")
++        password = _human_quote(self.password, "#/:?@[]")
+         host = self.host
+         if host:
+             host = self._encode_host(self.host, human=True)

Reply via email to