bazelbuild / bazelbuild/bazel

file_test external workspace regex too loose

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

Description

### Description of the bug:

`file_test` assumes that a file whose name has "external" in it is in an external workspace. The executable then fails to find the runfile.

A repro is here: https://github.com/somethingvague/external-file-test-repro

The offending regex is here: https://github.com/bazelbuild/bazel/blob/master/tools/build_rules/test_rules.bzl#L22

It should probably be `external/.*` so that the "/" is always matched.

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

See this repro: https://github.com/somethingvague/external-file-test-repro

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

Linux/Mac

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

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

```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 in tools/build_rules/test_rules.bzl at line 22 and use the external-file-test-repro repository to reproduce the failure. Verify that only paths under external/ are treated as external workspaces, while filenames merely containing "external" still allow the executable to find its runfile.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.