Skip to content

--incompatible_strict_action_env breaks autodetecting Python toolchain on Mac #8536

@brandjon

Description

@brandjon

Enabling --incompatible_strict_action_env without providing an explicit --action_env causes PATH to default to /bin:/usr/bin.

if (strictActionEnv) {
env.put("PATH", pathOrDefault(os, null, shellExecutable));
} else if (os == OS.WINDOWS) {

// 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.

+cc @philwo for CI, @buchgr for strict action env.

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)team-Rules-PythonNative rules for Pythontype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions