Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 559364 - mail-filter/pypolicyd-spf: conflict with ipaddress module in python < 3
Summary: mail-filter/pypolicyd-spf: conflict with ipaddress module in python < 3
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Michael Orlitzky
URL: https://bugs.launchpad.net/pypolicyd-...
Whiteboard:
Keywords:
Depends on: 559366
Blocks:
  Show dependency tree
 
Reported: 2015-09-02 01:13 UTC by Robert Trace
Modified: 2015-09-15 15:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
use ipaddress exclusively and use it correctly (ipaddress.patch,1.06 KB, patch)
2015-09-02 01:15 UTC, Robert Trace
Details | Diff
pypolicyd-spf-1.3.2.ebuild (pypolicyd-spf-1.3.2.ebuild,1.70 KB, text/plain)
2015-09-02 01:16 UTC, Robert Trace
Details
pypolicyd-spf-1.2-r1.ebuild (pypolicyd-spf-1.2-r1.ebuild,1.75 KB, text/plain)
2015-09-02 01:17 UTC, Robert Trace
Details
ipaddress.patch (ipaddress.patch,1.06 KB, patch)
2015-09-02 01:19 UTC, Robert Trace
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Trace 2015-09-02 01:13:05 UTC
ipaddress is included in python3, but not python2.  pypolicyd-spf tries to import ipaddress and when that fails, imports ipaddr instead.

However, dev-python/ipaddress (a backport of the python3 functionality) is now available.

So, if dev-python/ipaddress gets installed pypolicyd-spf will attempt to use it instead of ipaddr and it assumes the incorrect usage semantics (character strings, not byte strings, see: https://github.com/phihag/ipaddress).

This causes a fatal error than can block mail delivery.


Reproducible: Always

Steps to Reproduce:
1. install stable pypolicyd-spf
2. install dev-python/ipaddress
3. watch mail delivery fail



See: https://bugzilla.redhat.com/show_bug.cgi?id=1230373
and: https://bugzilla.redhat.com/show_bug.cgi?id=1232595

The fix is to stop using ipaddr and use the correct usage semantics.

(There's a related fix needed for dev-python/pyspf too.)
Comment 1 Robert Trace 2015-09-02 01:15:49 UTC
Created attachment 410806 [details, diff]
use ipaddress exclusively and use it correctly
Comment 2 Robert Trace 2015-09-02 01:16:48 UTC
Created attachment 410808 [details]
pypolicyd-spf-1.3.2.ebuild
Comment 3 Robert Trace 2015-09-02 01:17:10 UTC
Created attachment 410810 [details]
pypolicyd-spf-1.2-r1.ebuild
Comment 4 Robert Trace 2015-09-02 01:19:29 UTC
Created attachment 410812 [details, diff]
ipaddress.patch
Comment 5 Michael Orlitzky gentoo-dev 2015-09-14 13:35:51 UTC
@python

Upstream is going to be python3-only next release, and they suggest using python3 to solve this problem.

I plan on trying a pypolicyd-spf-1.3.2-r1 that has PYTHON_COMPAT=( python{3_3,3_4} ) and dropping the ipaddr dependency.

I'll test this to make sure of a few things:

* eselecting python2 doesn't break it (it gets run via the python-exec wrapper).

* installing dev-python/ipaddress (which installs for python3?) doesn't affect it.

I will do testing on a real mail server but if you see any obvious problems with the above please let me know before I crash everything.
Comment 6 Michael Orlitzky gentoo-dev 2015-09-15 15:22:30 UTC
This is fixed in

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=948a8a4aa89c00dd9f8dac44172d9b05284678c8

by removing python2 support.

Sadly I can't fix the stable version, but please test the new revision and see if it solves the problem for you. If it does, comment on bug #529492 and I will update the stabilization request for this new revision.