Delete the --remote_allow_symlink_upload flag.
It was introduced in dd3ddb0 and deprecated in fbfb3cb.
This flag controls whether symlinks are permitted to occur in local action outputs when remote caching is enabled; they are now always permitted. A separate flag, --incompatible_remote_symlinks, controls whether the symlinks are uploaded as such, or transparently dereferenced and uploaded as files or directories. To clarify the semantics of the latter flag, UploadManifest now uses "follow / no follow" terminology instead of "no upload / upload".
RELNOTES: The deprecated --remote_allow_symlink_upload flag has been removed. Symlinks in local action outputs are always permitted, even with remote caching. Whether they're uploaded as symlinks or as the files/directories they point to is still determined by the --incompatible_remote_symlinks flag.
PiperOrigin-RevId: 476057682
Change-Id: If78664107cf7d32c162e3d13abadfe52e4a5a9ec
diff --git a/src/main/java/com/google/devtools/build/lib/remote/UploadManifest.java b/src/main/java/com/google/devtools/build/lib/remote/UploadManifest.java
index ace02cd..209c956 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/UploadManifest.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/UploadManifest.java
@@ -75,8 +75,7 @@
private final DigestUtil digestUtil;
private final RemotePathResolver remotePathResolver;
private final ActionResult.Builder result;
- private final boolean allowSymlinks;
- private final boolean uploadSymlinks;
+ private final boolean followSymlinks;
private final Map<Digest, Path> digestToFile = new HashMap<>();
private final Map<Digest, ByteString> digestToBlobs = new HashMap<>();
@Nullable private ActionKey actionKey;
@@ -104,8 +103,7 @@
digestUtil,
remotePathResolver,
result,
- remoteOptions.incompatibleRemoteSymlinks,
- remoteOptions.allowSymlinkUpload);
+ /* followSymlinks= */ !remoteOptions.incompatibleRemoteSymlinks);
manifest.addFiles(outputFiles);
manifest.setStdoutStderr(outErr);
manifest.addAction(actionKey, action, command);
@@ -142,13 +140,11 @@
DigestUtil digestUtil,
RemotePathResolver remotePathResolver,
ActionResult.Builder result,
- boolean uploadSymlinks,
- boolean allowSymlinks) {
+ boolean followSymlinks) {
this.digestUtil = digestUtil;
this.remotePathResolver = remotePathResolver;
this.result = result;
- this.uploadSymlinks = uploadSymlinks;
- this.allowSymlinks = allowSymlinks;
+ this.followSymlinks = followSymlinks;
}
private void setStdoutStderr(FileOutErr outErr) throws IOException {
@@ -185,7 +181,7 @@
} else if (stat.isFile() && !stat.isSpecialFile()) {
Digest digest = digestUtil.compute(file, stat.getSize());
addFile(digest, file);
- } else if (stat.isSymbolicLink() && allowSymlinks) {
+ } else if (stat.isSymbolicLink()) {
PathFragment target = file.readSymbolicLink();
// Need to resolve the symbolic link to know what to add, file or directory.
FileStatus statFollow = file.statIfFound(Symlinks.FOLLOW);
@@ -198,7 +194,7 @@
}
Preconditions.checkState(
statFollow.isFile() || statFollow.isDirectory(), "Unknown stat type for %s", file);
- if (uploadSymlinks && !target.isAbsolute()) {
+ if (!followSymlinks && !target.isAbsolute()) {
if (statFollow.isFile()) {
addFileSymbolicLink(file, target);
} else {
@@ -309,9 +305,9 @@
Directory dir = computeDirectory(child, tree);
b.addDirectoriesBuilder().setName(name).setDigest(digestUtil.compute(dir));
tree.addChildren(dir);
- } else if (dirent.getType() == Dirent.Type.SYMLINK && allowSymlinks) {
+ } else if (dirent.getType() == Dirent.Type.SYMLINK) {
PathFragment target = child.readSymbolicLink();
- if (uploadSymlinks && !target.isAbsolute()) {
+ if (!followSymlinks && !target.isAbsolute()) {
// Whether it is dangling or not, we're passing it on.
b.addSymlinksBuilder().setName(name).setTarget(target.toString());
continue;
@@ -345,14 +341,12 @@
return b.build();
}
- private void illegalOutput(Path what) throws ExecException {
- String kind = what.isSymbolicLink() ? "symbolic link" : "special file";
+ private void illegalOutput(Path path) throws ExecException {
String message =
String.format(
- "Output %s is a %s. Only regular files and directories may be "
- + "uploaded to a remote cache. "
- + "Change the file type or use --remote_allow_symlink_upload.",
- remotePathResolver.localPathToOutputPath(what), kind);
+ "Output %s is a special file. Only regular files, directories or symlinks may be "
+ + "uploaded to a remote cache.",
+ remotePathResolver.localPathToOutputPath(path));
FailureDetail failureDetail =
FailureDetail.newBuilder()