Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 533440

Summary: dev-python/requests-2.5.0-r1 - sandbox violation by /usr/bin/pypy setup.py build in: mkdir /usr/lib64/pypy/site-packages/cryptography/hazmat/bindings/__pycache__
Product: Gentoo Linux Reporter: bay <alex3255>
Component: [OLD] DevelopmentAssignee: Python Gentoo Team <python>
Status: RESOLVED CANTFIX    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log

Description bay 2014-12-24 09:28:11 UTC
Requests library doesn't build for pypy.

Reproducible: Always

Steps to Reproduce:
1. Add pypy to PYTHON_TARGETS env var
2. emerge dev-python/requests
Actual Results:  
Package doesn't build

Expected Results:  
Package builds successfully 

Logs are attached

emerge --info:
Portage 2.2.15 (python 2.7.9-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.8.3, glibc-2.20, 3.18.0-gentoo x86_64)
=================================================================
System uname: Linux-3.18.0-gentoo-x86_64-Intel-R-_Core-TM-_i5-2410M_CPU_@_2.30GHz-with-gentoo-2.2
KiB Mem:     8074008 total,   1090524 free
KiB Swap:    4194300 total,   3431832 free
Timestamp of tree: Sun, 21 Dec 2014 12:00:01 +0000
sh bash 4.3_p30-r1
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.3_p30-r1
dev-java/java-config:     2.2.0
dev-lang/perl:            5.20.1-r4
dev-lang/python:          2.7.9, 3.2.5-r6, 3.3.5-r1, 3.4.2
dev-util/cmake:           3.0.2
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.6
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4, 1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.6.4, 4.7.3-r1, 4.8.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.4
sys-devel/make:           4.1-r1
sys-kernel/linux-headers: 3.17-r1 (virtual/os-headers)
sys-libs/glibc:           2.20
Repositories: gentoo Neurogeek seden ultrabug sublime-text kde qt mv kde-sunset Krontage
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA Oracle-BCLA-JavaSE AdobeFlash-10.3 AdobeFlash-11.x Google-TOS google-chrome PUEL dlj-1.1 skype-4.0.0.7-copyright Q3AEULA googleearth"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -mtune=generic -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -mtune=generic -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified depcheckstrict distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/neurogeek /var/lib/layman/seden /var/lib/layman/ultrabug /var/lib/layman/sublime-text /var/lib/layman/kde /var/lib/layman/qt /var/lib/layman/mv /var/lib/layman/kde-sunset /var/lib/layman/krontage"
USE="64bit X a52 aac aalib acl acpi adobe-cff aes-ni aio alsa amd64 amr apache2 apng bash-completion bcmath berkdb bittorrent bluetooth branding bzip2 cairo calendar canusb cdda cdinstall cdr chm clang cli cluster cracklib crypt cups curl cxx dbus declarative djvu dlz dri dts dvd dvdr eap eap-tls ebook emboss encode exif faac fam fcd ffmpeg firefox flac fontconfig fortran fpm gbm gd gdbm gif go gpm grc gtk h323 httpd iconv icq icu ipv6 ithreads jack java jpeg kde kerberos kipi lapack lcms ldap libass libcaca libkms libnotify libv4l2 lua lzma mad minizip mjpeg mmx mng modules mp3 mp4 mpeg multilib mysql mysqli ncat ncurses ndiff nls nmap-update notebook nping nptl nsplugin nx ogg opengl openmp opus oscar pam pango passwordsave pcntl pcre pcre16 pdf pdo phonon php plasma png policykit portaudio postgres ppds pulseaudio pypy python qt3support qt4 rdesktop readline rtmp rtsp samba script sdl semantic-desktop server session sip sipim skype sna sockets soprano spell sqlite sse sse2 sse3 sse4 sse4_1 sse4a ssh ssl ssse3 startup-notification static-user stream svg systemd tcmalloc tcpd threads tiff tk truetype udev udisks unicode upcall upower usb utils v4l v4l2 vaapi vde vkontakte vlm vnc vorbis wav webkit winbind wma-fixed wxwidgets x264 xattr xcb xcomposite xinerama xml xmlwriter xmpp xosd xscreensaver xslt xv xvfb xvid zip zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CURL_SSL="nss" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5 php5-4" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_3 python3_4 pypy pypy3" QEMU_SOFTMMU_TARGETS="i386 x86_64 mips mips64 arm" QEMU_USER_TARGETS="i386 mips arm armeb" RUBY_TARGETS="ruby19 ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.3 3.4"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC
Comment 1 bay 2014-12-24 09:30:24 UTC
Created attachment 392308 [details]
build.log
Comment 2 Ian Delaney (RETIRED) gentoo-dev 2014-12-27 08:24:44 UTC
this package poses major problems.

~/cvsPortage/gentoo-x86/dev-python/requests $ PYTHON_TARGETS=pypy ebuild requests-2.5.0-r1.ebuild clean install

yields

>>> Completed installing requests-2.5.0-r1 into /mnt/gen2/TmpDir/portage/dev-python/requests-2.5.0-r1/image/

since I have cryptography emerged.  
The log is showing the build is trying to emerge cryptography under pypy, however there is no sign of cryptography as a dep in the ebuild, nor dev-python/pyopenssl.  

/var/tmp/portage/dev-python/requests-2.5.0-r1/work/requests-2.5.0/requests/packages/urllib3/contrib/pyopenssl.py

says it's trying to import form pyopenssl installed in the system. pyopenssl pulls in cryptography.  It appears the build is building the bundled urllib3 which has its own set of deps, none of which are set in the ebuild.  Just to confound further, ebuilds of our urllib3 don't have these deps either, so just unbundling the urllib3 it seems would still leave gaps in required deps for this build.
Comment 3 Mike Gilbert gentoo-dev 2014-12-27 16:23:50 UTC
It's an optional runtime dependency.

# Attempt to enable urllib3's SNI support, if possible
try:
    from .packages.urllib3.contrib import pyopenssl
    pyopenssl.inject_into_urllib3()
except ImportError:
    pass

It's probably just broken because dev-python/cryptography needs to be rebuilt due to some timestamp issue or a change in pypy's cffi package.

Can you please try that rebuilding dev-python/cryptography?
Comment 4 bay 2014-12-27 18:00:58 UTC
Requests compiled successfully after rebuild dev-python/cryptography
Comment 5 Ian Delaney (RETIRED) gentoo-dev 2014-12-28 04:44:45 UTC
(In reply to Mike Gilbert from comment #3)
> It's an optional runtime dependency.
> 
> # Attempt to enable urllib3's SNI support, if possible
> try:
>     from .packages.urllib3.contrib import pyopenssl
>     pyopenssl.inject_into_urllib3()
> except ImportError:
>     pass
> 
> It's probably just broken because dev-python/cryptography needs to be
> rebuilt due to some timestamp issue or a change in pypy's cffi package.
> 
> Can you please try that rebuilding dev-python/cryptography?

yes we've seen this before.  the ebuild lacking cryptography as a dep won't auto rebuild it to make things work. I don't know what would be a comprehensive fix here. The optional part here seems a contradiction though.  How optional is it if it breaks a build that doesn't stipulate the option?
Comment 6 Mike Gilbert gentoo-dev 2014-12-28 05:59:21 UTC
(In reply to Ian Delaney from comment #5)
> yes we've seen this before.  the ebuild lacking cryptography as a dep won't
> auto rebuild it to make things work. I don't know what would be a
> comprehensive fix here. The optional part here seems a contradiction though.
> How optional is it if it breaks a build that doesn't stipulate the option?

If dev-python/pyopenssl is installed, and dev-python/cryptography is working, requests will have enhanced SSL support.

If dev-python/pyopenssl is not installed, requests will function just fine, albeit without the enhanced SSL support. This is the 'optional' part.

If dev-python/pyopenssl is installed, and the installed copy dev-python/cryptography is broken, we will encounter the issue presented in this bug report.

The real question here is how the cffi-based modules installed by dev-python/cryptography got broken/out-of-date. Given that this problem seems specific to pypy in this bug report, it probably has something to do with the bundled copy of cffi in dev-python/pypy.
Comment 7 Mike Gilbert gentoo-dev 2014-12-28 06:07:27 UTC
dev-python/cryptography has the following slot-operator dep to force rebuilds whenever dev-python/cffi is updated:

$(python_gen_cond_dep '>=dev-python/cffi-0.8:=[${PYTHON_USEDEP}]' 'python*')

For pypy, this slot-operator dep does nothing since cffi is bundled. We would need a slot-operator dep like || ( dev-python/pypy:= dev-python/pypy-bin:= ). However, slot-operators don't really work with || deps, and our subslot on pypy is too broad in any case.

I think the only reasonable to really resolve this would be to unbundle cffi from pypy. But I don't see that happening any time soon.

I think this is a CANTFIX.