Bug 8567 - The manual never mentions what environment tasks run in
Summary: The manual never mentions what environment tasks run in
Status: RESOLVED FIXED
Alias: None
Product: BitBake User Manual
Classification: Documentation
Component: bitbake-manual (show other bugs)
Version: 2.0
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.1 M4
Assignee: Scott Rifenbark
QA Contact:
URL:
Whiteboard: 15 Feb 2016: RESOLVED
Depends on:
Blocks:
 
Reported: 2015-10-25 12:54 UTC by ulfalizer
Modified: 2016-02-15 18:18 UTC (History)
4 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 ulfalizer 2015-10-25 12:54:29 UTC
...as far as I can see ("environment" as in "environment variables").

Is this some static cleaned-up environment? What does it contain? Is there some way for users to put variables into it, or are tasks supposed to do any environment manipulation required themselves?

If I'm understanding things right, BitBake's "export" statement has nothing to do with exporting variables to the environment, like "export" would do in sh. This is potentially confusing and could be mentioned too.
Comment 1 Scott Rifenbark 2015-10-27 13:39:34 UTC
Moving this to 2.1.  Also placing in NEEDINFO as I need some explanation on this one from developers. 

Scott
Comment 2 Stephen K Jolley 2015-12-10 15:55:06 UTC
Assigned to Richard to comment.
Comment 3 Ross Burton 2015-12-10 15:58:14 UTC
Drive-by comment: export in a .bb is exactly what you expect from sh: it exports a variable into the environment.
Comment 4 Joshua Lock 2016-02-01 11:02:00 UTC
By default BitBake clears the environment of non-whitelisted variables unless the BB_PRESERVE_ENV[1] variable is set.

The BitBake User Manual alludes to the environment cleaning in "2.1. Parsing the Base Configuration Metadata"[2] and the reference for the relevant variables; BB_ENV_WHITELIST[3], BB_ENV_EXTRAWHITE[4], BB_PRESERVE_ENV[1] and BB_ORIGENV[6].

Section "3.5.3. Passing Information Into the Build Task Environment"[5] talks about the task execution environment and how to pass extra data in to it.

It's probable that we could be clearer and explicitly state that by default the environment is cleaned of variables which aren't in the whitelist before it is loaded into the datastore and that the whitelist of variables is composed of the BB_ENV_WHITELIST internal variable and the BB_ENV_EXTRAWHITE variable.

It's worth noting, though perhaps not in the BitBake manual (I don't know whether the BB manual refers to OE at all?), that OpenEmbedded's oe-init-env script sets BB_ENV_EXTRAWHITE to include several variables[7].

1. https://www.yoctoproject.org/docs/2.0/bitbake-user-manual/bitbake-user-manual.html#var-BB_PRESERVE_ENV
2. https://www.yoctoproject.org/docs/2.0/bitbake-user-manual/bitbake-user-manual.html#parsing-the-base-configuration-metadata
3. https://www.yoctoproject.org/docs/2.0/bitbake-user-manual/bitbake-user-manual.html#var-BB_ENV_WHITELIST
4. https://www.yoctoproject.org/docs/2.0/bitbake-user-manual/bitbake-user-manual.html#var-BB_ENV_EXTRAWHITE
5. https://www.yoctoproject.org/docs/2.0/bitbake-user-manual/bitbake-user-manual.html#passing-information-into-the-build-task-environment
6. https://www.yoctoproject.org/docs/2.0/bitbake-user-manual/bitbake-user-manual.html#var-BB_ORIGENV
7. http://git.openembedded.org/openembedded-core/tree/scripts/oe-buildenv-internal#n106
Comment 5 Richard Purdie 2016-02-01 11:12:49 UTC
I'd also just add that this is specfically referring to shell task execution environment.
Comment 6 Richard Purdie 2016-02-01 11:13:52 UTC
Reassign to Scott, Joshua should be able to help with any needed info or further review.
Comment 7 Scott Rifenbark 2016-02-03 18:33:35 UTC
Hi, 

I have made some changes to two sections to try and make this issue of environment variables more clear.  The information was in there but this attempt should make it easier on the user.  

Please look at the following two sections and let me know if this helps:

 * http://www.yoctoproject.org/docs/temp/bitbake-user-manual/bitbake-user-manual.html#parsing-the-base-configuration-metadata

 * http://www.yoctoproject.org/docs/temp/bitbake-user-manual/bitbake-user-manual.html#passing-information-into-the-build-task-environment

Thanks,
Scott
Comment 8 ulfalizer 2016-02-06 14:35:41 UTC
Looks a bit clearer and more explicit now. Thanks!
Comment 9 Scott Rifenbark 2016-02-15 18:18:16 UTC
Thanks for the review.  I am setting to RESOLVED and putting the doc flag to "done."

Scott