Skip to content

Commit

Permalink
relativize symlink target wrt. execroot
Browse files Browse the repository at this point in the history
  • Loading branch information
lberki committed Dec 21, 2023
1 parent b8bc95c commit a80c48a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit a80c48a

Please sign in to comment.