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

Bug 351897

Summary: dev-lang/python has TFU uuid when libuuid is brought in by other extensions
Product: Gentoo Linux Reporter: Diego Elio Pettenò (RETIRED) <flameeyes>
Component: New packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED FIXED    
Severity: normal CC: blackrabbit, cardoe, davech, gnome, igor, joost.ruis, ps, python, qt, spatz, x11, zmedico
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 353224    
Bug Blocks: 366293    

Description Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-17 12:15:55 UTC
I guess the problem is that if you have x11-libs/cairo[qt4] installed, libuuid is brought in with pygtk, while if you don't have it it is not.

Simple testcase:

python -c 'import gtk, uuid; print (uuid.uuid1().hex)'

works if you have cairo[-qt4] segfaults with cairo[qt4].

Portage 2.1.9.31 (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.2-asneeded, glibc-2.12.2-r0, 2.6.37 x86_64)
=================================================================
System uname: Linux-2.6.37-x86_64-Intel-R-_Atom-TM-_CPU_D525_@_1.80GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 17 Jan 2011 10:00:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [enabled]
app-shells/bash:     4.1_p9
dev-lang/python:     2.6.6-r1
dev-util/cmake:      2.8.3-r1
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.7.0
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.21
sys-devel/gcc:       4.5.2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA skype-eula AdobeFlash-10.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=atom"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /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 -pipe -fomit-frame-pointer -march=atom"
DISTDIR="/var/cache/portage/distfiles"
FEATURES="assume-digests binpkg-logs distcc distlocks fail-clean fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.wheel.sk/"
LANG="en_US.utf8"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,-z,now"
LINGUAS="it en"
MAKEOPTS="-s -j5"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="xz"
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="/var/cache/portage/tree"
PORTDIR_OVERLAY="/var/lib/layman/flameeyes-overlay /var/lib/layman/tante"
SYNC="rsync://yamato.home.flameeyes.eu/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 avahi berkdb bluetooth branding bzip2 cairo caps cdr cli consolekit crypt cups custom-cflags custom-optimization cxx dbus dri dts dvd dvdr eds emacs emboss encode evo exif firefox flac fortran gdbm gdu gif gmp gnome gnome-keyring gstreamer gtk iconv idn ipv6 jpeg lcms libnotify mad mikmod mmx mng modules mp3 mp4 mpeg mudflap multicall multilib nautilus ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd pulseaudio qt3support qt4 readline sdl session smartcard spell sse sse2 sse3 ssl ssse3 startup-notification svg sysfs tiff truetype udev unicode usb vorbis x264 xattr xcb xml xmp xorg xulrunner xv xvid zlib" 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" 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 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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 ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="it en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" SANE_BACKENDS="snapscan" USERLAND="GNU" VIDEO_CARDS="nvidia" 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:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Pacho Ramos gentoo-dev 2011-01-17 17:49:48 UTC
I cannot reproduce:

 $ python -c 'import gtk, uuid; print (uuid.uuid1().hex)'
** Message: pygobject_register_sinkfunc is deprecated (GtkWindow)
** Message: pygobject_register_sinkfunc is deprecated (GtkInvisible)
** Message: pygobject_register_sinkfunc is deprecated (GtkObject)

 $ echo $?
0

I have the following:

[ebuild   R   ] dev-python/pygtk-2.17.0  USE="test -doc -examples" 0 kB
[ebuild   R   ] x11-libs/cairo-1.10.2-r1  USE="X opengl qt4 svg xcb (-aqua) -debug -directfb -doc (-drm) (-gallium) (-openvg) -static-libs" 0 kB
Comment 2 Rafał Mużyło 2011-01-17 18:01:49 UTC
I can - same cairo, but dev-python/pygtk-2.22.0.
No debugging symbols, but may help anyway:
#0  0xb5c4425d in uuid_generate_time () from /lib/libuuid.so.1
#1  0xb787c677 in ffi_call_SYSV () from /usr/lib/libffi.so.5
#2  0xb787c4ce in ffi_call () from /usr/lib/libffi.so.5
#3  0xb5ad1997 in _ctypes_callproc ()
   from /usr/lib/python2.7/lib-dynload/_ctypes.so
#4  0xb5acb7ba in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes.so
#5  0xb7e7cc1a in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#6  0xb7f148ac in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#7  0xb7f16c8f in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#8  0xb7f15471 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#9  0xb7f16c8f in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#10 0xb7f16dd3 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#11 0xb7f302db in ?? () from /usr/lib/libpython2.7.so.1.0
#12 0xb7f30f85 in PyRun_StringFlags () from /usr/lib/libpython2.7.so.1.0
#13 0xb7f31c24 in PyRun_SimpleStringFlags () from /usr/lib/libpython2.7.so.1.0
#14 0xb7f43396 in Py_Main () from /usr/lib/libpython2.7.so.1.0
#15 0x080487d3 in main ()
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-17 18:09:54 UTC
Yes that the same trace I got.
Comment 4 Gilles Dartiguelongue (RETIRED) gentoo-dev 2011-01-17 18:11:12 UTC
pygtk-2.22 is not in tree for a reason... It does not pass its testsuite as reported upstream.
Comment 5 Pacho Ramos gentoo-dev 2011-01-17 18:35:18 UTC
Also works ok for me with 2.22 :-/, maybe the problem is related by you using python-2.7?
Comment 6 Rafał Mużyło 2011-01-17 19:06:05 UTC
(In reply to comment #5)
> Also works ok for me with 2.22 :-/, maybe the problem is related by you using
> python-2.7?
> 

No, info says 2.6.6-r1.
Comment 7 Pacho Ramos gentoo-dev 2011-01-17 19:17:54 UTC
Yes, I don't know where is the problem then :-/

Flameeyes, what pygtk version are you using? (original report doesn't shows it). Thanks
Comment 8 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2011-01-17 19:25:44 UTC
I can reproduce segmentation fault with both x11-libs/cairo-1.10.2-r1[qt4] and x11-libs/cairo-1.10.2-r1[-qt4].
Comment 9 Pacho Ramos gentoo-dev 2011-01-17 19:31:25 UTC
And what pygtk version are you running?
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-17 19:33:22 UTC
Make sure you've been using --as-needed otherwise you need to rebuild more than just cairo[-qt4] (as QtGui, libSM and libuuid would be added to _more_ needed lists).

dev-python/pygtk-2.17.0 here; problem happens both with 2.7 and 2.6 (I did downgrade thinking it was 2.7 problem).
Comment 11 Rafał Mużyło 2011-01-17 19:57:06 UTC
OK, the difference in ldd output between qt4 and -qt4 is that
with qt4, cairo links indirectly to libuuid via libQtGui.so.4 -> libSM.so.6.

But why does python throw a fit about it ?

Comment 12 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-17 20:11:11 UTC
Yes that's the middle-cause of it; the root cause I don't know, it seems like Python makes a mess if libuuid is loaded before the uuid extension is imported. Zac also hit that with calibre before FWIW (if he didn't tell me about the order issue I'd never have found this problem).
Comment 13 Zac Medico gentoo-dev 2011-01-17 20:24:56 UTC
(In reply to comment #11)
> OK, the difference in ldd output between qt4 and -qt4 is that
> with qt4, cairo links indirectly to libuuid via libQtGui.so.4 -> libSM.so.6.

Maybe it's a duplicate of bug 317557 since that also involves qt libraries.

Comment 14 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-17 20:40:28 UTC
Sorta, the trace there is for the random uuid, this for the time uuid, so they are most definitely related but not the same issue.
Comment 15 Rafał Mużyło 2011-01-17 21:35:45 UTC
Perhaps the problem lies not in pygtk/PyQt4, but in a way python/ctypes loads/unloads libraries ?
Comment 16 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-19 19:14:00 UTC
Fun, now it seems to break in many other ways:


flame@raven ~ % python
Python 2.6.6 (r266:84292, Jan 16 2011, 22:31:06) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynotify
** Message: pygobject_register_sinkfunc is deprecated (GtkWindow)
** Message: pygobject_register_sinkfunc is deprecated (GtkInvisible)
** Message: pygobject_register_sinkfunc is deprecated (GtkObject)
>>> import uuid
>>> uuid.uuid1().hex
zsh: segmentation fault  python


so yes we have a problem here. Moving to python.
Comment 17 Rafał Mużyło 2011-01-19 21:29:07 UTC
Well, if you still have cairo[qt4], it may actually be exactly the same way
- something bad happens if cairo linked with QtGui is opened by python.
Comment 18 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-19 21:37:16 UTC
It filters through on other libraries if --as-needed is not entirely forced like I have suggested many times (as Arfrever can tell, LD_AS_NEEDED no longer works).

We're going to have to look for the original problem in python's uuid.
Comment 19 Davide Pesavento (RETIRED) gentoo-dev 2011-01-20 14:21:49 UTC
The root cause might be some TLS issues in libuuid (just taking a wild guess...)
Comment 20 Rafał Mużyło 2011-01-26 15:05:39 UTC
Seems the shortest way is "python -c 'import cairo, uuid; print (uuid.uuid1().hex)'".
Comment 21 Rafał Mużyło 2011-04-06 19:07:43 UTC
Does anyone have an idea if the patch from bug 353224 is the proper solution ?
Comment 22 Rafał Mużyło 2011-08-07 14:46:33 UTC
(In reply to comment #20)
> Seems the shortest way is "python -c 'import cairo, uuid; print
> (uuid.uuid1().hex)'".

Well, as this works with glibc 2.13-r4, it most likely was the same problem as in bug 353224.

Would be nice if backported to 2.12, unless 2.13-r4 is getting into stable soon.
Comment 23 Davide Pesavento (RETIRED) gentoo-dev 2011-12-31 13:30:03 UTC
(In reply to comment #22)
> (In reply to comment #20)
> > Seems the shortest way is "python -c 'import cairo, uuid; print
> > (uuid.uuid1().hex)'".
> 
> Well, as this works with glibc 2.13-r4, it most likely was the same problem as
> in bug 353224.
> 
> Would be nice if backported to 2.12, unless 2.13-r4 is getting into stable
> soon.

glibc-2.13-r4 is already stable on most arches, anything else to do here?
Comment 24 Davide Pesavento (RETIRED) gentoo-dev 2012-03-08 00:51:16 UTC
Closing