bazelbuild / bazelbuild/bazel

bazel info doesn't work with host_platform using @foo//:bar labels

Open
#29,740 0 comments 0 reactions 0 assignees View on GitHub
team-ExternalDeps type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the bug:

In Bazel 9.x `--incompatible_use_plus_in_repo_names` flipped, and bazel info inherits `build` options form the .bazel rc.
This means that if we provide our own host plaform from our own extension bazel can nolonger reference it unless we use a fully resolved repo name.

### Which category does this issue belong to?

Core

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

[bazel-info-repro.zip](https://github.com/user-attachments/files/28591189/bazel-info-repro.zip)
This contains a very minimal reproduction.
```
# FAILS — apparent label, bazel info resolves to @@host_platform (legacy format)
bazel info bazel-bin
→ ERROR: Repository '@@host_platform' is not defined

# SUCCEEDS — apparent label works fine for build commands
bazel build //...

# SUCCEEDS — explicit canonical label bypasses the broken mapping
bazel info bazel-bin --host_platform=@@+host_platform_ext+host_platform//:host
```

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

windows

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

release 9.1.0

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

--- Bisect Result

first bad commit is https://github.com/bazelbuild/bazel/commit/632540df12a1fa96b6db3d8f5cb45a9255c0a903

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

Start with the attached bazel-info-repro.zip and compare the failing `bazel info bazel-bin --host_platform=@foo//:bar` behavior with the successful build command and canonical label. Use the bisected commit 632540df12a1fa96b6db3d8f5cb45a9255c0a903 as the entry point; done means bazel info resolves the apparent label from the .bazelrc without requiring the fully resolved repository name.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.