-
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
Bazel 0.21.0 flipped --incompatible_strict_action_env to true and broke itself #7026
Comments
Philipp, thanks for finding, filing, and working around this bug. We (@philwo , @hlopko , and myself) argued about this flag today and realized that, while sh_* rules should probably not run It's unclear to me what should Bazel do. It seems that PATH's whole purpose is to contain the locations of these common tools, in which case PATH should be exempt from the "strict" env and be available to the action. On the other hand, PATH is inherently machine-specific and as such it poisons remote caches. Another important observation @philwo made is that the "strict" action env is just as non-hermetic as the non-strict one; we just replace the clientenv's PATH with a hardcoded PATH string, but whatever is in those directories is out of our control (and not tracked by Bazel). And on one machine they might have |
One option would be to make |
This will help prevent bazelbuild/bazel#7026
To prevent this from happening again, I filed bazelbuild/continuous-integration#434 |
…eakage. Context: #7026 PiperOrigin-RevId: 227524684
This will help prevent bazelbuild/bazel#7026
I can't speak for PATH in general, but from the point of view of the Python interpreter: The long-term solution is to define the interpreter as a toolchain rule, where a particular toolchain target is appropriate for a specific system / path installation. The toolchain target for the current host system could be generated by a repository rule. Currently |
@brandjon : Can you explain how executing a |
And this is only the Linux/macOS stub script. On Windows we have another stub that is a C++ program (called the "launcher"). @meteorcloudy could correct me on this, but IIRC the local python interpreter's path is embedded in the launcher. |
@laszlocsomor The native launcher also only uses python on PATH if no bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java Line 200 in f451cd8
That said, the python binary (including the native launcher for python) won't be a problem if python path is explicitly specified even with |
I think we need to change the default PATH on macos and Windows. It might be worthwhile to roll back the flag flip, except it may be too late now? |
@meteorcloudy : Thanks, that's comforting to know. |
Regarding Windows:
|
I don't have a mac available right now, but I take it /sbin is on the PATH by default, so we should add it to the default path in Bazel as well. It's |
For a specific proposal, I'd say we should at least set it to |
I assume the strict PATH env should contain the most common native tools available on that platform. For Windows, I think they should be:
But there are two issues to be considered on Windows:
|
We need to achieve three things here:
I think the images that will be built / are already being built for remote execution will largely put binaries in the locations matching the default PATH. (I don't think I'm saying anything new, just trying to clarify the situation. Using %SYSTEMROOT% in PATH should be fine; however, we do need to figure out how to handle %SYSTEMROOT% with remote execution to prevent remote cache thrashing.) |
Re @meteorcloudy : Also, it's not clear to me anymore who's waiting on whose input and who are decision makers on this bug. How can we move forward? I'm happy to volunteer to add an incompatible flag enabling the strict PATH that @meteorcloudy proposed. |
If anyone is, it's @buchgr or @ishikhman . |
there were some discussions around this. @buchgr will be able to give a better update when he is back in a week. |
'--experimental_strict_action_env' was a Bazel 0.20.0 option which got renamed to '--incompatible_strict_action_env' and was planned to be the default as of 0.21.0 [1]. However, this planned flip still hasn't happened for at least the baseline of 1.0.0 (as of rc3), so we can't remove it as of now [2]. In general, we should try to avoid having --incompatible_* or --experimental_* flags in the bazelrc, as per explanation in Issue 11122 [3] as well as on the 'Backward Compatibility' page of Bazel [4]: > Users should never run their production builds with --experimental_* > or --incompatible_* flags. However, for this case we have a compelling reason to have '--incompatible_strict_action_env'. [1]: bazelbuild/bazel#6648 [2]: bazelbuild/bazel#7026 [3]: https://bugs.chromium.org/p/gerrit/issues/detail?id=11122 [4]: https://docs.bazel.build/versions/0.29.1/backward-compatibility.html Change-Id: Ie78708ffaeb1bfe9ebceb924939833f7c30eaeaf
Any updates here? Can this be flipped again? |
Unfortunately I’m not aware of any further work that has happened in this area. I think the situation is still unchanged from a year ago. |
is there an RFC for how this might be addressed? |
Users continue to trip over this, for example |
I created this PR to trigger our CI and see if Bazel still fails to build without it. See bazelbuild#7026 for context.
I created this PR to trigger our CI and see if Bazel still fails to build with this flag. See bazelbuild#7026 for context.
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
@bazelbuild/triage, this issue is definitely still relevant, IMO, per Alex's comment above. Seems like this default should really get flipped. (@bazelbuild/triage didn't seem to create a tag last I tried (no link) so I'm going to also tag @sgowroji and @Pavank1992 manually. Please coach me if you'd have preferred otherwise--and maybe update the bot's instructions) |
Description of the problem / feature request:
Bazel 0.21.0 flipped --incompatible_strict_action_env to true via #6648, which broke CI on macOS and Windows CI. On macOS we can no longer find "md5" (which is in /sbin) and on Windows we can no longer find Python, PowerShell and other tools.
We didn't discover these breakages during testing, because apparently we don't actually test Bazel itself in the "Bazel@HEAD + Downstream Projects".
We'll revert this via a flag in the CI config files, but flag owners should work on fixing our tests (and taking user feedback into account whether this new behavior is actually working well for others) so that we can eventually remove the config entry again.
Relevant logs:
The text was updated successfully, but these errors were encountered: