Skip to content

Specifying data with ':' breaks Windows support #23729

@xansec

Description

@xansec

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 ?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)area-WindowsWindows-specific issues and feature requeststeam-Rules-CPPIssues for C++ rulestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions