Bug 3872 - Multiple scripts directories causes infinite oe-core/scripts/bitbake loop
Summary: Multiple scripts directories causes infinite oe-core/scripts/bitbake loop
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium major
Target Milestone: 1.4 M4
Assignee: Saul Wold
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-02-09 17:08 UTC by Fcooper
Modified: 2013-02-15 22:34 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments
Bug fix (1.33 KB, patch)
2013-02-09 17:13 UTC, Fcooper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fcooper 2013-02-09 17:08:58 UTC
When sourcing conf/setenv the below snippet searches all your layers for a scripts directory and adds it to your path.

# check for any scripts directories in the top-level of the repos and add those
# to the PATH
SCRIPTS=`find ${OEBASE}/sources -maxdepth 2 -name "scripts" -type d`
for s in ${SCRIPTS}
do
    PATH="${s}:$PATH"
done

Usually oe-core is the only layer that contains a scripts directory but it is possible for other layers to define their own especially if they plan on overriding a script contained within oe-core's scripts directory.

oe-core/scripts/bitbake contains the below snippet:

export PATH=`echo $PATH | sed s#[^:]*/scripts:##`

This portion is meant to remove any scripts directory from the PATH temporarily. However, this assumes that only one scripts directory has been defined. In the event that more scripts directory is located in the path only once instance will be removed. For whatever reason the bitbake script freaks out and results in a recursive call to itself spawning multiple instances of itself until after a long time it crashes.

The simple fix is to add the g option to the regular expression so all instances of the scripts directory within the path is removed.
Comment 1 Fcooper 2013-02-09 17:13:22 UTC
Created attachment 1068 [details]
Bug fix
Comment 2 Denys Dmytriyenko 2013-02-11 19:43:19 UTC
Franklin,

1. Do you realize that conf/setenv as well as the code you cited below are specific to our own layer setup tool from the Arago Project?

2. And even with that, I don't seem to experience any problems with setup code and multiple instances of scripts/ directory...
Comment 3 Denys Dmytriyenko 2013-02-11 23:19:43 UTC
Ok, I was able to reproduce the issue on Franklin's machine...

The "find" command below is from our own setenv script, but it adds all occurrences of <layer>/scripts to the PATH variable. The order of layers is not guaranteed, so if oe-core/scripts is not the first in the list, it won't be processed by the below sed command within scripts/bitbake wrapper and filtered out from the PATH variable before re-calling the actual bitbake binary. And since it only filters out the first occurrence (which could have been e.g. meta-arago/scripts), it ends up calling bitbake wrapper from oe-core/scripts again and again.