-
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
ctx.actions.symlink + building without the bytes misbehaves on Windows #21747
Comments
There is some code where bazel is creating junctions if cannot find target file:
|
Thanks for the detailed bug report! I suspect the fix is simply: - // Still Create a dangling junction if the target doesn't exist.
- if (!target.toFile().exists() || target.toFile().isDirectory()) {
- WindowsFileOperations.createJunction(link.toString(), target.toString());
+ if (createSymbolicLinks) {
+ WindowsFileOperations.createSymlink(link.toString(), target.toString());
} else {
- if (createSymbolicLinks) {
- WindowsFileOperations.createSymlink(link.toString(), target.toString());
+ // Still Create a dangling junction if the target doesn't exist.
+ if (!target.toFile().exists() || target.toFile().isDirectory()) {
+ WindowsFileOperations.createJunction(link.toString(), target.toString());
} else {
Files.copy(target, link);
} ...but I had no time yet to try it out and implement a test. I believe this would fix the |
When using remote cache, Windows symlinks which should be executable may break, see: bazelbuild/bazel#21747 Instead of creating symlinks, copy the bins instead until the issue is resolved.
The issue here is that, when building without the bytes, we create the symlink before the file it points to exists (it will be downloaded later if the symlink is ever consumed as an action input, or is itself materialized as an output). The Possible solutions, in rough order of complexity:
|
After #2826 was merged, I started seeing flaky builds on Windows related to build script executables (#2891 (comment)). This appears to be related to bazelbuild/bazel#21747 so to avoid the issue, this change ensures that Windows build script executables are copied instead of symlinked.
This is a partial fix for issue #21747 for the `--windows_enable_symlinks` case. The fix was suggested in discussion of this issue. This resolves the problem with creating a junction if the target path doesn't exist for those who have Windows symlinks enabled, until a complete solution is provided. Closes #24051. PiperOrigin-RevId: 688724224 Change-Id: Ie44f7834af5fd35ab57961e6012b9f336c25d606
This is a partial fix for issue bazelbuild#21747 for the `--windows_enable_symlinks` case. The fix was suggested in discussion of this issue. This resolves the problem with creating a junction if the target path doesn't exist for those who have Windows symlinks enabled, until a complete solution is provided. Closes bazelbuild#24051. PiperOrigin-RevId: 688724224 Change-Id: Ie44f7834af5fd35ab57961e6012b9f336c25d606
…of symlink (#24058) This is a partial fix for issue #21747 for the `--windows_enable_symlinks` case. The fix was suggested in discussion of this issue. This resolves the problem with creating a junction if the target path doesn't exist for those who have Windows symlinks enabled, until a complete solution is provided. Closes #24051. PiperOrigin-RevId: 688724224 Change-Id: Ie44f7834af5fd35ab57961e6012b9f336c25d606 Commit 3e5514d Co-authored-by: Alexander Golovlev <[email protected]>
Description of the bug:
The issue seems to be that if built normally, the
builder_reset\builder.exe
created inrules_go
below throughctx.actions.symlink
(link) is a regular file when run without cache, but is JUNCTION when taken from remote cache.Looks like junctions for files do not work well under Windows.
Below reproduction on hello world example using rules_go: https://github.com/hauserx/rules-go-startup
Which category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
No response
Which operating system are you running Bazel on?
Windows
What is the output of
bazel info release
?release 7.1.0
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
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
Below bug describes some non-deterministic behavior with same symptoms.
#19018
In contrary this bug is fully reproducible and seems to be caused by build without bytes behavior.
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: