diff options
author | twerth <twerth@google.com> | 2018-05-15 05:02:31 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-15 05:03:50 -0700 |
commit | c4f2d80270f1ce947fcf7fb0a4e5f0afb3a7062d (patch) | |
tree | 5928bf2f9d72ffc3eec0a5e08456e2574a4c2e31 /src/test/java/com/google/devtools/build/lib/skyframe | |
parent | bd16ab9454e624a26c53a0f3fb892e20fb1c36e6 (diff) |
Allow more characters in labels.
Partly addresses #374.
Specifically allow !%^`"'&;<>?[]{|} in target and package names. It's actually
simpler now to declare what we don't allow. In target names:
0-31 (control characters)
58 ':' (colon)
92 '\' (backslash)
127 (delete)
In package names:
0-31 (control characters)
58 ':' (colon)
64 '@' (at-sign)
92 '\' (backslash)
127 (delete)
- '\' is a path segment separator on Windows, and allowing it can lead to
silent output file conflicts and - therefore - data corruption. We may be
able to allow it in the future, but I didn't want to make that call.
- ':' is a special character that Bazel interprets as the package name / target
name separator.
- '@' in package names can probably be allowed; at the beginning of a label it
indicates a workspace name, but not within a segment. We actually have some
tests that disallow it specifically, but those can probably just be deleted;
however, it does require a bit of investigation, so I decided to delay that
change.
It is possible that we don't correctly escape filenames in all cases. Also note
that the shell may require escaping for specific characters, and that Bazel
treats a single '*' (star) target name specially when given on the command
line.
RELNOTES: Bazel now allows almost all 7-bit ASCII characters in labels.
PiperOrigin-RevId: 196650651
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java index 195d987fca..4d6339922f 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java @@ -243,8 +243,8 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase { @Test public void testInvalidPackageName() throws Exception { - scratch.file("parentpackage/invalidpackagename%42/BUILD"); - PackageLookupValue packageLookupValue = lookupPackage("parentpackage/invalidpackagename%42"); + scratch.file("parentpackage/invalidpackagename:42/BUILD"); + PackageLookupValue packageLookupValue = lookupPackage("parentpackage/invalidpackagename:42"); assertThat(packageLookupValue.packageExists()).isFalse(); assertThat(packageLookupValue.getErrorReason()).isEqualTo(ErrorReason.INVALID_PACKAGE_NAME); assertThat(packageLookupValue.getErrorMsg()).isNotNull(); |