From 4117c867fe8e560f53bc1c7106af9c2889cc18f2 Mon Sep 17 00:00:00 2001 From: John Cater Date: Mon, 20 Nov 2017 08:09:02 -0800 Subject: Update GlobFunction to check for subdirectories crossing into a local repository. Part of #4056. Change-Id: I4b8e41660b0a135e23aa572bbfeea27a7cda0581 PiperOrigin-RevId: 176362103 --- .../google/devtools/build/lib/skyframe/GlobFunction.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java') diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java index 22bb42807f..16846bc621 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java @@ -74,6 +74,10 @@ public final class GlobFunction implements SkyFunction { // We crossed the package boundary, that is, pkg/subdir contains a BUILD file and thus // defines another package, so glob expansion should not descend into that subdir. return GlobValue.EMPTY; + } else if (globSubdirPkgLookupValue + instanceof PackageLookupValue.IncorrectRepositoryReferencePackageLookupValue) { + // We crossed a repository boundary, so glob expansion should not descend into that subdir. + return GlobValue.EMPTY; } } @@ -351,11 +355,18 @@ public final class GlobFunction implements SkyFunction { valueRequested, fileName, glob); - if (!((PackageLookupValue) valueRequested).packageExists()) { + PackageLookupValue packageLookupValue = (PackageLookupValue) valueRequested; + if (packageLookupValue.packageExists()) { + // This is a separate package, so ignore it. + return null; + } else if (packageLookupValue + instanceof PackageLookupValue.IncorrectRepositoryReferencePackageLookupValue) { + // This is a separate repository, so ignore it. + return null; + } else { return glob.getSubdir().getRelative(fileName); } } - return null; } @Nullable -- cgit v1.2.3