This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients David Carlier, Michael.Felt, devnexen, koobs, pitrou, vstinner
Date 2018-01-17.15:21:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516202484.07.0.467229070634.issue32493@psf.upfronthosting.co.za>
In-reply-to
Content
Actually, the libc/libuuid function called should be setting the version/variant values as well.

So, I think the AMD64 FreeBSD 10.x Shared 3.x uuid_generate() function is wrong (if that is what it is using - was it/can it also use the uuid_generate* routines?

FYI:

I notice the AIX include file does not actually define the bits for RFC_4122, etc.., but the include file comments does show that the implementation is taking them into account.

/** The strlen() of a UUID string (does not include terminating null) */
#define UUID_STRLEN 36
/**
 * Constant value indicating an as-yet undetermined UUID for a thing.  Spells \c
 * "\0\0UUID\x10_\x80UNKNOWN" in ASCII.  Zeroes at the top make it very unlikely
 * to collide with a uuid_create()d value, which puts a timestamp in that spot.
 * The \c "\x10" and \c "\x80" are reserved/version/mask bits that make this
 * conform to the format expected by the uuid.h API.
 */
#define UUID_UNKNOWN (uuid_t){0x00005555, 0x4944, 0x105F, 0x80, 0x55, {0x4E, 0x4B, 0x4E, 0x4F, 0x57, 0x4E}}
#define UUID_UNKNOWN_STR       "00005555-4944-105f-8055-4e4b4e4f574e"

I wrote a simple program to examine uuid for myself.

Maybe - if you ran a loop (looking at uuid1().variant and uuid1().version you could see if there is an incorrect version showing up. Rather than python - that would seem to be a library function error.

My very simple program:

cat -n ../x4.py
     1  import _uuid
     2  import uuid
     3  _generate_time_safe = _uuid.generate_time_safe
     4  _has_uuid_generate_time_safe = _uuid.has_uuid_generate_time_safe
     5  uuid_time, _ = _generate_time_safe()
     6
     7  uu1a = uuid.UUID(bytes=uuid_time)
     8  uu1b = uuid.uuid1()
     9  uu4 = uuid.uuid4()
    10
    11  print("a)uuid1 = %x" % uu1a.int)
    12  print("b)uuid1 = %x" % uu1b.int)
    13  print("")
    14  print("a uuid1 = ",uu1a.fields, uu1a.version, uu1a.variant)
    15  print("b uuid1 = ",uu1b.fields, uu1b.version, uu1b.variant)
    16  uu1c = uuid.uuid1()
    17  print("c uuid1 = ",uu1c.fields, uu1c.version, uu1c.variant)
    18  print("")
    19  print("  uuid4 = %x" % uu4.int)
    20  print("  uuid4 = ",uu4.fields, uu4.version, uu4.variant)
    21  print("")
    22  uu4 = uuid.uuid4()
    23  print("  uuid4 = %x" % uu4.int)
    24  print("  uuid4 = ",uu4.fields, uu4.version, uu4.variant)
History
Date User Action Args
2018-01-17 15:21:24Michael.Feltsetrecipients: + Michael.Felt, pitrou, vstinner, koobs, David Carlier, devnexen
2018-01-17 15:21:24Michael.Feltsetmessageid: <1516202484.07.0.467229070634.issue32493@psf.upfronthosting.co.za>
2018-01-17 15:21:24Michael.Feltlinkissue32493 messages
2018-01-17 15:21:23Michael.Feltcreate