Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 200992 - dev-lang/python - python scripts using module urllib2 crash with webs that use https protocol w/ dev-libs/openssl compiled w/ USE=kerberos
Summary: dev-lang/python - python scripts using module urllib2 crash with webs that us...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: High minor (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-02 12:00 UTC by jordi bofill
Modified: 2009-10-18 16:18 UTC (History)
3 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 jordi bofill 2007-12-02 12:00:50 UTC
Checking url links with python a script using module urllib2, I got segmentation violation crash in webs that use https protocol.
After some testa&error I found a work around for the crash problem: emerge dev-libs/openssl without kerberos use flag.
Maybe related to http://bugs.gentoo.org/show_bug.cgi?id=114759

Reproducible: Always

Steps to Reproduce:
Steps to reproduce:
# equery uses dev-libs/openssl
 U I
 - - bindist  : Flag to enable or disable options for prebuilt (GRP)  packages (eg. due to licensing issues)
 - - emacs    : Adds support for GNU Emacs
 - - gmp      : Adds support for dev-libs/gmp (GNU MP library)
 + + kerberos : Adds kerberos support
 + + sse2     : faster floating point optimization for SSE2 capable chips
 - - test     : Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in make.conf/package.use anymore.
 + + zlib     : Adds support for zlib (de)compression


# python
>>> import urllib2
>>> f=urllib2.urlopen("https://bugs.gentoo.org/")
>>> quit()
Violació de segment
#
(thats in catalan, in english -> segmentation violation)


work around:

# USE="-kerberos" emerge dev-libs/openssl
# python
>>> import urllib2
>>> f=urllib2.urlopen("https://bugs.gentoo.org/")
>>> quit()
#




# emerge --info
Portage 2.1.4_rc4 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.7-r0, 2.6.22-gentoo-r9 x86_64)
=================================================================
System uname: 2.6.22-gentoo-r9 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
Timestamp of tree: Sat, 01 Dec 2007 14:46:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.3
dev-lang/python:     2.4.4-r7, 2.5.1-r4
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.10-r5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r2
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib64/mozilla/defaults/pref /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=athlon64 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="        ftp://fido.online.kz/gentoo/pub         http://gentoo.supp.name/        http://ftp.uoi.gr/mirror/OS/gentoo/     http://ftp.caliu.info/gentoo    "
LANG="ca_ES@euro"
LC_ALL="ca_ES.utf8"
LINGUAS="ca es en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/gentoo-gis /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 apache2 arts audiofile berkdb bitmap-fonts blas cairo cdr cli cracklib crypt cups dbus dri dts dv dvb dvd dvdr dvdread eds emboss encode esd evo examples exif fam ffmpeg firefox flac foomaticdb fortran gdbm gif gimp gimpprint glitz gnome gphoto2 gpm gsl gstreamer gtk hal iconv ipv6 isdnlog jpeg kde kerberos lapack ldap libdvdread live mad midi mikmod mmx mp3 mpeg mplayer mudflap mysql ncurses nls nptl nptlonly nsplugin nvidia ogg opengl openmp oss pam pcre pdf perl png pppd python qt qt3 qt3support qt4 quicktime readline reflection reiserfs sasl scanner sdl session sndfile spell spl sse sse2 ssl subversion svg tcpd theora tiff tk truetype truetype-fonts type1-fonts unicode usb utf8 v4l vcd vhosts vorbis x264 xine xinerama xml xorg xv xvid zlib" ALSA_CARDS="hda-intel usb-audio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ca es en" USERLAND="GNU" VIDEO_CARDS="nvidia vga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-12-02 12:09:08 UTC
openssl version? Also, can you attach a backtrace? http://www.gentoo.org/proj/en/qa/backtraces.xml
Comment 2 jordi bofill 2007-12-02 14:18:13 UTC
(In reply to comment #1)
> openssl version? Also, can you attach a backtrace?
dev-libs/openssl-0.9.8g
also happens with previous versions (0.9.8e-r4, 0.9.8f)

> http://www.gentoo.org/proj/en/qa/backtraces.xml
> 

>>> f=urllib2.urlopen("https://lafarga.cpl.upc.edu")
>>> quit()

Program received signal SIGSEGV, Segmentation fault.
remove_session_lock (ctx=0x1, c=0x7cc3d0, lck=1) at ssl_sess.c:543
543     ssl_sess.c: No such file or directory.
        in ssl_sess.c
(gdb)     
Comment 3 Randy Barlow 2008-06-25 18:21:37 UTC
I can confirm this bug, on the x86 platform, as well as the workaround that Jordi has identified.  I discovered it when my code that works in Debian didn't work in Gentoo, and it's that same urllib.urlopen() statement that seg faults.  When I rebuild openssl with -kerberos, it worked.

I am using openssl 0.9.8g-r2, and my emerge --info is:

Portage 2.1.4.4 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r8 i686)
=================================================================
System uname: 2.6.24-gentoo-r8 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz
Timestamp of tree: Mon, 16 Jun 2008 21:15:01 +0000
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r13
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=prescott -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=prescott -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://mirror.iawnet.sandia.gov/pub/gentoo/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo "
LINGUAS="en en_US"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X a52 aac acl alsa avahi bash-completion berkdb branding bzip2 cli cpudetection cracklib crypt cups dbus dri ffmpeg firefox fortran gdbm glitz gnome gpm gtk hal hddtemp iconv isdnlog java jpeg kerberos ldap midi mmx mp3 mpeg mudflap mysql ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pcre pdf perl png ppds pppd python radio readline reflection replytolist session smp spell spl sse sse2 ssl svg symlink tcpd tetex tiff unicode vim-syntax vorbis win32codecs x86 xinerama xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 4 Rob Cakebread (RETIRED) gentoo-dev 2008-06-26 04:52:06 UTC
I can't find anything in upstream's (bugs.python.org)bug tracker about this, but here's what some testing for me shows in case you must have kerberos:

openssl 0.9.8h and 0.9.8h-r1 works with:

python 2.5.2-r5
       2.4.4-r13

Fails with:

python 2.5.1-r1
(and those mentioned in above comments)

Comment 5 Dirkjan Ochtman (RETIRED) gentoo-dev 2009-10-17 09:07:24 UTC
Does this still happen with more recent Python/OpenSSL?
Comment 6 jordi bofill 2009-10-17 10:30:03 UTC
(In reply to comment #5)
> Does this still happen with more recent Python/OpenSSL?
> 

I compiled openssl with kerberos support, and it now works ok. From my point of view, the bug can be closed.

dev-libs/openssl-0.9.8k-r1
dev-lang/python-2.6.2-r1

# emerge --info
Portage 2.1.7.1 (default/linux/amd64/2008.0/desktop, gcc-4.3.3, glibc-2.10.1-r0, 2.6.30-gentoo-r5 x86_64)
=================================================================                                        
System uname: Linux-2.6.30-gentoo-r5-x86_64-AMD_Phenom-tm-_9850_Quad-Core_Processor-with-gentoo-2.0.1    
Timestamp of tree: Fri, 16 Oct 2009 15:15:03 +0000                                                       
distcc 3.1 x86_64-pc-linux-gnu [enabled]                                                                 
ccache version 2.4 [enabled]                                                                             
app-shells/bash:     4.0_p33                                                                             
dev-java/java-config: 2.1.9-r1                                                                           
dev-lang/python:     2.4.6, 2.5.4-r3, 2.6.2-r1                                                           
dev-python/pycrypto: 2.0.1-r8                                                                            
dev-util/ccache:     2.4-r8                                                                              
dev-util/cmake:      2.6.4                                                                               
sys-apps/baselayout: 2.0.1                                                                               
sys-apps/openrc:     0.4.3-r3                                                                            
sys-apps/sandbox:    2.1                                                                                 
sys-devel/autoconf:  2.13, 2.63-r1                                                                       
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11                                     
sys-devel/binutils:  2.19.1-r1                                                                           
sys-devel/gcc-config: 1.4.1                                                                              
sys-devel/libtool:   2.2.6a                                                                              
virtual/os-headers:  2.6.30-r1                                                                           
ACCEPT_KEYWORDS="amd64 ~amd64"                                                                           
CBUILD="x86_64-pc-linux-gnu"                                                                             
CFLAGS="-march=athlon64 -O2 -pipe"                                                                       
CHOST="x86_64-pc-linux-gnu"                                                                              
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/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 /etc/udev/rules.d"                                                                                                                                       
CXXFLAGS="-march=athlon64 -O2 -pipe"                                                                                                                                               
DISTDIR="/usr/portage/distfiles"                                                                                                                                                   
FEATURES="assume-digests ccache distcc distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"                      
FFLAGS="-march=athlon64 -O2 -pipe"                                                                                                                                                 
GENTOO_MIRRORS="ftp://mirror.muntinternet.net/pub/gentoo/ ftp://gentoo.imj.fr/pub/gentoo/ http://mirror.muntinternet.net/pub/gentoo/ http://212.219.56.135/sites/www.ibiblio.org/gentoo/ http://212.219.56.133/sites/www.ibiblio.org/gentoo/"                                                                                                                         
LANG="ca_ES.utf8"                                                                                                                                                                  
LC_ALL="ca_ES.utf8"                                                                                                                                                                
LDFLAGS="-Wl,-O1"                                                                                                                                                                  
LINGUAS="ca es en"                                                                                                                                                                 
MAKEOPTS="-j9"                                                                                                                                                                     
PKGDIR="/usr/portage/packages"                                                                                                                                                     
PORTAGE_CONFIGROOT="/"                                                                                                                                                             
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"                                                                                                                                                                        
PORTAGE_TMPDIR="/var/tmp"                                                                                                                                                          
PORTDIR="/usr/portage"                                                                                                                                                             
PORTDIR_OVERLAY="/usr/local/portage/layman/science /usr/local/portage/layman/sunrise /usr/portage/local"                                                                           
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"                                                                                                                              
USE="X a52 aac accessibility acl acpi alsa amd64 apache2 arts audiofile avi berkdb blas bluetooth branding bzip2 cairo cdr cli consolekit cracklib crypt cups dbus divx4linux docbook dri dts dv dvb dvd dvdr dvdread eds emboss encode esd evo examples exif fam fame ffmpeg firefox flac foomaticdb fortran gdbm gif gimp gimpprint glitz gnome gphoto2 gpm gsl gstreamer gtk hal iconv ipv6 isdnlog jpeg kde lapack ldap libdvdread libnotify live lm_sensors lyx mad matroska mikmod mjpeg mmx modules mp3 mp4 mpeg mplayer mudflap multilib mysql ncurses nls nptlonly nsplugin nvidia obex ogg opengl openmp oss pam pcre pdf perl plasma png ppds pppd python qt qt3 qt3support qt4 quicktime readland readline reflection reiserfs samba sasl scanner sdl semantic-desktop session sndfile spell spl sqlite sqlite3 sse sse2 ssl startup-notification subtitles subversion svg sysfs tcl tcpd theora thunar tiff tk truetype unicode usb utf8 v4l vcd vhosts vorbis x264 xcomposite xine xinerama xml xmms xorg xrandr xulrunner xv xvid zlib" ALSA_CARDS="hda-intel usb-audio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ca es en" SANE_BACKENDS="epson2" USERLAND="GNU" VIDEO_CARDS="nvidia vga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 7 Dirkjan Ochtman (RETIRED) gentoo-dev 2009-10-17 13:46:47 UTC
I don't see kerberos in your emerge --info, are you sure you compiled openssl with it?
Comment 8 jordi bofill 2009-10-18 13:38:22 UTC
(In reply to comment #7)
> I don't see kerberos in your emerge --info, are you sure you compiled openssl
> with it?
> 
Yes I did;

# equery uses dev-libs/openssl
 * Searching for dev-libs/openssl ...
[ Legend : U - flag is set in make.conf       ]
[        : I - package is installed with flag ]
[ Colors : set, unset                         ]
 * Found these USE flags for dev-libs/openssl-0.9.8k-r1:
 U I
 - - bindist  : Flag to enable or disable options for prebuilt (GRP)  packages (eg. due to licensing issues)
 - - gmp      : Adds support for dev-libs/gmp (GNU MP library)
 - + kerberos : Adds kerberos support
 + + sse2     : faster floating point optimization for SSE2 capable chips
 - - test     : Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in make.conf/package.use anymore
 + + zlib     : Adds support for zlib (de)compression

and the above test passed. 
For the record: after your comment, I executed a more complete linkcheck test and found that it crashed at some point. I recompiled python-2.6.2-r1 and since then have no more crashes. My previous compilation of python-2.6.2-r1 was in 29-May-2009.

Comment 9 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-10-18 16:18:36 UTC
(In reply to comment #8)
> I recompiled python-2.6.2-r1 and since then have no more crashes.

OK. I'm closing this bug.