-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Omit checksum verification for local git dependencies #11188
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
Closed
jarhodes314
wants to merge
8
commits into
rust-lang:master
from
jarhodes314:local-git-dependency-requires-checksum
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7620823
Omit checksum verification for local git dependencies
jarhodes314 1bdfc9d
Use null instead of empty string to represent missing checksum
jarhodes314 d8f0948
Change local_from_git to skip_checksum
jarhodes314 0408e9f
map -> if let Some
jarhodes314 88d7d28
Revert "map -> if let Some"
jarhodes314 419d76e
Revert "Use null instead of empty string to represent missing checksum"
jarhodes314 c5804b5
Apply review suggestions and test fix
jarhodes314 813325a
Add link to PR in test comment
jarhodes314 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid this change? I feel like resolve graph should reflect what is inside the index, even it is an empty
checksum = ""
. This also seems unnecessary in order to getcargo local-registry
works.Also, it is a bit risky to change what is included in a resolver graph, as it would get serialized into lockfile, which we want to keep as stable as possible.
(Though I currently have yet found any case breaking the compatibility)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. The problem arises from the fact that the git dependency has no checksum, so when you generate a lockfile after adding a git dependency to a project, the relevant
[[package]]
section does not contain a checksum field. When updating the dependencies,cargo local-registry
removes the source replacement configuration before runningcargo::ops::resolve_ws
, which verifies the checksums. The way round this would be to do similar filtering inResolve::merge_from
instead.For example, after
cargo/src/cargo/core/resolver/resolve.rs
Line 158 in b690ab4
and this does appear to prevent the error from occurring.
re lockfile stability, my main expectation with the lockfile as a user is that enabling source replacement and running a build shouldn't cause the lockfile to change. The proposed alternative change does obviously cause the lockfile to change. My usual test for whether I have set up my local registry correctly is to verify
cargo build --frozen
works and immediately after syncing the local registry, that will not work.As far as I'm aware, only
cargo local-registry
can generate empty checksums (as git dependencies, path dependencies and vendored dependencies all generate no checksum whatsoever) so there shouldn't be another case to break compatibility with.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now convinced. Thank you for explaining it again and again!
That's also what I observed. I am going to do an FCP and see if we can reach a consensus from the team.