Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 569740 - dev-python/pip-7.1.2: environment: line 3419: 12144 Segmentation fault "${PYTHON}" pip/__init__.py completion --bash > "${COMPLETION}"
Summary: dev-python/pip-7.1.2: environment: line 3419: 12144 Segmentation fault "...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
: 578868 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-25 18:20 UTC by David Kredba
Modified: 2019-06-19 04:23 UTC (History)
7 users (show)

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


Attachments
Build.log (build.log,55.05 KB, text/plain)
2015-12-25 18:21 UTC, David Kredba
Details
Bt 2.7 (bt_full_2_7.txt,360.65 KB, text/plain)
2015-12-28 19:05 UTC, David Kredba
Details
Bt 3.5m (bt_full_3_5m.txt.gz,61.21 KB, application/octet-stream)
2015-12-28 19:21 UTC, David Kredba
Details
python3.4 bt on hardened (bt-hardened-3.4.txt,27.12 KB, text/plain)
2016-01-22 23:44 UTC, Jan Sembera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Kredba 2015-12-25 18:20:27 UTC
I can't recompile dev-python/pip.

-cut-
running install_scripts
Installing pip script to /var/tmp/portage/dev-python/pip-7.1.2/image//_python3.5/usr/lib/python-exec/python3.5
Installing pip3.5 script to /var/tmp/portage/dev-python/pip-7.1.2/image//_python3.5/usr/lib/python-exec/python3.5
Installing pip3 script to /var/tmp/portage/dev-python/pip-7.1.2/image//_python3.5/usr/lib/python-exec/python3.5
 * python3_5: running distutils-r1_run_phase python_install_all
/var/tmp/portage/dev-python/pip-7.1.2/temp/environment: line 3419: 12144 Segmentation fault      "${PYTHON}" pip/__init__.py completion --bash > "${COMPLETION}"
 * ERROR: dev-python/pip-7.1.2::gentoo failed (install phase):
 *   (no error message)

Reproducible: Always




Portage 2.2.26 (python 2.7.11-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-5.3.0, glibc-2.22-r1, 4.3.3-gentoo x86_64)
=================================================================
System uname: Linux-4.3.3-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9550_@_2.83GHz-with-gentoo-2.2
KiB Mem:     8169824 total,    460544 free
KiB Swap:    8396796 total,   8358196 free
Timestamp of repository gentoo: Fri, 25 Dec 2015 14:30:01 +0000
sh bash 4.3_p42
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.22.1::gentoo
dev-lang/python:          2.7.11-r1::gentoo, 3.5.1-r2::gentoo
dev-util/cmake:           3.4.1::gentoo
dev-util/pkgconfig:       0.29::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.19.1::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r1::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            5.3.0::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -ggdb -pipe -march=core2 -frecord-gcc-switches"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind /var/lib/hsqldb"
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.6/ext-active/ /etc/php/apache2-php7.0/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/php/cli-php7.0/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="-O2 -ggdb -pipe -march=core2 -frecord-gcc-switches"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch usersandbox usersync xattr"
FFLAGS="-O2 -ggdb -pipe -march=core2 -frecord-gcc-switches"
GENTOO_MIRRORS="ftp://gentoo.mirror.web4u.cz/"
LANG="cs_CZ.utf8"
LC_ALL="cs_CZ.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="echo"
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"
USE="X a52 aac aalib acl acpi alsa amd64 argyllcms berkdb blas bluetooth branding bzip2 cairo caps cdda cddb cdparanoia cdr cli colord consolekit cracklib crypt cups cvs cxx dbus declarative djvu dri dts dv dvb dvd dvdr emboss encode exif fam ffmpeg fftw firefox flac fontconfig fortran ftp gd gdbm geoip gif glamor gmp gnuplot gpm gps graphviz gsl gsm gstreamer gtk hdf5 iconv icu idn ieee1394 imagemagick imlib ipv6 ithreads javascript jbig jpeg jpeg2k kde kipi ladspa lame lapack lcms ldap libass libnotify libsamplerate lzma lzo mad matroska mms mmx mmxext mng modplug modules mp3 mp4 mpeg mplayer msn mtp multilib musepack musicbrainz ncurses netcdf nls nptl odbc ogg opencl openexr opengl openmp pam pango pch pcre pdf perl phonon pic plasma plotutils png policykit postscript ppds pulseaudio python qml qt3support qt4 qt5 quicktime rdesktop readline samba scanner sdl seccomp semantic-desktop session slang smp sndfile sox speex spell sse sse2 ssl ssse3 startup-notification svg szip tcpd theora threads tidy tiff truetype udev udisks unicode upower usb v4l vcd vdpau vnc vorbis wavpack widgets wmf wxwidgets x264 xattr xcb xcomposite xft xine xinerama xml xosd xpm xscreensaver xv xvid xvmc 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="actions alias auth_basic authn_alias authn_anon authn_core authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias access_compat" APACHE2_MPMS="worker" CALLIGRA_FEATURES="author braindump flow karbon kexi krita plan sheets stage words" CAMERAS="ptp2 adc65 agfa_cl20 aox ax203 barbie canon casio_qv clicksmart310 digigr8 digita dimagev dimera3500 directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 jl2005a jl2005c kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica konica_qm150 largan lg_gsm mars mustek panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 pccam300 pccam600 pentax polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ricoh ricoh_g3 samsung sierra sipix_blink2 sipix_web2 smal sonix sony_dscf1 sony_dscf55 soundvision spca50x sq905 st2205 stv0674 stv0680 sx330z topfield toshiba_pdrm11 tp6801" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3" CURL_SSL="gnutls" ELIBC="glibc" FFTOOLS="aviocat cws2fws ffescape ffeval fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart trasher ffhash" GPSD_PROTOCOLS="aivdm ashtech earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 navcom nmea ntrip oceanserver oncore rtcm104v2 rtcm104v3 sirf superstar2 tnt tripmate tsip ubx fury geostar nmea2000" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer scripting-beanshell scripting-javascript nlpsolver" LINGUAS="cs en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="5.6 7-0" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_5" QEMU_SOFTMMU_TARGETS="x86_64 arm i386" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby20 ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="nouveau radeon" 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.5"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 David Kredba 2015-12-25 18:21:26 UTC
Created attachment 420800 [details]
Build.log
Comment 2 David Kredba 2015-12-25 18:23:00 UTC
Relevant lines from the environment file:

