Skip to content

Fix ordering of --remap-path-prefix flags.#4008

Merged
krasimirgg merged 2 commits intobazelbuild:mainfrom
slackito:main
May 5, 2026
Merged

Fix ordering of --remap-path-prefix flags.#4008
krasimirgg merged 2 commits intobazelbuild:mainfrom
slackito:main

Conversation

@slackito
Copy link
Copy Markdown
Collaborator

These flags are interpreted in reverse order (see
rust-lang/rust#82108), and if we have a set of flags like:

  --remap-path-prefix=/a/b/c/d=.
  --remap-path-prefix=/a/b=.

then the first flag will never apply, because the path will be first rewritten as ./c/d.

In this case, output_base is the outermost directory, so we need to make sure it's remapped last.

@slackito slackito requested a review from UebelAndre April 30, 2026 14:04
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 30, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

These flags are interpreted in reverse order (see
rust-lang/rust#82108), and if we have a set of
flags like:
```
  --remap-path-prefix=/a/b/c/d=.
  --remap-path-prefix=/a/b=.
```
then the first flag will never apply, because the path will be first
rewritten as ./c/d.

In this case, output_base is the outermost directory, so we need to make
sure it's remapped last.
Copy link
Copy Markdown
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! One optional nit

Comment thread test/unit/remap_path_prefix/remap_path_prefix_test.bzl
@krasimirgg krasimirgg enabled auto-merge May 5, 2026 11:46
@krasimirgg krasimirgg added this pull request to the merge queue May 5, 2026
Merged via the queue into bazelbuild:main with commit 52e3509 May 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants