bazelbuild / bazelbuild/bazel

Bazel sends host's PATH to remote executor

Open
#28,065 6 comments 0 reactions 0 assignees View on GitHub
area-Windows help wanted P3 team-Remote-Exec type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Even with the strict action env, the PATH that gets sent to a remote action can be very incorrect. For example, when running on a Windows host and a linux executor, I see `PATH=C:\Program Files\Git\usr\bin;C:\Program Files\Git\bin;C:\Windows;C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0`.

This results in bash scripts being unable to execute shebangs such as `#!/usr/bin/env bash` as there is no `bash` in the (nonsense) PATH

### Which category does this issue belong to?

_No response_

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

_No response_

### Which operating system are you running Bazel on?

_No response_

### What is the output of `bazel info release`?

_No response_

### If `bazel info release` returns `development 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 HEAD` ?

```text

```

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

cc @fmeum

Contributor guide

Open the contributing guide

Research direction

No source file or test is identified. Start by reproducing the Windows-host/Linux-remote-executor case with strict action environment enabled, then trace how PATH is propagated to remote actions. Done means remote actions receive an executor-appropriate PATH and bash shebangs work; add a regression test for the behavior.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.