python_install_all ()
{
    local DOCS=(AUTHORS.txt docs/*.rst);
    distutils-r1_python_install_all;
    COMPLETION="${T}"/completion.tmp;
    "${PYTHON}" pip/__init__.py completion --bash > "${COMPLETION}" || die;
    newbashcomp "${COMPLETION}" ${PN};
    "${PYTHON}" pip/__init__.py completion --zsh > "${COMPLETION}" || die;
    insinto /usr/share/zsh/site-functions;
    newins "${COMPLETION}" _pip
}
Comment 3 Alex Xu (Hello71) 2015-12-27 16:47:35 UTC
please paste the output of "dmesg | grep segfault".
Comment 4 David Kredba 2015-12-27 20:18:46 UTC
[136608.755705] python3.5[7258]: segfault at 80 ip 00007f65c87db1de sp 00007ffe9ec226a0 error 4 in libpython3.5m.so.1.0[7f65c8773000+232000]

How can I debug it please?

Using
gdb --args /usr/bin/python2.7 /usr/bin/emerge --oneshot -v dev-python/pip
run
[Inferior 1 (process 7589) exited with code 01]
(gdb) inferior 1
[Switching to inferior 1 [<null>] (/usr/bin/python2.7)]
(gdb) bt full

I got "No stack."

Thank you!
Comment 5 Mike Gilbert gentoo-dev 2015-12-28 03:40:47 UTC
(In reply to David Kredba from comment #4)
> [136608.755705] python3.5[7258]: segfault at 80 ip 00007f65c87db1de sp
> 00007ffe9ec226a0 error 4 in libpython3.5m.so.1.0[7f65c8773000+232000]
> 
> How can I debug it please?

After running emerge pip, do this:

cd /var/tmp/portage/dev-python/pip-7.1.2/work/pip-7.1.2
gdb --args python3.5 pip/__init__.py --bash

Hopefully that will reproduce the segfault and you can get a backtrace from there.
Comment 6 David Kredba 2015-12-28 07:53:08 UTC
Thank you very much.

(gdb) run
Starting program: /usr/bin/python3.5 pip/__init__.py --bash
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Traceback (most recent call last):
  File "pip/__init__.py", line 12, in <module>
    from pip.exceptions import InstallationError, CommandError, PipError
ImportError: No module named 'pip'
[Inferior 1 (process 6803) exited with code 01]
Comment 7 David Kredba 2015-12-28 08:25:53 UTC
Pip is present in image/ folder. I tried to copy it to corresponding system folders and call the failing command again and got very long backtrace. Starting this way installed pip by calling /usr/bin/pip segfaults too, so until asked I will not paste the bt to here.
Comment 8 David Kredba 2015-12-28 10:26:41 UTC
The same happens for =dev-python/autobahn-0.10.4 ( "${@}" || die "${die_args[@]}" || return ${?}), but not for any other python package.

Python-updater does not want to do anything.
I am trying revdep-rebuild now.
Comment 9 David Kredba 2015-12-28 11:34:08 UTC
Nothing to rebuild.

I deleted pip manually copied from image/ and
tried python2.7 only:

python2.7 pip/__init__.py --bash
Traceback (most recent call last):
  File "pip/__init__.py", line 12, in <module>
    from pip.exceptions import InstallationError, CommandError, PipError
ImportError: No module named pip.exceptions

There is exceptions.py file present in 
"/var/tmp/portage/dev-python/pip-7.1.2/work/pip-7.1.2/pip/__init__.py"

It does not import its modules from /var/tmp/portage/dev-python/pip-7.1.2/work/pip-7.1.2/pip/.
Comment 10 Justin Lecher (RETIRED) gentoo-dev 2015-12-28 13:07:17 UTC
what is $PYTHONPATH set to on your system?

Please try to rename python_install_all to _python_install_all and install pip. Does "python -m pip completions --bash" work then?
Comment 11 David Kredba 2015-12-28 14:52:23 UTC
There is no PYTHONPATH set in the environment.

Do you mean to rename the function in pip ebuild please?


When I changed python_install_all() to contain this only

python_install_all() {
    distutils-r1_python_install_all
}
it installed.

But pip module cannot be used:

gdb /usr/bin/python2.7
GNU gdb (Gentoo 7.10.1 vanilla) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python2.7...done.
(gdb) run
Starting program: /usr/bin/python2.7
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Python 2.7.11 (default, Dec 28 2015, 14:07:12)
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7a5af0c in PyObject_Call (func=func@entry=<unknown at remote 0x7ffff1483810>,
    arg=arg@entry=(9,), kw=kw@entry=0x0)
    at /usr/src/debug/dev-lang/python-2.7.11-r1/Python-2.7.11/Objects/abstract.c:2542
2542        if ((call = func->ob_type->tp_call) != NULL) {
-cut-




python
Python 2.7.11 (default, Dec 28 2015, 14:07:12)
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ["PYTHONPATH"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'PYTHONPATH'

eselect python list --python2
Available Python 2 interpreters:
  [1]   python2.7 *

Available Python 3 interpreters:
  [1]   python3.5 *

eselect python show --ABI
2.7

Thank you.
Comment 12 Mike Gilbert gentoo-dev 2015-12-28 16:20:00 UTC
Please attach the full backtrace. You cut it off after the first function.
Comment 13 David Kredba 2015-12-28 19:02:56 UTC
It is ugly long :).

Please see it attached - variants for Pythopn 2.7 and 3.5.
Comment 14 David Kredba 2015-12-28 19:05:02 UTC
Created attachment 421022 [details]
Bt 2.7
Comment 15 David Kredba 2015-12-28 19:21:05 UTC
Created attachment 421024 [details]
Bt 3.5m
Comment 16 David Kredba 2015-12-29 11:15:34 UTC
When I removed || die from autobahn environment file (+1470) it installed
and "import autobahn" from python2.7 does not segfault. So for autobahn it is not caused by miscompilation I think.
Comment 17 Jan Sembera 2016-01-10 18:27:04 UTC
I'm seeing the same issue on my hardened gentoo and suspected it might be related to grsec, but your system doesn't seem to use hardened profile, or is it?
Comment 18 David Kredba 2016-01-11 20:38:24 UTC
No, it does not. I removed samba package so pip is not needed, but autobahn is still affected by the same issue.
Comment 19 Lujeni 2016-01-11 21:45:23 UTC
Hello,

I encounter a similar issue (hardened server) when i try to install pip:

 *   environment, line 2312:  Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_install_all'
 *   environment, line 2310:  Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'python_install_all'
 *   environment, line  640:  Called distutils-r1_run_phase 'python_install_all'
 *   environment, line  959:  Called python_install_all
 *   environment, line 3375:  Called die
 * The specific snippet of code:
 *       "${PYTHON}" -m pip completion --bash > "${COMPLETION}" || die;
 * 


Portage 2.2.26 (python 2.7.9-final-0, hardened/linux/amd64, gcc-4.9.3, glibc-2.19-r1, 3.17.7-hardened-r1 x86_64)
=================================================================
System uname: Linux-3.17.7-hardened-r1-x86_64-Intel-R-_Xeon-R-_CPU_E5-2640_0_@_2.50GHz-with-gentoo-2.2
KiB Mem:    32916420 total,    660916 free
KiB Swap:   32001476 total,  31966160 free
Timestamp of repository gentoo: Mon, 11 Jan 2016 19:45:01 +0000
sh bash 4.3_p42-r1
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.3_p42-r1::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r1::gentoo, 3.3.5-r1::gentoo, 3.4.3-r1::gentoo
dev-util/cmake:           2.8.12.2-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.12.4::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.12.6::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.23.2::gentoo
sys-devel/gcc:            4.7.3-r1::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.2::gentoo
sys-devel/make:           3.82-r4::gentoo
sys-kernel/linux-headers: 3.9::gentoo (virtual/os-headers)
sys-libs/glibc:           2.19-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://192.168.100.162/gentoo-portage
    priority: -1000

portage-1m
    location: /var/lib/layman/portage-1m
    sync-type: git
    sync-uri: git@gitlab.1000mercis.com:root/portage-1m.git
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/layman/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="fr_FR.UTF-8"
LC_ALL=""
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j7"
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"
USE="acl amd64 berkdb bzip2 cli cracklib crypt cxx dri gdbm hardened iconv justify mmx mmxext modules multilib ncurses nls nptl openmp pam pax_kernel pcre pic pie readline seccomp session sse sse2 ssl ssp tcpd unicode urandom xattr xtpax zlib" ABI_X86="64" 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" CPU_FLAGS_X86="mmx mmxext sse sse2" 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="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" 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"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 20 Lujeni 2016-01-12 09:30:43 UTC
Please try to rename python_install_all to _python_install_all and install pip. Does "python -m pip completions --bash" work then?

works for me.
Comment 21 Jan Sembera 2016-01-22 23:43:54 UTC
Still doesn't on hardened, but the backtrace is a bit different than what's here... maybe two unrelated issues triggering the same segfault?
Comment 22 Jan Sembera 2016-01-22 23:44:23 UTC
Created attachment 423644 [details]
python3.4 bt on hardened
Comment 23 Mike Gilbert gentoo-dev 2016-04-02 21:50:38 UTC
*** Bug 578868 has been marked as a duplicate of this bug. ***
Comment 24 Eric Siskonen 2016-04-03 17:26:24 UTC
Has anyone figured out a fix for this yet? I have this exact bug on several hardened profile machines with samba. I was able to temporarily get around the issue by doing emerge --resume --skip-first to skip emerging pip (samba and cifs-utils both function fine so far). The problem is now any time I update portage and attempt to update @world on these boxes, pip keeps getting pulled into the dependency graph for obvious reasons.
Comment 25 Mike Gilbert gentoo-dev 2016-04-03 18:41:35 UTC
I see /usr/lib64/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py in the backtrace.

I suggest rebuilding dev-python/cryptography; this module has been known to cause problems in the past.
Comment 26 Eric Siskonen 2016-04-03 21:04:54 UTC
(In reply to Mike Gilbert from comment #25)
> I see
> /usr/lib64/python2.7/site-packages/cryptography/hazmat/bindings/openssl/
> binding.py in the backtrace.
> 
> I suggest rebuilding dev-python/cryptography; this module has been known to
> cause problems in the past.

I just gave this a shot and no luck. I tried rebuilding dev-python/cryptography first and then building pip but it still segfaults. Unfortunately python-updater doesn't rebuild any packages either. I do remember depclean removing openssl-0.9.8z_p8 after the upgrade. This might be a clue to why it's segfaulting. I may try installing this specific version of openssl again and see if that resolves the issue. I hate the idea of leaving a "stale" openssl around though.
Comment 27 Eric Siskonen 2016-04-03 22:26:20 UTC
(In reply to Eric Siskonen from comment #26)
> (In reply to Mike Gilbert from comment #25)
> > I see
> > /usr/lib64/python2.7/site-packages/cryptography/hazmat/bindings/openssl/
> > binding.py in the backtrace.
> > 
> > I suggest rebuilding dev-python/cryptography; this module has been known to
> > cause problems in the past.
> 
> I just gave this a shot and no luck. I tried rebuilding
> dev-python/cryptography first and then building pip but it still segfaults.
> Unfortunately python-updater doesn't rebuild any packages either. I do
> remember depclean removing openssl-0.9.8z_p8 after the upgrade. This might
> be a clue to why it's segfaulting. I may try installing this specific
> version of openssl again and see if that resolves the issue. I hate the idea
> of leaving a "stale" openssl around though.

Unfortunately installing this version of openssl (0.9.8z p8) doesn't work either. I also tried rebuilding dev-python/cryptography after doing this and the pip installation still segfaults.
Comment 28 Maxim Britov 2016-04-04 14:44:09 UTC
From https://bugs.gentoo.org/show_bug.cgi?id=562396#c12
quote "Anything that use the libffi or cffi need to have EMUTRAMP on."
Comment 29 Mike Gilbert gentoo-dev 2016-04-04 15:09:56 UTC
(In reply to Maxim Britov from comment #28)

The original reporter was not using a hardened (PaX) kernel.

I suppose the other people on this bug may have different configurations.
Comment 30 Maxim Britov 2016-04-04 15:19:39 UTC
(In reply to Mike Gilbert from comment #29)
> (In reply to Maxim Britov from comment #28)
> 
> The original reporter was not using a hardened (PaX) kernel.
> 
> I suppose the other people on this bug may have different configurations.

Thanks. But emutramp=y fixes it for me. Waiting real fix, not this workaroud :)
Comment 31 Mike Gilbert gentoo-dev 2016-04-04 16:22:25 UTC
I don't know what you mean by "real fix"; AFAIK libffi needs that EMUTRAMP support to work with PaX and that is not going to change.

Regardless, it has nothing to do with the issue reported in this bug.
Comment 32 Martin Filo 2016-04-17 19:22:56 UTC
Emerging dev-python/cryptography-1.3.1 solve problem with hardened kernel. Emutramp is not needed.
Comment 33 Daniel Seyffer 2016-04-22 09:41:25 UTC
I can confirm that pip-7.1.2 build segfaults [1] on a hardened profile as well as that upgrading dev-python/cryptography from 1.1.x to 1.3.1 fixes this issue. Thanks.

For what is worth, this is a stable hardened profile so I had to unmask cryptography in package.accept_keywords as ~amd64 to allow the update.

--
[1] same or at least related segfault:
Installing pip3.4 script to /var/tmp/portage/dev-python/pip-7.1.2/image//_python3.4/usr/lib/python-exec/python3.4
 * python3_4: running distutils-r1_run_phase python_install_all
/var/tmp/portage/dev-python/pip-7.1.2/temp/environment: line 3371: 32226 Segmentation fault      "${PYTHON}" -m pip completion --bash > "${COMPLETION}"
 * ERROR: dev-python/pip-7.1.2::gentoo failed (install phase):
 *   (no error message)
Comment 34 Plüss Roland 2016-04-22 16:20:02 UTC
I confirm the same. Upgrading from 1.2.x to 1.3.1 helps. Strange why this package causes pip to fail.
Comment 35 Jocelyn Mayer 2016-05-25 10:04:48 UTC
I confirm the same issue and that the proposed solution is OK for me:
I have no issue merging dev-python/pip while using dev-python/cryptography-1.0.2 with a default/linux/amd64/13.0/developer profile but I need to upgrade to dev-python/cryptography-1.3.1 with a hardened/linux/amd64/no-multilib profile to solve the same crash issue.
Note: I got the crash during python-3.4 installation phase while python-2.7 installation phase was OK.
# eselect python list
Available Python interpreters:
  [1]   python2.7
  [2]   python3.3
  [3]   python3.4 *
Comment 36 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2019-06-19 04:23:39 UTC
old pip is gone (and newer should be stabilized)