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

experimental_action_listener config variable is set to "null" instead of "[]" in exec configuration #16911

Closed
eric-skydio opened this issue Dec 2, 2022 · 0 comments
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug untriaged

Comments

@eric-skydio
Copy link

eric-skydio commented Dec 2, 2022

Description of the bug:

In the configuration associated with CoreOptions there is a configuration value experimental_action_listener: [] associated with the (deprecated) command-line flag --experimental_action_listener. We do not use this functionality, and have no desire to do so.

Unfortunately, after any transition to exec configuration, this value appears to change from [] to null, and there is no way to transition it back from Starlark code.

The reason this is a problem is related to our desire to perform "unifying transitions" as discussed in #14023 and #14236. All of the other config set by "exec" can be controlled manually from a Starlark transition, but because this particular flag is "experimental" we can't reset it to [], so we end up with two different configuration hashes for the same configuration, and Bazel ends up building those targets and everything they depend on twice without reason.

This should be a small one-line fix, and is a blocker for many of the benefits of --experimental_output_directory_naming_scheme=diff_against_baseline, and possibly for moving to Bazel 6.x entirely, so it would be nice to get this fix backported as well.

I believe the simplest fix is a one-line change here to construct an empty list, although more complicated solutions are possible: https://github.com/bazelbuild/bazel/blob/release-6.0.0rc4/src/main/java/com/google/devtools/build/lib/analysis/config/ExecutionTransitionFactory.java#L131-L132

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

genrule(
    name = "rule1",
    srcs = [],
    outs = ["file1.bin"],
    cmd = "echo 'echo hi' > $@",
    executable = True,
)

genrule(
    name = "rule2",
    srcs = [],
    outs = ["file2.txt"],
    cmd = 'echo "file2" > $@',
    exec_tools = [":rule1"],
)

bazel cquery "filter(rule1, deps(:all))"
This returns two different config hashes, use diff on bazel config to show the issue

<   experimental_action_listener: []
---
>   experimental_action_listener: null

Note that we're not concerned with any of the other changes in this list since they are all controllable by Starlark

Which operating system are you running Bazel on?

Ubuntu 18.04

What is the output of bazel info release?

release 6.0.0rc4

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 master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

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

Tagging @gregestren @sdtwigg and the Configurability team

@sgowroji sgowroji added team-Configurability platforms, toolchains, cquery, select(), config transitions untriaged type: bug labels Dec 3, 2022
ShreeM01 added a commit that referenced this issue Jan 24, 2023
…7284)

Previously, the flag value was set to `null` rather than an empty list, which resulted in distinct yet equivalent configurations.

Fixes #16911

Closes #16912.

PiperOrigin-RevId: 493175302
Change-Id: I7a34c988265f3a3d94f1720a7fc7ad501eb44247

Co-authored-by: Fabian Meumertzheim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug untriaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants