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

Tracking issue for Path Prefix Remapping #41555

Closed
michaelwoerister opened this issue Apr 26, 2017 · 41 comments
Closed

Tracking issue for Path Prefix Remapping #41555

michaelwoerister opened this issue Apr 26, 2017 · 41 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-metadata Area: Crate metadata B-unstable Feature: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.

Comments

@michaelwoerister
Copy link
Member

This feature was originally requested in #38322. The PR that implements this in its unstable form is #41508. This will eventually become stable if the testing phase goes well.

@michaelwoerister michaelwoerister added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-metadata Area: Crate metadata B-unstable Feature: Implemented in the nightly compiler and unstable. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-tools labels Apr 26, 2017
@alexcrichton alexcrichton added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 22, 2017
@brson
Copy link
Contributor

brson commented Jul 8, 2017

What's the next step to stabilize this? Looks like it probably won't be stable for 1.20?

@michaelwoerister
Copy link
Member Author

Good question. I did not heard any complaints about the way things currently work -- which I interpret as everybody being happy :).

Some of the people initially interested in the feature were @jmesmon, @infinity0, @sanxiyn, and @jsgf. Do you have any feedback?

Other than that, two open topics are:

  • The documentation (currently in the unstable book) needs a revamp. @jsgf found it confusing, IIRC.
  • The exact form of the CLI has seen some discussion but there was no clear agreement on what would be best. The current form is -Zremap-path-prefix-from=_, -Zremap-path-prefix-to=_. The could be transformed to
    • -Cremap-path-prefix-from=_, -Cremap-path-prefix-to=_ or
    • --remap-path-prefix-from=_, --remap-path-prefix-to=_ or
    • something else altogether.

I personally would be fine with either of the first two options.

cc @rust-lang/dev-tools

@infinity0
Copy link
Contributor

I haven't tested this yet but I'm still interested. When I get a chance, I'll test it with 1.19 in Debian and see if we get a reproducible build.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 10, 2017

We use it in clippy for making our tests' stderr output OS independent. Works like a charm: https://github.com/Manishearth/rust-clippy/blob/master/tests/examples.rs#L29

@infinity0
Copy link
Contributor

Is the duplication of the path with / and \ really necessary? I thought the stripping algorithm worked on whole-path components, so that trailing directory separators shouldn't be necessary.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 10, 2017

Maybe it changed. But I had to implement it this way, otherwise it wouldn't work

@michaelwoerister
Copy link
Member Author

I thought the stripping algorithm worked on whole-path components, so that trailing directory separators shouldn't be necessary.

The current implementation works on plain strings. It does not try to interpret them as paths.

@infinity0
Copy link
Contributor

infinity0 commented Jul 10, 2017

Oh right. I was going by the code at the bottom of this older comment, I didn't notice you had gone back to plain string matching. What was the reason? I know GCC also do plain string matching, but I actually prefer path-level matching because it would be easier to use. This cross-platform duplication issue is a further example in that area.

@jsgf
Copy link
Contributor

jsgf commented Jul 13, 2017

@brson, @michaelwoerister I just hacked it up in buck and it all looks good. Once it's stable (at least, we have decided on a stable command line option), I can do a real diff.

Either -Cremap-path-prefix or --remap-path-prefix is fine by me.

@jsgf
Copy link
Contributor

jsgf commented Jul 17, 2017

@michaelwoerister Do you think it's possible to stabilize this in the 1.21 timeframe?

@michaelwoerister
Copy link
Member Author

@infinity0 I'm divided on whether path matching should be string- or component-based. Component-based is a bit more ergonomic in the cross-platform case. I'm not sure though if it can be somewhat less predictable in corner cases (e.g. strange Windows path prefixes).

@jsgf That should be doable.

I'm nominating this for the next @rust-lang/dev-tools meeting to discuss string matching and which form the CLI should take -- and then we can let the appropriate subteams vote on it.

@rust-lang/core: Which teams need to sign off on stabilizing this? Quick recap: This feature allows to remap file paths (in output messages and output artifacts) to be remapped. This is necessary for reproducible builds and helps with custom debugging setups.

@alexcrichton
Copy link
Member

@michaelwoerister @rust-lang/dev-tools sounds good to me as a team for signing off!

@codyps
Copy link
Contributor

codyps commented Jul 18, 2017

On matching mechanism: an alternate to paths & strings is to use regexes. Strings works fine for me though.

@Mark-Simulacrum Mark-Simulacrum added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Jul 22, 2017
@michaelwoerister michaelwoerister removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 8, 2017
@michaelwoerister
Copy link
Member Author

This has been discussed in the @rust-lang/dev-tools meeting and the conclusion was that we want to stabilize in the following form:

  • This becomes a single, non--C flag: --remap-path-prefix
  • We change parameter passing to the GCC way: the option takes a single string argument of the form from=to. This means that the new prefix (the to part) cannot contain an equals sign, but otherwise this has the advantage of being shorter than the current unstable form and is close to prior art.
  • The option will only be shown in the extended help output of rustc (i.e. when --help -v is passed).

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Aug 8, 2017

Team member @michaelwoerister has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Aug 8, 2017
@sophiajt
Copy link
Contributor

sophiajt commented Aug 8, 2017

@rfcbot reviewed

@infinity0
Copy link
Contributor

We change parameter passing to the GCC way: the option takes a single string argument of the form from=to. This means that the new prefix (the to part) cannot contain an equals sign, but otherwise this has the advantage of being shorter than the current unstable form and is close to prior art.

So in other words you would split on the final =, right? I prefer that to the current GCC behaviour, which splits on the initial = so that the from part cannot contain an equals sign.

@luser
Copy link
Contributor

luser commented Feb 2, 2018

What's the current status of this? It looks like it's been approved for stabilization, but the plan is to change the option to a single --remap-path-prefix. Does that change just need to be made, and then this can ship on stable?

@jsgf
Copy link
Contributor

jsgf commented Feb 14, 2018

I've been using the -Zremap-path-prefix- form in our build environment (I failed to guess when they'd stabilize) for a few months now, and it's been working well.

@michaelwoerister
Copy link
Member Author

Yes, it's just waiting to be implemented. I've just been busy with other things. I'm glad to take PRs though.

@jsgf
Copy link
Contributor

jsgf commented Feb 18, 2018

OK, I'm looking at it now.

@kpcyrd
Copy link

kpcyrd commented Feb 19, 2018

As a minor note, it would be interesting to have both $HOME and $PWD remapped to standard values for release builds. This is currently the only thing that I have to adjust manually for reproducible builds (besides #47135).

@jsgf
Copy link
Contributor

jsgf commented Feb 20, 2018

They would only affect the build if you're explicitly referencing them with env!("HOME"), right? You could just do --remap-path-prefix=$PWD=./.

jsgf added a commit to jsgf/rust that referenced this issue Feb 22, 2018
Remove experimental -Zremap-path-prefix-from/to, and replace it with
the stabilized --remap-path-prefix=from=to variant.

This is an implementation for issue of rust-lang#41555.
@kpcyrd
Copy link

kpcyrd commented May 9, 2018

@jsgf the binary includes my $CARGO_HOME into the binary by default, if I don't have that variable set it defaults to $HOME/.cargo. :)

I think my project root and my explicit or implicit cargo home should be remapped.

@jsgf
Copy link
Contributor

jsgf commented May 9, 2018

@kpcyrd Well I guess that's an issue to be addressed in cargo.

@kpcyrd
Copy link

kpcyrd commented May 10, 2018

@jsgf you're right, I've opened an issue for that: rust-lang/cargo#5505

@Centril Centril added disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels May 24, 2018
@XAMPPRocky
Copy link
Member

Closing as this was stabilised in 1.26.0 and there doesn't seem to be any leftover features to be implemented.

tylerwhall added a commit to tylerwhall/meta-rust that referenced this issue Jul 22, 2018
Before the flag was stabilized, it required two arguments of the form
"from=<from_path>" and "to=<to_path>" respectively. The stabilized
version uses one argument of the form "<from_path>=<to_path>".

Unfortunately the old format is still parsed successfully, but results
in attempting to replace the literal paths "from" and "to".

rust-lang/rust#41555 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-metadata Area: Crate metadata B-unstable Feature: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests