Bug 678253

Summary: Anaconda dies with ZeroDivisionError when installing less than 1kB
Product: [Fedora] Fedora Reporter: Hynek Bures <hynek>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 13CC: anaconda-maint-list, jonathan, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-08 20:18:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Hynek Bures 2011-02-17 09:50:38 UTC
In Anacoda 13.42, when the total size of all packages being installed is less then 1kB, Anaconda crashes:

anaconda 13.42 exception report
Traceback (most recent call first):
File "/usr/lib/anaconda/yuminstall.py", line
219, in callback
self.progress.set_fraction(float(self.doneSize
/ self.totalSize))
ZeroDivisionError: float division 

The totalSize variable is calculated as a total number of kilobytes to be installed. If the size of the package is less than 1024 bytes, the division by 1024 returns zero (an integer division is used).

We have patched Anaconda to always make the total size non-zero:


*** yuminstall.py       2010-05-07 03:11:33.000000000 -0400
--- yuminstall_backup.py        2011-02-16 06:21:37.602888749 -0500
***************
*** 216,221 ****
--- 216,223 ----
                                            self.numpkgs)
                                         % {'donepkgs': self.donepkgs,
                                            'numpkgs': self.numpkgs})
+             if self.totalSize < 1:                                      
+                 self.totalSize = 1
              self.progress.set_fraction(float(self.doneSize / self.totalSize))
              self.progress.processEvents()

Comment 1 Chris Lumens 2011-03-08 20:18:52 UTC
anaconda is an operating system installer, not a single package installer.  You should not be hitting cases where the total size of all packages being installed is this small.