-
Notifications
You must be signed in to change notification settings - Fork 4.4k
--incompatible_strict_action_env breaks autodetecting Python toolchain on Mac #8536
Description
Enabling --incompatible_strict_action_env without providing an explicit --action_env causes PATH to default to /bin:/usr/bin.
bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
Lines 169 to 171 in e495e6b
| if (strictActionEnv) { | |
| env.put("PATH", pathOrDefault(os, null, shellExecutable)); | |
| } else if (os == OS.WINDOWS) { |
bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
Lines 449 to 454 in e495e6b
| // TODO(ulfjack): The default PATH should be set from the exec platform, which may be different | |
| // from the local machine. For now, this can be overridden with --action_env=PATH=<value>, so | |
| // at least there's a workaround. | |
| if (os != OS.WINDOWS) { | |
| return "/bin:/usr/bin"; | |
| } |
On our Mac CI workers, python3 is installed via Homebrew in /usr/local/bin. I expect other Mac users would have similar configurations.
This causes downstream failures in my presubmit to flip --incompatible_use_python_toolchains for Bazel 0.27. The flag is being flipped anyway. I expect those projects will have to either modify their --action_env or somehow modify their buildkite CI to add a custom Python toolchain.