bazelbuild / bazelbuild/bazel

Windows AutoRun can kybosh bazel's attempts to run bat files

Open
#23,001 4 comments 0 reactions 0 assignees View on GitHub
area-Windows P2 team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the bug:

I've just spent a few hours with a user debugging an odd issue with C++ builds on their machine. Bazel's attempts to invoke bat files were failing. Turns out this user had enabled AutoRun, which is a windows feature that invokes their custom bat script at the start of every shell invocation, and their bat script was failing.

This issue was previously opened and closed stale: https://github.com/bazelbuild/bazel/issues/8865

More info about AutoRun commands:
- this registry key will be set: HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd

The fix is for Bazel to add the /D parameter to every cmd.exe invocation that it makes

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

Create an autorun command that fails if USERPROFILE is not set
Register it HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
Run a Bazel C++ build

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

windows

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

bazel 7.2.1

### 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` ?

_No response_

### 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?

_No response_

Contributor guide

Open the contributing guide

Research direction

The payload names no source files or tests. Start by locating Bazel's Windows cmd.exe invocation sites and reproduce the failure with a registered AutoRun command; verify that each relevant invocation disables AutoRun with /D and that the C++ build succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.