bitbake/ConfHandler: Be more strict about variable quoting
PATCH 1/1 bitbake/ConfHandler: Be more strict about variable quoting
[cross posted to OE-Core since this is a major change in behaviour but in my opinion, probably a good one]
Currently, bitbake will accept variables in the forms:
X = 1
X = '1 \
X = "1"
X = '1'
which will all set X=1. This patch removes the first two possibilities and makes quoting mandatory. There is little metadata out there which doesn't quote properly and bitbake will exit with an error about the exact line number and file with any problem so users can easily identify and fix issues. OE-Core has already been checked/fixed.
The motivation for this is being able to give sane errors if a user does something like:
IMAGE_INSTALL += # tslib mtd-utils"
which currently gives a really nasty failure.
---
bitbake/lib/bb/parse/parse_py/ConfHandler.py +1 -2
@@ -29,8 +29,7 @@ import logging import bb.utils from bb.parse import ParseError, resolve_file, ast, logger -#__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") -__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<lazyques>\?\?=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") +__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<lazyques>\?\?=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"])(?P<value>.*)(?P=apo)$") __include_regexp__ = re.compile( r"include\s+(.+)" ) __require_regexp__ = re.compile( r"require\s+(.+)" ) __export_regexp__ = re.compile( r"export\s+(.+)" )
Quoted 2 lines · Richard Purdie
[cross posted to OE-Core since this is a major change in behaviour but in my opinion, probably a good one]
Agreed, missing quotes are hard to notice and easy to fix in existing recipes with resonable error message provided by this.
Quoted 5 lines
Currently, bitbake will accept variables in the forms:
X = 1
X = '1 \
Quoted 8 lines
X = "1"
X = '1'which will all set X=1. This patch removes the first two possibilities and makes quoting mandatory. There is little metadata out there which doesn't quote properly and bitbake will exit with an error about the exact line number and file with any problem so users can easily identify and fix issues. OE-Core has already been checked/fixed.
Not completly true about OE-Core, but I'll send another patch fixing the rest and also meta-oe and meta-smartphone layers..
Cheers,
Quoted 30 lines
The motivation for this is being able to give sane errors if a user does something like:
IMAGE_INSTALL+= # tslib mtd-utils"which currently gives a really nasty failure.
Signed-off-by Richard Purdie <[email protected]>---
bitbake/lib/bb/parse/parse_py/ConfHandler.py +1
-2@@ -29,8 +29,7 @@ import logging import bb.utils from bb.parse import ParseError, resolve_file, ast, logger -#__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") -__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<lazyques>\?\?=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") +__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<lazyques>\?\?=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"])(?P<value>.*)(?P=apo)$") __include_regexp__ = re.compile( r"include\s+(.+)" ) __require_regexp__ = re.compile( r"require\s+(.+)" ) __export_regexp__ = re.compile( r"export\s+(.+)" )_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Quoted 15 lines · Martin Jansa
Quoted 2 lines · Richard Purdie
[cross posted to OE-Core since this is a major change in behaviour but in my opinion, probably a good one]
Agreed, missing quotes are hard to notice and easy to fix in existing recipes with resonable error message provided by this.
Quoted 8 lines
Currently, bitbake will accept variables in the forms:
X = 1
X = '1 \X = "1"
X = '1'
Quoted 8 lines
Quoted 5 lines
which will all set X=1. This patch removes the first two possibilities and makes quoting mandatory. There is little metadata out there which doesn't quote properly and bitbake will exit with an error about the exact line number and file with any problem so users can easily identify and fix issues. OE-Core has already been checked/fixed.
Not completly true about OE-Core, but I'll send another patch fixing the rest and also meta-oe and meta-smartphone layers..
Right, it looks like I didn't trigger a full reparse. Thanks for the patches, I've applied the OE-Core one.
Cheers,
Richard