Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 463459 - sci-calculators/galculator-2.1 segmentation fault with >=GTK+ 3.6.3
Summary: sci-calculators/galculator-2.1 segmentation fault with >=GTK+ 3.6.3
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL: http://sourceforge.net/p/galculator/b...
Whiteboard:
Keywords: UPSTREAM
Depends on:
Blocks:
 
Reported: 2013-03-27 11:40 UTC by Mads
Modified: 2015-11-07 10:20 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
backtrace from gdb galculator 2.1.2 (file_463459.txt,3.76 KB, text/plain)
2013-05-03 10:55 UTC, Mads
Details
stripped down version of galculator (galculator_basic_v1.tar.bz2,5.35 KB, application/x-bzip)
2013-09-02 07:14 UTC, Simon
Details
galculator-2.1.2-r1.tar.gz (galculator-2.1.2-r1.tar.gz,2.18 KB, application/x-gzip)
2014-02-13 14:43 UTC, Mark Tomich
Details
Patch for galculator-2.1.3 ebuild (galculator-2.1.3.patch,548 bytes, patch)
2014-09-09 09:45 UTC, Artem
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mads 2013-03-27 11:40:42 UTC
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
Comment 1 Viktor Yu. Kovalskii 2013-04-30 04:22:10 UTC
I suppose this bugreport may be helpful:

http://sourceforge.net/p/galculator/bugs/97/

Upstream bug fixed at galculator-2.1.2
Comment 2 Mads 2013-04-30 22:32:08 UTC
It seems things have gotten better :) I haven't encountered the bug with 2.1.2, so I hope it hits the tree soon.
Comment 3 Alexandre Rostovtsev (RETIRED) gentoo-dev 2013-05-01 04:13:54 UTC
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.
Comment 4 Mads 2013-05-03 10:55:24 UTC
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...
Comment 5 Viktor Yu. Kovalskii 2013-05-03 16:41:00 UTC
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".
Comment 6 Alexandre Rostovtsev (RETIRED) gentoo-dev 2013-05-05 01:30:51 UTC
(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.
Comment 7 Mads 2013-05-15 08:55:46 UTC
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)
Comment 8 Andreas Proteus 2013-05-15 11:16:30 UTC
(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.
Comment 9 Pacho Ramos gentoo-dev 2013-08-26 12:20:33 UTC
Are you all running march=core2? What gcc version?
Comment 10 Andreas Proteus 2013-08-26 12:46:12 UTC
(In reply to Pacho Ramos from comment #9)
CFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer"
gcc-4.7.3
Comment 11 Viktor Yu. Kovalskii 2013-08-26 13:00:11 UTC
(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"
Comment 12 Pacho Ramos gentoo-dev 2013-08-26 16:31:36 UTC
(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?
Comment 13 Viktor Yu. Kovalskii 2013-08-26 17:07:53 UTC
(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.
Comment 14 Pacho Ramos gentoo-dev 2013-08-26 17:18:41 UTC
Can't you try? Also, have you checked with latest 3.8 gtk+?
Comment 15 Viktor Yu. Kovalskii 2013-08-26 17:24:18 UTC
(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.
Comment 16 Pacho Ramos gentoo-dev 2013-08-26 17:34:00 UTC
Try rebuilding it with more basic flags like -O2 -pipe
Comment 17 Viktor Yu. Kovalskii 2013-08-26 17:51:12 UTC
(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.
Comment 18 Pacho Ramos gentoo-dev 2013-08-27 06:16:53 UTC
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/
Comment 19 Mads 2013-09-01 17:58:21 UTC
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?
Comment 20 Andreas Proteus 2013-09-01 19:51:03 UTC
(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
Comment 21 Simon 2013-09-02 07:14:43 UTC
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
Comment 22 Andreas Proteus 2013-09-02 14:07:26 UTC
(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
Comment 23 Simon 2013-09-02 17:02:27 UTC
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
Comment 24 Andreas Proteus 2013-09-02 18:31:54 UTC
(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.
Comment 25 Viktor Yu. Kovalskii 2013-09-02 19:07:55 UTC
(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.
Comment 26 Mark Tomich 2014-02-13 14:43:08 UTC
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".
Comment 27 Mark Tomich 2014-02-13 14:43:58 UTC
FTR, disabling quadmath seems to have fixed it for me.
Comment 28 Pacho Ramos gentoo-dev 2014-04-12 20:42:40 UTC
Are you still hitting this with 2.1.3?
Comment 29 Andreas Proteus 2014-04-13 11:58:15 UTC
(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.
Comment 30 Simon 2014-04-16 10:45:47 UTC
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
Comment 31 Simon 2014-05-17 14:47:44 UTC
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
Comment 32 Andreas Proteus 2014-05-17 18:20:46 UTC
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.
Comment 33 Artem 2014-09-09 09:45:35 UTC
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.
Comment 34 Pacho Ramos gentoo-dev 2015-11-07 10:20:41 UTC
Please retry with 2.1.4