You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the file given in the --target_pattern_file option contains an empty comment line, the command bazel build crashes with this exception below:
$ hexdump -C targets.list
00000000 23 0a |#.|
00000002
$ bazel build --target_pattern_file=targets.list
...
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at com.google.devtools.build.lib.runtime.commands.TargetPatternsHelper.lambda$readFrom$0(TargetPatternsHelper.java:61)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.base/java.util.Collections$2.tryAdvance(Unknown Source)
at java.base/java.util.Collections$2.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
at com.google.devtools.build.lib.runtime.commands.TargetPatternsHelper.readFrom(TargetPatternsHelper.java:64)
at com.google.devtools.build.lib.runtime.commands.BuildCommand.exec(BuildCommand.java:69)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:664)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:244)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:573)
at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:644)
at io.grpc.Context$1.run(Context.java:566)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
On the other hand, no problem with single space after the #.
$ hexdump -C targets.list
00000000 23 20 0a |# .|
00000003
$ bazel build --target_pattern_file=targets.list
...
Your request is correct, but requested an empty set of targets. Nothing will be built.
INFO: Found 0 targets...
INFO: Elapsed time: 1.591s, Critical Path: 0.14s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
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.
No response
Which operating system are you running Bazel on?
linux/amd64
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 ?
No response
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
The text was updated successfully, but these errors were encountered:
Thank you for the very clear bug report. Skimming over the code history, this was probably introduced by #15903. Looks like that code doesn't handle this exact situation.
Description of the bug:
If the file given in the
--target_pattern_file
option contains an empty comment line, the commandbazel build
crashes with this exception below:On the other hand, no problem with single space after the
#
.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.
No response
Which operating system are you running Bazel on?
linux/amd64
What is the output of
bazel info release
?release
7.3.1
If
bazel info release
returnsdevelopment 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
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
The text was updated successfully, but these errors were encountered: