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

feat: Take the whole rustc version into hash calculation #1553

Merged
merged 4 commits into from Jan 11, 2023

Conversation

Xuanwo
Copy link
Collaborator

@Xuanwo Xuanwo commented Jan 11, 2023

Signed-off-by: Xuanwo github@xuanwo.io

Fix #1552

This is a use case that may break user's build after rust version bumped.

Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2023

Codecov Report

Base: 30.91% // Head: 30.91% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (c8f49a5) compared to base (1a82863).
Patch coverage: 10.00% of modified lines in pull request are covered.

❗ Current head c8f49a5 differs from pull request most recent head 5e0e22e. Consider uploading reports for the commit 5e0e22e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1553      +/-   ##
==========================================
- Coverage   30.91%   30.91%   -0.01%     
==========================================
  Files          48       48              
  Lines       16589    16598       +9     
  Branches     7896     7906      +10     
==========================================
+ Hits         5129     5131       +2     
+ Misses       6107     6106       -1     
- Partials     5353     5361       +8     
Impacted Files Coverage Δ
src/compiler/compiler.rs 36.24% <0.00%> (-0.22%) ⬇️
src/compiler/rust.rs 33.55% <11.11%> (-0.67%) ⬇️
src/jobserver.rs 47.91% <0.00%> (-2.09%) ⬇️
src/cache/cache.rs 40.31% <0.00%> (-0.39%) ⬇️
src/config.rs 36.59% <0.00%> (-0.19%) ⬇️
src/compiler/msvc.rs 43.35% <0.00%> (-0.14%) ⬇️
src/lib.rs 10.67% <0.00%> (ø)
src/util.rs 35.50% <0.00%> (ø)
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@drahnr
Copy link
Collaborator

drahnr commented Jan 11, 2023

The rustc binary is hashed already, which by definition must change if the output of rustc -vV would change.

Could you elaborate on the precise case that would require the version to be hashed in addition?

@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 11, 2023

The rustc binary is hashed already, which by definition must change if the output of rustc -vV would change.

I must miss this part. Can you point out the detailed place which rustc been hashed? Thanks.

@drahnr
Copy link
Collaborator

drahnr commented Jan 11, 2023

I was writing that from memory, since there were issues in the past when switching from nightly to stable or vice versa, I have yet to double check the code

@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 11, 2023

I was writing that from memory, since there were issues in the past when switching from nightly to stable or vice versa, I have yet to double check the code

My current understanding is we just hashed the path to rustc instead rustc itself, thus we need the verbose version get hashed.

@sylvestre
Copy link
Collaborator

it is the path and it is coming from rustup, it should be something like
~/.rustup/toolchains/1.58-x86_64-unknown-linux-gnu/bin/rustc ?

@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 11, 2023

it is the path and it is coming from rustup, it should be something like ~/.rustup/toolchains/1.58-x86_64-unknown-linux-gnu/bin/rustc ?

I'm afraid that we just found cargo:

[2023-01-11T08:34:03Z DEBUG sccache::compiler::compiler] Found rustc at path: "/home/xuanwo/.cargo/bin/rustc"

This can be reproduced by change:

- debug!("Found rustc");
+ debug!("Found rustc at path: {rustc_executable:?}");

@glandium
Copy link
Collaborator

it is the path and it is coming from rustup, it should be something like ~/.rustup/toolchains/1.58-x86_64-unknown-linux-gnu/bin/rustc ?

I don't think that's guaranteed. It could well be ~/.cargo/bin/rustc. Also, in most cases it would be ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc.

@glandium
Copy link
Collaborator

glandium commented Jan 11, 2023

And yeah, when the path is ~/.cargo/bin/rustc, if you were hashing the binary, you'd end up hashing rustup's binary, which never changes. It's possible to unwrap and find the real binary, though...

Signed-off-by: Xuanwo <github@xuanwo.io>
@sylvestre
Copy link
Collaborator

it is the path and it is coming from rustup, it should be something like ~/.rustup/toolchains/1.58-x86_64-unknown-linux-gnu/bin/rustc ?

I don't think that's guaranteed. It could well be ~/.cargo/bin/rustc. Also, in most cases it would be ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc.

or /usr/bin/rustc ;)

@glandium
Copy link
Collaborator

There is actually code to unwrap the rustup proxy already:

let proxy = RustupProxy::find_proxy_executable::<T>(

src/compiler/compiler.rs Outdated Show resolved Hide resolved
Signed-off-by: Xuanwo <github@xuanwo.io>
@sylvestre sylvestre merged commit f452e4b into mozilla:main Jan 11, 2023
@Xuanwo Xuanwo deleted the take-whole-rustc-version-into-hash branch January 11, 2023 13:50
@drahnr
Copy link
Collaborator

drahnr commented Jan 11, 2023

The rustc binary is hashed already, which by definition must change if the output of rustc -vV would change.

Could you elaborate on the precise case that would require the version to be hashed in addition?

This was wrong, I got confused and thought the sysroot would include rustc, but it apparently does not. Sorry for the red hering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sccache didn't take rustc version into hash calculation
5 participants