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

--remap-path-prefix broken in rustc version >= 1.46.0 #77046

Closed
Bargsteen opened this issue Sep 22, 2020 · 2 comments
Closed

--remap-path-prefix broken in rustc version >= 1.46.0 #77046

Bargsteen opened this issue Sep 22, 2020 · 2 comments
Labels
C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Bargsteen
Copy link

When compiling a rust program with --remap-path-prefix in 1.46.0, (and nightlies 1.47.0, 1.48.0) the specified prefixes in the binary are unaltered. I expected them to be changed.

When using 1.45.2 and 1.43.0, it works as expected.

Steps to reproduce

  1. Make sure you are using rustc >=1.46.0, check via rustc --version
  2. Create a new cargo project: cargo new --bin foo
  3. Add a dependency to Cargo.toml, for example regex = "1"
  4. Add code that uses this dependency, for example:
use regex::Regex;

fn main() {
    Regex::new(r"{").unwrap();
}
  1. Run RUSTFLAGS=--remap-path-prefix=/home/kasper=bar cargo build --release, where /home/kasper/ is the prefix you want to change, for example your $HOME.
  2. Inspect the binary using: strings target/release/foo | grep kasper (where kasper is something contained in the prefix), and see that it returns several lines.

If the same steps are taken on 1.45.2, step 5 returns no results, as expected.

Notes

The crate and code example is arbitrary, and the same behavior is observed for any combination of crates.

Software versions:

  • rustc 1.46.0 (04488af 2020-08-24)
  • OS: Linux (Ubuntu 20.04.1 LTS)

The following nightly versions also fail:

  • rustc 1.47.0-nightly (f44c6e4 2020-08-24)
  • rustc 1.48.0-nightly (1fd5b9d 2020-09-20)
@Bargsteen Bargsteen added the C-bug Category: This is a bug. label Sep 22, 2020
@jonas-schievink jonas-schievink added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Sep 22, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 22, 2020
@Stupremee Stupremee added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Sep 22, 2020
@ehuss
Copy link
Contributor

ehuss commented Sep 22, 2020

I believe this is essentially a duplicate of #73167. The paths should only appear if you have the rust-src component installed. Can you confirm that removing that component resolves what you are seeing?

@spastorino spastorino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 23, 2020
@hameerabbasi hameerabbasi added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 23, 2020
@Bargsteen
Copy link
Author

I believe this is essentially a duplicate of #73167. The paths should only appear if you have the rust-src component installed. Can you confirm that removing that component resolves what you are seeing?

Yes, I can confirm that removing the rust-src component essentially fixes the problem.
Closing this issue as it is a duplicate of #73167.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants