-
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
--enable_runfiles is not applied correctly without manual cleaning #19333
Comments
My suspicion is that this occurs because, even though flipping A possible solution is to use a tree artifact to track the entire runfiles directory. |
Actually, there's a simpler solution: maybe |
@tjgq wow that was a fast turn-around time, thank you very much. Just to clarify: Both directions are important: when turning runfiles off, the directory should be deleted. But also when turning it on, the directory should be popuplated. The latter direction was also not working in case the runfiles directory pre-existed in an empty state. In your change, I only saw that you tested the "turning runfiles off" direction. The "turn runfiles on" direction would probably also make a good test. |
@hofst You're welcome! I happened to be working on something else that touches this part of the codebase, so I knew exactly what the problem was and how to fix it. I'm happy to add a test for the reverse case, but I couldn't construct a scenario where it doesn't work already. Are you saying you have an example where building first with |
yes that is correct. I just reproed it again: Not sure if this is a caching issue, a Windows issue, or something else. |
@hofst, can I trouble you for a concrete repro case and the Bazel version you're using? Here's how I attempted to repro it on Windows with Bazel 6.3.2:
|
@tjgq |
@tjgq |
Thanks, The reason you're seeing this behavior is that |
Hmm, if I understand you correctly you are saying that the |
Sorry, I should have actually tested on Windows before drawing conclusions from my experiments on Linux/MacOS. You're completely correct, the issue is definitely there on Windows, and it only occurs when incrementally toggling runfiles on (i.e., |
I suspect it has to do this code that decides whether to create runfiles just-in-time before action execution. It's checking whether the output manifest is a symlink, but on Windows we implement symlinks as a file copy by default. Setting the @hofst is |
Unfortunately, |
Fixes two separate but related issues: * On all OSes, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from on to off did not result in runfiles being cleared due to a missing call to `SymlinkTreeHelper#clearRunfilesDirectory` that was only added to `SymlinkTreeStrategy` in f84329e. * On Windows only, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from off to on did not result in runfiles being created since the logic in `RunfilesTreeUpdater` would see a copy of the manifest instead of a symlink. Work towards bazelbuild#20676 Fixes bazelbuild#19333
Fixes two separate but related issues: * On all OSes, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from on to off did not result in runfiles being cleared due to a missing call to `SymlinkTreeHelper#clearRunfilesDirectory` that was only added to `SymlinkTreeStrategy` in f84329e. * On Windows only, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from off to on did not result in runfiles being created since the logic in `RunfilesTreeUpdater` would see a copy of the manifest instead of a symlink. Work towards bazelbuild#20676 Fixes bazelbuild#19333
Fixes two separate but related issues: * On all OSes, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from on to off did not result in runfiles being cleared due to a missing call to `SymlinkTreeHelper#clearRunfilesDirectory` that was only added to `SymlinkTreeStrategy` in f84329e. * On Windows only, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from off to on did not result in runfiles being created since the logic in `RunfilesTreeUpdater` would see a copy of the manifest instead of a symlink. Work towards bazelbuild#20676 Fixes bazelbuild#19333
Description of the bug:
--enable_runfiles controls whether bazel will fill the runfiles directory with the specified dependencies (symlinked or copied).
It defaults to off on posix and to off on Windows.
When it is off, tests need to find their dependencies on their own, e.g., by inspecting the environment variables that bazel provides for this case.
Switching this flag, however, currently has a bug: It looks like bazel will do nothing unless the directory is manually cleaned.
E.g., if you previously did a build with runfiles enabled, and then turn it off, your test will run inside a filled runfiles directory. On the other hand, if you started with the flag off and then turned it on, your test will run in an empty runfiles directory. At least that is what I observe on Windows.
This is very problematic since it will cause test failures (very confusing ones).
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.
Create a test with runfiles dependencies. Turn the flag off, run the test, turn the flag on, run the test.
Which operating system are you running Bazel on?
Windows
What is the output of
bazel info release
?6.3.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 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.
No response
Have 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: