Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 497778 - games-board/pysolfc-2.0-r2 with dev-python/pillow-2.1.0 segfaults during startup
Summary: games-board/pysolfc-2.0-r2 with dev-python/pillow-2.1.0 segfaults during startup
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-11 12:02 UTC by Andrey Grozin
Modified: 2014-01-25 19:19 UTC (History)
1 user (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 Andrey Grozin gentoo-dev 2014-01-11 12:02:17 UTC
After recent upgrades of many packages, on 2 different computers (one ~amd64 and one ~x86) I reproducibly get

grozin@dns ~ $ pysolfc
*** Error in `python2.7': malloc(): memory corruption: 0x00000000030cac90 ***

"Welcome to PySol" window appears, the slider moves most of the way to the right, then the error message appears on the console, and the program hangs. Pressing ctrl-c any number of times on the console just produces ^C^C^C^C^C^C output; the only way is to kill the python process. On the ~x86 computer, everything's the same, only the address differs.

dns ~ # emerge --info
Portage 2.2.8 (default/linux/amd64/13.0/desktop/kde, gcc-4.8.2, glibc-2.17, 3.9.3-gentoo x86_64)
=================================================================
System uname: Linux-3.9.3-gentoo-x86_64-Intel-R-_Core-TM-_i7-3610QM_CPU_@_2.30GHz-with-gentoo-2.2
KiB Mem:     8075304 total,   3089584 free
KiB Swap:   10485756 total,  10485756 free
Timestamp of tree: Sat, 11 Jan 2014 08:15:01 +0000
ld GNU ld (GNU Binutils) 2.24
app-shells/bash:          4.2_p45-r1
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.6, 3.2.5-r3, 3.3.3
dev-util/cmake:           2.8.12.1-r3
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
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-r1
sys-devel/gcc:            4.7.3-r1, 4.8.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.12 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo lisp sunrise science grozin
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/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 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
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 strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -march=native -pipe"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo"
LANG="ru_RU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
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/lisp /var/lib/layman/sunrise /var/lib/layman/science /usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="X a52 aac acpi alsa amd64 bash-completion berkdb blas bluetooth boehm-gc branding browserplugin bzip2 cairo cdda cdr cli consolekit cracklib crypt css cups curl cxx dbus declarative dirac doc dri dvd emacs enca encode exif fam ffmpeg fftw firefox flac fltk fortran gd gdbm gif gmp gpm gsl gtk iconv imagemagick jpeg kde kipi kpathsea lapack latex lcms ldap libnotify lzma mad mmx mng modules mozilla mp3 mp4 mpeg mudflap multilib ncurses nls nptl nsplugin offensive ogg opengl openmp pam pango pcre pdf phonon plasma plotutils png policykit ppds python qt3support qt4 readline schroedinger sdl semantic-desktop session speex spell sse sse2 ssl startup-notification svg tcl tcpd theora tiff tk truetype udev udisks umfpack unicode upower usb v4l2 vorbis win32codecs wxwidgets x264 xcb xcomposite xinerama xml xscreensaver xv xvid 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" 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 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" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19 ruby18" 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"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

dns ~ # eix dev-lang/python
[I] dev-lang/python
     Available versions:  
     (2.6)  2.6.8-r3 (~)2.6.9
     (2.7)  2.7.5-r3 (~)2.7.5-r4 (~)2.7.6
     (3.2)  3.2.5-r3
     (3.3)  3.3.2-r2 (~)3.3.3
       {-berkdb build doc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml ELIBC="uclibc"}
     Installed versions:  2.7.6(2.7)(02:37:00 09.01.2014)(berkdb doc gdbm ncurses readline sqlite ssl threads tk wide-unicode xml -build -examples -hardened -ipv6 -wininst ELIBC="-uclibc") 3.2.5-r3(3.2)(02:38:41 09.01.2014)(doc gdbm ncurses readline sqlite ssl threads tk wide-unicode xml -build -examples -hardened -ipv6 -wininst ELIBC="-uclibc") 3.3.3(3.3)(02:40:45 09.01.2014)(doc gdbm ncurses readline sqlite ssl threads tk xml -build -examples -hardened -ipv6 -wininst ELIBC="-uclibc")
     Homepage:            http://www.python.org/
     Description:         An interpreted, interactive, object-oriented programming language

Just re-compiled python-2.7.6 by gcc-4.8.2, does not help.

dns ~ # eix sys-libs/glibc
[I] sys-libs/glibc
     Available versions:  (2.2) (~)2.9_p20081201-r3^s 2.10.1-r1^s 2.11.3^s (~)2.12.1-r3^s 2.12.2^s (~)2.13-r2^s 2.13-r4^s (~)2.14^s (~)2.14.1-r2^s 2.14.1-r3^s (~)2.15-r1^s 2.15-r2^s 2.15-r3^s 2.16.0^s 2.17^s **2.18^s **9999^s
       {debug gd hardened multilib nscd profile selinux suid systemtap vanilla CROSSCOMPILE_OPTS="headers-only"}
     Installed versions:  2.17(2.2)^s(19:49:35 08.01.2014)(gd multilib -debug -hardened -nscd -profile -selinux -suid -systemtap -vanilla CROSSCOMPILE_OPTS="-headers-only")
     Homepage:            http://www.gnu.org/software/libc/libc.html
     Description:         GNU libc6 (also called glibc2) C library
Comment 1 Andrey Grozin gentoo-dev 2014-01-13 05:49:06 UTC
I've just installed pysolfc-2.0-r2 to a third computer, a fully updated ~x86, and got the same error. So, it's 100% reproducible.
Then I tried to start pysolfc in the upstream-recommended way, without installation - just unpacked PySolFC-2.0.tar.bz2 in my home directory, edited pysol.py #! line to contain python2, and started ./pysol.py. And everything worked fine! So, this is not an upstream bug, but a bug introduced by Gentoo.
In any case, I think the python interpreter should not hang like this, even for a buggy python code - it should produce a backtrace and exit.
Comment 2 Andrey Grozin gentoo-dev 2014-01-19 15:43:59 UTC
Ping. The upstream program works, the Gentoo package does not. If it's not going to be fixed, we should at least hard-mask it.
Comment 3 Dirkjan Ochtman (RETIRED) gentoo-dev 2014-01-20 07:31:41 UTC
I have no clue about where this could be. Perhaps you can file a bug against CPython? That might help somehow. I know some cpython devs use gentoo, too.
Comment 4 Andrey Grozin gentoo-dev 2014-01-20 11:58:58 UTC
As I said: if I take PySolFC, unpack it in my home dir and start it, it works normally. No bug in either PySolFC or CPython. It's only the Gentoo-installed version which does not work.
Comment 5 Andrey Grozin gentoo-dev 2014-01-20 12:07:59 UTC
The Gentoo version worked fine before the recent python-exec changes. The bug is somehow induced by python-exec.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-01-20 14:36:07 UTC
(In reply to Andrey Grozin from comment #5)
> The Gentoo version worked fine before the recent python-exec changes. The
> bug is somehow induced by python-exec.

Try this:

  cd /usr/share/pysolfc
  ./pysol.py-python2.7

If it's indeed induced by us, it's induced by the sole fact that the Python script is renamed. This is not Gentoo bug at all, it's just the package being incapable of running under different filename.

Then, CPython should not segfault. It can raise exceptions, exit with horrible errors but any kind of memory corruption either means a serious bug inside CPython or the package doing some kind of ugly low-level hackery. Depending on which it is, it's bug either for Python upstream or pysolfc upstream. And since it is the first package to fail like this, I guess it's the latter.

That said, I've told more than once that games should be using python-single-r1. Trying to enable multi-implementation support on a package that doesn't support it is just asking for trouble. Now you have it. Python team out.
Comment 7 Andrey Grozin gentoo-dev 2014-01-21 04:23:33 UTC
grozin@elrond ~ $ cd /usr/share/games/pysolfc
grozin@elrond /usr/share/games/pysolfc $ ./pysol.py-python2.7
*** Error in `python2.7': malloc(): memory corruption: 0x0a1d7cc0 ***

and I have to kill the python process, because ctrl-c does not help

grozin@elrond /usr/share/games/pysolfc $ cd ~/PySolFC-2.0
grozin@elrond ~/PySolFC-2.0 $ ./pysol.py
<runs normally>
Comment 8 Andrey Grozin gentoo-dev 2014-01-21 04:38:09 UTC
One more experiment:

grozin@elrond ~/PySolFC-2.0 $ mv pysol.py pysol.py-python2.7
grozin@elrond ~/PySolFC-2.0 $ ./pysol.py-python2.7
<runs normally>
Comment 9 Andrey Grozin gentoo-dev 2014-01-21 04:42:50 UTC
What's even more interesting: the files are identical

grozin@elrond ~/PySolFC-2.0 $ diff pysol.py-python2.7 /usr/share/games/pysolfc/pysol.py-python2.7
grozin@elrond ~/PySolFC-2.0 $
Comment 10 Julian Ospald 2014-01-22 00:18:46 UTC
cannot reproduce
Comment 11 Andrey Grozin gentoo-dev 2014-01-22 12:24:02 UTC
This happens on 3 different computers, 2 ~x86 and 1 ~amd64. So, hardware problems are out of question. Re-emerging python-2.7 and pysolfc does not help.
Comment 12 Julian Ospald 2014-01-22 15:02:59 UTC
and I have 2 computers where it works, so really... no idea

you can try if setting _PYTHON_WANT_PYTHON_EXEC2=0 in the ebuild helps
Comment 13 Andrey Grozin gentoo-dev 2014-01-24 15:04:17 UTC
I've traced the problem to pysollib/tile/toolbar.py, class PysolToolbarTk, method _createDisabledButtonImage, and, naturally, started to suspect dev-python/pillow. I've re-emerges pillow-2.1.0 (graphics libraries on which it depends were updated recently; however, revdep-rebuild did not ask to recompile pillow). And voila! the behaviour changed. Now I get

grozin@dns ~/PySolFC-2.0 $ /usr/share/games/pysolfc/pysol.py 
Fatal Python error: (pygame parachute) Segmentation Fault

More reasomable than hanging... So, why the non-Gentoo pysolfc works? This is because the patch pysolfc-PIL-imports.patch is not applied to it. As a result, this non-Gentoo pysol (file pysollib/mfxutil.py) cannot import Image, ImageTk, ImageOps and happily continues to work (with less nice disabled images on the toolbar, I suppose).

But the emerged pysolfc succeeds in importing these modules from pillow. The behaviour is weird: I inserted a print just before return in _createDisabledButtonImage (in pysollib/tile/toolbar.py) and another print just after the line

dis_image = self._createDisabledButtonImage(image)

in _setButtonImage. The first print triggers; then python segfaults, before the second print. It seems that the pillow library is doing something really bad here, like overwriting some memory ised by the python interpreter.
Comment 14 Julian Ospald 2014-01-24 16:23:23 UTC
if this was an issue with stable arch I'd simply revert the dependency to dev-python/imaging and drop the patch
Comment 15 Julian Ospald 2014-01-24 16:25:51 UTC
latest pillow is 2.3.0 btw, how about bumping it and maybe we are lucky?
Comment 16 Mike Gilbert gentoo-dev 2014-01-25 18:17:17 UTC
I just bumped dev-python/pillow to 2.3.0.
Comment 17 Julian Ospald 2014-01-25 18:59:50 UTC
(In reply to Andrey Grozin from comment #13)
> I've traced the problem to pysollib/tile/toolbar.py, class PysolToolbarTk,
> method _createDisabledButtonImage, and, naturally, started to suspect
> dev-python/pillow. I've re-emerges pillow-2.1.0 (graphics libraries on which
> it depends were updated recently; however, revdep-rebuild did not ask to
> recompile pillow). And voila! the behaviour changed. Now I get
> 

This sounds like a candidate for subslots.
Comment 18 Julian Ospald 2014-01-25 19:02:31 UTC
(In reply to Mike Gilbert from comment #16)
> I just bumped dev-python/pillow to 2.3.0.

This version works for me and I was able to reproduce the bug with 2.1.0, so I suggest we just remove 2.1.0 from the tree.
Comment 19 Mike Gilbert gentoo-dev 2014-01-25 19:18:01 UTC
Nice work guys.

+  25 Jan 2014; Mike Gilbert <floppym@gentoo.org> -pillow-2.1.0.ebuild,
+  pillow-2.3.0.ebuild:
+  Remove buggy version, bug 497778.