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

Unstable dependency selection and rebuilding #3043

Closed
jwilm opened this issue Aug 26, 2016 · 8 comments
Closed

Unstable dependency selection and rebuilding #3043

jwilm opened this issue Aug 26, 2016 · 8 comments

Comments

@jwilm
Copy link
Contributor

jwilm commented Aug 26, 2016

I've got a project with workspaces that looks roughly like

├── Cargo.lock
├── Cargo.toml
├── push
│   └── Cargo.toml
├── src
└── util
    └── Cargo.toml

util has a dependency on postgres with the uuid feature. I've recently upgraded postgres to support uuid 0.3. Since a new version hasn't been cut, I've added postgres to my .cargo/config. There's a package in my project that depends on uuid 0.2 internally; this may be important. Now, whenever I run cargo build from the push folder, there's a change that postgres decides to switch between 0.2 and 0.3 of uuid thereby triggering rebuilds of postgres, util, and my push crate.

Here's some fingerprint logs demonstrating the behavior:

One run

INFO:cargo::ops::cargo_rustc::fingerprint: fingerprint error for postgres v0.11.10 (file:///home/jwilm/code/rust-postgres): new (uuid v0.2.3) != old (uuid v0.3.1)

Some number of runs later (varies)

INFO:cargo::ops::cargo_rustc::fingerprint: fingerprint error for postgres v0.11.10 (file:///home/jwilm/code/rust-postgres): new (uuid v0.3.1) != old (uuid v0.2.3)

Other fingerprint logs are a result of postgres deciding to rebuild, and there's nothing to suggest why it chose a different uuid abrubtly. The Cargo.lock file does not appear to change.

I've tried setting a workspace in rust-postgres/Cargo.toml to no effect. The rust-postgres uuid dependency looks like this:

uuid = { version = ">= 0.1, < 0.4", optional = true }

which does allow for other versions. In my project Cargo.toml files, only uuid 0.3 is ever specified other than in third-party dependencies which use 0.2 internally.

rustc/cargo versions:

jwilm@jwilm-desk ➜  ~/code/onepush/push  rustc -V
rustc 1.13.0-nightly (3c5a0fa45 2016-08-22)
jwilm@jwilm-desk ➜  ~/code/onepush/push  cargo -V
cargo 0.13.0-nightly (41b2177 2016-08-22)
@alexcrichton
Copy link
Member

Hm, sounds fishy! Do you have any paths overrides in .cargo/config in play?

@jwilm
Copy link
Contributor Author

jwilm commented Aug 26, 2016

Only for rust-postgres, but there's nothing changing over there to warrant a rebuild.

paths = ["/home/jwilm/code/rust-postgres"]

@alexcrichton
Copy link
Member

Ah that'd do it, if you remove that is the build deterministic?

There's a couple of known bugs in Cargo where paths can cause nondeterministic compiles.

@jwilm
Copy link
Contributor Author

jwilm commented Aug 26, 2016

Well, it's a deterministic failure. I need the path override so that another dependency uses my version of rust-postgres. Should this just be closed with a reference to one of those issues?

@alexcrichton
Copy link
Member

I'd recommend using [replace] for overriding for now, otherwise I believe this is #2041

@lilith
Copy link
Contributor

lilith commented Sep 17, 2016

@alexcrichton Is there a nightly build available which supports combining workspaces and [replace]? Do I just have a bad build here?.

@alexcrichton
Copy link
Member

@nathanaeljones I'll comment more on that issue

@alexcrichton
Copy link
Member

I believe we've since implemented warnings for paths overrides that are likely to cause fishy compilations, so I'm going to close this.

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

No branches or pull requests

3 participants