Bug 5426

Summary: Detect and fail if inherit is used in conf file
Product: [Build System, Metadata & Runtime] BitBake Reporter: Paul Eggleton <bluelightning>
Component: bitbakeAssignee: Gregor Zatko <gzatko>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Low CC: bogdanx.a.voiculescu, gzatko, poky.bs.watcher, poky.watcher, randy.macleod, richard.purdie
Version: 1.5   
Target Milestone: Future   
Hardware: All   
OS: Multiple   
Whiteboard: NEWCOMER
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Paul Eggleton 2013-10-30 16:58:03 UTC
If for example in local.conf you do this:

  inherit += "buildhistory"

instead of this:

  INHERIT += "buildhistory"

No error will be produced - "inherit" will be treated as a variable since it is not supported in a conf file. BitBake should be erroring out immediately if it sees inherit in a conf file.
Comment 1 Paul Eggleton 2016-01-22 11:04:15 UTC
*** Bug 8983 has been marked as a duplicate of this bug. ***
Comment 2 Bogdan Alexandru Voiculescu 2016-01-22 12:50:23 UTC
Well, at least a Note in documentation will help to warn people to be careful when using variable Upper or Lower; since it is case sensitive.
Comment 3 Randy MacLeod 2020-02-11 23:20:08 UTC
Gregor, Thanks for taking this enhancement. Hopefully you can make it an error rather than just warning in the documentation.
Comment 4 Gregor Zatko 2020-02-14 19:40:51 UTC
I think that making this issue an error is just a matter of editing the cooker .py files.

However there is a general question from me:
does Yocto have any tool for checking that a keyword is of a valid form?

In other words, if I changed SRC_URI to src_uri in a recipe everything still works. A short cooker BB parser investigation confirm there is no such tool.

If upper written doesn't correspond with an actual state please correct my thoughts.
If it's true I'd suggest adding the tool because then every keyword complies with substance of this bug :-)
Comment 5 Richard Purdie 2020-02-17 12:47:11 UTC
(In reply to comment #4)
> I think that making this issue an error is just a matter of editing the
> cooker .py files.
> 
> However there is a general question from me:
> does Yocto have any tool for checking that a keyword is of a valid form?

Unfortunately this isn't really possible as our language is extensible and we don't have a list of defined variables.

> In other words, if I changed SRC_URI to src_uri in a recipe everything still
> works. A short cooker BB parser investigation confirm there is no such tool.

Correct, I'm not sure its possible to have a generic one either.

> If upper written doesn't correspond with an actual state please correct my
> thoughts.
> If it's true I'd suggest adding the tool because then every keyword complies
> with substance of this bug :-)

The inherit/INHERIT mixup is particularly bad as "include" is valid syntax so "inherit" can easily be mixed up.

Adding a test to sanity.bbclass which checks if "inherit" is set as a variable should be an easy way to test/check for the issue without needing to hardcode specifics in bitbake.
Comment 6 Gregor Zatko 2020-05-23 12:52:25 UTC
Check added, hope it's a good form.
Comment 7 Richard Purdie 2020-05-26 15:03:33 UTC
Yes, looks good, thanks for the patch! I did tweak the shortlog format and bug reference slightly when merging but its much appreciated!