aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2017-02-22 19:51:28 +0000
committerGravatar Yue Gan <yueg@google.com>2017-02-23 11:29:36 +0000
commit6b4a8b34fed686fe178a02f4cf27807c2f11bab5 (patch)
tree3b2d7f8fb257156605f6564fe6f8dd6afb38b62a /src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
parent569383c41ac15ef9c185a8e9986e42855c78bbed (diff)
Allow absolute symlinks in TreeArtifacts. Let the downstream action (if there is one) worry about it.
-- PiperOrigin-RevId: 148249223 MOS_MIGRATED_REVID=148249223
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
index 0f86ad1934..5a132c362a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
@@ -191,14 +191,12 @@ class TreeArtifactValue implements SkyValue {
pathToExplode.getChild(subpath.getBaseName()), valuesBuilder);
} else if (subpath.isSymbolicLink()) {
PathFragment linkTarget = subpath.readSymbolicLinkUnchecked();
+ valuesBuilder.add(canonicalSubpathFragment);
if (linkTarget.isAbsolute()) {
- String errorMessage = String.format(
- "A TreeArtifact may not contain absolute symlinks, found %s pointing to %s.",
- subpath,
- linkTarget);
- throw new IOException(errorMessage);
+ // We tolerate absolute symlinks here. They will probably be dangling if any downstream
+ // consumer tries to read them, but let that be downstream's problem.
+ continue;
}
-
// We visit each path segment of the link target to catch any path traversal outside of the
// TreeArtifact root directory. For example, for TreeArtifact a/b/c, it is possible to have
// a symlink, a/b/c/sym_link that points to ../outside_dir/../c/link_target. Although this
@@ -216,7 +214,6 @@ class TreeArtifactValue implements SkyValue {
throw new IOException(errorMessage);
}
}
- valuesBuilder.add(canonicalSubpathFragment);
} else if (subpath.isFile()) {
valuesBuilder.add(canonicalSubpathFragment);
} else {