From 519eef48ee166cfcc4fb8e92d4728483ecc4fd40 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Tue, 25 Apr 2023 22:02:27 -0700 Subject: [PATCH] Fix crash on multiple output symlinks with BwoB Fixes an issue introduced by ca30372e210a638cfce8334b6dc3396c83424baa. Fixes https://github.com/bazelbuild/rules_go/issues/3545 Closes #18207. PiperOrigin-RevId: 527160752 Change-Id: I8baa3b8f855e22226ba83155e56fd9889a1f2051 --- .../devtools/build/lib/remote/RemoteExecutionService.java | 2 +- src/test/shell/bazel/remote/build_without_the_bytes_test.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java index e00ffb04490ea3..e3ca2be4dd63aa 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java @@ -1308,7 +1308,7 @@ private boolean shouldDownloadOutputsFor( String.format( "Symlinks in action outputs are not yet supported by --remote_download_minimal," + " falling back to downloading all action outputs due to output symlink %s", - Iterables.getOnlyElement(metadata.symlinks()).path()))); + Iterables.get(metadata.symlinks(), 0).path()))); return true; } return false; diff --git a/src/test/shell/bazel/remote/build_without_the_bytes_test.sh b/src/test/shell/bazel/remote/build_without_the_bytes_test.sh index 813c3b1de769b0..b8cb18b9076341 100755 --- a/src/test/shell/bazel/remote/build_without_the_bytes_test.sh +++ b/src/test/shell/bazel/remote/build_without_the_bytes_test.sh @@ -418,8 +418,8 @@ EOF genrule( name = "foo", srcs = ["input.txt"], - outs = ["output.txt", "output_symlink"], - cmd = "cp $< $(location :output.txt) && ln -s output.txt $(location output_symlink)", + outs = ["output.txt", "output_symlink", "output_symlink_2"], + cmd = "cp $< $(location :output.txt) && ln -s output.txt $(location output_symlink) && ln -s output.txt $(location output_symlink_2)", ) EOF