Incorrect path in new_local_repository causes Bazel crash with unclear error
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
Specifying the wrong `path` with double slash at start or in middle of path in a `new_local_repository` rule causes Bazel crash. The error message is:
`FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node '[]/[/]' (requested by nodes 'FILE:[]/[/]')
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$AdaptedRunnableAction.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.lang.IllegalStateException: java.io.IOException: Cannot get last change time of '\': ERROR: src/main/native/windows/file-jni.cc(81): nativeGetChangeTime(\\?\\): ERROR: src/main/native/windows/file.cc(127): GetChangeTime(\\?\\): expected an absolute Windows path
at com.google.devtools.build.lib.vfs.JavaIoFileSystem.statIfFound(JavaIoFileSystem.java:513)
at com.google.devtools.build.lib.vfs.Path.statIfFound(Path.java:322)
at com.google.devtools.build.lib.skyframe.DefaultSyscallCache.statImpl(DefaultSyscallCache.java:257)
at com.google.devtools.build.lib.skyframe.DefaultSyscallCache$Builder.lambda$build$0(DefaultSyscallCache.java:108)
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:128)
at com.google.devtools.build.lib.skyframe.DefaultSyscallCache.getType(DefaultSyscallCache.java:164)
at com.google.devtools.build.lib.vfs.SingleFileSystemSyscallCache.getType(SingleFileSystemSyscallCache.java:64)
at com.google.devtools.build.lib.actions.FileStateValue.create(FileStateValue.java:77)
at com.google.devtools.build.lib.skyframe.FileStateFunction.compute(FileStateFunction.java:69)
at com.google.devtools.build.lib.skyframe.FileStateFunction.compute(FileStateFunction.java:35)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:461)
... 7 more
Caused by: java.io.IOException: Cannot get last change time of '\': ERROR: src/main/native/windows/file-jni.cc(81): nativeGetChangeTime(\\?\\): ERROR: src/main/native/windows/file.cc(127): GetChangeTime(\\?\\): expected an absolute Windows path
at com.google.devtools.build.lib.windows.WindowsFileOperations.getLastChangeTime(WindowsFileOperations.java:171)
at com.google.devtools.build.lib.windows.WindowsFileSystem.stat(WindowsFileSystem.java:160)
at com.google.devtools.build.lib.vfs.JavaIoFileSystem.statIfFound(JavaIoFileSystem.java:503)
... 23 more`
### 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.
Create WORKSPACE.bazel file:
`new_local_repository(`
` name = "examples",`
` path = "//examples",`
` build_file = "//internal:BUILD.bazel",`
`)`
Please note the double slash in path.
Create an empty internal/BUILD.bazel file.
Run `bazel build @examples//:target`.
### Which operating system are you running Bazel on?
Windows
### What is the output of `bazel info release`?
release 7.0.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` ?
_No response_
### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I think, no. Version 6.5.0 shows the same behavior.
### 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
Assessment
This issue has not been assessed yet.