Skip to content

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

Open
slackito wants to merge 1 commit intobazelbuild:mainfrom
slackito:main
Open

Fix ordering of --remap-path-prefix flags.#4008
slackito wants to merge 1 commit 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

"--remap-path-prefix=${output_base}=.",
"--remap-path-prefix=${pwd}=.",
"--remap-path-prefix=${exec_root}=.",
])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: Maybe add an assert message that the ordering is sensitive?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean? assert_list_contains_adjacent_elements doesn't have any argument to pass a message.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh, I thought it did, I know some do. Either way, the desire was to ensure folks who encounter this test to be failing don't just update the test to match the current behavior. A note would be nice

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.

2 participants