gnome-calculator crashed with SIGABRT in mpfr_assert_fail → mpfr_init2 → mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi

Bug #1745188 reported by fcole90
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gnome-calculator (Ubuntu)
Fix Released
Medium
Unassigned
mpclib3 (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

I cannot launch gnome-calculator because of the following:

```
../../src/init2.c:52: MPFR assertion failed: p >= 2 && p <= ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))
Aborted (core dumped)
```

errors.u.c:
https://errors.ubuntu.com/problem/40a6712b7f663d518c85d34a30891ff7629f9041

ProblemType: Crash
DistroRelease: Ubuntu 18.04
Package: gnome-calculator 1:3.26.0-0ubuntu1
ProcVersionSignature: Ubuntu 4.14.0-13.15-generic 4.14.7
Uname: Linux 4.14.0-13-generic x86_64
ApportVersion: 2.20.8-0ubuntu6
Architecture: amd64
CurrentDesktop: GNOME
Date: Wed Jan 24 19:13:49 2018
ExecutablePath: /usr/bin/gnome-calculator
InstallationDate: Installed on 2017-08-21 (156 days ago)
InstallationMedia: Ubuntu 17.10 "Artful Aardvark" - Alpha amd64 (20170820)
ProcCmdline: gnome-calculator
Signal: 6
SourcePackage: gnome-calculator
StacktraceTop:
 mpfr_assert_fail () at /usr/lib/x86_64-linux-gnu/libmpfr.so.4
 mpfr_init2 () at /usr/lib/x86_64-linux-gnu/libmpfr.so.4
 () at /usr/lib/x86_64-linux-gnu/libmpc.so.3
 mpc_pow_usi () at /usr/lib/x86_64-linux-gnu/libmpc.so.3
 number_xpowy_integer () at /usr/lib/x86_64-linux-gnu/gnome-calculator/libcalculator.so
Title: gnome-calculator crashed with SIGABRT in mpfr_assert_fail()
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo

Revision history for this message
fcole90 (fcole90) wrote :
Revision history for this message
Apport retracing service (apport) wrote :

StacktraceTop:
 mpfr_assert_fail (filename=filename@entry=0x7fe4f8b5d6b0 "../../src/init2.c", linenum=linenum@entry=52, expr=expr@entry=0x7fe4f8b5d098 "p >= 2 && p <= ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))") at ../../src/mpfr-gmp.c:305
 mpfr_init2 (x=x@entry=0x7fffef865540, p=p@entry=1) at ../../src/init2.c:52
 mpc_init3 (x=x@entry=0x7fffef865520, prec_re=prec_re@entry=64, prec_im=prec_im@entry=1) at init3.c:27
 mpc_pow_usi_naive (z=z@entry=0x55f8ffbc8400, x=x@entry=0x55f8ffbc8460, y=y@entry=3, sign=sign@entry=-1, rnd=rnd@entry=0) at pow_ui.c:31
 mpc_pow_usi (z=0x55f8ffbc8400, x=0x55f8ffbc8460, y=3, sign=-1, rnd=0) at pow_ui.c:77

Revision history for this message
Apport retracing service (apport) wrote : Stacktrace.txt
Revision history for this message
Apport retracing service (apport) wrote : StacktraceSource.txt
Revision history for this message
Apport retracing service (apport) wrote : ThreadStacktrace.txt
Changed in gnome-calculator (Ubuntu):
importance: Undecided → Medium
tags: removed: need-amd64-retrace
information type: Private → Public
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: gnome-calculator crashed with SIGABRT in mpfr_assert_fail()

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-calculator (Ubuntu):
status: New → Confirmed
summary: - gnome-calculator crashed with SIGABRT in mpfr_assert_fail()
+ gnome-calculator crashed with SIGABRT in mpfr_assert_fail → mpfr_init2 →
+ mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi
description: updated
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for your report.

I noticed that you're using libmpc3 1.1.0-1 from bionic-proposed. Could you revert to the version in bionic to check if it fixes your issue?

Thanks.

Changed in gnome-calculator (Ubuntu):
status: Confirmed → Incomplete
Changed in mpclib3 (Ubuntu):
importance: Undecided → High
summary: gnome-calculator crashed with SIGABRT in mpfr_assert_fail → mpfr_init2 →
- mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi
+ mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi (possible regression with
+ mpclib3 1.1.0-1)
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote : Re: gnome-calculator crashed with SIGABRT in mpfr_assert_fail → mpfr_init2 → mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi (possible regression with mpclib3 1.1.0-1)

confirmed by installating libmpc3 1.1.0-1 from bionic-proposed;

Changed in gnome-calculator (Ubuntu):
status: Incomplete → Triaged
Changed in mpclib3 (Ubuntu):
status: New → Triaged
summary: gnome-calculator crashed with SIGABRT in mpfr_assert_fail → mpfr_init2 →
- mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi (possible regression with
- mpclib3 1.1.0-1)
+ mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi (regression with mpclib3
+ 1.1.0-1)
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote : Re: gnome-calculator crashed with SIGABRT in mpfr_assert_fail → mpfr_init2 → mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi (regression with mpclib3 1.1.0-1)

This is because the precision is set to 1 in libmpfr 4.0.0 (in bionic-proposed) and 2 in libmpfr 3.1.6

mpfr4-4.0.0/src/mpfr.h:#define MPFR_PREC_MIN 1
mpfr4-3.1.6/src/mpfr.h:#define MPFR_PREC_MIN 2

Please downgrade to the versions in bionic until the publication of all the dependent packages in proposed is done.

summary: gnome-calculator crashed with SIGABRT in mpfr_assert_fail → mpfr_init2 →
- mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi (regression with mpclib3
- 1.1.0-1)
+ mpc_init3 → mpc_pow_usi_naive → mpc_pow_usi
Changed in mpclib3 (Ubuntu):
importance: High → Medium
Revision history for this message
Raghavan Santhanam (geekie12) wrote :
Download full text (3.4 KiB)

Hello,

I encountered this abort/crash with gnome-calculator and finally got rid of it as under.

I manually built and installed the latest mpfr/mpfc/gmp source code and binaries for
building gcc-7.3 which turned out to be extremely frustrating and energy-draining.
So, after installing those hand-built mpfr/mpfc/gmp binaries, I happened to launch the calculator(gnome-calculator) from the quick launch side-bar(yes, I still have Unity on
17.10!) and its icon was animating as usual for few seconds and nothing was happening
after that. So, I tried to launch it from terminal - it showed the abort/crash error
that this bug reports :
"../../src/init2.c:52: MPFR assertion failed: p >= 2 && p <= ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))".

After searching for the above error, I stumbled upon this bug report, and I tried to
downgrade back to the default Ubuntu-repo version via "apt install" - that didn't solve
the issue. I tried to build and install mpfr-4.0.0 version - didn't change the crash behavior.
Tried building and installing mpfr-3.1.6/5 - didn't work. Manually removed the installed
libraries(libmpfr*) from /usr/lib/* and /usr/local/lib/* and redid the installation - both
"apt install" and build-install method from source for the reported mpfr-3.1.6 - didn't help.
I had also tried to modify mpfr-4.0.1's source code to use precision 2 instead of 1 and also
bunch of the other assert-macros logic for disabling the assertion(abort) - didn't help.

Downgraded mpc* as well as gmp* to older versions by building from their sources and installing
them - didn't help.

So, basically, I tried to put my system back to the previous state before I started meddling
with the mpfr/gmp/mpc all for building gcc-7.3 from its source - huge cost paid!

Tried the extreme cases out though not relevant as I could already figure out but did them
anyway to get back the "calculator" : reinstalled the kernel(I know kernel has nothing
to do with mpfr!), rebooted the PC, and so on - didn't help.

Finally, I paid close attention to the error stating that this assertion was from "init2.c:52",
so I located this 52nd source code line inside mpfr-3.1.6/src/init2.c and *disabled* the
assertion by commenting it out as my last attempt to get back the system to successfully
launch gnome-calculator, rebuilt and installed it - boom! I got the gnome-calculator back.
Below is what I commented out. I thought this was not necessary as MPFR_PREC_MIN was already 2
and not 1 as mentioned here in this proposed bug report/fix. Anyway.

<snip>
  /* p=1 is not allowed since the rounding to nearest even rule requires at
     least two bits of mantissa: the neighbours of 3/2 are 1*2^0 and 1*2^1,
     which both have an odd mantissa */
  //MPFR_ASSERTN(p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX);
</snip>

I confirmed that MPFR_PREC_MIN was 2 as told in here in this bug report and not 1 as in 4.0.1.
But, even then the above assertion was failing causing abort/crash for gnome-calculator.
Below is what I have in mpfr-3.1.6/src/mpfr.h(unchanged).

<snip>
/* Definition of precision limits without needing <limits.h> */
/* Note: the casts allows the expression to yield the wanted behavior
   for _M...

Read more...

Revision history for this message
Raghavan Santhanam (geekie12) wrote :
Download full text (3.6 KiB)

<< reposting my previous comment in the aligned format as there seems to
be no option to edit it >>

Hello,

I encountered this abort/crash with gnome-calculator and finally got rid
of it as under.

I manually built and installed the latest mpfr/mpfc/gmp source code and
binaries for building gcc-7.3 which turned out to be extremely
frustrating and energy-draining. So, after installing those hand-built
mpfr/mpfc/gmp binaries, I happened to launch the calculator(gnome-
calculator) from the quick launch side-bar(yes, I still have Unity on
17.10!) and its icon was animating as usual for few seconds and nothing
was happening after that. So, I tried to launch it from terminal - it
showed the abort/crash error that this bug reports :
"../../src/init2.c:52: MPFR assertion failed: p >= 2 && p <= ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))".

After searching for the above error, I stumbled upon this bug report, and
I tried to downgrade back to the default Ubuntu-repo version via "apt
install" - that didn't solve the issue. I tried to build and install
mpfr-4.0.0 version - didn't change the crash behavior.

Tried building and installing mpfr-3.1.6/5 - didn't work. Manually
removed the installed libraries(libmpfr*) from /usr/lib/* and /usr/local
/lib/* and redid the installation - both "apt install" and build-install
method from source for the reported mpfr-3.1.6 - didn't help. I had also
tried to modify mpfr-4.0.1's source code to use precision 2 instead of 1
and also bunch of the other assert-macros logic for disabling the
assertion(abort) - didn't help.

Downgraded mpc* as well as gmp* to older versions by building from their
sources and installing them - didn't help.

So, basically, I tried to put my system back to the previous state before
I started meddling with the mpfr/gmp/mpc all for building gcc-7.3 from
its source - huge cost paid!

Tried the extreme cases out though not relevant as I could already figure
out but did them anyway to get back the "calculator" : reinstalled the
kernel(I know kernel has nothing to do with mpfr!), rebooted the PC, and
so on - didn't help.

Finally, I paid close attention to the error stating that this assertion
was from "init2.c:52", so I located this 52nd source code line inside
mpfr-3.1.6/src/init2.c and *disabled* the assertion by commenting it out
as my last attempt to get back the system to successfully launch gnome
-calculator, rebuilt and installed it - boom! I got the gnome-calculator
back.

Below is what I commented out. I thought this was not necessary as
MPFR_PREC_MIN was already 2 and not 1 as mentioned here in this proposed
bug report/fix. Anyway.

<snip>
  /* p=1 is not allowed since the rounding to nearest even rule requires at
     least two bits of mantissa: the neighbours of 3/2 are 1*2^0 and 1*2^1,
     which both have an odd mantissa */
  //MPFR_ASSERTN(p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX);
</snip>

I confirmed that MPFR_PREC_MIN was 2 as told in here in this bug report
and not 1 as in 4.0.1. But, even then the above assertion was failing
causing abort/crash for gnome-calculator. Below is what I have in
mpfr-3.1.6/src/mpfr.h(unchanged).

<snip>
/* Definition of precision limits wi...

Read more...

Revision history for this message
Sebastien Bacher (seb128) wrote :

There are no report from 3.28 or newer, seems to be resolved

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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