diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionOutputMetadataStore.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionOutputMetadataStore.java index 25d9adac9a9f86..7bf241b201611b 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionOutputMetadataStore.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionOutputMetadataStore.java @@ -544,7 +544,15 @@ private FileArtifactValue constructFileArtifactValue( // target during previous action execution. path = statAndValue.realPath(); injectedDigest = DigestUtils.manuallyComputeDigest(path, value.getSize()); - return FileArtifactValue.createForResolvedSymlink(path.asFragment(), value, injectedDigest); + + PathFragment execRootRelativeRealPath; + if (path.asFragment().startsWith(execRoot)) { + execRootRelativeRealPath = path.asFragment().relativeTo(execRoot); + } else { + execRootRelativeRealPath = path.asFragment(); + } + + return FileArtifactValue.createForResolvedSymlink(execRootRelativeRealPath, value, injectedDigest); } injectedDigest = DigestUtils.manuallyComputeDigest(path, value.getSize());