bazelbuild / bazelbuild/bazel

Visibility is case sensitive

Open
#27,723 0 comments 0 reactions 0 assignees View on GitHub
team-Core type: bug untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 16h
Merged PRs (30d)
72

Description

### Description of the bug:

Let's declare 2 targets

`//my/super/Pkg:TargetA`
`//my/dependency:target`

Now, `//my/super/Pkg:TargetA` depend on `//my/dependency:target`, but target has declared the visibility:
```
visibility = ["//my/super/Pkg:__pkg__"],
```

If you `bazel build //my/super/Pkg:TargetA`, everything works fine.
But if you `bazel build //my/super/pkg:TargetA`, bazel finds the rule, try to build but is hit with a visibility issue:

```
target '//my/dependency:target' is not visible from target '//my/super/pkg:TargetA'
```

The behavior is correct, the lowercase version is not visible but it's a bit confusing.
Maybe I would have expected bazel to tell me that trying to build `//my/super/pkg:TargetA` is not possible because the target does not exists?

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

Like I explained in the previous block, 1 target depend on the other one, with the visibility but with a uppercase character in one of the directories.

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

MacOS Sequoia 15.7.2

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

release 8.4.2

### 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 by reproducing the two commands, `bazel build //my/super/Pkg:TargetA` and `bazel build //my/super/pkg:TargetA`, using the minimal target and visibility setup described in the issue. Compare target resolution with the resulting visibility diagnostic and determine whether the behavior or its error message should change; done means the intended behavior is documented or covered by a verified fix.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.