aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages
diff options
context:
space:
mode:
authorGravatar twerth <twerth@google.com>2018-05-30 11:48:57 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-30 11:50:39 -0700
commitc4ba94ce5ddb1bff8217d3262a7d951869c25ce3 (patch)
tree8b2ce200a837400f633ba91da70eb1fe0e8b6045 /src/main/java/com/google/devtools/build/lib/packages
parent5ad445b09283ee80dab22a4ba342cb4a72fedb0e (diff)
Special case * in target lookup, work around for #5300.
* is not an allowed file system character on Windows and checking if it's a directory or file for the wilcard check would throw an InvalidPathException. RELNOTES: None PiperOrigin-RevId: 198595138
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Package.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index af885be009..7e15bd2b42 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -498,11 +498,13 @@ public class Package {
// stat(2) is executed.
Path filename = getPackageDirectory().getRelative(targetName);
String suffix;
- if (!PathFragment.isNormalized(targetName)) {
- // Don't check for file existence in this case because the error message
- // would be confusing and wrong. If the targetName is "foo/bar/.", and
- // there is a directory "foo/bar", it doesn't mean that "//pkg:foo/bar/."
- // is a valid label.
+ if (!PathFragment.isNormalized(targetName) || "*".equals(targetName)) {
+ // Don't check for file existence if the target name is not normalized
+ // because the error message would be confusing and wrong. If the
+ // targetName is "foo/bar/.", and there is a directory "foo/bar", it
+ // doesn't mean that "//pkg:foo/bar/." is a valid label.
+ // Also don't check if the target name is a single * character since
+ // it's invalid on Windows.
suffix = "";
} else if (filename.isDirectory()) {
suffix = "; however, a source directory of this name exists. (Perhaps add "