-
Notifications
You must be signed in to change notification settings - Fork 441
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
Add --remap-path-prefix=$PWD to make dbg builds more reproducible. #139
Conversation
I wasn't familiar with the problem, looked up the following: Tracking issue for the feature: rust-lang/rust#41555 Ref from book: https://doc.rust-lang.org/1.25.0/unstable-book/compiler-flags/remap-path-prefix.html
The book goes on to describe some reasons why this flag would be set, including a situation where debuggers might want to look at another directory. In both the old impl and with this change, those usecases would not be served since the current directories are ephemeral, and the new directories are lies. I feel like we could do better for non-external code by linking to the actual workspace. Do you think this is feasible instead of what we're doing here? Or perhaps I've misunderstood this change? |
Ah, there is a totally separate problem of making builds reproducible across machines (which appears to have motivated this change). I would prioritize that over better debugger support. If you can speak to both this comment and the last comment, that would be helpful. |
What path would we use for the actual workspace? Afaiu this would be
different per developer per workspace.
…On Sat, Oct 20, 2018 at 7:05 PM Alex McArther ***@***.***> wrote:
I wasn't familiar with the problem, looked up the following:
Tracking issue for the feature: rust-lang/rust#41555
<rust-lang/rust#41555>
Ref from book:
https://doc.rust-lang.org/1.25.0/unstable-book/compiler-flags/remap-path-prefix.html
I expect that link to break at some point, so the relevant snippets (to
me):
The -Z remap-path-prefix-from, -Z remap-path-prefix-to commandline option pair allows
to replace prefixes of any file paths the compiler emits in various places. This is useful
for bringing debuginfo paths into a well-known form and for achieving reproducible builds
independent of the directory the compiler was executed in. All paths emitted by the
compiler are affected, including those in error messages.
The book goes on to describe some reasons why this flag would be set,
including a situation where debuggers might want to look at another
directory. In both the old impl and with this change, those usecases would
not be served since the current directories are ephemeral, and the new
directories are lies.
I feel like we could do better for non-external code by linking to the
actual workspace. Do you think this is feasible instead of what we're doing
here? Or perhaps I've misunderstood this change?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#139 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACLjeLhP1_JNhQRY9B-BuGZAKGIvdYSTks5um6wpgaJpZM4XyLGw>
.
|
Yes this was 100% geared towards reproducibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W.R.T. finding the workspace path. I would expect there to be a lib function that does that, and I did find a stack overflow link.
I think this is a moot point though, as AFAICT the reproducible objective is at odds with the workspace directory objective, and I would prioritize the former.
This should make debug binaries come out (closer to) identical when built by different users or machines.
See also rust-lang/cargo#5505
PWD was usually something like
/home/marco/.cache/bazel/_bazel_marco/5e2375638c8763207dcac6c950a3684d/sandbox/linux-sandbox/14/execroot/
, which is a transient path. This should already be cause debugging problems, if there are any.Edit:
This is visible w/
strings
, eg:Tangentially related, we could also remap "external/" to "" to make paths in stacktraces attempt to correspond to the source root, rather than the execroot... but I am not convinced this is a good idea.
eg.
to