bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.2k stars 4.06k forks source link

'Config value is not defined' when referenced with 'common' in bazelrc #23213

Open justinhorvitz opened 2 months ago

justinhorvitz commented 2 months ago

Description of the bug:

$ echo "common:abc --config=xyz" >> .bazelrc
$ echo "build:xyz --define=a=1" >> .bazelrc
$ bazel query --config=abc
ERROR: Config value 'xyz' is not defined in any .rc file

Not sure if this case was ever thought through or whether it is worth fixing, but I ran into it today in my own work. @fmeum please comment on whether you think it's worth improving this scenario. I can work around it (by replacing common:abc with build:abc), so it's not too much of a priority, just wanted to make sure it was tracked in an issue.

Which category does this issue belong to?

Core

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

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

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

No response

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

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

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

No response

fmeum commented 2 months ago

Is this really a bug? This results in the same error, which I would consider expected (although maybe something we could/should change):

$ echo "query:abc --config=xyz" >> .bazelrc
$ echo "build:xyz --define=a=1" >> .bazelrc
$ bazel query --config=abc
ERROR: Config value 'xyz' is not defined in any .rc file
justinhorvitz commented 2 months ago

I was surprised by the behavior, though I think it's up to interpretation whether it's a bug. Also, the repro is actually simpler.

$ echo "common --config=xyz" >> .bazelrc
$ echo "build:xyz --define=a=1" >> .bazelrc
$ bazel query
ERROR: Config value 'xyz' is not defined in any .rc file

No pressure to change anything. I mostly just wanted to write up this issue so I could link to it for context.