Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 82903 - torsmo Program always received signal SIGFPE, Arithmetic exception when started
Summary: torsmo Program always received signal SIGFPE, Arithmetic exception when started
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High trivial
Assignee: Daniel Black (RETIRED)
URL: http://sourceforge.net/tracker/index....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-21 19:45 UTC by Alias John Doe
Modified: 2005-02-28 00:11 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alias John Doe 2005-02-21 19:45:26 UTC
i always get the torsmo Program received signal SIGFPE, Arithmetic exception when started i think: it is because the torsmo asume that the totale swap size cant be 0 to compute the % of swap used he ((cur->swap*100) / cur->swapmax) but in my case 
cur->swapmax == 0

because of free -m
             total       used       free     shared    buffers     cached
Mem:          1263       1241         21          0        241        704
-/+ buffers/cache:        295        967
Swap:            0          0          0

Reproducible: Always
Steps to Reproduce:
1. just find a ways to mess up with your swap (0 0 0 for swap):
$free -m show 0 0 0 for swap

2. run torsmo :/usr/bin/torsmo
Actual Results:  
Program received signal SIGFPE, Arithmetic exception.

Expected Results:  
just not dumpcore :)

Program received signal SIGFPE, Arithmetic exception.
0x0804fa31 in generate_text () at torsmo.c:1129
1129          snprintf(p, 255, "%*u", pad_percents, (cur->swap*100) / cur->swapmax);
(gdb) print cur->swapmax
$8 = 0

[CODE]
.:[Managing 0/94 jobs.] [CPU Load: 0.34 Uptime: 1h39m]:.
.:[11 files using 144k] [root@HackXoR /usr/portage/sys-apps/portage]:.
.:[04:56:49]:. $ free -m
             total       used       free     shared    buffers     cached
Mem:          1263       1241         21          0        241        704
-/+ buffers/cache:        295        967
Swap:            0          0          0
[/CODE]

yeah i know it is wired to have 0 0 0 for swap but it was a bug withe my
encrypted swap....



if would add test case if (...==0) {...} else ... in evry part of the code that
/ by a unknow value like the totale swap on my box



PS: torsmo has many ugly code like the above
Comment 1 Alias John Doe 2005-02-21 19:51:44 UTC
be gentle it is my first use of :gbd,ebuild,unpack and my 1st bugreport
Comment 2 Luke Macken (RETIRED) gentoo-dev 2005-02-22 12:34:32 UTC
Reassigning to maintainer (instead of CCing).
Comment 3 Daniel Black (RETIRED) gentoo-dev 2005-02-27 23:51:57 UTC
John - this is one of the better bug reports I have ever received.

Only suggestions for improvement are to include a patch and to submit it upstream.

torsmo-0.18-r3 added that includes a patch.

Please let me know if it works for you and if you want to add it to the sourceforge patches pages please do so.

good use of gdb and please teach all other bug submitters to use it too :-)
Comment 4 Daniel Black (RETIRED) gentoo-dev 2005-02-28 00:11:43 UTC
couldn't wait to add upstream. Tell me if I stuffed up.