-
Notifications
You must be signed in to change notification settings - Fork 212
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
Local file path strings embedded in binary #56
Comments
You may be interested in this: Specifically |
Thank you @johnthagen, I will check these out! Also, I was looking through the Unstable Book and found these--any thoughts if they are helpful too? On quick look, looks like perhaps the |
Ran with |
This won't help for size, but a short term idea to help avoid leaking your personal information into the binaries would be to build in a container (for Linux builds) or some kind of generic CI system or VM for Windows/macOS such as GitHub Actions. |
For reproduction, there is this example (which began the discussion that led to [dependencies]
rand = "0.8.0" use rand::prelude::*;
fn main() {
let r: f64 = rand::thread_rng().gen();
println!("{}", r);
} Then with either the mentioned $ cargo +nightly build --release -Z trim-paths
$ RUSTFLAGS="-Z location-detail=none" cargo +nightly build --release
Perhaps you can verify the above, and then try identify what is being done differently for those not to work. Make sure you're not building from any cache which may already have those paths too? There is also this issue which notes that TL;DRMaybe try |
I am able to get rid of all path and dependencies information by adding |
From https://rust-lang.github.io/rfcs/3127-trim-paths.html#cargo:
Reading the docs, it seems like this default for release profile should resolve most practical issues related to privacy. So when this goes stable, trimming paths should just work for everyone. Also seems like if you are using For reference, as of Rust 1.75.0, this is still a nightly-only feature. |
Hello!
I'm working through this awesome guide to reduce the size of my compiled binaries. It is making a big difference. While inspecting the result, I used
strings
to take a look at what strings are still in the result. I see multiple places where it appears that the resultant release binary contains file paths which are a reflection of my local file system. Also, these paths are sometimes long and thus also contributing slightly to binary size. I'd like to understand why these full paths are being included and if there is a way to suppress them.Your help, thoughts, and ideas are much appreciated!
Here is my release compile profile:
And, here is a redacted sample of the output of
strings
on the resultant binary:release/macos/aarch64/bin/foo | grep "ptdecker"
Output (redacted):
Note the
/Users/ptdecker/PycharmProjects/baz/foo/target...
pathsThe text was updated successfully, but these errors were encountered: