-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[5.5] Do not crash on relative file URLs in a dependency #3604
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
Conversation
Currently, SwiftPM crashes when someone specifies the URL of a package dependency as a relative file URL. We should instead be able to just make it absolute based on the location of the package itself. (cherry picked from commit d771063)
@swift-ci please test |
I just happened to spot this by accident, but it doesn’t look correct - in the URL Personally, I don’t agree that this syntax should be supported. Relative file URLs are not a thing. Even RFC-8089 says:
The reason is that, with the proper 3 slashes ( |
Thanks, @karwa, looks like you're right and import Foundation
let url = URL(string: "file://../best")!
print("host: \(url.host ?? "<empty>")")
print("path: \(url.path)") prints
Based on that, it seems appropriate to change this to checking whether there's a host component and rejecting the URL if that is the case. |
It turns out that relative file URLs actually do not exist, see [here](#3604 (comment)) for more discussion. Instead we will now error and guide users to using a local package reference.
It turns out that relative file URLs actually do not exist, see [here](#3604 (comment)) for more discussion. Instead we will now error and guide users to using a local package reference.
It turns out that relative file URLs actually do not exist, see [here](#3604 (comment)) for more discussion. Instead we will now error and guide users to using a local package reference.
It turns out that relative file URLs actually do not exist, see [here](#3604 (comment)) for more discussion. Instead we will now error and guide users to using a local package reference. rdar://80751251 (cherry picked from commit e6a7323)
Amended with cherry-pick of #3625 |
@swift-ci please test |
|
@swift-ci please test linux |
Let's see how #3630 shakes out before merging this. |
Actually, let's get this merged. We are getting closer to the 5.5 release and this diagnostic is already a big improvement over crashing. If there's time, we can make another cherry pick of a refined diagnostic. |
5.5 cherry-pick of #3603