bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Inconsistent cquery configuration output

Open moroten opened this issue 4 months ago • 0 comments

Description of the bug:

I get the following inconsistent output from cquery:

$ bazel shutdown
$ bazel cquery :some_tool 2>/dev/null
//tmp:some_tool (23f2fe8)
$ bazel cquery :packager 2>/dev/null
//tmp:packager (23f2fe8)
$ bazel cquery :some_tool 2>/dev/null
//tmp:some_tool (23f2fe8)
//tmp:some_tool (b8845d7)  <- THIS ONE IS NEW

I seems like bazel cquery is looking for my targets in all loaded configurations, not just the command line configuration. The exec config below is only there after the bazel cquery :package command.

$ bazel config 2>/dev/null
Available configurations:
23f2fe887fea893bcf15f486f42279fc7b8af18589122f17444d7418474d3596 k8-fastbuild
ab8cba103302292a2b1ba4f5816adc45d4e4bc4d1f3a0e0ddbfd94da0f3bd83b fastbuild-noconfig
b8845d7af429907895a44f71777a587e8041bc42fe623c8b32dade48a988de15 k8-opt-exec-ST-034a0f31d80e (exec)

Which category does this issue belong to?

Configurability

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

# BUILD.bazel
genrule(
    name = "some_tool",
    srcs = [
        ":foo.txt",  # a filegroup with multiple files in it ==> $(locations)
    ],
    outs = ["foo_copy.txt"],
    cmd = "cat $< > $@",
)

genrule(
    name = "packager",
    srcs = [
        ":foo.txt"
    ],
    outs = ["foo_package.txt"],
    tools = [":some_tool"],
    cmd = "cat $< > $@",
)
bazel shutdown
bazel cquery :some_tool 2>/dev/null
bazel cquery :packager 2>/dev/null
bazel cquery :some_tool 2>/dev/null

Which operating system are you running Bazel on?

Ubuntu 22.04

What is the output of bazel info release?

release 7.4.0rc2

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?

Could not find any earlier reported cquery issue about this when searching for cquery config.

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

No response

moroten avatar Oct 19 '24 20:10 moroten