FS#52458 - [pypy3] fails to import ssl module because of openssl "no-ssl3-method"

Attached to Project: Community Packages
Opened by Daniel Hahler (blueyed) - Monday, 09 January 2017, 17:03 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Saturday, 25 March 2017, 14:53 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:

Openssl is built with `no-ssl3-method` (https://git.archlinux.org/svntogit/packages.git/tree/openssl/trunk/PKGBUILD?id=698241593a2bb7289633227562f7b513647e9433), which causes an error when importing `ssl` in pypy3.

Upstream bug report: https://bitbucket.org/pypy/pypy/issues/2315/failed-to-import-ssl-if-openssl-is-built

Given the staleness of the upstream issue I think a patch for Arch's package might make sense, since it seems to be uncommon to build openssl with `no-ssl3-method`?
The patch could then be sent upstream, of course.

Additional info:
* 5.5.0-1


Steps to reproduce:

% pypy3 -c 'import ssl'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/pypy3/lib-python/3/ssl.py", line 94, in <module>
from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23,
ImportError: cannot import name 'PROTOCOL_SSLv3'


This causes e.g. pip to fail:

> pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Saturday, 25 March 2017, 14:53 GMT
Reason for closing:  Fixed
Comment by Chih-Hsuan Yen (yan12125) - Monday, 09 January 2017, 18:32 GMT
FYI: My AUR package https://aur.archlinux.org/packages/pypy3-hg has a patch for SSL3. I've disowned it for a long time, so it may be broken.
Comment by Daniel Hahler (blueyed) - Tuesday, 10 January 2017, 13:41 GMT
This also causes an error when trying to build pypy3 with pyenv ("pyenv install pypy3.3-5.2-alpha1"):

> ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?


@yan12125
Your PKGBUILD works, thanks!
btw: it should be twice as fast to use `pypy` for building, instead of `python2`.
Comment by Chih-Hsuan Yen (yan12125) - Tuesday, 10 January 2017, 14:39 GMT
@Daniel Hahler (blueyed)

FYI: pyenv uses prebuilt binaries [1] so the issue should be reported to pyenv

> btw: it should be twice as fast to use `pypy` for building, instead of `python2`.

I use python2 as I believe almost everyone already has python2 while much fewer people have pypy. I've disowned that AUR package for a long time. Feel free to adopt and update it!

[1] https://github.com/yyuu/pyenv/blob/master/plugins/python-build/share/python-build/pypy3.3-5.2-alpha1
Comment by Daniel Hahler (blueyed) - Thursday, 12 January 2017, 12:23 GMT
@Yen Chi Hsuan (yan12125)
Yes, the issue with pyenv shows that it is really an upstream issue.
But also that it's caused by Arch's (progressive) openssl configuration.
Comment by Daniel Hahler (blueyed) - Thursday, 12 January 2017, 12:25 GMT
As for pypy vs python2: community/pypy should be quick to install, and in this case it's worth the extra download I think.
Also, it's just a makedepends.

> I've disowned that AUR package for a long time. Feel free to adopt and update it!

Thanks for the offer.
Not sure if I will do it, but what would be the process?
Comment by Chih-Hsuan Yen (yan12125) - Thursday, 12 January 2017, 13:06 GMT
Hello Daniel Hahler, I feel the thread now goes far beyond how to fix the pypy3 package in [community]. Maybe we can continue the discussion in other places to prevent bothering others here. You can reach me via my email address (listed on my bugs.archlinux.org profile page) or query yan12125 on freenode.
Comment by Markus Unterwaditzer (untitaker) - Tuesday, 21 March 2017, 20:18 GMT
This is quite high-severity as this prevents me from using pip to install packages.
Comment by Sven-Hendrik Haase (Svenstaro) - Wednesday, 22 March 2017, 14:02 GMT
Should be fixed in pypy3 in staging.
Comment by Chih-Hsuan Yen (yan12125) - Saturday, 25 March 2017, 13:59 GMT
pypy3 5.7.0 just enters [community-testing], and I confirm it's working.

$ pypy3
Python 3.5.3 (b16a4363e930f6401bceb499b9520955504c6cb0, Mar 22 2017, 08:59:27)
[PyPy 5.7.0-beta0 with GCC 6.3.1 20170306] on linux
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``the way to avoid a workaround is
to introduce a stronger workaround somewhere else''
>>>> import urllib.request
>>>> req = urllib.request.urlopen('https://httpbin.org/ip')
>>>> import json
>>>> json.loads(req.read().decode())
{'origin': '(my IP)'}

Loading...