Galculator, when linked against GTK+ 3.6.3, gets segmentation faults when trying to do basic calculations. Reproducible: Always Steps to Reproduce: 1. Start galculator 2.1 linked against GTK+ 3.6.3 2. Enter 30-3 and press enter using the numpad. 3. Get a segmentation fault. Often crashes when typing the minus sign. # galculator -v galculator v2.1, (c) 2002-2013 Simon Flöry Usage: galculator [options] options: (GTK options) -h, --help Show this usage message -v, --version Show version information Compiled against GTK version 3.6.3 Linked against GTK version 3.6.3 Quad-precision floating point numbers. # emerge --info Portage 2.2.0_alpha169 (default/linux/x86/13.0, gcc-4.7.2, glibc-2.16.0, 3.8.4-gentoo x86_64) ================================================================= System uname: Linux-3.8.4-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_P8600_@_2.40GHz-with-gentoo-2.2 KiB Mem: 6111112 total, 4318752 free KiB Swap: 1048572 total, 1048572 free Timestamp of tree: Tue, 26 Mar 2013 07:30:01 +0000 ld GNU ld (GNU Binutils) 2.23.1 app-shells/bash: 4.2_p45 dev-java/java-config: 2.1.12-r1 dev-lang/python: 2.7.3-r3, 3.2.3-r2 dev-util/cmake: 2.8.10.2-r1 dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.11.8 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.11.6, 1.13.1 sys-devel/binutils: 2.23.1 sys-devel/gcc: 4.4.7, 4.7.2-r1 sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.8 (virtual/os-headers) sys-libs/glibc: 2.16.0 Repositories: gentoo rion local ACCEPT_KEYWORDS="x86 ~x86" ACCEPT_LICENSE="* -@EULA Oracle-BCLA-JavaSE AdobeFlash-11.x" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=native -pipe" CHOST="i686-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/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -march=native -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -march=i686 -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" FFLAGS="-O2 -march=i686 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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/rion /usr/portage/local" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X accessibility acl alsa bzip2 cairo caps cli consolekit cracklib crypt cups cxx dbus dri fortran gdbm gif gpm gtk gtkstyle hvm iconv icu idn jpeg kerberos libkms libnotify lzma mmx mmxext modules mudflap ncurses nls nptl ogg opengl openmp pam pcre png policykit qt3support readline samba session sse sse2 sse3 sse4 sse4_1 ssl ssse3 startup-notification svg tcpd threads thunar tiff truetype udev unicode uxa vorbis x86 xcb xinerama xscreensaver xvmc zlib" ABI_X86="32" 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 mmap_emul mulaw multi null plug rate route share shm softvol" 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" 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 synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="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" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
I suppose this bugreport may be helpful: http://sourceforge.net/p/galculator/bugs/97/ Upstream bug fixed at galculator-2.1.2
It seems things have gotten better :) I haven't encountered the bug with 2.1.2, so I hope it hits the tree soon.
2.1.2 has been added to portage, thanks for reporting! +*galculator-2.1.2 (01 May 2013) + + 01 May 2013; Alexandre Rostovtsev <tetromino@gentoo.org> + galculator-1.3.4.ebuild, galculator-2.1.ebuild, +galculator-2.1.2.ebuild: + Version bump, fixes crash with gtk+-3.6 (bug #463459, thanks to Mads and + Viktor Yu. Kovalskiy). Update license.
Created attachment 347258 [details] backtrace from gdb galculator 2.1.2 I'm very sorry, but I think I'll have to revive this bug. A bit hard to reproduce on all computers it seems - the computer which produces a segfault now is running a Gentoo x86 userspace on a amd64 kernel, maybe that has something to do with it? I've tested with gtk+ 3.6.3 and now 3.8.1, and GLib 2.36.1 and now -9999, and on the machine running with an amd64 kernel it still segfaults... Attaching a backtrace, hope it helps...
Hmm.. It's very strange but I can reproduce this segfault with dev-libs/glib-2.34.3 anf x11-libs/gtk+-3.6.3-r2. Earlier galculator (2.1 version) segfaults when trying calculate something simple like "46/2". But now galculator (2.1.2 version) segfaults when trying calculate more complex expression, i.e. "7465827/(7384*367-726)^2".
(In reply to comment #4) > Attaching a backtrace, hope it helps... Many debugging symbols are missing. Please re-emerge galculator, gtk+ and glib with -ggdb in CFLAGS to get a full backtrace; see http://www.gentoo.org/proj/en/qa/backtraces.xml for more information. Then please report the problem (with the full backtrace) directly to upstream developers: https://sourceforge.net/p/galculator/bugs/new/ and then add a comment here with the url for the upstream report. I am asking you to report it because I cannot reproduce the crash on my machine, and the person who reports the bug upstream should be someone who can reliably reproduce the problem and run tests or debugging tools that the upstream developer might ask.
As I reported to the original bug report, you can reproduce this error (on i686 at least, haven't tested with amd64) with these CFLAGS: "-O2 -march=core2 -pipe" and with quadmath enabled (is enabled by default). You get rid of this segfault by either using --disable-quadmath or emerging with no CFLAGS set (CFLAGS="" emerge -av galculator)
(In reply to comment #7) > CFLAGS="" emerge -av galculator This worked here. galculator-2.1.2 no longer crashes. My system is x86 with gtk+-3.82 Thank you for the tip.
Are you all running march=core2? What gcc version?
(In reply to Pacho Ramos from comment #9) CFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer" gcc-4.7.3
(In reply to Pacho Ramos from comment #9) > Are you all running march=core2? What gcc version? I use CFLAGS="-O2 -pipe -march=pentium-m -fomit-frame-pointer" and emerge -pv sys-devel/gcc -1 These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-devel/gcc-4.7.3:4.7 USE="cxx fortran gtk mudflap nls nptl openmp (-altivec) -doc (-fixed-point) -gcj -go -graphite (-hardened) (-libssp) -lto (-multilib) -multislot -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla"
(In reply to Viktor Yu. Kovalskiy from comment #11) > (In reply to Pacho Ramos from comment #9) > > Are you all running march=core2? What gcc version? > > I use CFLAGS="-O2 -pipe -march=pentium-m -fomit-frame-pointer" and > > emerge -pv sys-devel/gcc -1 > > These are the packages that would be merged, in order: > > Calculating dependencies... done! > [ebuild R ] sys-devel/gcc-4.7.3:4.7 USE="cxx fortran gtk mudflap nls > nptl openmp (-altivec) -doc (-fixed-point) -gcj -go -graphite (-hardened) > (-libssp) -lto (-multilib) -multislot -nopie -nossp -objc -objc++ -objc-gc > -regression-test -vanilla" And, in your case, what CFLAGS are you needing to drop?
(In reply to Pacho Ramos from comment #12) > And, in your case, what CFLAGS are you needing to drop? I'm very sorry but I have no idea.
Can't you try? Also, have you checked with latest 3.8 gtk+?
(In reply to Pacho Ramos from comment #14) > Can't you try? Also, have you checked with latest 3.8 gtk+? What I should to try? I have already installed x11-libs/gtk+-3.8.2. Right now I recompile galculator again. It fails with segmentation fault like at first comment.
Try rebuilding it with more basic flags like -O2 -pipe
(In reply to Pacho Ramos from comment #16) > Try rebuilding it with more basic flags like -O2 -pipe I clean ccache then recompile with CFLAGS="-O2 -pipe" galculator. Galculator fails with segmentation fault.
As I see in upstream bug report, other reporter is working with upstream giving him access to a Gentoo box for testing, please refer directly to upstream report: http://sourceforge.net/p/galculator/bugs/97/
I'm now running gtk+ 3.8.2, glibc-2.17 and gcc-4.8.1, and now I can't reproduce the error even with CFLAGS="-O2 -march=native -pipe". Could you update and test it out, Viktor?
(In reply to Mads from comment #19) I installed gcc-4.8.1 (the rest are the same as yours) and recompiled galculator. Result: 8+ ... segmentation fault upon pressing '+' 8/4= ... success! 86/ ... segmentation fault upon pressing '/' i.e. same behaviour as before. CFLAGS="" emerge galculator works with gcc-4.8.1 as it does with gcc-4.7.3
Created attachment 357622 [details] stripped down version of galculator Hi everyone, I'm the maintainer of galculator, Mads and me have been trying to reproduce this bug over the weekend, though without success. May I ask someone, who is able to reproduce this bug on his/her system, to give attachment "galculator_basic_v1" a try. This is a stripped down version of galculator's calculating core without any GUI. It reads all input from stdin: enter a number, press enter, enter an operation's identifier (e.g. '+', '-', '='), press enter, and so on. Compilation instructions are in README. Does this segfault as well? thanks, simon
(In reply to Simon from comment #21) > stripped down version of galculator > Hello Simon. I compiled and run the test program as per README. It runs giving results to 6 decimal places. I could not make it segfault, even when I gave it erroneous input (letters instead of digits et.c.). Also note that I get no segfault even when I compile it with my usual CFLAGS: gcc calc_basic.c -O2 -march=core2 -pipe \ `pkg-config --cflags --libs glib-2.0` -Wall -lm
Thanks for trying with your original CFLAGS causing the segfaults, this makes more sense indeed. I remember Victor's valgrind logs (cf. http://sourceforge.net/p/galculator/bugs/97/?limit=10&page=1#2bab) now that indicate some memory corruption caused by libXcursor / gtk. Maybe we should investigate this further. Could those of you, who are able to reproduce this bug, run (and segfault) galculator through valgrind valgrind --log-file=galculator.log ./galculator On systems, where galculator crashes: does the libXcursor problem show up in valgrind's log? Is it there if you compile with CFLAGS=""? best, simon
(In reply to Simon from comment #23) > valgrind --log-file=galculator.log ./galculator Unfortunately I cannot run valgrind because my glibc is not compiled to have debug symbols.
(In reply to Simon from comment #21) > Created attachment 357622 [details] > stripped down version of galculator > > Hi everyone, > > I'm the maintainer of galculator, Mads and me have been trying to reproduce > this bug over the weekend, though without success. May I ask someone, who is > able to reproduce this bug on his/her system, to give attachment > "galculator_basic_v1" a try. > > This is a stripped down version of galculator's calculating core without any > GUI. It reads all input from stdin: enter a number, press enter, enter an > operation's identifier (e.g. '+', '-', '='), press enter, and so on. > > Compilation instructions are in README. Does this segfault as well? > > thanks, simon I try your test program with recommended compilation instructions from README and with CFLAGS="-O2 -pipe -march=pentium-m -fomit-frame-pointer". The test program runs without any segfaults.
Created attachment 370318 [details] galculator-2.1.2-r1.tar.gz For those of us still impacted by this issue, here is an ebuild and patch. To enable the workaround, emerge with "USE=-quadmath".
FTR, disabling quadmath seems to have fixed it for me.
Are you still hitting this with 2.1.3?
(In reply to Pacho Ramos from comment #28) Unfortunately 2.1.3 still segfaults. It does not segfault if either set "CFLAGS =""" or by disabling quadmath.
Sorry guys for being quiet on this issue for so long. I have not been able to reproduce this bug in the meanime, I even tried on a gentoo machine. Is anyone aware of any problems with libquadmath on gentoo? On a different track, I identified several places in galculator's code where libc functions for memory management (alloc/malloc/free/etc.) are mixed with GLIB functions (g_strdup, g_free, ...). I don't know if GTK/GLIB may be compiled in a way to use a different memory pool, and if this is the case on gentoo. Anyway, I should fix that - but it will take time to sort this out. I'll keep you updated, best, Simon
I updated galculator to call memory management functions from glib only. I'd appreciate if someone, who is able to reproduce the crashes, could give current SVN a try: svn checkout svn://svn.code.sf.net/p/galculator/code/trunk galculator-code tia, simon
Hello Simon. I just tried the SVN (version 2.1.4devel). It compiles and runs fine. No more crashes. I hope this helps. Keep up the good work with your excellent calculator.
Created attachment 384448 [details, diff] Patch for galculator-2.1.3 ebuild With this patch you can emerge galculator-2.1.3 without quadmath flag. It solves segmentation fault problems on some machines. Note, that it's temporary workaround. New version of galculator not reproduce this bug.
Please retry with 2.1.4