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

[6.3.0] Make variable substitution in C++ rule environment variables broken #19070

Closed
eric-skydio opened this issue Jul 25, 2023 · 5 comments
Closed
Assignees
Labels
team-Rules-CPP Issues for C++ rules type: bug

Comments

@eric-skydio
Copy link

Description of the bug:

C++ rules support make variable substitution in the env= attribute, as used in the example below. Unfortunately, starting with Bazel 6.3.0, this seems to be broken, and instead produces this error:

ERROR: /tmp/repro/BUILD.bazel:1:8: in cc_test rule //:test: 
Traceback (most recent call last):
        File "/virtual_builtins_bzl/common/cc/cc_test.bzl", line 70, column 29, in _impl
        File "/virtual_builtins_bzl/common/cc/cc_test.bzl", line 30, column 47, in _cc_test_impl
        File "/virtual_builtins_bzl/common/cc/cc_helper.bzl", line 900, column 34, in _get_expanded_env
        File "/virtual_builtins_bzl/common/cc/cc_helper.bzl", line 783, column 46, in _expand
        File "/virtual_builtins_bzl/common/cc/cc_helper.bzl", line 717, column 27, in _expand_nested_variable
Error in extend: trying to mutate a frozen list value
ERROR: /tmp/repro/BUILD.bazel:1:8: Analysis of target '//:test' failed
ERROR: Analysis of target '//:test' failed; build aborted: 

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

.bazelversion

6.3.0

BUILD.bazel

cc_test(
    name="test",
    srcs=["test.cc"],
    env={"MY_VAR": "$(rootpath //:test.cc)"},
)

test.cc

int main() { return 0; }

Which operating system are you running Bazel on?

Ubuntu 18.04

What is the output of bazel info release?

release 6.3.0

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

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

A bisect points at 2f9e8c1 being the culprit, @brentleyjones

Have you found anything relevant by searching the web?

No response

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

No response

@keertk
Copy link
Member

keertk commented Jul 25, 2023

@bazel-io fork 6.3.1

@keertk
Copy link
Member

keertk commented Jul 25, 2023

@bazel-io fork 6.4.0

@brentleyjones
Copy link
Contributor

@iancha1992
Copy link
Member

As per #19070 (comment), this should be fixed in and after 6.3.1

@keertk
Copy link
Member

keertk commented Jul 26, 2023

@eric-skydio Thank you for reporting this issue.
We're looking to improve our release process so that we can catch more issues early on in the cycle (before the final release) and would love your input. What can we do to make it easier for you to test release candidates in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

No branches or pull requests

6 participants