<?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>8752</bug_id>
          
          <creation_ts>2015-12-02 23:42:14 +0000</creation_ts>
          <short_desc>Raising subprocess.CalledProcessError in an eventhandler will exit with 0 for the exit code</short_desc>
          <delta_ts>2016-01-06 16:24:19 +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.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.1 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Randy Witt">randy.e.witt</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>bogdanx.a.voiculescu</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          <qa_contact name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</qa_contact>
          <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>56971</commentid>
    <comment_count>0</comment_count>
      <attachid>2885</attachid>
    <who name="Randy Witt">randy.e.witt</who>
    <bug_when>2015-12-02 23:42:14 +0000</bug_when>
    <thetext>Created attachment 2885
Test bbclass

If subprocess.CalledProcessError is raised in an eventhandler, bitbake will exit but the exit code will be 0. It is expected that the exitcode should be non-zero.

Steps to reproduce:

1. Add mytest.bbclass to meta/classes
2. Add INHERIT += &quot;mytest&quot; to local.conf
3. bitbake core-image-minimal

You should see:

(&apos;__init__() takes at least 3 arguments (1 given)&apos;, &lt;class &apos;subprocess.CalledProcessError&apos;&gt;, ())%


This was originally discovered when using uninative.bbclass and the loader was missing. I just made a simpler testcase.

Also if you look in bitbake/lib/bb/event.py where the exception is handled on line 33, it seems that it really is the &quot;value&quot; parameter being subprocess.CalledProcessError causing the problem.

If you set &quot;value&quot; to None, or even raise a different exception in the event handler the logger message is displayed, and the exit code is non-zero.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57259</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-12-14 23:19:06 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=5de3800c3081dfa3db55f80788eaeda6dd7d9f29</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57594</commentid>
    <comment_count>2</comment_count>
    <who name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</who>
    <bug_when>2016-01-06 16:24:19 +0000</bug_when>
    <thetext>Verified: no errors on master:
bitbake core-image-minimal
Parsing recipes: 100% |##########################################################################################################################################################| Time: 00:00:10
Parsing of 885 .bb files complete (0 cached, 885 parsed). 1314 targets, 57 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = &quot;1.28.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;Ubuntu-14.04&quot;
TARGET_SYS        = &quot;arm-poky-linux-gnueabi&quot;
MACHINE           = &quot;beaglebone&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;2.0+snapshot-20160106&quot;
TUNE_FEATURES     = &quot;arm armv7a vfp neon callconvention-hard cortexa8&quot;
TARGET_FPU        = &quot;vfp-neon&quot;
meta
meta-yocto
meta-yocto-bsp    = &quot;master:2cd061a29a94fdcdfec86732e6bcbb71c12c4afc&quot;

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 2215 tasks of which 460 didn&apos;t need to be rerun and all succeeded.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2885</attachid>
            <date>2015-12-02 23:42:14 +0000</date>
            <delta_ts>2015-12-02 23:42:14 +0000</delta_ts>
            <desc>Test bbclass</desc>
            <filename>mytest.bbclass</filename>
            <type>text/plain</type>
            <size>182</size>
            <attacher name="Randy Witt">randy.e.witt</attacher>
            
              <data encoding="base64">YWRkaGFuZGxlciBteV9ldmVudGhhbmRsZXIKbXlfZXZlbnRoYW5kbGVyW2V2ZW50bWFza10gPSAi
YmIuZXZlbnQuQnVpbGRTdGFydGVkIgoKcHl0aG9uIG15X2V2ZW50aGFuZGxlcigpIHsKICAgIGlt
cG9ydCBzdWJwcm9jZXNzCiAgICByYWlzZSBzdWJwcm9jZXNzLkNhbGxlZFByb2Nlc3NFcnJvcigx
LCAiZm9vIikKfQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>