-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Prioritize [patch]
versions the way we do for versions in the lockfile
#9535
Comments
I'd like to give this a try, if I can. It sounds like the suggested fix changes existing behavior. In particular, perhaps a crate has old Alternatives might be to warn or fail on an otherwise-ignored patch. I'll start figuring out how the internals work to see where this change might be made. |
In fact, it looks like such a warning is in place: cargo/src/cargo/ops/resolve.rs Lines 435 to 452 in d1c0a9d
Maybe that fixes this issue? Or maybe it means that the changes to existing behavior are OK, since those changes are in cases that currently generate a warning. |
I think the latter. It is ok to change the behavior as it has a warning. |
@rustbot claim |
I think this will be the critical passage: cargo/src/cargo/core/registry.rs Lines 553 to 566 in 7cdf534
here, |
I think that would lead to the more radical "don't look at other versions if patch exists", witch is a more significant change then we wanted to do (at this time). The section of code I had in mind was |
I've read through both If you can help me understand a bit more about how all of this fits together, that'd be great. |
The "avoid" bits were originally added for I think we since adapted the "avoid" to also include entries where if the I agree though that it's all very complicated, it's unfortunately not seen a ton of love of the years and I haven't done a great job of keeping it readable. |
Thanks for that - the history is helpful! I'm still at a loss here, though -- anything I do seems to upset some delicate balance. For example, I definitely don't understand this, and I think that a guess-and-check method of making changes until the tests pass is not a sufficiently robust way to modify code this critical to Rust users. I'll keep trying things, but I will need a great deal of attention to the review! The 90s build time is making for slow going, too :( My current project is to try to generate a list of |
Hm, it seems that the Dependency for a |
Here is what I've got so far. |
In the original Cargo meeting where we thought of this idea we were discussing how |
So this is going to be trickier than I thought. Sorry for leading you astray. As you pointed out repeatedly the complication is that when making Plan B: is to smuggle |
I can give that a shot.. but, is that tying things into even further knots? Apologies for the delay -- I was away for the long weekend. |
You are volunteering to do work, there is no need to apologize! If you find that it makes for more problems, then it may be to |
It looks like Plan B wasn't bad, after all. Maybe |
Thanks for your help! |
If you have renames or refactors you think would help, please do! |
Thanks for the reminder -- I created #9703. |
Describe the problem you are trying to solve
Often when
[patch]
does not work for a user it is because there are newer versions available from the canonical source. Fixing this requires ether temporarily modifying the version of the replaced package or the requirement of the depending package. In ether case this probably needs to be un-done before upstreaming the fix.Describe the solution you'd like
If a version is from the
[patch]
section try it before versions from the canonical source, even if the patched package has a lower version. This is already what happens for versions that were in a lockfile, so it should not be hard to do.Notes
We thought of this in a Cargo Team meeting, and I wanted to wright it down before we forgot.
The text was updated successfully, but these errors were encountered: