bazelbuild / bazelbuild/bazel

Specifying data with ':' breaks Windows support

Open
#23,729 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 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Discovered this while doing cross-platform testing. Not entirely sure what the issue is, but it looks like the colon from the data label is being literally copied into the absolute system path?

```
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'test' (requested by nodes 'ConfiguredTargetKey{label=//test:combined_test_calculator, config=BuildConfigurationKey[42298a1ed22be8752c784234875004ef3de86c3cf865d58da715c7ea67c404a6]}')
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:550)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:414)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 52: D:\a\mayhem-bazel-example\mayhem-bazel-example\test\:testsuite
at java.base/sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsPath.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
at java.base/java.io.File.toPath(Unknown Source)
at com.google.devtools.build.lib.windows.WindowsFileSystem.getAttribs(WindowsFileSystem.java:274)
at com.google.devtools.build.lib.windows.WindowsFileSystem.stat(WindowsFileSystem.java:146)
at com.google.devtools.build.lib.vfs.JavaIoFileSystem.statIfFound(JavaIoFileSystem.java:516)
at com.google.devtools.build.lib.vfs.Path.statIfFound(Path.java:322)
at com.google.devtools.build.lib.skyframe.DefaultSyscallCache.statImpl(DefaultSyscallCache.java:[25](https://github.com/ForAllSecure/mayhem-bazel-example/actions/runs/11013957521/job/30583479106#step:5:26)7)
at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$3(LocalLoadingCache.java:197)
at com.github.benmanes.caffeine.cache.UnboundedLocalCache.lambda$computeIfAbsent$2(UnboundedLocalCache.java:296)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
at com.github.benmanes.caffeine.cache.UnboundedLocalCache.computeIfAbsent(UnboundedLocalCache.java:292)
at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:107)
at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:57)
at com.google.devtools.build.lib.skyframe.DefaultSyscallCache.statIfFound(DefaultSyscallCache.java:1[28](https://github.com/ForAllSecure/mayhem-bazel-example/actions/runs/11013957521/job/30583479106#step:5:29))
at com.google.devtools.build.lib.vfs.SingleFileSystemSyscallCache.statIfFound(SingleFileSystemSyscallCache.java:58)
at com.google.devtools.build.lib.vfs.UnixGlob$GlobVisitor.reallyGlob(UnixGlob.java:776)
at com.google.devtools.build.lib.vfs.UnixGlob$GlobVisitor$1.run(UnixGlob.java:578)
at com.google.devtools.build.lib.vfs.UnixGlob$GlobVisitor.lambda$enqueue$0(UnixGlob.java:611)
at com.google.devtools.build.lib.packages.GlobCache.lambda$new$0(GlobCache.java:113)
... 6 more
```

Full build is here:

https://github.com/ForAllSecure/mayhem-bazel-example/actions/runs/11013957521/job/30583479106

Here is the `cc_test` rule that fails to parse:

```
cc_test(
name = "combined_test_calculator",
size = "small",
srcs = ["combined_test_calculator.cc"],
copts = ["-ftest-coverage", "-fprofile-arcs"],
linkopts = ["-lgcov", "--coverage"],
deps = [
"@googletest//:gtest_main",
"//main:calculator_lib",
],
data = [":testsuite", "//test:download_combined_test_calculator_results"],
)
```

It works fine with just `:testsuite` specified, but when adding the "//test:download_combined_test_calculator_results" it fails.

### Which category does this issue belong to?

C++ Rules

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

You can reproduce this by cloning the repo here:

https://github.com/ForAllSecure/mayhem-bazel-example/

And running

```
bazel build //test:combined_test_calculator
```

on Windows.

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

Windows

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

release 7.3.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
https://github.com/ForAllSecure/mayhem-bazel-example
848abe3177d1dc5f014d63c75e8e8ecf6aeb9218
```

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

Reproduce the failure with `bazel build //test:combined_test_calculator` on Windows using the linked example repository. Start with `WindowsFileSystem.java`, `JavaIoFileSystem.java`, and the `UnixGlob` stack-trace path, then verify that the same `cc_test` data labels build successfully without an InvalidPathException.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java
Domain
build-system, operating-systems
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.