Bug 18762 - drakdisk crashed (Illegal division by zero at /usr/lib/libDrakX/diskdrake/hd_gtk.pm line 343)
Summary: drakdisk crashed (Illegal division by zero at /usr/lib/libDrakX/diskdrake/hd_...
Status: RESOLVED INVALID
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Pascal Terjan
QA Contact:
URL:
Whiteboard:
Keywords: NEEDINFO
Depends on:
Blocks:
 
Reported: 2016-06-22 18:38 CEST by Barry Jackson
Modified: 2016-07-28 22:55 CEST (History)
2 users (show)

See Also:
Source RPM: drakxtools-curses-16.103-1.mga5
CVE:
Status comment:


Attachments

Description Barry Jackson 2016-06-22 18:38:47 CEST
The "drakdisk" program crashed. Drakbug-16.103 caught it.

Trying to use a Mga5 LIVE stick to look at the hard drives on my system which has a boot fail

Illegal division by zero at /usr/lib/libDrakX/diskdrake/hd_gtk.pm line 343.
Perl's trace:
drakbug::bug_handler() called from /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm:58
Glib::Object::Introspection::__ANON__() called from /usr/lib/libDrakX/mygtk3.pm:1533
mygtk3::flush() called from /usr/lib/libDrakX/ugtk3.pm:68
ugtk3::gtkflush() called from /usr/lib/libDrakX/ugtk3.pm:877
ugtk3::flush() called from /usr/lib/libDrakX/ugtk3.pm:875
ugtk3::sync() called from /usr/lib/libDrakX/diskdrake/hd_gtk.pm:115
diskdrake::hd_gtk::main() called from /usr/libexec/drakdisk:93

Theme name: oxygen-gtk
Kernel version = 3.19.8-desktop-2.mga5
Distribution=Mageia release 5 (Official) for x86_64
CPU=Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
Thierry Vignaud 2016-06-22 19:00:40 CEST

CC: (none) => thierry.vignaud
Summary: drakdisk crashed => drakdisk crashed (Illegal division by zero at /usr/lib/libDrakX/diskdrake/hd_gtk.pm line 343)

Marja Van Waes 2016-06-23 08:47:44 CEST

CC: (none) => marja11
Assignee: bugsquad => pterjan

Comment 1 Thierry Vignaud 2016-06-23 09:08:22 CEST
Is there anything special? raid? lvm?
Can you attach the the /tmp/fdisk.txt file resulting from running the following command as root:
fdisk -l > /tmp/fdisk.txt

Keywords: (none) => NEEDINFO

Comment 2 Pascal Terjan 2016-06-23 10:26:28 CEST
Reading the code:

    my @parts = grep { $_->{size} > MB(2) || !isEmpty($_) } @all_parts;

    my $ratio = $totalsectors ? ($width - @parts * $minwidth) / $totalsectors : 1;
    my $i = 1;
    while ($i < 30) {
	$i++;
	my $totalwidth = sum(map { $_->{size} * $ratio + $minwidth } @parts);
	$totalwidth <= $width and last;
	$ratio /= $totalwidth / $width * 1.1;
    }

So either $width is 0 or $totalwidth is 0 and $width is < 0.

I guess if the window is too small ($width - @parts * $minwidth) could be negative with interesting effects. $minwidth is 16 so that would happen if the window is smaller than 16 pixels * number of partitions.

But still that would not be enough to get a 0, I believe that to get $totalwidth to get a 0 we need $ratio to be (- @parts * $minwidth) / sum(map { $_->{size} } @parts), so $width to be 0, and in this case we would have $totalwidth <= $width and last and not reach that line.

So we probably have $width is 0 and $totalwidth is not.

    if ($w->{window}->get_window) {
	my $windowwidth = $w->{window}->get_allocated_width;
	$windowwidth = $::real_windowwidth if $windowwidth <= 1;
	$width = $windowwidth - first(get_action_box_size()) - 25;
    }

So $windowwidth is 25 + first(get_action_box_size())?
Comment 3 Barry Jackson 2016-07-28 22:21:54 CEST
Sorry for the delay.

I suspect this happened when an SSD failed.

The date seems correct. The drive (128GB) suddenly was reporting only 32kB and it also crashed gparted when I tried to investigate.

It has been returned under warranty, so I can't put it back to check anything more, so probably best to close as invalid.

I am in the same Mga5 LIVE now and diskdrake is behaving perfectly with 4 conventional hard drives.
Comment 4 Thierry Vignaud 2016-07-28 22:55:18 CEST
Closing then

Status: NEW => RESOLVED
Resolution: (none) => INVALID


Note You need to log in before you can comment on or make changes to this bug.