summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/dnspython/files/dnspython-2.5.0-musl-test.patch')
-rw-r--r--dev-python/dnspython/files/dnspython-2.5.0-musl-test.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/dev-python/dnspython/files/dnspython-2.5.0-musl-test.patch b/dev-python/dnspython/files/dnspython-2.5.0-musl-test.patch
new file mode 100644
index 000000000000..a5aec3378fdd
--- /dev/null
+++ b/dev-python/dnspython/files/dnspython-2.5.0-musl-test.patch
@@ -0,0 +1,67 @@
+From 1b22985f2d67b6dd43259e3c6b853498f1cff712 Mon Sep 17 00:00:00 2001
+From: Bob Halley <halley@dnspython.org>
+Date: Sat, 27 Jan 2024 12:38:03 -0800
+Subject: [PATCH] In tests, work around musl libc and docker issues.
+
+Specifically: musl libc's getaddrinfo behavior always returns
+a canonical name.
+
+Docker's resolver proxy doesn't do dangling CNAMEs correctly
+and also answers NXDOMAIN in some cases where it should say
+no error, no data.
+---
+ tests/test_async.py | 14 +++++++++++---
+ tests/test_resolver.py | 21 +++++++++++++++------
+ tests/test_resolver_override.py | 19 ++++++++++++-------
+ tests/util.py | 10 +++++++++-
+ 4 files changed, 47 insertions(+), 17 deletions(-)
+
+diff --git a/tests/test_resolver_override.py b/tests/test_resolver_override.py
+index aed7a53d..be9e53f2 100644
+--- a/tests/test_resolver_override.py
++++ b/tests/test_resolver_override.py
+@@ -69,7 +69,7 @@ def test_override(self):
+ dns.resolver.restore_system_resolver()
+ self.assertTrue(socket.getaddrinfo is dns.resolver._original_getaddrinfo)
+
+- def equivalent_info(self, a, b):
++ def equivalent_info(self, a, b, q):
+ if len(a) != len(b):
+ return False
+ for x in a:
+@@ -78,16 +78,21 @@ def equivalent_info(self, a, b):
+ # looking for a zero protocol.
+ y = (x[0], x[1], 0, x[3], x[4])
+ if y not in b:
+- print("NOT EQUIVALENT")
+- print(a)
+- print(b)
+- return False
++ # musl libc insists on always providing a canonical name, so
++ # accept that too.
++ y = (x[0], x[1], x[2], q, x[4])
++ if y not in b:
++ print("NOT EQUIVALENT")
++ print(a)
++ print(b)
++ return False
+ return True
+
+ def equivalent(self, *args, **kwargs):
++ q = args[0]
+ a = socket.getaddrinfo(*args, **kwargs)
+ b = dns.resolver._original_getaddrinfo(*args, **kwargs)
+- return self.equivalent_info(a, b)
++ return self.equivalent_info(a, b, q)
+
+ @unittest.skipIf(
+ sys.platform == "win32", "avoid windows original getaddrinfo issues"
+@@ -139,7 +144,7 @@ def test_getaddrinfo_nxdomain(self):
+ def test_getaddrinfo_service(self):
+ a = socket.getaddrinfo("dns.google", "domain")
+ b = socket.getaddrinfo("dns.google", 53)
+- self.assertTrue(self.equivalent_info(a, b))
++ self.assertTrue(self.equivalent_info(a, b, "dns.google"))
+ try:
+ socket.getaddrinfo("dns.google", "domain", flags=socket.AI_NUMERICSERV)
+ self.assertTrue(False) # should not happen!