-
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
fix: only skip mtime check on ~/.cargo/{git,registry}
#12369
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @weihanglo (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
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.
Thanks for the contribution! Could you add a test to verify that only registry and git path are ignored? Maybe by ensuring mtime check won't skip ~/.cargo/bin
.
let is_readonly = ["git", "registry"] | ||
.into_iter() | ||
.map(|subfolder| cargo_home.join(subfolder)) | ||
.any(|readonly_dir| path.starts_with(readonly_dir)); |
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.
- Maybe just a micro optimization. This
cargo_home.join
is in a hot loop overpaths
. Could we do the allocation out of the loop upfront? - I am a bit wary that we now duplicate the path construction logic. Do you feel it better if we reuse the code here in
Config
?
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 will take a look at it. Should I combine the commits, when I'm done?
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.
My personal preference is making each commit atomic. Given the size of this change is not huge, it makes sense to me just rebase and leave one or two commits.
More personally, I may have the first commit to have a test first asserting the "bug behavior". Then the second contains the actual patch and the fixup of the test.
~/.cargo/{git,registry}
Pardon my title editing 🙇🏾. |
if let Ok(true) = home::cargo_home().map(|home| path.starts_with(home)) { | ||
continue; | ||
// Assuming anything in cargo_home/{git, registry} is immutable | ||
// (see also #9455 about marking cargo_home readonly) which avoids rebuilds when CI caches |
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.
FWIW: #9455 is not about marking CARGO_HOME readonly, but rather only a subdirectory of it.
97181c8
to
ccccfda
Compare
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.
Thanks for adding tests!
Could we move these two tests to tests/testsuite/freshness.rs
. It makes more sense to put them there.
03fe631
to
a4ecceb
Compare
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.
We're almost there! Could you run cargo fmt --all
to address the format error?
Closes rust-lang#12090 Commit Fix formatting Fix tests Fix formatting Fix formatting Fix formatting
a4ecceb
to
839069f
Compare
☀️ Test successful - checks-actions |
1 similar comment
☀️ Test successful - checks-actions |
👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request. |
Update cargo 8 commits in 1b15556767f4b78a64e868eedf4073c423f02b93..7ac9416d82cd4fc5e707c9ec3574d22dff6466e5 2023-07-18 14:44:47 +0000 to 2023-07-24 14:29:38 +0000 - fix(cargo-credential): should enable feature `serde/derive` (rust-lang/cargo#12396) - fix: encode URL params correctly for SourceId in Cargo.lock (rust-lang/cargo#12280) - docs: format config override caveat as a note (rust-lang/cargo#12392) - credential provider implementation (rust-lang/cargo#12334) - feat(crates-io): expose HTTP headers and Error type (rust-lang/cargo#12310) - chore: Don't update test data (rust-lang/cargo#12380) - fix: only skip mtime check on `~/.cargo/{git,registry}` (rust-lang/cargo#12369) - Update docs for artifact JSON debuginfo levels. (rust-lang/cargo#12376) Since rust-lang/cargo#12334 makes built-in credential providers part of the cargo binary, it's no longer needed to build them in bootstrap.
Update cargo 8 commits in 1b15556767f4b78a64e868eedf4073c423f02b93..7ac9416d82cd4fc5e707c9ec3574d22dff6466e5 2023-07-18 14:44:47 +0000 to 2023-07-24 14:29:38 +0000 - fix(cargo-credential): should enable feature `serde/derive` (rust-lang/cargo#12396) - fix: encode URL params correctly for SourceId in Cargo.lock (rust-lang/cargo#12280) - docs: format config override caveat as a note (rust-lang/cargo#12392) - credential provider implementation (rust-lang/cargo#12334) - feat(crates-io): expose HTTP headers and Error type (rust-lang/cargo#12310) - chore: Don't update test data (rust-lang/cargo#12380) - fix: only skip mtime check on `~/.cargo/{git,registry}` (rust-lang/cargo#12369) - Update docs for artifact JSON debuginfo levels. (rust-lang/cargo#12376) Since rust-lang/cargo#12334 makes built-in credential providers part of the cargo binary, it's no longer needed to build them in bootstrap.
rust-lang/cargo#12369 fixed this bug and was picked up in rust-lang/rust#114027.
rust-lang/cargo#12369 fixed this bug and was picked up in rust-lang/rust#114027.
Fixes #12090
Make cargo only skip mtime checks on
$CARGO_HOME/{git, registry}
.