Bug 2075187

Summary: zone transfer issues due to bug trying to compare nonetype with float
Product: Red Hat Enterprise Linux 8 Reporter: Tobias Urdin <tobias.urdin>
Component: python-dnsAssignee: Charalampos Stratakis <cstratak>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, jiehuang, jwboyer, lbalhar, torsava
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-dns-1.15.0-11.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 10:45:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tobias Urdin 2022-04-13 18:55:15 UTC
Description of problem:

The python3-dns package has a bug where it tries to do a compare between a float and an nonetype causing issues. This causes zone transfer issues in the OpenStack Designate project which is using python3-dns

This is only present in CentOS Stream 8 because it's running version 1.15 where the bug is resolved in >= 2.0.0

See bug report in https://bugs.launchpad.net/designate/+bug/1941988

Version-Release number of selected component (if applicable): python3-dns-1.15.0-10.el8.noarch


How reproducible:
See reproduce in https://bugs.launchpad.net/designate/+bug/1941988


Actual results:
Python exception trying to compare float > nonetype

Expected results:
No error, instead checking value for nonetype before comparing

Additional info:
courtasy patch to solve issue as describe in https://bugs.launchpad.net/designate/+bug/1941988 and fixed in https://github.com/rthalley/dnspython/blob/v2.0.0rc1/dns/query.py#L925

From 2e2ee980ab0fdbf0574b67c415756ba79304ac5a Mon Sep 17 00:00:00 2001
From: Tobias Urdin <tobias.urdin>
Date: Wed, 13 Apr 2022 18:50:12 +0000
Subject: [PATCH] Fix operator compare between NoneType and float

---
 dns/query.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dns/query.py b/dns/query.py
index bfecd43..19b9fbb 100644
--- a/dns/query.py
+++ b/dns/query.py
@@ -467,7 +467,8 @@ def xfr(where, zone, rdtype=dns.rdatatype.AXFR, rdclass=dns.rdataclass.IN,
     first = True
     while not done:
         mexpiration = _compute_expiration(timeout)
-        if mexpiration is None or mexpiration > expiration:
+        if mexpiration is None or \
+           (expiration is not None and mexpiration > expiration):
             mexpiration = expiration
         if use_udp:
             _wait_for_readable(s, expiration)

Comment 1 Tobias Urdin 2022-04-13 18:58:15 UTC
Not an issue in CentOS Stream 9 since that uses a version that already has the fix

Comment 2 Charalampos Stratakis 2022-04-20 23:50:27 UTC
Upstream fix: https://github.com/rthalley/dnspython/commit/9fbf9b223dc26262b1cf23f623f89283ee9c8375

Comment 10 errata-xmlrpc 2022-11-08 10:45:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (python-dns bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7697

Comment 11 Michael Johnson 2023-08-22 14:55:34 UTC
*** Bug 2233061 has been marked as a duplicate of this bug. ***