Skip to content

Not enough info in the warning about conflicting repos #8311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
dschaefer2 opened this issue Feb 26, 2025 · 1 comment
Open
1 task done

Not enough info in the warning about conflicting repos #8311

dschaefer2 opened this issue Feb 26, 2025 · 1 comment
Labels

Comments

@dschaefer2
Copy link
Member

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

I am getting this warning from SwiftPM as I resolve the dependencies in our PR that add the dependency on swift-build.

warning: 'swift-build': 'swift-build' dependency on 'https://github.com/swiftlang/swift-driver.git' conflicts with dependency on 'https://github.com/apple/swift-driver.git' which has the same identity 'swift-driver'. this will be escalated to an error in future versions of SwiftPM.

It's good that it's telling me one side of the story. The question is where is the dependency on the 'apple' version of the URL coming from? It's not from SwiftPM since we don't have a direct dependency on swift-driver.

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

From a clone of SwiftPM, fetch the PR with the new swift-build dependency in it.

gh pr checkout 8271

Then do a swift build. You should see the warning

Swift Package Manager version/commit hash

Latest main toolchain

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

No response

@dschaefer2 dschaefer2 added the bug label Feb 26, 2025
@neonichu
Copy link
Contributor

I also think this warning is a bit half baked.

IIRC, the purpose was to help with registry migration, but e.g. in this particular case, both URLs point to the literal same repo, so it feels like we should be able to not even emit a warning.

bripeticca pushed a commit that referenced this issue Mar 25, 2025
Update error messaging to be a bit more clear where the conflict of
identities is coming from.

### Motivation:

#8311 — when multiple packages share the same identity (for example:
`gh/swiftlang/swift-driver` and `gh/apple/swift-driver` share the same
identity `swift-driver`) then the error doesn't help to resolve the
conflict. It is particularly confusing when the conflicting package is
pulled from transitive dependencies. I wanted to offer more context to
resolve these types of conflicts, particularly:

 - how the conflict is introduced in relation to the root package
- itemize all paths for both sides of the conflict, so that users can
better understand how to approach resolution, but not overwhelm the
error message with too many details

### Modifications:

- Rephrase error message for clarity, add a suggestion to work with
maintainers of transitive dependencies.
- Reconstruct the dependency chains from roots to the conflicting
packages.

### Result:

Before: 

`'swift-build': 'swift-build' dependency on
'https://github.com/swiftlang/swift-driver.git' conflicts with
dependency on 'https://github.com/apple/swift-driver.git' which has the
same identity 'swift-driver'.`

After:

`Conflicting identity for swift-driver: dependency
'github.com/swiftlang/swift-driver' and dependency
'github.com/apple/swift-driver' both point to the same package identity
'swift-driver'. The dependencies are introduced through the following
chains: (A)
/users/yy/pub/swift-package-manager->github.com/swiftlang/swift-build->github.com/swiftlang/swift-driver
(B) /users/yy/pub/swift-package-manager->github.com/apple/swift-driver.
If there are multiple chains that lead to the same dependency, only the
first chain is shown here. To see all chains use debug output option. To
resolve the conflict, coordinate with the maintainer of the package that
introduces the conflicting dependency.
`

Plus also debug logs:

`debug: 'swift-build': Conflicting identity for swift-driver: chains of
dependencies for https://github.com/swiftlang/swift-driver.git:
[[/users/yy/pub/swift-package-manager, github.com/swiftlang/swift-build,
github.com/swiftlang/swift-driver]]`

`debug: 'swift-build': Conflicting identity for swift-driver: chains of
dependencies for https://github.com/apple/swift-driver.git:
[[/users/yy/pub/swift-package-manager, github.com/apple/swift-driver]]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants