Package: python3-milter
Version: 1.0.3-2
Severity: normal
Tags: patch, upstream
0 dkg@alice:~$ ipython3
Python 3.7.2+ (default, Feb 2 2019, 14:31:48)
Type "copyright", "credits" or "license" for more information.
IPython 5.8.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import Milter.utils
In [2]: Milter.utils.parseaddr('Daniel Kahn Gillmor <[email protected]>')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-1d0e7b5b4ed6> in <module>()
----> 1 Milter.utils.parseaddr('Daniel Kahn Gillmor <[email protected]>')
/usr/lib/python3/dist-packages/Milter/utils.py in parseaddr(t)
137 """
138 #return email.utils.parseaddr(t)
--> 139 res = email.utils.parseaddr(t)
140 # dirty fix for some broken cases
141 if not res[0]:
AttributeError: module 'email' has no attribute 'utils'
In [3]:
------
weirdly, it doesn't have the same problem in python2:
0 dkg@alice:~$ ipython
Python 2.7.15+ (default, Feb 3 2019, 13:13:16)
Type "copyright", "credits" or "license" for more information.
IPython 5.8.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import Milter.utils
In [2]: Milter.utils.parseaddr('Daniel Kahn Gillmor <[email protected]>'
...: )
Out[2]: ('Daniel Kahn Gillmor', '[email protected]')
In [3]:
I don't know how to account for this difference, but i'd say that
pymilter probably needs more testing.
A simple patch is attached.
--dkg
-- System Information:
Debian Release: buster/sid
APT prefers testing-debug
APT policy: (500, 'testing-debug'), (500, 'testing'), (200,
'unstable-debug'), (200, 'unstable'), (1, 'experimental-debug'), (1,
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.19.0-1-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages python3-milter depends on:
ii libc6 2.28-6
ii libmilter1.0.1 8.15.2-12
ii python3 3.7.2-1
ii python3-dns 3.2.0-2
python3-milter recommends no packages.
Versions of packages python3-milter suggests:
ii postfix 3.3.2-1+b1
pn python-milter-doc <none>
-- no debconf information
From: Daniel Kahn Gillmor <[email protected]>
Date: Tue, 19 Feb 2019 18:20:18 -0500
Subject: utils: import email.utils
Without this patch, Milter.utils.parseaddr() fails with:
File "/usr/lib/python3/dist-packages/Milter/utils.py", line 139, in parseaddr
res = email.utils.parseaddr(t)
AttributeError: module 'email' has no attribute 'utils'
---
Milter/utils.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/Milter/utils.py b/Milter/utils.py
index 2ed5db8..85fd635 100644
--- a/Milter/utils.py
+++ b/Milter/utils.py
@@ -8,6 +8,7 @@ import socket
import email.errors
from email.header import decode_header
import email.base64mime
+import email.utils
from fnmatch import fnmatchcase
from binascii import a2b_base64