Skip to content
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 a --print=unmap-path-prefixes flag #612

Closed
1 of 3 tasks
lnicola opened this issue Apr 12, 2023 · 3 comments
Closed
1 of 3 tasks

Add a --print=unmap-path-prefixes flag #612

lnicola opened this issue Apr 12, 2023 · 3 comments
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team

Comments

@lnicola
Copy link
Member

lnicola commented Apr 12, 2023

Proposal

To help with reproducible builds, the standard library is built under a path like /rustc/b955c8271da80a1af8a1d54c4e1bbdaf51b032e9/library. However, debuggers will not be able to locate the source code, leading to a poor user experience, as shown in rust-lang/rust#62945.

This was fixed in rust-lang/rust#109527 for GDB and rustup installs, but it's fragile because it still makes some assumptions about the directory structure:

set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust

Specifically, this is unlikely to work for Linux distro packagers. In addition, getting the commit hash is not that easy either, and requires an external tool to be available:

RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \(\w*\)/\1/p')"

So this MCP proposes adding a way to set up the path mapping shown above. There are a couple of alternatives, for example:

  • a single --print flag to print both components (remapped and real path), e.g. /rustc/b955c8271da80a1af8a1d54c4e1bbdaf51b032e9:/home/lnicola/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust. This has the disadvantage of requiring the user to split by a character like : or \x1f (like with CARGO_ENCODED_RUSTCFLAGS), but can support multiple mapped paths if necessary (from_1\x1fto_1\x1ffrom_2\x1fto_2).
  • two flags, one for each component
  • two flags, one for the commit hash and one for the rust-src path, the latter potentially relative to the sysroot. This bakes in the assumption that the mapped path will always be /rustc/$RUSTC_COMMIT_HASH.

Which of these to implement is an open question. I'd personally pick the second or first option above.

Mentors or Reviewers

@cuviper as the Fedora Rust packager

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Comments

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@lnicola lnicola added major-change A proposal to make a major change to rustc T-compiler Add this label so rfcbot knows to poll the compiler team labels Apr 12, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 12, 2023

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

cc @rust-lang/compiler @rust-lang/compiler-contributors

@rustbot rustbot added the to-announce Announce this issue on triage meeting label Apr 12, 2023
@lnicola lnicola changed the title Add a --print=library-dir-mapping flag Add a --print=unmap-path-prefixes flag Apr 12, 2023
@davidtwco
Copy link
Member

@rustbot second

@rustbot rustbot added the final-comment-period The FCP has started, most (if not all) team members are in agreement label Apr 12, 2023
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Apr 13, 2023
@apiraino
Copy link
Contributor

@rustbot label -final-comment-period +major-change-accepted

@rustbot rustbot added major-change-accepted A major change proposal that was accepted to-announce Announce this issue on triage meeting and removed final-comment-period The FCP has started, most (if not all) team members are in agreement labels Apr 25, 2023
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team
Projects
None yet
Development

No branches or pull requests

4 participants