<?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>4491</bug_id>
          
          <creation_ts>2013-05-13 09:27:18 +0000</creation_ts>
          <short_desc>improve the definition of bb.fatal()</short_desc>
          <delta_ts>2013-10-03 14:57:02 +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>1.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>1.5 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Yang">liezhi.yang</reporter>
          <assigned_to name="Robert Yang">liezhi.yang</assigned_to>
          <cc>corneliux.stoicescu</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</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>33063</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-05-13 09:27:18 +0000</bug_when>
    <thetext>Comments from Mike:

I was actually more thinking like this (untested pseusocode follows):

class Fatal(SystemExit):
    def __init__(self, *args):
        SystemExit.__init__(self, 1, &apos;&apos;.join(*args)) # or so


def fatal(*args):
    &apos;For backward compatibility&apos;
    raise Fatal(*args)


New code should use &quot;raise bb.Fatal(..)&quot; instead of &quot;fatal(..)&quot;. It has the added advantage of being able to explicitly catch and handle the Fatal error. Which could be useful in bitbake frontends.

Inheriting from SystemExit makes it behave exactly like the old code in all ways, so it wouldn&apos;t break things.

It makes it clear what happens. bb.fatal() is a function that doesn&apos;t really return. But it isn&apos;t as fatal as its name suggests, because it really just raises an exception, so anyone doing a catch or finally may be surprised by its implementation. Converting it into an exception makes it obvious to the world what it does without the need for documentation...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33064</commentid>
    <comment_count>1</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-05-13 09:30:27 +0000</bug_when>
    <thetext>We may also change the currently &quot;bb.fatal(...)&quot; to raise &quot;bb.Fatal(...)&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33919</commentid>
    <comment_count>2</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-06-17 09:15:29 +0000</bug_when>
    <thetext>After more investigations, I&apos;m sorry to say that I didn&apos;t see many benefits
of this change, the only one that you mentioned we can use &quot;except SystemExit&quot;
to handle the fatal error with the new code, but the &quot;except SystemExit&quot; also
works with the old code, e.g.:

import sys
try:
    sys.exit(1)
except SystemExit:
    print &quot;Catch SystemExit&quot;

And the new code uses:

SystemExit.__init__(self, 1, &apos;&apos;.join(*args))

which can raise more messages, but I think that we need the logger.critical()
here to log the messages in the log file, so we can only use 
SystemExit.__init__(self, 1), it seems that it equals to sys.exit(1).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35592</commentid>
    <comment_count>3</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-08-13 01:47:18 +0000</bug_when>
    <thetext>Please see the previous comments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37569</commentid>
    <comment_count>4</comment_count>
    <who name="Stoicescu Cornel">corneliux.stoicescu</who>
    <bug_when>2013-10-03 14:57:02 +0000</bug_when>
    <thetext>Marking as Verified as per above comments..</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>