`@` character in label causes parsing issue with `--flaky_test_attempts`
#19 447 ouverte le 7 sept. 2023
Métriques du dépôt
- Stars
- (25 384 stars)
- Métriques de merge PR
- (Merge moyen 22j 20h) (77 PRs mergées en 30 j)
Description
Description of the bug:
According to the documentation, @ is a valid character in target labels - https://bazel.build/concepts/labels#target-names
@ is also the character used to separate target labels from the number of attempts when using --flaky_test_attempts - https://bazel.build/reference/command-line-reference#flag--flaky_test_attempts
Alternate syntax:
regex_filter@flaky_test_attempts. Where flaky_test_attempts is as above and regex_filter stands for a list of include and exclude regular expression patterns (Also see --runs_per_test). Example:--flaky_test_attempts=//foo/.*,-//foo/bar/.*@3deflakes all tests in //foo/ except those under foo/bar three times
If you try to use this @ syntax in --flaky_test_attempts with a label that includes an @ sign, CLI argument parsing fails.
$ bazel test //... --flaky_test_attempts=//foo:v@lid-target@3
ERROR: While parsing option --flaky_test_attempts=//foo:v@lid-target@3: '//foo:v@lid-target@3' has a non-numeric value
This is due to this line of code here - https://github.com/bazelbuild/bazel/blob/7e0df68aa4d11307dff8571ebce11d37c79c170c/src/main/java/com/google/devtools/build/lib/analysis/config/PerLabelOptions.java#L50 - which uses the first @ to split the string.
Which category does this issue belong to?
CLI
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
In any repo
$ bazel test //... --flaky_test_attempts=//foo:v@lid-target@3
Confirm that you get an error.
Which operating system are you running Bazel on?
Linux
What is the output of bazel info release?
release 6.3.2
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
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
Not as far as I know
Have you found anything relevant by searching the web?
Google didn't turn up anything
Any other information, logs, or outputs that you want to share?
No response