Taking the square root of the square root of negative one freezes^^-1

Bug #515280 reported by Sean Cassidy
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gcalctool (Ubuntu)
Fix Released
Medium
Ubuntu Desktop Bugs
Nominated for Lucid by Merritt Townsend
Karmic
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: gcalctool

To freeze gcalctool:
1.) Be in the Scientific or Programming mode (Ctrl-S)
2.) Type 1
3.) Press the +/- operator, such that the current expression is -(1)
4.) Put your cursor before the current expression
5.) Press the square root button twice
6.) Press enter
7.) Watch as gcalctool fails to respond

$ uname -r
2.6.31-17-generic
$ lsb_release -rd
Description: Ubuntu 9.10
Release: 9.10
$ apt-cache policy gcalctool
gcalctool:
  Installed: 5.28.2-0ubuntu1
  Candidate: 5.28.2-0ubuntu1

Revision history for this message
Sean Cassidy (slamsean) wrote :

To be clear, you can also do this in a more straightforward way by just pressing sqrt twice, and then -1, and then enter. This also freezes gcalctool.

Revision history for this message
Pedro Villavicencio (pedro) wrote :

Please try to obtain a backtrace of the hang following the instructions at http://wiki.ubuntu.com/DebuggingProgramCrash and upload the backtrace (as an attachment) to the bug report. This will greatly help us in tracking down your problem.

Changed in gcalctool (Ubuntu):
assignee: nobody → Ubuntu Desktop Bugs (desktop-bugs)
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Sean Cassidy (slamsean) wrote :
Revision history for this message
Sean Cassidy (slamsean) wrote :
Revision history for this message
Robert Ancell (robert-ancell) wrote :

patch:
diff -Nur -x '*.orig' -x '*~' gcalctool-5.28.2/src/mp.c gcalctool-5.28.2.new/src/mp.c
--- gcalctool-5.28.2/src/mp.c 2009-12-16 10:24:32.000000000 +1100
+++ gcalctool-5.28.2.new/src/mp.c 2010-02-22 09:36:14.763690384 +1100
@@ -1705,8 +1705,10 @@
 void
 mp_sqrt(const MPNumber *x, MPNumber *z)
 {
- if (x->sign < 0)
+ if (x->sign < 0) {
         mperr("*** X NEGATIVE IN CALL TO SUBROUTINE MP_SQRT ***");
+ mp_set_from_integer(0, z);
+ }
     else if (x->sign == 0)
         mp_set_from_integer(0, z);
     else {

Changed in gcalctool (Ubuntu):
status: Incomplete → Triaged
status: Triaged → Fix Committed
status: Fix Committed → Fix Released
Revision history for this message
Robert Ancell (robert-ancell) wrote :

This bug is fixed in Ubuntu 10.04 (Lucid). Thanks for your bug report.

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted gcalctool into karmic-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in gcalctool (Ubuntu Karmic):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Sean Cassidy (slamsean) wrote : Re: Taking the square root of the square root of negative one freezes

The fixed version, gcalctool-5.28.2-0ubuntu2 in -proposed works great. Thanks for the fix.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Konna77 (konsta)
Changed in gcalctool (Ubuntu):
status: Fix Released → Confirmed
Changed in gcalctool (Ubuntu Karmic):
status: Fix Committed → Confirmed
Revision history for this message
Mitch Towner (kermiac) wrote :

@ Konna77: Please do not change bug status without an explanation

Changed in gcalctool (Ubuntu):
status: Confirmed → Fix Released
Changed in gcalctool (Ubuntu Karmic):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcalctool - 5.28.2-0ubuntu2

---------------
gcalctool (5.28.2-0ubuntu2) karmic-proposed; urgency=low

  * debian/patches/02_sqrt_crash.patch:
    - Fix crash taking double square root of -1 (√√−1) (LP: #515280)
 -- Robert Ancell <email address hidden> Mon, 22 Feb 2010 09:36:35 +1100

Changed in gcalctool (Ubuntu Karmic):
status: Fix Committed → Fix Released
Konna77 (konsta)
Changed in gcalctool (Ubuntu):
status: Fix Released → Fix Committed
Martin Pitt (pitti)
Changed in gcalctool (Ubuntu):
status: Fix Committed → Fix Released
Changed in gcalctool (Ubuntu):
status: Fix Released → Fix Committed
status: Fix Committed → Fix Released
Revision history for this message
eryksun (eryksun) wrote :

I can't reproduce this bug. I get an error instead of crashing:

*** X NEGATIVE IN CALL TO SUBROUTINE MP_SQRT ***

I have a newer kernel:

uname -r
2.6.31-19-generic

apt-cache policy gcalctool
gcalctool:
  Installed: 5.28.2-0ubuntu1
  Candidate: 5.28.2-0ubuntu2

summary: - Taking the square root of the square root of negative one freezes
+ Taking the square root of the square root of negative one freezes^^-1
Changed in gcalctool (Ubuntu):
status: Fix Released → New
Revision history for this message
Steve Langasek (vorlon) wrote :

Please don't change the bug status without explanation.

Changed in gcalctool (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.