<?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>10331</bug_id>
          
          <creation_ts>2016-09-26 20:21:06 +0000</creation_ts>
          <short_desc>build.py exception: FileNotFoundError: [Errno 2] No such file or directory</short_desc>
          <delta_ts>2016-09-28 21:41:38 +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>BitBake</product>
          <component>bitbake</component>
          <version>2.2</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>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Juro Bystricky">juro.bystricky</reporter>
          <assigned_to name="Juro Bystricky">juro.bystricky</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66600</commentid>
    <comment_count>0</comment_count>
      <attachid>3442</attachid>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-09-26 20:21:06 +0000</bug_when>
    <thetext>Created attachment 3442
Avoid exception when calling os.getcwd()

Under some rather unique conditions I encountered the following error:

ERROR: nativesdk-libgcc-initial-6.2.0-r0 do_populate_sysroot: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_python_func() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:do_populate_sysroot(d)
     0003:
File: &apos;/data/master-zephyr/poky/meta/classes/staging.bbclass&apos;, lineno: 213, function: do_populate_sysroot
     0209:            problems.add(task)
     0210:    return problems
     0211:
     0212:python do_populate_sysroot () {
 *** 0213:    bb.build.exec_func(&quot;sysroot_stage_all&quot;, d)
     0214:    bb.build.exec_func(&quot;sysroot_strip&quot;, d)
     0215:    for f in (d.getVar(&apos;SYSROOT_PREPROCESS_FUNCS&apos;, True) or &apos;&apos;).split():
     0216:        bb.build.exec_func(f, d)
     0217:    pn = d.getVar(&quot;PN&quot;, True)
File: &apos;/data/master-zephyr/poky/bitbake/lib/bb/build.py&apos;, lineno: 264, function: exec_func
     0260:            exec_func_python(func, d, runfile, cwd=adir, pythonexception=pythonexception)
     0261:        else:
     0262:            exec_func_shell(func, d, runfile, cwd=adir)
     0263:
 *** 0264:    if oldcwd and os.getcwd() != oldcwd:
     0265:        try:
     0266:            bb.warn(&quot;Task %s changed cwd to %s&quot; % (func, os.getcwd()))
     0267:            os.chdir(oldcwd)
     0268:        except:
Exception: FileNotFoundError: [Errno 2] No such file or directory



The reason for the exception is we are running the command os.getcwd() from a directory that no longer exist.

(The attachment fixes this)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66602</commentid>
    <comment_count>1</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-09-26 21:20:37 +0000</bug_when>
    <thetext>patch sent to the mailing list:
http://lists.openembedded.org/pipermail/openembedded-core/2016-September/126949.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66704</commentid>
    <comment_count>2</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-09-28 21:41:38 +0000</bug_when>
    <thetext>Patch merged with master:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=8b24b0c3593de2d8ada977cd4a49229771a6c477</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>3442</attachid>
            <date>2016-09-26 20:21:06 +0000</date>
            <delta_ts>2016-09-26 20:21:06 +0000</delta_ts>
            <desc>Avoid exception when calling os.getcwd()</desc>
            <filename>build_py.diff</filename>
            <type>text/plain</type>
            <size>683</size>
            <attacher name="Juro Bystricky">juro.bystricky</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL2JpdGJha2UvbGliL2JiL2J1aWxkLnB5IGIvYml0YmFrZS9saWIvYmIvYnVp
bGQucHkKaW5kZXggMmVkMDQ0MS4uMjQ5ZjdkNiAxMDA2NDQKLS0tIGEvYml0YmFrZS9saWIvYmIv
YnVpbGQucHkKKysrIGIvYml0YmFrZS9saWIvYmIvYnVpbGQucHkKQEAgLTI2MSw5ICsyNjEsMTQg
QEAgZGVmIGV4ZWNfZnVuYyhmdW5jLCBkLCBkaXJzID0gTm9uZSwgcHl0aG9uZXhjZXB0aW9uPUZh
bHNlKToKICAgICAgICAgZWxzZToKICAgICAgICAgICAgIGV4ZWNfZnVuY19zaGVsbChmdW5jLCBk
LCBydW5maWxlLCBjd2Q9YWRpcikKIAotICAgIGlmIG9sZGN3ZCBhbmQgb3MuZ2V0Y3dkKCkgIT0g
b2xkY3dkOgorICAgIHRyeToKKyAgICAgICAgY3VyY3dkID0gb3MuZ2V0Y3dkKCkKKyAgICBleGNl
cHQ6CisgICAgICAgIGN1cmN3ZCA9IE5vbmUKKworICAgIGlmIG9sZGN3ZCBhbmQgY3VyY3dkICE9
IG9sZGN3ZDoKICAgICAgICAgdHJ5OgotICAgICAgICAgICAgYmIud2FybigiVGFzayAlcyBjaGFu
Z2VkIGN3ZCB0byAlcyIgJSAoZnVuYywgb3MuZ2V0Y3dkKCkpKQorICAgICAgICAgICAgYmIud2Fy
bigiVGFzayAlcyBjaGFuZ2VkIGN3ZCB0byAlcyIgJSAoZnVuYywgY3VyY3dkKSkKICAgICAgICAg
ICAgIG9zLmNoZGlyKG9sZGN3ZCkKICAgICAgICAgZXhjZXB0OgogICAgICAgICAgICAgcGFzcwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>