diff options
author | ulfjack <ulfjack@google.com> | 2018-06-04 05:27:38 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-04 05:29:03 -0700 |
commit | 278a5e345b79a5c0301b3bcd31440eb4e22f9ac1 (patch) | |
tree | ab281c54fe6a08e5e47ca774bd954c9a74124e58 /src/main/java/com/google/devtools/build/lib/exec | |
parent | b93ae42e8e693ccbcc387841a17f58259966fa38 (diff) |
Improve error message slightly
PiperOrigin-RevId: 199118944
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java b/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java index 05dee2b1b8..c48674a913 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java +++ b/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java @@ -93,7 +93,10 @@ public final class FilesetManifest { private int lineNum; private final LinkedHashMap<PathFragment, String> entries = new LinkedHashMap<>(); - private final Map<PathFragment, String> relativeLinks = new HashMap<>(); + // Resolution order of relative links can affect the outcome of the resolution. In particular, + // if there's a symlink to a symlink, then resolution fails if the first symlink is resolved + // first, but works if the second symlink is resolved first. + private final LinkedHashMap<PathFragment, String> relativeLinks = new LinkedHashMap<>(); ManifestLineProcessor( String workspaceName, @@ -178,12 +181,17 @@ public final class FilesetManifest { String value = e.getValue(); PathFragment actualLocation = location.getParentDirectory().getRelative(value); String actual = entries.get(actualLocation); - boolean isActualAcceptable = actual == null || actual.startsWith("/"); - if (!entries.containsKey(actualLocation) || !isActualAcceptable) { + if (actual == null) { throw new IllegalStateException( String.format( - "runfiles target '%s' is not absolute, and could not be resolved in the same " - + "Fileset", + "runfiles target '%s' is a relative symlink, and could not be resolved within the " + + "same Fileset", + value)); + } + if (!actual.startsWith("/")) { + throw new IllegalStateException( + String.format( + "runfiles target '%s' is a relative symlink, and points to another symlink", value)); } entries.put(location, actual); |