-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
genrule fails with non-existent path using --build_tests_only
on Windows
#24546
Comments
@ADVD Do you know what the path looked like before the breaking commit? |
No, I don't know. But I suspect that this is related to the data that is appended to the launcher.exe on Windows. I don't have a Windows machine, which makes this always a bit tricky to debug. |
Here is a CI run with two jobs, one is using bazel from 610fe7b Also, the error also occurs when just trying to build the Here's a hexdump of the end of the hello_world.exe (for the failed build):
|
Thanks for the update. I think I know what's up, but will need to confirm my theory. The commit you originally identified as the culprit actually has a bug, so thanks for making me aware of that. :-) |
While it is true that the culprit commit changed how the |
This is ultimately caused by https://github.com/tweag/rules_sh/blob/dfd9051483ebcd0cd84902291b52270617ca8028/sh/private/defs.bzl#L35-L38: Genrule tools expect a runfiles structure in which each has a sibling Without a solution to #15486, you probably have to create a wrapper script around each individual tool that sets the runfiles environment variables to the single shared runfiles location. |
Thank you for digging into this @fmeum!
OK, I see. Closing. |
Description of the bug:
In a genrule, trying to run a command which gets expanded from a template variable results in an error when using Bazel >= 7.3.0:
Note the path looks fishy:
c:\\b\\3mrahdhj\\execroot\\_main\\bazel-out\\x64_windows-fastbuild\\bin\\sh_binaries\\hello_world.exe.runfiles/_main/sh_binaries/hello_world
Removing the
--build_tests_only
flag makes this work.cc @fmeum
Which category does this issue belong to?
Local Execution
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
You can use rules_sh as reproducer (I'll try to give a minimal example later):
gh repo clone tweag/rules_sh
cd rules_sh/tests
bazel test --build_tests_only ...
Which operating system are you running Bazel on?
Windows
What is the output of
bazel info release
?7.3.0 - 7.4.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
Bisecting this points to
282ac62610fe7bHave you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
I ran into this error for bazelbuild/bazel-central-registry#3288, see https://buildkite.com/bazel/bcr-presubmit/builds/9106.
The text was updated successfully, but these errors were encountered: