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

fix: normalize argv0 so runfiles root can be found on windows with bazel 9 #2481

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

rickeylev
Copy link
Collaborator

@rickeylev rickeylev commented Dec 6, 2024

When the shell test invokes the python binary, it uses a combination of forward slashes and
backslashes. Under Bazel 9, that mixture of slashes is preserved. This later breaks a regex
that looks for the OS-specific path separator.

To fix, normalize forward slashes to the OS path separator.

Oddly, it's not Bazel that is passing the mixture of slashes (it's the shell), but behavior seems to
vary based on which version of Bazel is used.

Along the way, copy the nicer print_verbose function from the stage2 bootstrap into the old
bootstrap. It prints debug information in a nicer format.

Work towards #2469

@rickeylev rickeylev requested a review from aignas as a code owner December 6, 2024 17:38
@aignas
Copy link
Collaborator

aignas commented Dec 7, 2024

Do we need to have CHANGELOG.md notes for this? I think it is a very low level change that will probably not affect anyone though.

@rickeylev
Copy link
Collaborator Author

I'm ok with omitting a changelog entry for it. It's for an unreleased version of bazel (which I'm not sure can be used with rules_python right now), and the bug report didn't come from a user, so I doubt anybody has actually encountered it.

@rickeylev rickeylev added this pull request to the merge queue Dec 7, 2024
Merged via the queue into bazelbuild:main with commit 0fb4ce1 Dec 7, 2024
4 checks passed
@rickeylev rickeylev deleted the add-python3lib-windows branch December 7, 2024 07:17
ewianda pushed a commit to ewianda/rules_python that referenced this pull request Dec 7, 2024
…zel 9 (bazelbuild#2481)

When the shell test invokes the python binary, it uses a combination of
forward slashes and
backslashes. Under Bazel 9, that mixture of slashes is preserved. This
later breaks a regex
that looks for the OS-specific path separator.

To fix, normalize forward slashes to the OS path separator.

Oddly, it's not Bazel that is passing the mixture of slashes (it's the
shell), but behavior seems to
vary based on which version of Bazel is used.

Along the way, copy the nicer `print_verbose` function from the stage2
bootstrap into the old
bootstrap. It prints debug information in a nicer format.

Work towards bazelbuild#2469
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