-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 build
updates the git commit
#8468
Comments
cargo build
updates the git reference while it should not do thiscargo build
updates the git commit
FYI: We have everywhere |
Okay, I think I know what the problem is:
The new syntax requires the |
Thanks for the report! Could you expand a bit on how you're depending on the |
https://github.com/paritytech/polkadot/tree/v0.8.13 You can check this out and try to compile it.(it is enough to just compile for a second, you don't need to compile the full project) It will work with a cargo without your pr, if you add your pr it will fail to resolve a depdency (because it updated the substrate commit). I always deleted the target dir in between the runs. What I have posted is the change that happened on master, after I updated the commit by intention. In the old format the master branch was not added to the cargo.lock and now it is added because it is not the default anymore. I think this is the reason why cargo tries to update the cargo.lock with your pr included. (but just guessing here) |
Ok so I've done some digging here and I think I see what's going on. Before #8364 specifying This had implications on With #8364, however, Anyway, putting all that together, checking out that repository and running Ok now what to do about this. Some possibilities I can think of:
I'd personally hope that we could continue to land the change as-is and see if updating y'all's |
Could we support loading the old cargo.lock files with no branch=master until stable writes the same Cargo.lock format? In the end all our old releases are "broken". Removing master from the Cargo.toml files could work for the future, but I will first need to see if there is a tool that changes the branch of all workspace projects (which is currently just a find&sed) |
If this is an issue for y'all the only real fix is to back everything out of Cargo for now. There's no way to roll out changes to the lock file quickly, so we'd have to slow this change down a lot. You can work across stable/beta/nightly by omitting |
One could special case In the long term, one could put version numbers into |
See #8475 . |
Nice :) |
Fixes rust-lang#8468 which was a regression of rust-lang#8364 .
I came across this problem before seeing this issue and the explanations, and what I ended up doing is: sed -i 's/branch = "master"/rev = "e7457b1eb9980596301fe1afd36478a6725157ef"/' ./**/Cargo.toml That's because we've been collecting performance data (across ~750 Rust PRs by now) for a specific version of Polkadot, and if we allow any versions to change, the performance data wouldn't be as useful (as it's not comparing I'll probably leave that hack in, especially with how uniform it is, just because I can trust that going back to any Rust/Cargo version, there's no chance of version updates accidentally succeeding (although I'm pretty sure it's guaranteed to fail, at this point). |
We talked about this at the Cargo meeting today and we didn't reach a firm conclusion one way or another. One thing I wanted to ask, though, @bkchr what would y'all do if we didn't fix this? Is that a viable option for y'all or is this something we really need to fix one way or another? |
My CI pipeline for my Rust projects uses a single |
@mathstuf is the fix of removing |
I've also posted about this on internals to try to get more visibility into this issue as well to see if others have feedback. |
We're using just |
@mathstuf to make sure, you experience the problem with |
The dependency referenced by
|
@mathstuf I think I found the cause for your issue. Technically it's a different bug than this one, but also a regression of #8364. Basically, if you have a .toml entry like this: ogg = { git = "https://github.com/rustaudio/ogg" } ... and run cargo vendor on Rust stable before #8364, you'll get a message like:
If you run cargo vendor with Rust nightly after #8364, the message will be like:
Notice the missing This means that there's an incompatibility between cargo vendor output from prior to #8364 and after #8364, as long as any git dependency was used where a branch wasn't specified. This case is much more common than the case of The obvious workaround of specifying As this affects much less of a niche use case, I'd recommend reverting #8364 for now from master and beta (it has already entered beta) and figuring out solutions that don't invalidate a large portion of old vendored cargo sources. |
Thanks for the help investigating that @est31, I agree that the change should be reverted given that this is an entirely independent issue. |
I've done a quick literal |
I think we would switch to the proposed solution of you. I would already have done this, but I was on vacations this week :) But now I would like to wait for your pr. |
Ok I've opened up #8522 to close this issue. |
This commit is intended to be an effective but not literal revert of rust-lang#8364. Internally Cargo will still distinguish between `DefaultBranch` and `Branch("master")` when reading `Cargo.toml` files, but for almost all purposes the two are equivalent. This will namely fix the issue we have with lock file encodings where both are encoded with no `branch` (and without a branch it's parsed from a lock file as `DefaultBranch`). This will preserve the change that `cargo vendor` will not print out `branch = "master"` annotations but that desugars to match the lock file on the other end, so it should continue to work. Tests have been added in this commit for the regressions found on rust-lang#8468.
I would like to report that this issue seems to persist in 1.47.0-nightly. I had opened an issue #8586 for the same. (It was prematurely closed due to confusion) |
Hey, so we have the following problem:
cargo build
in our repo with aCargo.lock
leads to the following output:It tries to update the git commit, which leads to some other dependency problems.
Using
cargo 1.46.0-nightly (fede83ccf 2020-07-02)
.Doing the same with cargo
2020-06-26
, it just starts building without updating the git commit.I tracked it down to the following pr: #8364
If I revert this pr, it works.
TLDR: cargo now always updates the git commit using
cargo build
.CC @alexcrichton as you have created the pr.
The text was updated successfully, but these errors were encountered: