bazelbuild / bazelbuild/bazel

Label validator for target name allows space in name

Open
#27,628 0 comments 0 reactions 0 assignees View on GitHub
team-Loading-API type: bug undecided
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Target name according to https://github.com/bazelbuild/bazel/blob/c32926f879b4378c7df8e54c93b00f1a7feef901/site/en/concepts/labels.md?plain=1#L139 can not have spaces.
Yet logic in https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java#L39-L69 allows that

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

Linux, Mac OS

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

release 8.4.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` ?

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java, especially lines 39-69, and compare its target-name validation with the linked labels documentation. Trace the existing label-validation tests or entry point before changing behavior; done means target names containing spaces are rejected consistently with the documented syntax and a regression case covers it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.