diff --git a/SOURCES/incorrect-exception-to-udp-function.patch b/SOURCES/incorrect-exception-to-udp-function.patch new file mode 100644 index 0000000..66c18a3 --- /dev/null +++ b/SOURCES/incorrect-exception-to-udp-function.patch @@ -0,0 +1,53 @@ +From daf723176da7bfee5baae928ff1af310a2400289 Mon Sep 17 00:00:00 2001 +From: Bob Halley +Date: Sun, 21 Feb 2016 15:22:21 -0800 +Subject: [PATCH] Set response_time to zero when exceptions occur early. + +--- + dns/query.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/dns/query.py b/dns/query.py +index ad6dffd..4e8089f 100644 +--- a/dns/query.py ++++ b/dns/query.py +@@ -204,6 +204,7 @@ def udp(q, where, timeout=None, port=53, af=None, source=None, source_port=0, + (af, destination, source) = _destination_and_source(af, where, port, source, + source_port) + s = socket.socket(af, socket.SOCK_DGRAM, 0) ++ begin_time = None + try: + expiration = _compute_expiration(timeout) + s.setblocking(0) +@@ -224,7 +225,10 @@ def udp(q, where, timeout=None, port=53, af=None, source=None, source_port=0, + '%s instead of %s' % (from_address, + destination)) + finally: +- response_time = time.time() - begin_time ++ if begin_time is None: ++ response_time = 0 ++ else: ++ response_time = time.time() - begin_time + s.close() + r = dns.message.from_wire(wire, keyring=q.keyring, request_mac=q.mac, + one_rr_per_rrset=one_rr_per_rrset) +@@ -301,6 +305,7 @@ def tcp(q, where, timeout=None, port=53, af=None, source=None, source_port=0, + (af, destination, source) = _destination_and_source(af, where, port, source, + source_port) + s = socket.socket(af, socket.SOCK_STREAM, 0) ++ begin_time = None + try: + expiration = _compute_expiration(timeout) + s.setblocking(0) +@@ -320,7 +325,10 @@ def tcp(q, where, timeout=None, port=53, af=None, source=None, source_port=0, + (l,) = struct.unpack("!H", ldata) + wire = _net_read(s, l, expiration) + finally: +- response_time = time.time() - begin_time ++ if begin_time is None: ++ response_time = 0 ++ else: ++ response_time = time.time() - begin_time + s.close() + r = dns.message.from_wire(wire, keyring=q.keyring, request_mac=q.mac, + one_rr_per_rrset=one_rr_per_rrset) diff --git a/SPECS/python-dns.spec b/SPECS/python-dns.spec index 0b14efc..43a414e 100644 --- a/SPECS/python-dns.spec +++ b/SPECS/python-dns.spec @@ -4,7 +4,7 @@ Name: python-dns Version: 1.12.0 -Release: 1%{?from_checkout:.20150617git%{shortcommit}}%{?dist} +Release: 2%{?from_checkout:.20150617git%{shortcommit}}%{?dist} Summary: DNS toolkit for Python Group: Development/Languages @@ -15,10 +15,11 @@ Source0: https://github.com/rthalley/%{name}/archive/%{commit}.tar.gz %else Source0: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz %endif +Patch0: incorrect-exception-to-udp-function.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -BuildRequires: python-setuptools +BuildRequires: python-setuptools %description dnspython is a DNS toolkit for Python. It supports almost all record @@ -32,6 +33,7 @@ manipulation of DNS zones, messages, names, and records. %prep %setup -q -n rthalley-dnspython-%{?from_checkout:%{shortcommit}}%{!?from_checkout:%{version}} +%patch0 -p1 # strip executable permissions so that we don't pick up dependencies # from documentation @@ -62,7 +64,11 @@ mv test_resolver.py test_resolver.pynorun %changelog -* Wed Jun 17 2015 Matej Stuchlik - 1.12.0-3.20150617git465785f +* Tue Mar 08 2016 Charalampos Stratakis - 1.12.0-2 +- Added patch to fix incorrect exception to udp function +Resolves: rhbz#1312770 + +* Wed Jun 17 2015 Matej Stuchlik - 1.12.0-1.20150617git465785f - Update to 1.12.0 (465785f) Resolves: rhbz#1196971