-
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
In-process runfile tree creation from SymlinkTreeAction fails for some consecutive builds #20266
Comments
This sounds like its a similar area to: #19018 where the symlink action can happen before the action that creates the linked target is executed. |
Note that this issue is specifically about |
`SymlinkTreeUpdater` now correctly replaces symlinks with directories and vice versa in runfiles trees. Fixes bazelbuild#20266 Closes bazelbuild#22087. PiperOrigin-RevId: 628028591 Change-Id: Id94cea42f9cdfab001e56242a329b8d6d253ba29
…2116) `SymlinkTreeUpdater` now correctly replaces symlinks with directories and vice versa in runfiles trees. Fixes #20266 Closes #22087. PiperOrigin-RevId: 628028591 Change-Id: Id94cea42f9cdfab001e56242a329b8d6d253ba29 Commit 4b18dbe Co-authored-by: Fabian Meumertzheim <[email protected]>
`SymlinkTreeUpdater` now correctly replaces symlinks with directories and vice versa in runfiles trees. Fixes bazelbuild#20266 Closes bazelbuild#22087. PiperOrigin-RevId: 628028591 Change-Id: Id94cea42f9cdfab001e56242a329b8d6d253ba29
A fix for this issue has been included in Bazel 7.2.0 RC1. Please test out the release candidate and report any issues as soon as possible. |
I tried |
Description of the bug:
We are facing an interesting hermeticity issue when creating runfiles locally. It is solvable by running
bazel clean
but preferably should be addressed. The premise of the bug is that the in-process runfile tree creation does not handle all cases of the previuos runfile tree.With the flags
the in-process symlink creation will be used and thus the bug can be triggered.
In the example reproduction case, we have a target
output
that can be produced from two different inputs depending on a flag:then the
output
target is built two times by using different input rules. Themake_folder
rule produces the files by running a shell script and theuse_folder
produces the same files by globbing them from the sources. Both of these inputs are linked using runfiles to the same output path albeit a little differently, with:make_folder
usingctx.runfiles(symlinks = {"lib": directory})
use_folder
usingctx.runfiles(symlinks = symlinks)
with a complete dict for each file.The bug is triggered by building the
output
target twice in a row using different configurations, therefore forcing the runfiles tree builder into an edge case.Depending on the build oder, the error is slightly different:
From debugging, it seems that the
FileSystemUtils.ensureSymbolicLink
function does not do enough to ensure a symbolic link is created (i.e. if there is a folder where the symlink is supposed to go). This happens in therepro1.sh
case.In the second case
repro2.sh
it seems like a symlink is followed where it should not be:The file that the
SymlinkTreeAction
is trying to overwrite is actually outside the runfiles root:In practice we have bumped into this by when migrating from
rules_node
torules_js
and when trying to optionally pull out some pre-built artifacts.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.
I have attached a zip file with a minimal reproduction example, there are two errors that can be produced by running
repro1.sh
or therepro2.sh
scripts.Which operating system are you running Bazel on?
MacOS
What is the output of
bazel info release
?release 6.4.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 master; git rev-parse HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I have tested with bazel 6.3.0, 6.4.0 and latest master (sha
487bb42410488a3919e2b4d0c7fd2e37efe8e830
), this is reproducible on all the tested versionsHave you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: