Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 273888 - latest sip and PyQt4 cause segfault when using "import qt"
Summary: latest sip and PyQt4 cause segfault when using "import qt"
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-12 16:27 UTC by James Bowlin
Modified: 2009-06-13 21:43 UTC (History)
0 users

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 James Bowlin 2009-06-12 16:27:29 UTC
After emerge -uDN world that upgraded to dev-python/sip-4.8 and dev-python/PyQt4-4.5 (among others), xbmc would instantly crash with a segfault on start up.  I tracked the problem down to this Python code:

try:
    from qt import *
    AvailableOutputs.append("--error-output=Qt")
except:
    pass

I masked dev-python/PyQt4-4.5 and then re-emerged sip and PyQt.  After sip was downgraded to sip-4.7.9 the segfault went away even before PyQt4-4.4.4-r5 finished emerging.

Reproducible: Always

Steps to Reproduce:
1. emerge sip-4.8 and PyQt4-4.5
2. run xbmc (or simple Python program above)
3. 

Actual Results:  
Segfault

Expected Results:  
Normal operation (no output from test program).

With PyQt4-4.5 masked and the downgraded sip and PyQt, Portage is unhappy about multiple package instances within a single package slot.

# emerge --info
Portage 2.2_rc33 (default/linux/amd64/2008.0/desktop, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.29-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.29-gentoo-r5-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_3600+-with-glibc2.2.5
Timestamp of tree: Fri, 12 Jun 2009 04:00:01 +0000
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 2.1.7
dev-lang/python:     2.5.4-r2
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    2.0
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="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/kde/4.2/env /usr/kde/4.2/share/config /usr/kde/4.2/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /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/sandbox.d /etc/splash /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="distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo     http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/     http://gentoo.netnitco.net http://gentoo.mirrors.hoobly.com/     ftp://mirror.iawnet.sandia.gov/pub/gentoo/"
LANG="en_US"
LDFLAGS="-Wl,-O1"
LINGUAS="en"
MAKEOPTS="-j3"
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"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acpi alsa amarok amd64 apache2 bash-completion berkdb bluetooth branding bzip2 cairo cddb cdparanoia cdr cli cracklib crypt cups dbus dri dvd dvdnav dvdr dvdread eds emboss encode evo exif fam fbcon ffmpeg firefox flac fortran gdbm gif glitz gmp gpm gstreamer hal iconv id3 ieee1394 imagemagick isdnlog java jpeg kde kdeenablefinal kdeprefix kdexdeltas kpathsea libnotify libwww lm_sensors logitech-mouse mad midi mikmod mmx mmxext mp3 mpeg mplayer mudflap multilib musicbrainz ncurses nls nptl nptlonly nsplugin objc ogg opengl openmp pam pcre pdf perl plotutils png ppds pppd python qt3 qt3support qt4 quicktime readline reflection ruby sdl semantic-desktop session sockets spell spl sse sse2 ssl startup-notification svg sysfs tcltk tcpd tetex tidy tiff tk truetype unicode usb vdpau vim-pager vim-syntax vorbis xcomposite xine xinerama xml xorg xulrunner xv xvid zlib" ALSA_CARDS="hda-intel" 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="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Markos Chandras (RETIRED) gentoo-dev 2009-06-12 19:20:30 UTC
This behavior doesnt happen with every PyQt4 application so I am adjusting the title

So far we havent found any PyQt4 that fails with the latest pyqt4 and sip. Did you try to re-emerge xbmc?
Comment 2 James Bowlin 2009-06-12 19:34:15 UTC
I did try re-emerging xbmc but it made no difference.  Did you try the sample 5-line program I provided?  It always segfaults with the newer sip + PyQt4.  It no longer segfaults after I downgraded sip.
Comment 3 Davide Pesavento (RETIRED) gentoo-dev 2009-06-12 21:16:30 UTC
(In reply to comment #2)
> I did try re-emerging xbmc but it made no difference.  Did you try the sample
> 5-line program I provided?  It always segfaults with the newer sip + PyQt4.  It
> no longer segfaults after I downgraded sip.
> 

'qt' is not a valid module name...
Comment 4 James Bowlin 2009-06-12 21:44:57 UTC
(In reply to comment #3)
>
> 'qt' is not a valid module name...

I believe that is why there is the try statement, to determine if 'qt' is a valid module name on the system.  If the import statement works then the append is executed, otherwise it is not.   But regardless, unlike C, if Python segfaults, the fault never lies in the script.  IMO a segfault under any conditions is a significant bug.  For example this code:

try:
    from xyzzy import *
    print "Module xyzzy exists.\n"
except:
    print "Module xyzzy not found.\n"

Prints "Module zyzzy not found." on my system.  Also, a similar test program with qt says that qt does exist on my system (with the older versions of sip and PyQt).


Comment 5 Davide Pesavento (RETIRED) gentoo-dev 2009-06-12 23:11:53 UTC
What happens if you execute 'import qt' in a python shell?
Comment 6 James Bowlin 2009-06-13 00:20:08 UTC
Import qt works fine.  But I'm still using the downgraded packages so the test program is also working fine.
Comment 7 SpanKY gentoo-dev 2009-06-13 00:40:39 UTC
considering he provided a very simple piece of test code that has nothing xbmc related in it that still crashes ...
Comment 8 James Bowlin 2009-06-13 01:51:59 UTC
I updated the title.  It never occurred to me that someone would suspect the append line so I upgraded to the latest sip and PyQt to verify.   I get a segfault when I try to run:

import qt


Comment 9 Markos Chandras (RETIRED) gentoo-dev 2009-06-13 09:16:09 UTC
Works for me

hwoarang@Raptor ~ $ python
Python 2.6.2 (r262:71600, May 29 2009, 01:05:03)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qt
>>>
Comment 10 Davide Pesavento (RETIRED) gentoo-dev 2009-06-13 09:34:11 UTC
I still can't understand where that 'qt' module comes from. PyQt4 does not install such a module, it may belong to PyQt-3.x...

Could you post the output of:
qfile /usr/lib/python*/site-packages/qt.*
Comment 11 Ben de Groot (RETIRED) gentoo-dev 2009-06-13 09:36:18 UTC
Works for me, in the sense that it doesnt segfault with sip-4.8 and PyQt4-4.5:

ben@raven ~ % python
Python 2.6.2 (r262:71600, May 30 2009, 15:55:39) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named qt

And the same on my other box:

ben@hummingbird ~ % python
Python 2.6.2 (r262:71600, Jun  8 2009, 17:17:30) 
[GCC 4.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named qt
Comment 12 Markos Chandras (RETIRED) gentoo-dev 2009-06-13 10:03:21 UTC
(In reply to comment #10)
> I still can't understand where that 'qt' module comes from. PyQt4 does not
> install such a module, it may belong to PyQt-3.x...
> 
> Could you post the output of:
> qfile /usr/lib/python*/site-packages/qt.*
> 

Yes it comes from PyQt-3.X

hwoarang@Raptor ~ $ qlist PyQt|grep qt|grep site-packages|sed "s/.*\///"
qtsql.so
qt.so
qtgl.so
qtxml.so
qtui.so
qtcanvas.so
pyqtconfig.py
qttable.so
qtnetwork.so
qt.so
qtproxies.py
qtwebkit.py
pyqtconfig.py

Comment 13 Ben de Groot (RETIRED) gentoo-dev 2009-06-13 10:21:21 UTC
So was PyQt updated to 3.18, to go along with sip-4.8 ?
Comment 14 James Bowlin 2009-06-13 16:49:42 UTC
(In reply to comment #13)
> So was PyQt updated to 3.18, to go along with sip-4.8 ?

No.  I think this is probably where the problem lies.  I added:

dev-python/PyQt        
x11-libs/qscintilla    
dev-python/qscintilla-python
 
to package.keywords but unfortunately PyQt failed to emerge with this error:

sip/qt/qobject.sip: In function 'void* sipQtCreateUniversalSlot(sipWrapper*, const char*, PyObject*, const char*, const char**, int)':
sip/qt/qobject.sip:1652: error: 'struct _sipWrapper' has no member named 'ob_type'

which was preceded by six warnings like:

sip/qt/qobject.sip:1256: warning: missing initializer for member '_heaptypeobject::ht_slots'
Comment 15 Markos Chandras (RETIRED) gentoo-dev 2009-06-13 21:09:06 UTC
Please try to reproduce this issue with the latest PyQt-3.18

Re-open the bug if needed


Thanks
Comment 16 James Bowlin 2009-06-13 21:43:30 UTC
Thanks. I was able to emerge PyQt-3.18-r1 and that solved the problem.  Thank you all for your help.