-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
coreutils binary contains build path / build is not reproducible #6833
Comments
There's this option that might fix your problem: https://doc.rust-lang.org/rustc/command-line-arguments.html#--remap-path-prefix-remap-source-names-in-output I'm not sure whether this is something that we should fix necessarily if it can be configured. Let me know if this option works for you! |
I tested this in .cargo/config.toml and it works for the X86 release build:
However there are some instances left in the debug build., and it does not work completely for the yocto cross-build (there is one occurence left), so I'll try to debug this:
I also tested "trim-paths" in .cargo/config.toml which is available only with cargo nightly at the moment, with the same result:
Thanks for the hint. It looks like this is a generic rust issue not specific to uutils-coreutils. |
I'm glad it works! We could enable this by default for release builds. You mention debug builds, why would you need the reproducibility there? And I wonder where the trouble with the cross-build is! |
I mentioned debug builds because I was wondering if debug symbols are the reason there is one instance of the buildpath left when compiling with yocto (yocto generates debug symbols for all binaries and then split them to some extra debug symbol file). You are correct that in principle for the normal cargo debug binary, reproducibility is not important. |
The remaining occurence of the buildpath in the yocto build is caused by libstdbuf.rlib (from src/uu/stdbuf/src/libstdbuf). However I have not yet found a way to reproduce outside of yocto. When compiling uu_stdbuf directly in the uutils-coreutils repository this buildpath is not there. I'll debug further when I find some time. I also want to double-check "remap-debuginfo = true" as simpler alternative to "remap-path-prefix=XXX". |
At the moment, the coreutils binary contains several occurrences of the absolute path under which coreutils was built, which makes the build not reproducible (the binaries will be different depending on under which path they are built). Reproducibility is important in some industries ( see also https://github.com/rust-lang/rust/labels/A-reproducibility and rust-lang/rust#111540 ) and also triggers a "buildpath" build error which I disabled in the yocto integration of coreutils as workaround.
For instance, in the Ubuntu package rust-coreutils 0.0.24-2, the binary /usr/bin/coreutils contains occurences of absolute paths starting with "/usr/share/cargo/registry/coreutils-0.0.24-2/src/uucore/..."
I can also reproduce in current master branch:
The string "SIZE is an integer with an optional prefix and optional unit." right after "/home/ecordonnier/dev/coreutils/src/uu/truncate/src/truncate.rs" comes from https://github.com/uutils/coreutils/blob/d1f253481172786b819044f3717de9517506e910/src/uu/truncate/truncate.md
The text was updated successfully, but these errors were encountered: