Skip to content

Mirror-based SCM-to-registry mapping requires exact URL string matching (.git suffix, case sensitivity) #9856

@vsarunas

Description

@vsarunas

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

When using mirrors to map source control dependencies to registry identities (as enabled by #6017), mirror lookup uses exact string matching on URLs.
This means a mirror set for https://github.com/apple/swift-nio does not match https://github.com/apple/swift-nio.git, even though they refer to the same repository.

In practice, a root package declares .package(url: "https://github.com/apple/swift-nio", ...) (without .git) and sets a mirror for that URL. But a transitive dependency (e.g. async-http-client) declares the same package as .package(url: "https://github.com/apple/swift-nio.git", ...) (with .git).
The mirror matches the root's URL but not the transitive dep's URL, causing the same package to resolve under two different identities — apple.swift-nio (registry, mirrored) and swift-nio (source control, not mirrored).

Targets that reference one identity can't find the other:

error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git')

The same issue occurs with URL casing — https://github.com/swift-server/RediStack does not match a mirror set for https://github.com/swift-server/rediStack, even though GitHub URLs are case-insensitive.

The workaround is to set mirrors for every URL permutation (with/without .git, original/lowercase casing) up to 4 entries per package. To get our repo fully usable under a package registry requires 119 mirror entries, which in some ways is a workaround for #9854.

Expected behavior

To work as this does:

swift build --replace-scm-with-registry

Actual behavior

Computing version for swift-server.async-http-client
Computed swift-server.async-http-client at 1.30.1 (0.83s)
Fetching https://github.com/apple/swift-algorithms.git from cache
Fetching https://github.com/apple/swift-nio-ssl.git from cache
Fetching https://github.com/apple/swift-nio-transport-services.git from cache
Fetching https://github.com/apple/swift-distributed-tracing.git from cache
Fetching https://github.com/apple/swift-nio-http2.git from cache
Fetching https://github.com/apple/swift-nio-extras.git from cache
Fetching https://github.com/apple/swift-atomics.git from cache
Fetched https://github.com/apple/swift-atomics.git from cache (0.75s)
Fetched https://github.com/apple/swift-algorithms.git from cache (0.75s)
Fetched https://github.com/apple/swift-nio-transport-services.git from cache (0.75s)
Fetched https://github.com/apple/swift-nio-ssl.git from cache (0.75s)
Fetched https://github.com/apple/swift-distributed-tracing.git from cache (0.75s)
Fetched https://github.com/apple/swift-nio-http2.git from cache (0.75s)
Fetched https://github.com/apple/swift-nio-extras.git from cache (0.75s)
Computing version for apple.swift-nio
Computed apple.swift-nio at 2.97.0 (0.97s)
Fetching https://github.com/apple/swift-system.git from cache
Fetching https://github.com/apple/swift-collections.git from cache
Fetched https://github.com/apple/swift-system.git from cache (0.82s)
Fetched https://github.com/apple/swift-collections.git from cache (0.83s)
Computing version for apple.swift-log
Computed apple.swift-log at 1.6.4 (1.04s)
Computing version for https://github.com/apple/swift-atomics.git
Computed https://github.com/apple/swift-atomics.git at 1.3.0 (0.04s)
Computing version for https://github.com/apple/swift-distributed-tracing.git
Computed https://github.com/apple/swift-distributed-tracing.git at 1.4.1 (0.03s)
Fetching https://github.com/apple/swift-service-context.git from cache
Fetched https://github.com/apple/swift-service-context.git from cache (0.55s)
Computing version for https://github.com/apple/swift-algorithms.git
Computed https://github.com/apple/swift-algorithms.git at 1.2.1 (0.61s)
Fetching https://github.com/apple/swift-numerics.git from cache
Fetched https://github.com/apple/swift-numerics.git from cache (0.57s)
Computing version for https://github.com/apple/swift-service-context.git
Computed https://github.com/apple/swift-service-context.git at 1.3.0 (0.62s)
Computing version for https://github.com/apple/swift-nio-transport-services.git
Computed https://github.com/apple/swift-nio-transport-services.git at 1.26.0 (0.03s)
Computing version for https://github.com/apple/swift-numerics.git
Computed https://github.com/apple/swift-numerics.git at 1.1.1 (0.03s)
Computing version for https://github.com/apple/swift-nio-http2.git
Computed https://github.com/apple/swift-nio-http2.git at 1.42.0 (0.03s)
Computing version for https://github.com/apple/swift-nio-ssl.git
Computed https://github.com/apple/swift-nio-ssl.git at 2.36.1 (0.03s)
Computing version for https://github.com/apple/swift-system.git
Computed https://github.com/apple/swift-system.git at 1.6.4 (0.03s)
Computing version for https://github.com/apple/swift-collections.git
Computed https://github.com/apple/swift-collections.git at 1.4.1 (0.05s)
Computing version for https://github.com/apple/swift-nio-extras.git
Computed https://github.com/apple/swift-nio-extras.git at 1.33.0 (0.03s)
Fetching https://github.com/apple/swift-http-types.git from cache
Fetching https://github.com/apple/swift-http-structured-headers.git from cache
Fetching https://github.com/apple/swift-async-algorithms.git from cache
Fetching https://github.com/swift-server/swift-service-lifecycle.git from cache
Fetching https://github.com/apple/swift-certificates.git from cache
Fetching https://github.com/apple/swift-asn1.git from cache
Fetched https://github.com/apple/swift-async-algorithms.git from cache (0.53s)
Fetched https://github.com/apple/swift-certificates.git from cache (0.53s)
Fetched https://github.com/apple/swift-http-structured-headers.git from cache (0.86s)
Fetched https://github.com/apple/swift-http-types.git from cache (1.39s)
Fetched https://github.com/swift-server/swift-service-lifecycle.git from cache (1.39s)
Fetched https://github.com/apple/swift-asn1.git from cache (1.39s)
Computing version for https://github.com/swift-server/swift-service-lifecycle.git
Computed https://github.com/swift-server/swift-service-lifecycle.git at 2.10.1 (1.45s)
Computing version for https://github.com/apple/swift-async-algorithms.git
Computed https://github.com/apple/swift-async-algorithms.git at 1.1.3 (0.04s)
Computing version for https://github.com/apple/swift-http-types.git
Computed https://github.com/apple/swift-http-types.git at 1.5.1 (0.03s)
Computing version for https://github.com/apple/swift-asn1.git
Computed https://github.com/apple/swift-asn1.git at 1.6.0 (0.03s)
Computing version for https://github.com/apple/swift-certificates.git
Computed https://github.com/apple/swift-certificates.git at 1.18.0 (0.03s)
Fetching https://github.com/apple/swift-crypto.git from cache
Fetched https://github.com/apple/swift-crypto.git from cache (0.54s)
Computing version for https://github.com/apple/swift-http-structured-headers.git
Computed https://github.com/apple/swift-http-structured-headers.git at 1.6.0 (0.60s)
Computing version for https://github.com/apple/swift-crypto.git
Computed https://github.com/apple/swift-crypto.git at 4.3.0 (0.03s)
Creating working copy for https://github.com/apple/swift-asn1.git
Working copy of https://github.com/apple/swift-asn1.git resolved at 1.6.0
Creating working copy for https://github.com/apple/swift-crypto.git
Working copy of https://github.com/apple/swift-crypto.git resolved at 4.3.0
Creating working copy for https://github.com/apple/swift-async-algorithms.git
Working copy of https://github.com/apple/swift-async-algorithms.git resolved at 1.1.3
Creating working copy for https://github.com/apple/swift-nio-extras.git
Working copy of https://github.com/apple/swift-nio-extras.git resolved at 1.33.0
Creating working copy for https://github.com/apple/swift-nio-http2.git
Working copy of https://github.com/apple/swift-nio-http2.git resolved at 1.42.0
Creating working copy for https://github.com/apple/swift-system.git
Working copy of https://github.com/apple/swift-system.git resolved at 1.6.4
Creating working copy for https://github.com/apple/swift-atomics.git
Working copy of https://github.com/apple/swift-atomics.git resolved at 1.3.0
Creating working copy for https://github.com/apple/swift-distributed-tracing.git
Working copy of https://github.com/apple/swift-distributed-tracing.git resolved at 1.4.1
Creating working copy for https://github.com/apple/swift-http-structured-headers.git
Working copy of https://github.com/apple/swift-http-structured-headers.git resolved at 1.6.0
Creating working copy for https://github.com/apple/swift-certificates.git
Working copy of https://github.com/apple/swift-certificates.git resolved at 1.18.0
Creating working copy for https://github.com/apple/swift-collections.git
Working copy of https://github.com/apple/swift-collections.git resolved at 1.4.1
Creating working copy for https://github.com/apple/swift-nio-transport-services.git
Working copy of https://github.com/apple/swift-nio-transport-services.git resolved at 1.26.0
Creating working copy for https://github.com/apple/swift-numerics.git
Working copy of https://github.com/apple/swift-numerics.git resolved at 1.1.1
Creating working copy for https://github.com/apple/swift-http-types.git
Working copy of https://github.com/apple/swift-http-types.git resolved at 1.5.1
Fetching swift-server.async-http-client from cache
Fetched swift-server.async-http-client from cache (0.04s)
Creating working copy for https://github.com/apple/swift-nio-ssl.git
Working copy of https://github.com/apple/swift-nio-ssl.git resolved at 2.36.1
Creating working copy for https://github.com/apple/swift-service-context.git
Working copy of https://github.com/apple/swift-service-context.git resolved at 1.3.0
Creating working copy for https://github.com/apple/swift-algorithms.git
Working copy of https://github.com/apple/swift-algorithms.git resolved at 1.2.1
Creating working copy for https://github.com/swift-server/swift-service-lifecycle.git
Working copy of https://github.com/swift-server/swift-service-lifecycle.git resolved at 2.10.1
Fetching apple.swift-log from cache
Fetched apple.swift-log from cache (0.01s)
Fetching apple.swift-nio from cache
Fetched apple.swift-nio from cache (0.19s)
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-log' in dependencies of target 'AsyncHTTPClient'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClientTests'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClientTests'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClientTests'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClientTests'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClientTests'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-nio' in dependencies of target 'AsyncHTTPClientTests'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: 'swift-server.async-http-client': unknown package 'apple.swift-log' in dependencies of target 'AsyncHTTPClientTests'; valid packages are: 'swift-nio' (from 'https://github.com/apple/swift-nio.git'), 'swift-nio-ssl' (from 'https://github.com/apple/swift-nio-ssl.git'), 'swift-nio-http2' (from 'https://github.com/apple/swift-nio-http2.git'), 'swift-nio-extras' (from 'https://github.com/apple/swift-nio-extras.git'), 'swift-nio-transport-services' (from 'https://github.com/apple/swift-nio-transport-services.git'), 'swift-log' (from 'https://github.com/apple/swift-log.git'), 'swift-atomics' (from 'https://github.com/apple/swift-atomics.git'), 'swift-algorithms' (from 'https://github.com/apple/swift-algorithms.git'), 'swift-distributed-tracing' (from 'https://github.com/apple/swift-distributed-tracing.git')
error: fatalError

Steps to reproduce

Ready package that setups this up: mirror-reproducer.zip

bash setup.sh http://swift-package-registry

Swift Package Manager version/commit hash

6.3.0

Swift & OS version (output of swift --version ; uname -a)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions