From 94548b01e21bc596e8293b94470b1cc2fda72f27 Mon Sep 17 00:00:00 2001 From: Tiago Quelhas Date: Mon, 10 Nov 2025 20:13:23 +0000 Subject: [PATCH] [9.0.0] Compare paths as fragments in `AbstractActionInputPrefetcher`. (#27627) This is required because `execRoot` might be located on an action file system overlaying the host file system where downloads are written (see the changes in https://github.com/bazelbuild/bazel/commit/b8589c3b278e3f5cee6ef85b0dcabb1cdcd69839 for context). PiperOrigin-RevId: 830480221 Change-Id: I217b81a81da80f2050c4ec9082ef5f18cb9a0bc9 --- .../lib/remote/AbstractActionInputPrefetcher.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java b/src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java index 1b67f191fd2ec7..79aad673f5b404 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java +++ b/src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java @@ -134,15 +134,9 @@ void setPermanentlyWritable(Path dir) throws IOException { } private void setWritable(Path dir, DirectoryState newState) throws IOException { - // External repo paths (which live directly under the output base) are not build outputs and - // don't need output permission management. Check this first (comparing fragments, since the - // dir may be on the host file system while the output base is on an overlay) so that the exec - // root, which is only resolvable during the loading phase and later, is not resolved during - // external repo materialization. - if (dir.asFragment() - .startsWith( - outputBase.getRelative(LabelConstants.EXTERNAL_REPOSITORY_LOCATION).asFragment()) - || !dir.startsWith(execRoot())) { + // Compare as fragments since execRoot may be located on a file system overlaying the host + // file system where downloads are written to. + if (!dir.asFragment().startsWith(execRoot.asFragment())) { return; } AtomicReference caughtException = new AtomicReference<>();