<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>3872</bug_id>
          
          <creation_ts>2013-02-09 17:08:58 +0000</creation_ts>
          <short_desc>Multiple scripts directories causes infinite oe-core/scripts/bitbake loop</short_desc>
          <delta_ts>2013-02-15 22:34:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>1.4 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Fcooper">fcooper</reporter>
          <assigned_to name="Saul Wold">sgw</assigned_to>
          <cc>denis</cc>
    
    <cc>fcooper</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>29700</commentid>
    <comment_count>0</comment_count>
    <who name="Fcooper">fcooper</who>
    <bug_when>2013-02-09 17:08:58 +0000</bug_when>
    <thetext>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 &quot;scripts&quot; -type d`
for s in ${SCRIPTS}
do
    PATH=&quot;${s}:$PATH&quot;
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&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29701</commentid>
    <comment_count>1</comment_count>
      <attachid>1068</attachid>
    <who name="Fcooper">fcooper</who>
    <bug_when>2013-02-09 17:13:22 +0000</bug_when>
    <thetext>Created attachment 1068
Bug fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29718</commentid>
    <comment_count>2</comment_count>
    <who name="Denys Dmytriyenko">denis</who>
    <bug_when>2013-02-11 19:43:19 +0000</bug_when>
    <thetext>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&apos;t seem to experience any problems with setup code and multiple instances of scripts/ directory...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29734</commentid>
    <comment_count>3</comment_count>
    <who name="Denys Dmytriyenko">denis</who>
    <bug_when>2013-02-11 23:19:43 +0000</bug_when>
    <thetext>Ok, I was able to reproduce the issue on Franklin&apos;s machine...

The &quot;find&quot; command below is from our own setenv script, but it adds all occurrences of &lt;layer&gt;/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&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29874</commentid>
    <comment_count>4</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2013-02-15 22:34:35 +0000</bug_when>
    <thetext>Thanks for the patch!

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=a9608dd3e5d32a784c13d2b379d36b9046226172</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>1068</attachid>
            <date>2013-02-09 17:13:22 +0000</date>
            <delta_ts>2013-02-09 17:13:22 +0000</delta_ts>
            <desc>Bug fix</desc>
            <filename>0001-scripts-bitbake-Remove-all-instances-of-paths-to-a-l.patch</filename>
            <type>text/plain</type>
            <size>1358</size>
            <attacher name="Fcooper">fcooper</attacher>
            
              <data encoding="base64">RnJvbSBjMGJjYmM2OWZkYWU3YjIwMTgwZDZlZjY1NzZiOGZlYzgyODZhZWIwIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBGcmFua2xpbiBTLiBDb29wZXIgSnIgPGZjb29wZXJAdGkuY29t
PgpEYXRlOiBTYXQsIDkgRmViIDIwMTMgMTE6MDg6MTAgLTA2MDAKU3ViamVjdDogW1BBVENIXSBz
Y3JpcHRzL2JpdGJha2U6IFJlbW92ZSBhbGwgaW5zdGFuY2VzIG9mIHBhdGhzIHRvIGEgbGF5ZXIn
cyBzY3JpcHRzIGRpcmVjdG9yeS4KCiogQ3VycmVudGx5IHRoZSBhc3N1bXB0aW9uIGlzIG1hZGUg
dGhhdCBvbmx5IG9lLWNvcmUgY2FuIGluY2x1ZGUgYSBzY3JpcHRzCiAgZGlyZWN0b3J5LgoKKiBI
b3dldmVyLCB3aGVuIG90aGVyIGxheWVycyBjcmVhdGUgYSBzY3JpcHRzIGRpcmVjdG9yeSB0aGUg
Yml0YmFrZSBzY3JpcHQKICBmcmVha3Mgb3V0IGNhdXNpbmcgYSBpbmZpbml0ZSByZWN1cnNpdmUg
bG9vcCB1bnRpbCBpdCBjcm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