Uuid::get_version() returns Version::Max for non-max UUIDs with a 0xF version nibble #867
Labels
No labels
breaking
bug
dependencies
good first issue
help wanted
unstable
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-uuid-rs/uuid#867
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Version::Maxcould be viewed as the special all-ones UUID, butUuid::get_version()currently returnsSome(Version::Max)for any UUID whose version nibble is0xF, even when the value is not actually the all-ones max UUID.Disclaimer: This might be a gap in the [documentation[(https://www.ietf.org/rfc/rfc9562.html#name-max-uuid) rather than an implementation error. The document only formally defines MAX UUID to be more specific, not
Version::MAX, andVersion::MAXcan be considered as the maximum possible version that can be set for UUID, which is indeed0xF. If this is the case, feel free to close the issue.Reproduction
Suggested fix
Gate the
Version::Maxbranch on the full UUID value, mirroring the existingNilhandling:A regression test for a non-max UUID with version nibble
0xFwould also help:Possibly related
Issue #322 (“Version number more than 5 returned for UUID”) looks related in the sense that it discusses version nibble
15, but this issue is specifically aboutget_version()misclassifying such values asVersion::Maxrather than returningNoneunless the UUID is actually the all-ones max value.I think it would be more correct to use the suggested fix here; only return Version::MAX for the actual max UUID.