Skip to content

AutoMerge feature request: Sanity check uuid for new packages #603

@GunnarFarneback

Description

@GunnarFarneback

UUIDs are standardized by RFC 4122 (and the recent followup RFC 9562) and it's a reasonable expectation that the uuid of a new Julia package should be generated by Julia's UUIDs stdlib, or if not still by a standards compliant generator. Most of the bits in a uuid are either random, timestamps, or random-looking, but there are some bits that are fixed by the specification. Specifically A and B marked below.

UUID("b1a8f88b-5968-4b8b-b9e8-905bb0cccf64")
                    A    B

A is the 4 bit version field. RFC 4122 defines versions 1-5. RFC 9562 adds 6-8. Julia 0.4 and later can generate versions 1 and 4. Julia 1.1 added version 5 and Julia 1.12 will add version 7.

The top two bits of B must be 10 if either RFC is followed, called the variant. I.e., B can be either 8, 9, a, or b.

Unfortunately Julia's version 1 implementation has been buggy (fix in JuliaLang/julia#59428), setting the variant bits to 00 instead of 10.

Realistically we must accept Julia's incorrect uuid version 1, so a sanity check for automerge of new packages could be

using UUIDs: UUID, uuid_version
function uuid_passes_sanity_check(uuid::UUID)
    version = uuid_version(uuid)
    variant = Int((uuid.value >> 62) & 0x3)
    return (variant == 2 && 1 <= version <= 8) || (variant == 0 && version == 1)
end

Addendum: 34 of the currently registered packages in General do not pass this sanity check. Obviously we cannot do anything about that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions