Bug 5507 - Inconsistent bitbake variable handling
Summary: Inconsistent bitbake variable handling
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.6
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard: 20 March 2014: Doc flag reset
Depends on:
Blocks:
 
Reported: 2013-11-07 19:50 UTC by Mark Hatle
Modified: 2014-03-20 11:04 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Done (doc changes complete)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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