Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source filenames containing colons #17509

Closed
nickbreen opened this issue Feb 16, 2023 · 2 comments
Closed

source filenames containing colons #17509

nickbreen opened this issue Feb 16, 2023 · 2 comments
Labels
team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob type: bug untriaged

Comments

@nickbreen
Copy link

Description of the bug:

Bazel cannot process source files with filenames that contain colons.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

touch "foo:bar.baz"
touch WORKSPACE
tee BUILD <<EOF
genrule(
	name = "colons",
	srcs = glob(["*.bar"]) # or literally, which cannot be differentiated from a label ["foo:bar.baz"],
	outs = ["colons.txt"],
	cmd = """find > $@""",
)
EOF

bazel build //:colons

Error:

BUILD:1:8: //:colons: invalid label 'foo:bar.baz' in element 0 of attribute 'srcs' in 'genrule' rule: invalid label 'foo:bar.baz': absolute label must begin with '@' or '//'
ERROR: package contains errors: 
ERROR: package contains errors: : //:colons: invalid label 'foo:bar.baz' in element 0 of attribute 'srcs' in 'genrule' rule: invalid label 'foo:bar.baz': absolute label must begin with '@' or '//'
ERROR: Skipping '//...': Error evaluating '//...': error loading package '': Package '' contains errors

Which operating system are you running Bazel on?

Fedora 36

What is the output of bazel info release?

release 6.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

N/A

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

Possibly a duplicate of this issue #374

Any other information, logs, or outputs that you want to share?

No response

@nickbreen
Copy link
Author

There is apparently a work-around by Using labels to reference directories.

E.g.

genrule(
    name = "foo",
    srcs = ["some/directory/."],   # note the slash-dot suffix.
)

@brandjon
Copy link
Member

This is a limitation of label syntax (see LabelValidator.java). Extending Labels to support more characters or nearly arbitrary bytes is a long-standing issue; see #374.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob type: bug untriaged
Projects
None yet
Development

No branches or pull requests

3 participants
@nickbreen @brandjon and others