Bug 142835 - RHEL4 U1: hwbrowser doesn't start with USB Floppy Drive connected
Summary: RHEL4 U1: hwbrowser doesn't start with USB Floppy Drive connected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: hwbrowser
Version: 4.0
Hardware: ia32e
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Nils Philippsen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 137160
TreeView+ depends on / blocked
 
Reported: 2004-12-14 16:38 UTC by Stuart Hayes
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Fixed In Version: RHBA-2005-101
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-04-14 01:19:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
/var/log/messages (44.56 KB, text/plain)
2004-12-14 16:41 UTC, Stuart Hayes
no flags Details
error message window (61.26 KB, image/png)
2004-12-14 16:42 UTC, 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 22:39 UTC, Stuart Hayes
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:101 0 normal SHIPPED_LIVE hwbrowser bug fix update 2005-06-09 04:00:00 UTC

Description Stuart Hayes 2004-12-14 16:38:02 UTC
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

Description.
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:
Easy


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 16:41:33 UTC
Created attachment 108530 [details]
/var/log/messages

Comment 2 Stuart Hayes 2004-12-14 16:42:11 UTC
Created attachment 108531 [details]
error message window

Comment 3 Stuart Hayes 2004-12-14 16:43:27 UTC
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 23:03:01 UTC
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 
numbers.

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 23:14:04 UTC
I see that pyparted is only returning bios_geom.cylinders 
for .cylinders, so that hwbrowser wouldn't even have access to 
hw_geom.cylinders.

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 22:37:04 UTC
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 
solution.

Thanks!



--- 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 * 
CANVAS_WIDTH
         xlength = self.partition.geom.length / totalSectors * 
CANVAS_WIDTH
         if self.partition.type & parted.PARTITION_LOGICAL


Comment 7 Stuart Hayes 2005-01-06 22:39:12 UTC
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 23:01:24 UTC
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 20:09:47 UTC
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 22:12:28 UTC
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 17:33:55 UTC
This should be fixed in hwbrowser-0.19-0.EL4.1.

Comment 12 Amit Bhutani 2005-04-14 01:19:39 UTC
Raghavendra from Dell has regressed and confirms that this issue is resolved 
in U1 beta. Closing. Thanks!

Comment 13 Tim Powers 2005-06-09 12:57:24 UTC
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.

http://rhn.redhat.com/errata/RHBA-2005-101.html



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