-
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
Non-reproducible builds when depending on local crates #15122
Comments
@rustbot label +A-reproducibility |
I think this bug may be responsible for the nonreproducibility of Hippotat in Debian: |
This bug may also be the same problem that is seen in the Yocto builds: |
This might be related to #5505 |
The script here had several minor errors due to being copied from a terminal probably and bash being actually astonishingly whitespace sensitive, which caused all the heredocs to not be recognized upon copy-pasting this back into a script. I had to fix it to make it work, like so: #!/bin/bash
cargo new --lib ext_crate
for i in a b
do
mkdir $i
(
cd $i
TOPDIR=`pwd`
cargo new --lib repro
cat > repro/src/lib.rs <<EOF
pub fn foo() -> usize {
ext_crate::add(1, 2) as usize
}
EOF
cp -r ../ext_crate ext_crate
cat > repro/Cargo.toml <<EOF
[package]
name = "repro"
version = "0.1.0"
edition = "2021"
[dependencies]
ext_crate = { version = "0.1.0", path="../ext_crate" }
EOF
(
cd repro
RUSTFLAGS="--remap-path-prefix=${TOPDIR}=/stablepath" cargo build -vv --release --target-dir=build
)
)
done
diff -ur [ab]/repro/build In the future, I would suggest you upload shell scripts directly rather than copy-pasting from the terminal (or whatever the original source was) to GitHub if you have the slightest doubt over whether a single space or newline from the script might be altered. With a shebang, too, that properly denotes it's bash or what. Please? So that it's, er, easier to reproduce the reproducer that reproduces the non-reproducibility? |
I guess this is as close to an MCVE as we're gonna get. |
This is an issue somewhere inside cargo. It passes different |
Thanks for clarifying! I suppose we can get this moved to rust-lang/cargo then? |
@rustbot transfer cargo |
It looks like meta fingerprints are not particularly stable when it comes to depending on local crates (i.e. with a dependency specifying a "path", a "[patch.crates-io]" section or a "__CARGO_TESTS_ONLY_SRC_ROOT" environment variable); different absolute pathnames seem to produce different build fingerprints. This makes it difficult to reproduce builds when running as a different user or on a different operating system or distribution.
--remap-path-prefix doesn't seem to help at all here.
To reproduce this problem:
My expected behavior here would be that those two builds would be identical and reproducible.
These are the versions I am using:
The text was updated successfully, but these errors were encountered: