Bug 142835 - RHEL4 U1: hwbrowser doesn't start with USB Floppy Drive connected
RHEL4 U1: hwbrowser doesn't start with USB Floppy Drive connected
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: hwbrowser (Show other bugs)
ia32e Linux
medium Severity medium
: ---
: ---
Assigned To: Nils Philippsen
Depends On:
Blocks: 137160
  Show dependency treegraph
Reported: 2004-12-14 11:38 EST by Stuart Hayes
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2005-101
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-04-13 21:19:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
/var/log/messages (44.56 KB, text/plain)
2004-12-14 11:41 EST, Stuart Hayes
no flags Details
error message window (61.26 KB, image/png)
2004-12-14 11:42 EST, Stuart Hayes
no flags Details
patch to hwbrowser's DeviceDisk.py to fix divide by zero error with USB floppy (560 bytes, patch)
2005-01-06 17:39 EST, Stuart Hayes
no flags Details | Diff

  None (edit)
Description Stuart Hayes 2004-12-14 11:38:02 EST
Description of problem:

RHEL4 pre-rc1: hwbrowser doent start with USB Floppy Drive conected.  
OS: RHEL4 Pre-rc1
Kernel :2.6.9-1.871.4.1_EL.libata.update.1smp
Platform: Dell PE1800

After connecting usb Floppy Drives , hwbrowser gives error and doesnt 
come upith the device list

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Install RHEL4 PRE-RC1.
2. Update kernel to the above version specified. 
3. Attatch USB Floppy Drive
4. Launch hwbrowser on X. 
Actual results:
error window (attached)

Expected results:
hwbrowser should run

Additional info:

I will attach /var/log/messages, output of lsusb -v, and error window
Comment 1 Stuart Hayes 2004-12-14 11:41:33 EST
Created attachment 108530 [details]
Comment 2 Stuart Hayes 2004-12-14 11:42:11 EST
Created attachment 108531 [details]
error message window
Comment 3 Stuart Hayes 2004-12-14 11:43:27 EST
The output of "lsusb -v" wasn't actually provided to me.  Please let 
me know if you need me to get it.  Thanks.
Comment 4 Stuart Hayes 2004-12-15 18:03:01 EST
This appears to be happening because hwbrowser is dividing by zero.  
The zero is coming from hwbrowser's calculation of xoffset in the 
file DeviceDisk.py's DiskStripeSlice.update, which is 
calculating "totalSectors" by multiplying 
disk.heads*disk.sectors*disk.cylinders, and then dividing something 
by that value.

The problem is that disk.cylinders is 0.  This is coming from 
libparted's linux.c, function _device_probe_geometry(), where it 
calculates dev->bios_geom.cylinders by dividing dev->length (0xb40 in 
this case) by 63*255, which comes out to 0.

_device_probe_geometry() appears to be calculating dev-
>hw_geom.cylinders correctly (it comes out to 0x3c0), but I guess 
hwbrowser is using the bios_geom numbers instead of the hw_geom 

It seems to me that hwbrowser should use the hw_geom numbers rather 
than the bios_geom numbers, but I'm really not familiar enough with 
the implications to be certain of that.

Other possible fixes would be to modify hwbrowser so that it doesn't 
crash if it gets a totalSectors of zero (i.e., don't divide by 
totalSectors if it is zero), or to use some intelligence to decide 
whether to use the bios_geom or the hw_geom (i.e., if 
bios_geom.cylinders is 0, try the hw_geom instead)...

Comment 5 Stuart Hayes 2004-12-15 18:14:04 EST
I see that pyparted is only returning bios_geom.cylinders 
for .cylinders, so that hwbrowser wouldn't even have access to 

Perhaps a better solution would be for hwbrowser to realize that the 
USB floppy is a floppy, and not attempt to display it under hard 
disks... I think that would eliminate the problem, since the 
DiskStripeSlice is only generated for hard disks, and that's where 
the divide by zero is occurring.
Comment 6 Stuart Hayes 2005-01-06 17:37:04 EST
Upon reflection, I think the best solution is just to make hwbrowser 
use disk.length for totalSectors if disk.cylinders * disk.heads * 
disk.sectors comes out to zero.  This seems to work fine, won't 
change the way hwbrowser works in any case where it worked before, 
and doesn't require any changes to parted, pyparted, or kudzu.

I copied a patch below, in case you agree that this is a good 


--- DeviceDisk.py.original	2005-01-05 12:46:01.000000000 -0500
+++ DeviceDisk.py	2005-01-05 17:32:55.568940104 -0500
@@ -147,6 +147,8 @@
         totalSectors = float(disk.heads
                              * disk.sectors
                              * disk.cylinders)
+        if totalSectors == 0:
+            totalSectors = float(disk.length)
         xoffset = self.partition.geom.start / totalSectors * 
         xlength = self.partition.geom.length / totalSectors * 
         if self.partition.type & parted.PARTITION_LOGICAL
Comment 7 Stuart Hayes 2005-01-06 17:39:12 EST
Created attachment 109447 [details]
patch to hwbrowser's DeviceDisk.py to fix divide by zero error with USB floppy
Comment 8 Nils Philippsen 2005-01-06 18:01:24 EST
Unfortunately this won't make it into GA (I've been busy with other
stuff as you undoubtedly have noticed already). I plan to get your fix
integrated for U1 so bug me if you don't hear anything from me be say
end of next week.
Comment 9 Amit Bhutani 2005-01-25 15:09:47 EST
Changing the title to reflect the Update in which a fix for this 
issue has been committed or being tracked for..
Comment 10 Russell C. Woodland 2005-01-28 17:12:28 EST
The report today from one of our testers in Austin indicates "Can't 
load the hwbrowser with the USB floppy drive attached" with RHEL 4 RC 
x86, but still works on x86_64.
Comment 11 Nils Philippsen 2005-02-01 12:33:55 EST
This should be fixed in hwbrowser-0.19-0.EL4.1.
Comment 12 Amit Bhutani 2005-04-13 21:19:39 EDT
Raghavendra from Dell has regressed and confirms that this issue is resolved 
in U1 beta. Closing. Thanks!
Comment 13 Tim Powers 2005-06-09 08:57:24 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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