Repository navigation
fix: locate external rb_binary main in runfiles on Windows - #446
Open
TrapsterDK wants to merge 1 commit into
Open
TrapsterDK wants to merge 1 commit into
TrapsterDK wants to merge 1 commit into
Conversation
The Windows launcher ran binaries from other repositories, such as `@bundle//bin:rake`, through a path relative to the working directory, so the launcher only worked from the default `bazel run` directory. Resolve those binaries with rlocation, like the shell launcher does. The batch rlocation function now falls back to the nearest parent directory entry in the manifest, which finds files inside generated directories such as the Bundler `bin/private` binstubs. CI runs the `@bundle//bin:rake` launcher from `/` on every OS. Assisted-by: Claude
p0deje
reviewed
Nov 18, 2026
Member
There was a problem hiding this comment.
Should this be upstreamed to https://github.com/aspect-build/bazel-lib/blob/ddac9c46c3bff4cf8d0118a164c75390dbec2da9/lib/windows_utils.bzl?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
On Windows, the batch launcher ran an
rb_binarymain from another repository (for example@bundle//bin:rake) through a path relative to the working directory. The launcher only worked from the defaultbazel rundirectory; started from anywhere else, it could not find the script. The shell launcher already resolves these through rlocation.Fix
ruby/private/binary.bzl: binaries from other repositories are resolved with rlocation on every OS. Main-repository binaries on Windows keep the relative path (and the fallback added in fix: resolve rb_binary main scripts from any working directory #427).ruby/private/utils.bzl: the batch rlocation function falls back to the nearest parent directory entry in the runfiles manifest, so files inside generated directories, such as the Bundlerbin/privatebinstubs, are found.ruby/private/binary/binary.cmd.tpl: runs the resolved!binary!.Testing
@bundle//bin:rakelauncher from/on all OSes; this is the regression test.bazel test //ruby/tests:all(10/10 passed) andbazel run //:buildifier.checklocally on Linux, and the rake launcher from/on Linux.Assisted by Claude.