Skip to content
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

Elaborate registry names to index URLs when publishing #4957

Merged
merged 3 commits into from
Jan 25, 2018

Conversation

sfackler
Copy link
Member

This avoids introducing a dependency on the publisher's name for the
registry.

Closes #4880

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

@sfackler
Copy link
Member Author

r? @alexcrichton

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @withoutboats and @carols10cents

Wanted to make y'all aware of this as well. This is enabling a feature which IIRC was explicitly disallowed in the original RFC (specifying the URL of an index in Cargo.toml). That being said, though, I don't think this is violating the spirit of the RFC in that we'd still basically only ever teach users about registry = "foo" (named registries) and maybe only mention registry-index = "..." in an appendix or something like that.

If the motivation isn't clear here though as to why we're doing that, I'd also be happy to clarify!

@@ -181,6 +181,7 @@ impl<'de> de::Deserialize<'de> for TomlDependency {
pub struct DetailedTomlDependency {
version: Option<String>,
registry: Option<String>,
registry_index: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this use #[serde(rename)] to use registry-index instead?

details.registry.as_ref(),
details.registry_index.as_ref(),
) {
(Some(_), _, Some(_), _) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One day we will make this better. It is not this day.

@sfackler
Copy link
Member Author

Updated

@@ -178,25 +178,26 @@ impl<'de> de::Deserialize<'de> for TomlDependency {
}

#[derive(Deserialize, Serialize, Clone, Debug, Default)]
#[serde(rename_all = "kebab-case")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah unfortuantely I don't think we can do this as it breaks manifests that use default_features = false, for example.

When we first moved to serde we ran into that (as the old rustc-serialize toml-rs accepted both) and that's why there's two entries below :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The #[serde(rename = "default_features")] down on default_features2 will handle that: https://play.rust-lang.org/?gist=db44b7c463a8b4ac43c0b67e2b36e5d0&version=stable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I missed that, nice!

@alexcrichton
Copy link
Member

This LGTM, but others from @rust-lang/cargo will likely wish to weigh in

@bors
Copy link
Contributor

bors commented Jan 20, 2018

☔ The latest upstream changes (presumably #4844) made this pull request unmergeable. Please resolve the merge conflicts.

@sfackler sfackler force-pushed the registry-elaboration branch from 44d2a3c to 7c7bc23 Compare January 20, 2018 18:23
@carols10cents
Copy link
Member

One reason we didn't want to support this is to disallow credentials (such as https://username:password@index-url.com) from getting into the Cargo.toml. We could just always explicitly ignore credentials specified here so that doing that doesn't work.....

@sfackler
Copy link
Member Author

Should we forbid credentials in index URLs entirely?

@sfackler
Copy link
Member Author

Forbidding them would also take care of potential issues if some people use ssh://foobar.com and others use ssh://git@foobar.com, for example.

@alexcrichton
Copy link
Member

I think so long as we have some way of specifying credentials in ~/.cargo/config it makes sense to forbid credentials in the manifest itself (although maybe allow a username as existing git/ssh deps may use that). Not that I think we should require the ~/.cargo/config configuration to exist before landing this of course!

@sfackler
Copy link
Member Author

Cool, so are there any blockers on this PR, then?

@sfackler sfackler force-pushed the registry-elaboration branch from 7c7bc23 to 77ccd0e Compare January 24, 2018 20:54
@sfackler
Copy link
Member Author

Updated to forbid credentials in registry URLs.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 25, 2018

📌 Commit 77ccd0e has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jan 25, 2018

⌛ Testing commit 77ccd0e with merge 91e36aa...

bors added a commit that referenced this pull request Jan 25, 2018
Elaborate registry names to index URLs when publishing

This avoids introducing a dependency on the publisher's name for the
registry.

Closes #4880
@bors
Copy link
Contributor

bors commented Jan 25, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 91e36aa to master...

@bors bors merged commit 77ccd0e into rust-lang:master Jan 25, 2018
@sfackler sfackler deleted the registry-elaboration branch January 25, 2018 16:56
@ehuss ehuss added this to the 1.25.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alternative registry references are inconsistent between the name and index URL
7 participants