After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 163468 - Parenthesis crash-bug in gnome-calculator
Parenthesis crash-bug in gnome-calculator
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other other
: Normal normal
: ---
Assigned To: Rich Burridge
Rich Burridge
: 302002 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-01-09 15:47 UTC by Wictor Lund
Modified: 2005-04-26 14:41 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8



Description Wictor Lund 2005-01-09 15:47:33 UTC
Distribution: Gentoo Base System version 1.5.3
Package: gcalctool
Severity: normal
Version: GNOME2.8.0 4.4.19
Gnome-Distributor: Gentoo Linux
Synopsis: Parenthesis crash-bug in gnome-calculator
Bugzilla-Product: gcalctool
Bugzilla-Component: general
Bugzilla-Version: 4.4.19
BugBuddy-GnomeVersion: 2.0 (2.8.0)
Description:
Description of the crash:
Clr button creates wierd sign on display inside parentheses.

Steps to reproduce the crash:
1. Start gnome-calculator
2. Press (
3. Press Clr
4. Press )

Expected Results:
The program crashes



How often does this happen?
Always

Additional Information:
I think (I think) it an easy problem to fix.




Debugging Information:

Backtrace was generated from '/usr/bin/gcalctool'

(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...[New Thread 16384 (LWP 7299)]
0x40c23e68 in waitpid ()
   from /lib/libpthread.so.0

Thread 1 (Thread 16384 (LWP 7299))

  • #0 waitpid
    from /lib/libpthread.so.0
  • #1 inflate_mask
    from /usr/lib/libgnomeui-2.so.0
  • #2 __pthread_sighandler
    from /lib/libpthread.so.0
  • #3 <signal handler called>
  • #4 mpstr
  • #5 process_stack
  • #6 button_for_fc
  • #7 do_pending
  • #8 create_kframe
  • #9 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #10 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #11 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #12 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #13 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #14 gtk_button_clicked
    from /usr/lib/libgtk-x11-2.0.so.0
  • #15 _gtk_button_set_depressed
    from /usr/lib/libgtk-x11-2.0.so.0
  • #16 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #17 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #18 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #19 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #20 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #21 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #22 gtk_button_released
    from /usr/lib/libgtk-x11-2.0.so.0
  • #23 _gtk_button_paint
    from /usr/lib/libgtk-x11-2.0.so.0
  • #24 _gtk_marshal_BOOLEAN__BOXED
    from /usr/lib/libgtk-x11-2.0.so.0
  • #25 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #26 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #27 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #28 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #29 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #30 gtk_widget_activate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #31 gtk_propagate_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #32 gtk_main_do_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #33 _gdk_events_queue
    from /usr/lib/libgdk-x11-2.0.so.0
  • #34 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #35 g_main_context_acquire
    from /usr/lib/libglib-2.0.so.0
  • #36 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #37 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #38 do_calctool
  • #39 main
  • #40 __libc_start_main
    from /lib/libc.so.6
  • #0 waitpid
    from /lib/libpthread.so.0




------- Bug moved to this database by unknown@bugzilla.gnome.org 2005-01-09 10:47 -------


Unknown version 4.4.19 in product gcalctool.  Setting version to "unspecified".
Unknown platform unknown. Setting to default platform "Other".
Unknown milestone "unknown" in product "gcalctool".
   Setting to default milestone for this product, '---'
The original reporter of this bug does not have
   an account here. Reassigning to the person who moved
   it here, unknown@bugzilla.gnome.org.
   Previous reporter was wictor@multi.fi.
Setting to default status "UNCONFIRMED".
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.

Comment 1 Rich Burridge 2005-01-10 17:00:09 UTC
I've just tried to reproduce this (with v4.4.20) on my
Solaris GNOME distribution and I'm not able to. Any chance
you could check out a copy of this version of gcalctool
from CVS, compile it with debug on, and give me more debug
information (like exact line number in mpstr where it's
failing) please?

Note, that you would need to check it out with:

cvs co -r gnome-2-8 gcalctool
Comment 2 Wictor Lund 2005-01-10 18:08:58 UTC
Oh I'm sorry, I gave you the wrong instructions to reproduce the bug.

You should press twice on (, then Clr, then twice on ).
I didn't try the cvs but I tried a newer version of the program
(gcalctool-4.4.20), but the bug still remained. 

GDB gave this information when I compiled gcalc with -gstabs+:

gdb ./gcalctool
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) run
Starting program: /tmp/gcalctool-4.4.20/gcalctool/gcalctool
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
[New Thread 16384 (LWP 3651)]
/usr/share/themes/Nuvola/gtk-2.0/iconrc:23: Unable to locate image file in
pixmap_path: "stock_stock.svg"
/usr/share/themes/Nuvola/gtk-2.0/iconrc:54: Unable to locate image file in
pixmap_path: "stock_ok.svg"

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 3651)]
0x0805cb26 in mpstr (x=0xfffffffc, y=0x806f758) at mp.c:4202
4202        j = x[1];
(gdb)

I saw a little bit on the code and I think that do_clear() isn't doing it's
job properly (just a guess).
Comment 3 Rich Burridge 2005-01-10 18:19:13 UTC
Thanks Wictor. Interestingly I still can't get it to
fail on Solaris (v4.4.20) even with the revised instructions
on how to reproduce it. 

Looking at the debug information, x (0xfffffffc) is definitely
bogus. I'll try to puzzle it out. 
Comment 4 Rich Burridge 2005-01-10 20:51:43 UTC
Looks like bug #106583 is the same problem. That was
supposedly fixed in v4.2.55. Comment from that bug is:

  The crash was caused by the paren_disp() function in display.c not
  correctly checking for when a Delete character was entered.

Continuing to investigate.
Comment 5 Rich Burridge 2005-01-10 20:55:48 UTC
Wictor, there is something you can try if you'd
like to help me debug this.

In the paren_disp() routine in display.c (about line 453),
can you add the following line:

  fprintf(stderr, "paren_disp: c: %d\n", c);

Rebuild and rerun. What I suspect you'll find is that it's
not catching the Delete/Clr character case and is going 
through the wrong part of this routine.

Thanks.
Comment 6 Wictor Lund 2005-01-11 12:59:21 UTC
OK, now I think I got something...

I added the line you told me about and the output from it was:

paren_disp: c: 40 <-- First left parenthesis
paren_disp: c: 40 <-- Second left parenthesis
paren_disp: c: 127 <-- Clr
paren_disp: c: 41  <-- First right parenthesis
paren_disp: c: 41  <-- Second right parenthesis
paren_disp: c: 40  <-- ??
paren_disp: c: 40  <-- ??
And then program crashes..

So what I did then was to change the first if statement in the function
from:
    if (c == -1) {         /* Is it a Delete character? */
to:
    if (c == -1 || c == 127) {         /* Is it a Delete character? */

and then the program quits crashing.
Comment 7 Rich Burridge 2005-01-11 16:36:12 UTC
Thanks Wictor. Looks like bug #163622 is the same problem.
I'm checking there to see if this one line change will fix that
problem too. If so, then I'll check the chanfe in.
Comment 8 Rich Burridge 2005-01-12 19:10:45 UTC
Looks like bug #163633 is fixed with the changes for bug #157277
(which will also fix the "funny character" problem mention above).
Change checked into CVS HEAD. I've bumped the version number in
configure.in to 4.4.22. I plan to generate a new tarball when I'm
sure that the fix to bug #157277 is indeed the fix for bug #163633.
Comment 9 Rich Burridge 2005-04-26 14:41:15 UTC
*** Bug 302002 has been marked as a duplicate of this bug. ***