Bug 5507

Summary: Inconsistent bitbake variable handling
Product: [Build System, Metadata & Runtime] BitBake Reporter: Mark Hatle <mark.hatle>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: kergoth, poky.bs.watcher, poky.watcher, sgw, srifenbark
Version: 1.5   
Target Milestone: 1.6   
Hardware: x86   
OS: Multiple   
Whiteboard: 20 March 2014: Doc flag reset
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description Mark Hatle 2013-11-07 19:50:26 UTC
I had a user who was trying to clear a value and noticed something (each of these examples when set in local.conf exhibited the explained behavior.)


VAL = ""

The variable VAL is 'defined', but is set to None.


VAL = " "
The variable VAL is 'defined', and is set to the string "".


VAL = " something"
The variable VAL is 'defined', and is set to the string "something".


Chris Larsen pointed me at:

https://github.com/openembedded/bitbake/blob/master/lib/bb/data.py#L217-L218
and
https://github.com/openembedded/bitbake/blob/master/lib/bb/data.py#L232

Which explains why "" and " " differ in behavior, and why leading white space is being stripped.

Should "" and " " return the same (None) value, or is this correct behavior.  If it is, this should likely be documented in the bitbake manual somewhere.
Comment 2 Scott Rifenbark 2014-03-20 11:04:05 UTC
Hi, 

I updated the http://www.yoctoproject.org/docs/1.6/user-manual/user-manual.html#basic-variable-setting section to include information about retention of leading and trailing blanks, setting a variable to an empty string, and setting a variable to whitespace.

Richard reviewed the changes and approved. 

Setting the Doc flag to "Done".

Scott