[libvirt] [PATCH] udev: Don't let strtoul parse USB busnum and devnum as octal

Dave Allan dallan at redhat.com
Tue Feb 2 14:35:28 UTC 2010


On 02/02/2010 03:52 AM, Matthias Bolte wrote:
> 2010/2/2 Dave Allan<dallan at redhat.com>:
>> On 02/01/2010 06:10 PM, Matthias Bolte wrote:
>>>
>>> udevGetUintProperty was called with base set to 0 for busnum and devnum.
>>> With base 0 strtoul parses the number as octal if it start with a 0. But
>>> busnum and devnum are decimal and udev returns them padded with leading
>>> zeros. So strtoul parses them as octal. This works for certain decimal
>>> values like 001-007, but fails for values like 008.
>>
>> This is a good change, but I thought it was already fixed a couple of weeks
>> ago.  You're sure they're returned decimal and not hex?  ACK assuming that's
>> the case.
>>
>
> vendor, device and ID_MODEL_ID where changed to be parsed as hex some weeks ago.
>
> I based my assumption that busnum and devnum are decimal on the lsusb
> manpage, because the udev driver output matches the lsusb output. The
> manpage says busnum and devnum are decimal and it also says that
> vendor is hex.
>
> I just found a libvirt bugreport [1] that confirms my assumption. Also
> googling for 'lsusb "bus X"' with X as decimal and hex numbers gives
> no result with hex numbers like 00A, but gives results for decimal
> numbers like 010, 011, etc. So I'm pretty sure that busnum and devnum
> are decimal :)

Excellent--many thanks!

Dave

> Okay, I pushed this one.
>
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=508645
>
> Matthias




More information about the libvir-list mailing list