Bazel: Glob patterns does not accept parentheses

Created on 24 Feb 2017  路  9Comments  路  Source: bazelbuild/bazel

[dmarting@trantor] /tmp/test$ cat BUILD 
filegroup(name = "test", srcs = glob(["**"], exclude = ["**/*(*"]))
[dmarting@trantor] /tmp/test$ cat WORKSPACE 
[dmarting@trantor] /tmp/test$ bazel build :test
ERROR: /tmp/test/BUILD:1:33: Traceback (most recent call last):
    File "/tmp/test/BUILD", line 1
        filegroup(name = "test", srcs = glob(["**"],..."]))
    File "/tmp/test/BUILD", line 1, in filegroup
        glob(["**"], exclude = ["**/*(*"])
illegal character '('
ERROR: no such target '//:test': target 'test' not declared in package '' defined by /tmp/test/BUILD
INFO: Elapsed time: 0.176s
FAILED: Build did NOT complete successfully
[dmarting@trantor] /tmp/test$ ls -R
.:
BUILD  WORKSPACE
good first issue team-Starlark

All 9 comments

@damienmg @laurentlb Should the exception be added in this file ?

I don't think so, if you look for "illegal character", you find that test which tends to means it was intentional to have '(' as an illegal character.

Looking at the other result, the problem is in UnixGlob. Looking at the blame on the file and going through the history before it got open sourced it is not clear why those characters are disallowed.

So this behavior dates back from the beginning of Blaze, there is no explanation whatsoever why those characters are not allowed in globs. I guess they wanted to reserve them to expand the glob pattern syntax. I would try to remove that restriction and run the test suite and see what it says :).

@damienmg I tried the changes (remove illegal character declaration and its assertion in the test).

It resulted in failing three tests: lib:foundations_test, lib:packages_test and skyframe:SkyframeTests. But I could not make much of the results. Here is the log. Thanks for all the help.

@harmank the log is just telling me which test has failed. It output the test log file that you can look at to the see the actual test failure.

@damienmg i would like to take up this issue. Can i start working on it?

@damienmg Is this issue still open? I see that parentheses ("()") are now valid in glob patterns, but I wonder if there is a desire to allow ("{}") and ("[]") as well. If so, I'd be happy to have a go at this!

Indeed that issue itself is resolved but other character might be missing, I will close this one and feel free to create separate issue for other characters.

Thank you @damienmg. I've raised a new issue at #3048. :)

Was this page helpful?
0 / 5 - 0 ratings