-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Unexpected evaluation order of user defined flags #13603
Comments
I don't think of this as "incorrect", so much as "what it does is not what most people would expect. So we really have one or more issues.
|
It looks inconsistent to me in the current form. Looking at issue #10781,
This is beyond my bazel knowledge, but aren't |
From looking at the code and thinking about it
https://github.com/aiuto/bazel_samples/tree/main/flag_evaluation_order It seems that built-in flags, like cpu do win from the command line, while user defined flags do not. TL;DR; You can not override user defined flags that are set in configs from the command line. |
Thanks a lot Tony for investigating.
Couldn't |
I don't think that would make sense. If we did that
- there would be no need for the flag
- you might as well just write bazel build --config=$(uname) ...
- it would not give you the conceptual layering of
1. build the baseline set of flags from the rc files and --config
1. automatically splice in my platform specific things.
In any case, --enable_platform_specific_config is something that belongs in
.bazelrc and not on the command line. Letting you choose it or not on a per
invocation basis is a foot-gun. It's a policy thing that should be chosen
project wide or not.
…On Thu, Jul 8, 2021 at 6:40 AM Christian Sigg ***@***.***> wrote:
Thanks a lot Tony for investigating.
if there is a platform specific config, it should override the less
specific config
Couldn't --enable_platform_specific_config expand in place to e.g.
--config=linux, which would in turn expand in place again to the *:linux
entries in .bazelrc? This would seem the most obvious choice (but I'm by
far no bazel expert).
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#13603 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXHHHHNCALQVM6D5YKUAALTWV6DFANCNFSM47HHMYEQ>
.
|
My comment seems to have implied that I would have
Isn't that unnecessarily imposing a specific pattern on the user? For example, I would expect
|
Yea. I think it should be --nofoo when run on linux.
|
Remove `--enable_platform_specific_config` because bazelbuild/bazel#13603 hasn't moved for more than 6 months. PiperOrigin-RevId: 429074750
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team ( |
Description of the problem / feature request:
User flags on the command line, expanded from command line configs, and from platform-specific configs are not applied in the correct order.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
build_defs.bzl:
BUILD:
.bazelrc:
Repro 1
--enable_platform_specific_config
gets expanded last:The correct output would be
cmdline
.Repro 2
--config=config
gets expanded last:The correct output would be
cmdline
.Repro 3
This works as expected:
What operating system are you running Bazel on?
Ubuntu
What's the output of
bazel info release
?release 4.1.0
Have you found anything relevant by searching the web?
Somewhat related: issue #10781
The text was updated successfully, but these errors were encountered: