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

.cargo/config path override & crates with optional deps broken #3313

Closed
vvuk opened this issue Nov 23, 2016 · 1 comment · Fixed by #3336
Closed

.cargo/config path override & crates with optional deps broken #3313

vvuk opened this issue Nov 23, 2016 · 1 comment · Fixed by #3336

Comments

@vvuk
Copy link

vvuk commented Nov 23, 2016

If a crate has an optional dependency, and it's ever used a .cargo/config, the optional dependency is always reported as a changed dep. STR:

  1. Pull https://github.com/servo/webrender
  2. Pull https://github.com/vvuk/dwrite-rs
  3. Set up path override to dwrite-rs
  4. Build in webrender/sample

Results in:

warning: path override for crate `dwrote` has altered the original list of
dependencies; the dependency on `serde_derive` was either added or
modified to not match the previously resolved version

(Note -- dwrite-rs is only used on Windows; for purposes of this, it should be possible to modify the Cargo.toml's in webrender to require it on all platforms... but a similar issue can likely be seen in many other crates.)

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Nov 28, 2016
Bad path overrides are currently detected to issue warnings in cases where path
overrides are not suitable and have exhibited buggy behavior in the past.
Unfortunately though it looks like some false positives are being issued,
causing unnecessary confusion about `paths` overrides.

This commit fixes the detection of these "bad path overrides" by comparing
`Summary` dependencies (what's written down in `Cargo.toml`) rather than
comparing the `Cargo.toml` of the override with `Cargo.lock`. We're guaranteed
that the package we're overridding has already been resolved into `Cargo.lock`,
so we know that if the two `Cargo.toml` files are equivalent we'll continue
with the same crate graph.

I'm not actually entirely sure why I originally thought it'd be better to go
through the `Cargo.lock` comparison route. Unfortunately that doesn't take into
account optional deps which aren't in `Cargo.lock` but are in `Cargo.toml` of
the override, causing the false positive. This method, however, simply ensures
that the two dependency lists are the same.

Closes rust-lang#3313
@alexcrichton
Copy link
Member

Fixed in #3336

bors added a commit that referenced this issue Dec 2, 2016
Test for bad path overrides with summaries

Bad path overrides are currently detected to issue warnings in cases where path
overrides are not suitable and have exhibited buggy behavior in the past.
Unfortunately though it looks like some false positives are being issued,
causing unnecessary confusion about `paths` overrides.

This commit fixes the detection of these "bad path overrides" by comparing
`Summary` dependencies (what's written down in `Cargo.toml`) rather than
comparing the `Cargo.toml` of the override with `Cargo.lock`. We're guaranteed
that the package we're overridding has already been resolved into `Cargo.lock`,
so we know that if the two `Cargo.toml` files are equivalent we'll continue
with the same crate graph.

I'm not actually entirely sure why I originally thought it'd be better to go
through the `Cargo.lock` comparison route. Unfortunately that doesn't take into
account optional deps which aren't in `Cargo.lock` but are in `Cargo.toml` of
the override, causing the false positive. This method, however, simply ensures
that the two dependency lists are the same.

Closes #3313
@bors bors closed this as completed in #3336 Dec 2, 2016
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 a pull request may close this issue.

2 participants