-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rust build stops be reproducible, after adding/removing one assert #140061
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
Comments
It seems like something is causing mono items to get reordered within a codegen unit. Can you run |
I have debugged quite a few of those reports by Debian packagers (not users). In every case, they were caused by a build script somewhere in your dependency tree, usually one iterating over a HashMap (which with the default hasher, is not reproducible). |
The responsible crate seems to be
A few times. Each time produces a different hash. Crates which depend on this one also have an unstable hash, but nothing else does. I've also confirmed that the hash becomes stable if I remove everything from the crate. Unfortunately the module graph in this crate has a LOT of cycles so it's going to be very hard to reduce this. |
I found a loop over a HashMap in a proc-macro crate that you are using: https://github.com/kellpossible/cargo-i18n/blob/ceb3da0ee3acf91b17a7a52e02642267ddb47a3d/i18n-embed-fl/src/lib.rs#L550 Which exactly lines up with the instability in the output of
diff --git a/old b/new
index f2be1cc..ef8766a 100644
--- a/old
+++ b/new
@@ -4182,11 +4182,11 @@ pub mod common_dir_traversal {
"core_cannot_read_entry_dir",
{
let mut args = std::collections::HashMap::new();
+ args.insert("reason", e.to_string().into());
args.insert(
"dir",
current_folder.to_string_lossy().to_string().into(),
);
- args.insert("reason", e.to_string().into());
args
},
)
@@ -4211,11 +4211,11 @@ pub mod common_dir_traversal {
"core_cannot_read_metadata_dir",
{
let mut args = std::collections::HashMap::new();
- args.insert("reason", e.to_string().into());
args.insert(
"dir",
current_folder.to_string_lossy().to_string().into(),
);
+ args.insert("reason", e.to_string().into());
args
},
)
@@ -4291,11 +4291,11 @@ pub mod common_dir_traversal {
"core_folder_no_modification_date",
{
let mut args = std::collections::HashMap::new();
- args.insert("reason", e.to_string().into());
args.insert(
"name",
current_file_name.to_string_lossy().to_string().into(),
);
+ args.insert("reason", e.to_string().into());
args
},
)
@@ -4308,11 +4308,11 @@ pub mod common_dir_traversal {
"core_file_no_modification_date",
{
let mut args = std::collections::HashMap::new();
+ args.insert("reason", e.to_string().into());
args.insert(
"name",
current_file_name.to_string_lossy().to_string().into(),
);
- args.insert("reason", e.to_string().into());
args
},
)
|
One user of my app reported that builds of my app are not reproducible.
I started to minimize the project, but found that randomly after removing code or dependencies, it either produces reproducible or non-reproducible builds.
Finally, I managed to get reproducible builds just by removing a single assert in the code.
This fails in exactly the same way on my OS, with both Mold and the default linker.
The strangest part for me is that the bug seems to be related to the size of the project.
After removing other unrelated parts, I was also able to make the project reproducible.
Steps to reproduce
czkawka_core/src/progress_data.rs
Project - czkawka.zip
Meta
rustc --version --verbose
:and also
but according to qarmin/czkawka#1507, this happens also with rust 1.85.0 from debian repo - https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/rust-czkawka-cli.html
The text was updated successfully, but these errors were encountered: