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

Transitions cannot read Starlark flags as @repository_name//:flag_name in 4.2.0 #13890

Closed
fmeum opened this issue Aug 23, 2021 · 2 comments
Closed

Comments

@fmeum
Copy link
Collaborator

fmeum commented Aug 23, 2021

Bazel 4.2.0 introduced a regression in the handling of Starlark flags: In a transition, the value of such a flag cannot be read if the flag is referred to as @repository_name//:flag_name instead of //:flag_name, which as far as I know is required for that transition to be usable by other workspaces. Reading the flag does not work even if it is set via both --@repository_name//:flag_name and --//:flag-name on the commandline.

I noticed this while working on rules_fuzzing, whose tests no longer pass with Bazel 4.2.0. Usage of rules_fuzzing by other workspaces does not seem to be affected.

I created a reproducer that prints

  • regressedwith
    • Bazel 4.2.0
  • not_regressed with
    • Bazel 4.0.0
    • Bazel 4.1.0
    • Bazel 5.0.0-pre.20210810.4
    • Bazel 4.2.0 with 80c59de reverted

Unfortunately 98d376f cannot be cleanly cherry-picked on top of Bazel 4.2.0 by itself, so reverting 80c59de appears to be the safest way to mitigate this regression.

Originally posted by @fmeum in #13558 (comment)

@fmeum fmeum mentioned this issue Aug 23, 2021
9 tasks
@katre
Copy link
Member

katre commented Aug 23, 2021

Investigating now. Please also file an issue at https://github.com/bazelbuild/continuous-integration/issues/new/choose to have rules_fuzzing added to our downstream CI, to prevent this happening in the future.

@katre
Copy link
Member

katre commented Aug 24, 2021

This will be fixed in 4.2.1.

@katre katre closed this as completed Aug 24, 2021
fmeum added a commit to fmeum/rules_go that referenced this issue Dec 19, 2021
The Label constructor can be used to transform a label string such as
@io_bazel_rules_go//foo:bar into the canonical label referencing this
target from the repository in which it is called.

For example, `str(Label("@io_bazel_rules_go//foo:bar"))` returns
`"@io_bazel_rules_go//foo:bar"` if rules_go is used as an external
repository from another main workspace, but returns `"//foo:bar"` when
rules_go is the main repository (e.g., when running the tests in the
CI).

This requires raising the minimum version of Bazel from 4.2.0 to 4.2.1
due to bazelbuild/bazel#13890.
fmeum added a commit to fmeum/rules_go that referenced this issue Dec 20, 2021
The Label constructor can be used to transform a label string such as
@io_bazel_rules_go//foo:bar into the canonical label referencing this
target from the repository in which it is called.

For example, `str(Label("@io_bazel_rules_go//foo:bar"))` returns
`"@io_bazel_rules_go//foo:bar"` if rules_go is used as an external
repository from another main workspace, but returns `"//foo:bar"` when
rules_go is the main repository (e.g., when running the tests in the
CI).

This requires raising the minimum version of Bazel from 4.2.0 to 4.2.1
due to bazelbuild/bazel#13890.
fmeum added a commit to fmeum/rules_go that referenced this issue Dec 20, 2021
The Label constructor can be used to transform a label string such as
@io_bazel_rules_go//foo:bar into the canonical label referencing this
target from the repository in which it is called.

For example, `str(Label("@io_bazel_rules_go//foo:bar"))` returns
`"@io_bazel_rules_go//foo:bar"` if rules_go is used as an external
repository from another main workspace, but returns `"//foo:bar"` when
rules_go is the main repository (e.g., when running the tests in the
CI).

This requires raising the minimum version of Bazel from 4.2.0 to 4.2.1
due to bazelbuild/bazel#13890.
fmeum added a commit to fmeum/rules_go that referenced this issue Dec 20, 2021
The Label constructor can be used to transform a label string such as
@io_bazel_rules_go//foo:bar into the canonical label referencing this
target from the repository in which it is called.

For example, `str(Label("@io_bazel_rules_go//foo:bar"))` returns
`"@io_bazel_rules_go//foo:bar"` if rules_go is used as an external
repository from another main workspace, but returns `"//foo:bar"` when
rules_go is the main repository (e.g., when running the tests in the
CI).

This requires raising the minimum version of Bazel from 4.2.0 to 4.2.1
due to bazelbuild/bazel#13890.
achew22 pushed a commit to bazel-contrib/rules_go that referenced this issue Dec 28, 2021
The Label constructor can be used to transform a label string such as
@io_bazel_rules_go//foo:bar into the canonical label referencing this
target from the repository in which it is called.

For example, `str(Label("@io_bazel_rules_go//foo:bar"))` returns
`"@io_bazel_rules_go//foo:bar"` if rules_go is used as an external
repository from another main workspace, but returns `"//foo:bar"` when
rules_go is the main repository (e.g., when running the tests in the
CI).

This requires raising the minimum version of Bazel from 4.2.0 to 4.2.1
due to bazelbuild/bazel#13890.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants