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

No warning or error if an invalid target attribute is set to None #11000

Closed
jmillikin-stripe opened this issue Mar 23, 2020 · 5 comments
Closed
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: bug

Comments

@jmillikin-stripe
Copy link
Contributor

jmillikin-stripe commented Mar 23, 2020

Description of the problem / feature request:

Given the following BUILD file:

cc_binary(
    name = "hello",            
    srcs = ["hello.c"],        
    no_such_attribute = None,
)

I would expect some sort of error to be printed. There is an error if the invalid attribute is set to some non-None value (0, False, whatever) but None is just silently ignored.

A warning would also be acceptable (backwards compatibility and all), maybe with a flag to make it a hard error (defaulting to true in the next breaking release).

This behavior happens for both built-in and Starlark-defined rules.

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

release 2.2.0

@laurentlb laurentlb added P1 I'll work on this now. (Assignee required) type: bug and removed untriaged labels Apr 7, 2020
@alandonovan
Copy link
Contributor

Dup of Google-internal issue: b/122552411.

@jin
Copy link
Member

jin commented Jan 19, 2021

Is this still a P1 bug?

@sventiffe sventiffe added P2 We'll consider working on this in future. (Assignee optional) and removed P1 I'll work on this now. (Assignee required) labels Feb 2, 2021
@brandjon
Copy link
Member

This is certainly surprising, and should be an error for non-existent attributes.

Should None be a valid value for attributes that do exist though? For instance, I could imagine it having the same effect as omitting an optional attribute of Label type. Indeed, this might be necessary in order to support feeding the output of native.existing_rule back into a target definition. It'd presumably still be an error for mandatory attributes, and perhaps list-typed attributes that can use [] as the zero value.

@brandjon brandjon added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Build-Language and removed P2 We'll consider working on this in future. (Assignee optional) team-Starlark labels Feb 19, 2021
@brandjon brandjon added untriaged team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts and removed team-Build-Language labels Nov 4, 2022
@comius comius added P2 We'll consider working on this in future. (Assignee optional) and removed P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) untriaged labels Aug 22, 2023
@comius comius assigned c-mita and comius and unassigned c-mita Aug 22, 2023
@comius
Copy link
Contributor

comius commented Aug 22, 2023

Wait what? :)

@comius comius closed this as completed Aug 29, 2023
@comius comius reopened this Aug 29, 2023
comius added a commit to comius/bazel that referenced this issue Sep 4, 2023
Fixes: bazelbuild#11000
RELNOTES[INC]: Fails on unknown attributes (even when set to None)
PiperOrigin-RevId: 562519157
Change-Id: If5e430c73485c8ae9661f4231692384a057f37d5
comius added a commit to comius/bazel that referenced this issue Sep 4, 2023
Fixes: bazelbuild#11000
RELNOTES[INC]: Fails on unknown attributes (even when set to None)
PiperOrigin-RevId: 562519157
Change-Id: If5e430c73485c8ae9661f4231692384a057f37d5
iancha1992 pushed a commit that referenced this issue Sep 5, 2023
Fixes: #11000

RELNOTES[INC]: Fails on unknown attributes (even when set to None)
PiperOrigin-RevId: 562519157
Change-Id: If5e430c73485c8ae9661f4231692384a057f37d5
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 6.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: bug
Projects
None yet
Development

No branches or pull requests

10 participants