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

Docs say --remap-path-prefix treats paths as strings during matching but compiler does not #96870

Open
michaelwoerister opened this issue May 9, 2022 · 2 comments
Labels
A-reproducibility Area: Reproducible / Deterministic builds C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@michaelwoerister
Copy link
Member

Our --remap-path-prefix documentation says "The
replacement is purely textual, with no consideration of the current system's
pathname syntax."
. But that currently is not the case. Prefix matching is implemented via Path::strip_prefix which can behave quite differently:

`abc` is a prefix of `abc/def`
`abc/.` is a prefix of `abc/def`
`ab` is NOT a prefix of `abc/def`
`abc` is NOT a prefix of `./abc/def`
`./abc` is NOT a prefix of `abc/def`
`./abc` is a prefix of `./abc/def`

It's unclear whether we should update the documentation or change the compiler's behavior.

rustc --version --verbose:

rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: x86_64-unknown-linux-gnu
release: 1.60.0
LLVM version: 14.0.0
@michaelwoerister michaelwoerister added the C-bug Category: This is a bug. label May 9, 2022
@ehuss
Copy link
Contributor

ehuss commented May 9, 2022

It looks like string-based matching was incidentally removed in #46335. I probably missed that when writing the docs, instead relying on your comment here. Do you recall at the time if the preference was for simplicity of implementation, or simplicity for the user?

@michaelwoerister
Copy link
Member Author

michaelwoerister commented May 10, 2022

If I remember correctly the original argument for doing things on a string basis was that it's more predictable for the user. But I'm not sure if that's actually true.

@jyn514 jyn514 added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-reproducibility Area: Reproducible / Deterministic builds labels Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-reproducibility Area: Reproducible / Deterministic builds C-bug Category: This is a bug. 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

3 participants