Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 538920 - net-wireless/crda-1.1.3-r1 with dev-python/m2crypto-0.22.3-r2 with dev-lang/swig-3.0.5 - /usr/lib64/python2.7/site-packages/M2Crypto/BIO.py: AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'
Summary: net-wireless/crda-1.1.3-r1 with dev-python/m2crypto-0.22.3-r2 with dev-lang/s...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 2 votes (vote)
Assignee: Panagiotis Christopoulos (RETIRED)
URL:
Whiteboard:
Keywords:
: 540618 542224 542268 (view as bug list)
Depends on:
Blocks: 531736
  Show dependency tree
 
Reported: 2015-02-05 12:08 UTC by dyle
Modified: 2015-05-28 14:20 UTC (History)
37 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dyle 2015-02-05 12:08:15 UTC
During compile net-wireless/crda includes dev-python/m2crypto. This fails at

x86_64-pc-linux-gnu-gcc -c  -march=native -g -O2 -pipe -fomit-frame-pointer -ggdb -Wall -g -DUSE_OPENSSL -DPUBKE
Y_DIR=\"/etc/wireless-regdb/pubkeys\" `x86_64-pc-linux-gnu-pkg-config --cflags openssl` -DCONFIG_LIBNL30 `x86_64
-pc-linux-gnu-pkg-config --cflags libnl-3.0` -o print-regdom.o print-regdom.c
./utils/key2pub.py --ssl pubkeys/linville.key.pub.pem keys-ssl.c
Traceback (most recent call last):
  File "./utils/key2pub.py", line 5, in <module>
    from M2Crypto import RSA
  File "/usr/lib64/python2.7/site-packages/M2Crypto/__init__.py", line 24, in <module>
    import ASN1
  File "/usr/lib64/python2.7/site-packages/M2Crypto/ASN1.py", line 12, in <module>
    import BIO
  File "/usr/lib64/python2.7/site-packages/M2Crypto/BIO.py", line 221, in <module>
    class CipherStream(BIO):
  File "/usr/lib64/python2.7/site-packages/M2Crypto/BIO.py", line 227, in CipherStream
    SALT_LEN = m2.PKCS5_SALT_LEN
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'
Makefile:104: recipe for target 'keys-ssl.c' failed
make: *** [keys-ssl.c] Error 1
make: *** Waiting for unfinished jobs....
 * ERROR: net-wireless/crda-1.1.3-r1::gentoo failed (compile phase):


Reason: m2crypto does not export m2.PCKS5_SALT_LEN (and a lot of other symbols) if it has been compiled with swig-3.0.5.

error symptom:

$ cd /usr/lib64/python2.7/site-packages/M2Crypto

$ python
Python 2.7.9 (default, Feb  5 2015, 08:57:19) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import m2
>>> m2.PKCS5_SALT_LEN
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'



if m2crypto has been compiled with swig-3.0.4 this renders to:

$ cd /usr/lib64/python2.7/site-packages/M2Crypto

$ python
Python 2.7.9 (default, Feb  5 2015, 08:57:19) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import m2
>>> m2.PKCS5_SALT_LEN
8


Reproducible: Always
Comment 1 Guilherme Amadio gentoo-dev 2015-02-09 16:48:36 UTC
I hit this bug too.
Comment 2 Charlie Gehlin 2015-02-14 16:27:22 UTC
Also confirming; crda-1.1.3-r1 compiles fine when m2crypto-0.22.3-r2 is emerged with swig-3.0.4.
Comment 3 Anthony Basile gentoo-dev 2015-02-15 13:17:56 UTC
(In reply to Charlie Gehlin from comment #2)
> Also confirming; crda-1.1.3-r1 compiles fine when m2crypto-0.22.3-r2 is
> emerged with swig-3.0.4.

This is an annoying bug.  I confirmed it on mips where you hit this because everything is ~mips.

One way to fix this is to change the deps on m2crypto to <=dev-lang/swig-3.0.4 and rev bump to force a rebuild.  Does m2crtypo work fine otherwise with swig-3.0.5?  Because the other approach is to blame crda and fix up its code to use whatever new method there is to get PKCS5_SALT_LEN.  I suspect there must be some way of doing that.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-19 08:16:52 UTC
*** Bug 540618 has been marked as a duplicate of this bug. ***
Comment 5 wolfwood 2015-02-22 20:13:55 UTC
had the same issue and resolution.
Comment 6 Mike Gilbert gentoo-dev 2015-02-23 16:00:45 UTC
(In reply to Anthony Basile from comment #3)
> One way to fix this is to change the deps on m2crypto to
> <=dev-lang/swig-3.0.4 and rev bump to force a rebuild.  Does m2crtypo work
> fine otherwise with swig-3.0.5?

I would say no, given that this is enough to trigger the error:

python2.7 -c "from M2Crypto import RSA"

Re-assigning this to the python team.
Comment 7 Mike Gilbert gentoo-dev 2015-02-24 03:11:01 UTC
I bisected swig, and arrived at this as the first "bad" commit:

https://github.com/swig/swig/commit/c21e2423a02939d2a4bc02bdfaa5c3bed3be95b2

swig maintainers, can you please take a look and possibly report this upstream?
Comment 8 Tim Harder gentoo-dev 2015-02-24 03:40:35 UTC
(In reply to Mike Gilbert from comment #7)
> I bisected swig, and arrived at this as the first "bad" commit:
> 
> https://github.com/swig/swig/commit/c21e2423a02939d2a4bc02bdfaa5c3bed3be95b2
> 
> swig maintainers, can you please take a look and possibly report this
> upstream?

https://github.com/swig/swig/issues/344
Comment 9 Ben Kohler gentoo-dev 2015-03-05 13:53:27 UTC
*** Bug 542224 has been marked as a duplicate of this bug. ***
Comment 10 Ben Kohler gentoo-dev 2015-03-05 16:02:01 UTC
*** Bug 542268 has been marked as a duplicate of this bug. ***
Comment 11 Pat Erley 2015-03-07 06:37:56 UTC
Per https://github.com/martinpaljak/M2Crypto/issues/60

M2Crypto is being fixed for swig 3.0.5, so making the current version depend on swig 3.0.4 with a revbump, and then the next release of M2Crypto removing that version dep would likely solve most systems without manual intervention.
Comment 12 rainer 2015-03-08 02:42:08 UTC
The same error persists in crda-3.18 with dev-lang/swig-3.0.5 and dev-python/m2crypto-0.22.3-r2 installed.
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-03-14 14:27:46 UTC
So is anyone in particular interested in fixing this?
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-03-14 14:48:31 UTC
+*m2crypto-0.22.3-r3 (14 Mar 2015)
+
+  14 Mar 2015; Michał Górny <mgorny@gentoo.org> +m2crypto-0.22.3-r3.ebuild,
+  -m2crypto-0.22.3-r2.ebuild, m2crypto-0.21.1-r2.ebuild:
+  Require swig < 3.0.5 as a workaround for bug #538920 (broken constants in
+  modules).

Now things will at least work. Leaving bug open for proper solution.
Comment 15 Ulenrich 2015-03-28 18:08:28 UTC
Do the patches listed here fix the issue?

https://github.com/martinpaljak/M2Crypto/issues/60

The patches perfectly apply during emerge m2crypto
but I don't have any expertise to test
beside just rebooting now and see if this works:
---
# emerge -p -1 m2crypto swig

These are the packages that would be merged, in order:

Calculating dependencies  ... done!
[ebuild   R    ] dev-lang/swig-3.0.5::gentoo 
[ebuild   R    ] dev-python/m2crypto-0.22.3-r4::pmaci  
---
Comment 16 Nick Andrade 2015-04-09 05:45:16 UTC
(In reply to Ulenrich from comment #15)
> Do the patches listed here fix the issue?
> 
> https://github.com/martinpaljak/M2Crypto/issues/60
> 
> The patches perfectly apply during emerge m2crypto
> but I don't have any expertise to test
> beside just rebooting now and see if this works:
> ---
> # emerge -p -1 m2crypto swig
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies  ... done!
> [ebuild   R    ] dev-lang/swig-3.0.5::gentoo 
> [ebuild   R    ] dev-python/m2crypto-0.22.3-r4::pmaci  
> ---

The patch applies cleanly to m2crypto however crda still fails to build with a slightly different error after the patch:

laptop ~ # emerge --nodeps -av =swig-3.0.5 m2crypto crda

These are the packages that would be merged, in order:

[ebuild   R    ] dev-lang/swig-3.0.5::gentoo  USE="pcre -ccache -doc" 0 KiB
[ebuild   R    ] dev-python/m2crypto-0.22.3-r3::gentoo  PYTHON_TARGETS="python2_7" 0 KiB
[ebuild   R    ] net-wireless/crda-3.18::gentoo  USE="-gcrypt" 0 KiB

Total: 3 packages (3 reinstalls), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] ^C Interrupted.

laptop ~ # emerge --nodeps crda

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-wireless/crda-3.18::gentoo
 * crda-3.18.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) [ ok ]
>>> Unpacking source...
>>> Unpacking crda-3.18.tar.xz to /var/tmp/portage/net-wireless/crda-3.18/work
>>> Source unpacked in /var/tmp/portage/net-wireless/crda-3.18/work
>>> Preparing source in /var/tmp/portage/net-wireless/crda-3.18/work/crda-3.18 ...
 * Applying crda-3.18-no-ldconfig.patch  [ ok ]
 * Applying crda-3.18-no-werror.patch [ ok ]
 * Applying crda-3.18-openssl.patch [ ok ]
 * Applying crda-3.18-cflags.patch [ ok ]
 * Applying crda-3.18-libreg-link.patch  [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/net-wireless/crda-3.18/work/crda-3.18 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/net-wireless/crda-3.18/work/crda-3.18 ...
make -j5 -l10 PREFIX=/usr SBINDIR=$(PREFIX)/sbin/ LIBDIR=$(PREFIX)/lib64 UDEV_RULE_DIR=/lib/udev/rules.d REG_BIN=/usr/lib/crda/regulatory.bin USE_OPENSSL=1 CC=x86_64-pc-linux-gnu-gcc V=1 WERROR= all_noverify 
./utils/key2pub.py --ssl pubkeys/linville.key.pub.pem pubkeys/sforshee.key.pub.pem keys-ssl.c
ERROR: Failed to import the "M2Crypto" module: No module named _m2crypto
Please install the "M2Crypto" Python module.
On Debian GNU/Linux the package is called "python-m2crypto".
Makefile:114: recipe for target 'keys-ssl.c' failed
make: *** [keys-ssl.c] Error 1
Comment 17 Mike Gilbert gentoo-dev 2015-05-25 16:43:09 UTC
Please test m2crypto-0.22.3-r4.

+*m2crypto-0.22.3-r4 (25 May 2015)
+
+  25 May 2015; Mike Gilbert <floppym@gentoo.org>
+  +files/0.22.3-Use-swig-generated-python-loader.patch,
+  +files/0.22.3-packaging.patch, +m2crypto-0.22.3-r4.ebuild:
+  Resolve issues with swig-3.0.5, bug 538920.
Comment 18 Mike Gilbert gentoo-dev 2015-05-25 17:17:28 UTC
Please try m2crypto-0.21.1-r3 as well.

+*m2crypto-0.21.1-r3 (25 May 2015)
+
+  25 May 2015; Mike Gilbert <floppym@gentoo.org>
+  +files/0.21.1-0001-Fixed-invalid-variable-name.patch,
+  +files/0.21.1-0002-Fixing-memory-leaks-in-the-SWIG-wrapper.patch,
+  +files/0.21.1-0003-Use-swig-generated-python-loader.patch,
+  +files/0.21.1-packaging.patch, +m2crypto-0.21.1-r3.ebuild:
+  Resolve issues with swig-3.0.5 in the older 0.21 fork as well.
Comment 19 Alexander E. Patrakov 2015-05-25 19:49:22 UTC
Successfully built dev-lang/swig-3.0.5::gentoo, dev-python/m2crypto-0.22.3-r4::gentoo and net-wireless/crda-3.18::gentoo.
Comment 20 Alexander E. Patrakov 2015-05-25 19:51:00 UTC
dev-python/m2crypto-0.21.1-r3 still depends on old swig, so will not test
Comment 21 Mike Gilbert gentoo-dev 2015-05-26 00:27:59 UTC
(In reply to Alexander E. Patrakov from comment #20)
> dev-python/m2crypto-0.21.1-r3 still depends on old swig, so will not test

Sorry, missed that.

+  26 May 2015; Mike Gilbert <floppym@gentoo.org> m2crypto-0.21.1-r3.ebuild:
+  Unpin swig.
Comment 22 Mike Gilbert gentoo-dev 2015-05-28 14:20:01 UTC
I'm going to call this fixed. A stable request has been filed (bug 545606).