Bug 1186057

Summary: Error when loading usb.ids
Product: [Fedora] Fedora Reporter: Brenton D. Rothchild <brentonr>
Component: hwdataAssignee: Michal Minar <miminar>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 21CC: david, miminar, msuchy, sebi
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-27 08:27:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brenton D. Rothchild 2015-01-26 22:50:05 UTC
Description of problem:
Instantiating the hwdata.USB class causes an exception when loading data from
the /usr/share/hwdata/usb.ids file.

An example:

$ python
Python 2.7.8 (default, Nov 10 2014, 08:19:18) 
[GCC 4.9.2 20141101 (Red Hat 4.9.2-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from hwdata import USB
>>> u = USB()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/hwdata.py", line 57, in __init__
    USB.devices[vendor][1][device][0][interface_id] = interface_name
TypeError: 'str' object does not support item assignment


It appears the code in line 57 should instead be

    USB.devices[vendor][1][device][1][interface_id] = interface_name

in order to access the dictionary, not [0] which accesses the device name.



Version-Release number of selected component (if applicable):
python-hwdata-1.10.1-3.fc21


How reproducible:
Always


Steps to Reproduce:
1. Call constructor of hwdata.USB class


Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/hwdata.py", line 57, in __init__
    USB.devices[vendor][1][device][0][interface_id] = interface_name
TypeError: 'str' object does not support item assignment


Expected results:
Instantiation of class succeeds.

Additional info:

Comment 1 Brenton D. Rothchild 2015-01-26 22:53:54 UTC
For what it's worth, I tried changing line 57 to use index 1 instead of 0 (as noted in the original bug report) and it appears to succeed correctly and give expected results.

Some background: I'm using this through spacewalk's rhnreg_ks command which recently seemed to break with this traceback. After making the noted change, the entire rhnreg_ks command (which performs HW inventory) succeeds.

Comment 2 Miroslav Suchý 2015-01-27 08:07:30 UTC
I can not reproduce it with:
  python-hwdata-1.10.1-3.fc21.noarch
  hwdata-0.273-1.fc21.noarch

Ah, there is new hwdata and it broke with hwdata-0.274-1.fc21.noarch, indeed.

Comment 3 Miroslav Suchý 2015-01-27 08:24:21 UTC
Well it seems as hwdata bug to me:
/usr/share/hwdata/usb.ids line 17397

8564  Transcend Information, Inc.
    1000  JetFlash
        8564 1000  JetFlash
    4000  RDF8

The line 
          8564 1000  JetFlash
Seems incorrect to me. Or it is new formating with new semantics?

Comment 4 Miroslav Suchý 2015-01-27 08:27:45 UTC

*** This bug has been marked as a duplicate of bug 1185630 ***