Issue 7650: test_uuid is invalid (original) (raw)

Created on 2010-01-07 01:49 by austin987, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)

msg97337 - (view)

Author: Austin English (austin987)

Date: 2010-01-07 01:49

From http://bugs.winehq.org/show_bug.cgi?id=21276

"I believe this is a bug in the python test code, not in Wine. Wine's UuidCreate function follows RFC 4122, section 4.4. That is, it generates a Uuid from a pseudorandom number generator, not from a MAC address. Thus, the error message from the test program is correct: it doesn't appear to be a MAC address. On the other hand, it's not an error: this is expected.

The python code should be checking the version field of the generated Uuid first. If it's 1, then the generated Uuid may be expected to contain a MAC address. From RFC 4122, section 4.1.6:

For UUID version 1, the node field consists of an IEEE 802 MAC address, usually the host address. For systems with multiple IEEE 802 addresses, any available one can be used. The lowest addressed octet (octet number 10) contains the global/local bit and the unicast/multicast bit, and is the first octet of the address transmitted on an 802.3 LAN.

However, the test for the most significant bit not being set is also invalid on systems with no MAC address. From the python code: self.assertTrue(node < (1 << 48), message) The most significant bit of a MAC address is set when the MAC address is a multicast address. For systems with no MAC address, a multicast address is supposed to be used. Also from RFC 4122, section 4.1.6:

For systems with no IEEE address, a randomly or pseudo-randomly generated value may be used; see Section 4.5. The multicast bit must be set in such addresses, in order that they will never conflict with addresses obtained from network cards.

This analysis may of use to the Python folks, but it certainly isn't a Wine bug."

msg97360 - (view)

Author: Austin English (austin987)

Date: 2010-01-07 17:36

More info from the wine bug: Whoops, I didn't notice that Python uses UuidCreateSequential. From MSDN:

For security reasons, UuidCreate was modified so that it no longer uses a machine's MAC address to generate UUIDs. UuidCreateSequential was introduced to allow creation of UUIDs using the MAC address of a machine's Ethernet card.

I'm reopening this, as Wine's implementation of UuidCreateSequential calls UuidCreate, whereas it should use the MAC address-based method. Setting component to rpcrt4, too.

My comment about the multicast bit occasionally being set (when the machine on which UuidCreateSequential is called has no MAC address) still stands, so there's still a Python bug.

msg102613 - (view)

Author: Stefan Krah (skrah) * (Python committer)

Date: 2010-04-08 10:21

The multicast bit is the least significant bit of the first octet.

Could you check if the patch for http://bugs.python.org/issue3581 fixes your problem?

msg102628 - (view)

Author: Austin English (austin987)

Date: 2010-04-08 16:48

From Juan Lang, who originally pointed out the bug:

My only comment is that the message is now misleading:

The test no longer checks for the uuid being a MAC address or not. Ideally it would be reworded to be less confusing, or perhaps the code could check the various "flavors" of uuids, and check that a generated uuid conforms to one of them.

msg102930 - (view)

Author: Stefan Krah (skrah) * (Python committer)

Date: 2010-04-12 09:22

Fixed in issue 3581. Thanks for the report and the comments!

History

Date

User

Action

Args

2022-04-11 14:56:56

admin

set

github: 51899

2010-04-12 09:22:37

skrah

set

status: open -> closed

dependencies: + failures in test_uuid
superseder: failures in test_uuid
assignee: skrah
keywords: + patch
messages: +
resolution: accepted
stage: needs patch -> resolved

2010-04-08 16:48:24

austin987

set

messages: +

2010-04-08 10:21:36

skrah

set

nosy: + skrah
messages: +

2010-01-07 18:23:34

brian.curtin

set

priority: normal
stage: needs patch
type: behavior
versions: + Python 2.6, Python 2.7, Python 3.2

2010-01-07 17:36:01

austin987

set

messages: +

2010-01-07 01:49:54

austin987

create