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

Verify source before recompile #11672

Merged
merged 2 commits into from
Feb 3, 2023
Merged

Conversation

weihanglo
Copy link
Member

@weihanglo weihanglo commented Feb 3, 2023

What does this PR try to resolve?

This fixes a regression introduced by #11407,
which Cargo should always verify a source before it recompiles.

Before #11407, we only cared about whether the compare Erred. #11407 changed some cases of the compare from being reported as an Err to an Ok with dirty information but the check on the compare Error wasn't updated. This is easy to miss in implementation and review as it was outside of the lines changed (github won't even let reviewers comment on the relevant line).

How should we test and review this PR?

You could checkout to branch rust-1.67.0 and run the new test case.
Cargo before #11407 refuses to build when checksum verification failed,
which is the correct behavior. You'll see this error with rust-1.67.0:

error: the listed checksum of `/projects/bar/src/lib.rs` has changed:
expected: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
actual:   66e843918c1d4ea8231af814f9f958958808249d4407de01114acb730ecd9bdf

directory sources are not intended to be edited, if modifications are required then it is recommended that `[patch]` is used with a forked copy of the source

Additional information

Worth a beta-nominated Nominated to backport to the beta branch. ?

This fixes a regression introduced by rust-lang#11407,
which Cargo should always verify a source before it recompiles.
@rustbot
Copy link
Collaborator

rustbot commented Feb 3, 2023

r? @epage

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 3, 2023
@epage
Copy link
Contributor

epage commented Feb 3, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Feb 3, 2023

📌 Commit 98a7339 has been approved by epage

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 3, 2023
@bors
Copy link
Contributor

bors commented Feb 3, 2023

⌛ Testing commit 98a7339 with merge 47ec597...

@bors
Copy link
Contributor

bors commented Feb 3, 2023

☀️ Test successful - checks-actions
Approved by: epage
Pushing 47ec597 to master...

@bors bors merged commit 47ec597 into rust-lang:master Feb 3, 2023
@weihanglo weihanglo deleted the recompile-verify branch February 3, 2023 16:22
@epage epage added the beta-nominated Nominated to backport to the beta branch. label Feb 3, 2023
weihanglo pushed a commit to weihanglo/cargo that referenced this pull request Feb 3, 2023
weihanglo added a commit to weihanglo/rust that referenced this pull request Feb 7, 2023
12 commits in e84a7928d93a31f284b497c214a2ece69b4d7719..82c3bb79e3a19a5164e33819ef81bfc2c984bc56
2023-01-31 22:18:09 +0000 to 2023-02-04 22:52:16 +0000

- util toml targets: Do not infer directory as a file (rust-lang/cargo#11678)
- Add more guidance on how to implement unstable features (rust-lang/cargo#11675)
- Fix unstable chapter layout for codegen-backend (rust-lang/cargo#11676)
- refactor: mod.rs over "name".rs for consistency (rust-lang/cargo#11673)
- Verify source before recompile (rust-lang/cargo#11672)
- doc: more doc comments and intra-doc links (rust-lang/cargo#11669)
- Turn off debuginfo for build dependencies v2 (rust-lang/cargo#11252)
- config: Deny CARGO_HOME in [env] table (fixes rust-lang/cargo#11590) (rust-lang/cargo#11644)
- Fix the wrong comment (rust-lang/cargo#11651)
- Add partial support for SSH known hosts markers (rust-lang/cargo#11635)
- Replace `winapi` with `windows-sys` crate. (rust-lang/cargo#11656)
- Handle .cargo-ok being truncated (rust-lang/cargo#11665)
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2023
Update cargo

12 commits in e84a7928d93a31f284b497c214a2ece69b4d7719..82c3bb79e3a19a5164e33819ef81bfc2c984bc56 2023-01-31 22:18:09 +0000 to 2023-02-04 22:52:16 +0000

- util toml targets: Do not infer directory as a file (rust-lang/cargo#11678)
- Add more guidance on how to implement unstable features (rust-lang/cargo#11675)
- Fix unstable chapter layout for codegen-backend (rust-lang/cargo#11676)
- refactor: mod.rs over "name".rs for consistency (rust-lang/cargo#11673)
- Verify source before recompile (rust-lang/cargo#11672)
- doc: more doc comments and intra-doc links (rust-lang/cargo#11669)
- Turn off debuginfo for build dependencies v2 (rust-lang/cargo#11252)
- config: Deny CARGO_HOME in [env] table (fixes rust-lang/cargo#11590) (rust-lang/cargo#11644)
- Fix the wrong comment (rust-lang/cargo#11651)
- Add partial support for SSH known hosts markers (rust-lang/cargo#11635)
- Replace `winapi` with `windows-sys` crate. (rust-lang/cargo#11656)
- Handle .cargo-ok being truncated (rust-lang/cargo#11665)

r? `@ghost`
bors added a commit that referenced this pull request Feb 8, 2023
 [beta-1.68] Backport fixes

Beta backports:

* #11661 — Do not error for `auth-required: true` without `-Z sparse-registry`
* #11672 — Verify source before recompile
bors added a commit that referenced this pull request Feb 9, 2023
 [beta-1.68] Backport fixes

Beta backports:

* #11661 — Do not error for `auth-required: true` without `-Z sparse-registry`
* #11672 — Verify source before recompile
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Feb 9, 2023
Update cargo

12 commits in e84a7928d93a31f284b497c214a2ece69b4d7719..82c3bb79e3a19a5164e33819ef81bfc2c984bc56 2023-01-31 22:18:09 +0000 to 2023-02-04 22:52:16 +0000

- util toml targets: Do not infer directory as a file (rust-lang/cargo#11678)
- Add more guidance on how to implement unstable features (rust-lang/cargo#11675)
- Fix unstable chapter layout for codegen-backend (rust-lang/cargo#11676)
- refactor: mod.rs over "name".rs for consistency (rust-lang/cargo#11673)
- Verify source before recompile (rust-lang/cargo#11672)
- doc: more doc comments and intra-doc links (rust-lang/cargo#11669)
- Turn off debuginfo for build dependencies v2 (rust-lang/cargo#11252)
- config: Deny CARGO_HOME in [env] table (fixes rust-lang/cargo#11590) (rust-lang/cargo#11644)
- Fix the wrong comment (rust-lang/cargo#11651)
- Add partial support for SSH known hosts markers (rust-lang/cargo#11635)
- Replace `winapi` with `windows-sys` crate. (rust-lang/cargo#11656)
- Handle .cargo-ok being truncated (rust-lang/cargo#11665)

r? `@ghost`
@ehuss ehuss added this to the 1.69.0 milestone Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-nominated Nominated to backport to the beta branch. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants