[New-bugs-announce] [issue7650] test_uuid is invalid

Austin English report at bugs.python.org
Thu Jan 7 02:49:55 CET 2010

New submission from Austin English <austinenglish+python at gmail.com>:

>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."

components: Tests
messages: 97337
nosy: austin987
severity: normal
status: open
title: test_uuid is invalid
versions: Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list