-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo has different version commit hashes per platform #10547
Comments
This could be an issue with #10323 potentially. If I had to guess it would be this part let output = match Command::new("git")
.arg("log")
.arg("-1")
.arg("--date=short")
.arg("--format=%H %h %cd")
.output()
{
Ok(output) if output.status.success() => output,
_ => return,
}; I don't have a spare machine to check the output on linux ATM but |
IIRC, it might come from here?
let short_ver_hash = output(
Command::new("git").current_dir(dir).arg("rev-parse").arg("--short=9").arg("HEAD"),
); I've tested on my Linux and macOS with Git v2.35.1. Both return a 9-chars long sha with |
I'm not sure if cargo uses |
I can't say why git decides to use a different length on different platforms. Can you say more about why this is an issue? I wouldn't expect the version output to be parsable, this is really for human consumption. If you want a parsable output, I suggest to use the verbose flag which includes the full length hash. |
You can specify a length with |
In rules_rust |
This appears to be a change from the previous stable release. I'll make a PR to set the length to 9 as @Muscraft described. On Linux I see:
|
Problem
In
1.60.0
I came across an issue wherecargo version
showed an unexpected difference on linux platforms in comparison to macos and windows.Running on linux, I get:
Where as running on macos, i get:
Note the slight difference in the commit hash (
d1fd9fe
vsd1fd9fe2c
). Linux is shorter than the other platforms by two characters. It would be ideal if these matched on all platforms, particularly since the full commit of each binary was not different.Steps
cargo version
in each environmentPossible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: