utils: Ensure shell function failure in python logging is correct
PATCH 1/1 utils: Ensure shell function failure in python logging is correct
If a python function exec_func() calls a shell task, the logging wasn't working correctly in all cases since the exception was turned into a BBHandledException() and the logfile piece was lost which is handled at the top task level.
The easiest way to avoid this is to allow the ExecutionError exceptions to be raised to a higher level, we don't need the traceback for them.
--- lib/bb/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/utils.py +1 -1
@@ -402,7 +402,7 @@ def better_exec(code, context, text = None, realfile = "<code>", pythonexception code = better_compile(code, realfile, realfile) try: exec(code, get_context(), context) - except (bb.BBHandledException, bb.parse.SkipRecipe, bb.data_smart.ExpansionError): + except (bb.BBHandledException, bb.parse.SkipRecipe, bb.data_smart.ExpansionError, bb.process.ExecutionError): # Error already shown so passthrough, no need for traceback raise except Exception as e:
Signature · 1 line
2.32.0
Quoted 33 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Richard Purdie
Sent: den 21 februari 2022 17:04
To: [email protected]
Subject: [bitbake-devel] [PATCH] utils: Ensure shell function failure in
python logging is correctIf a python function
exec_func()calls a shell task, the logging wasn't working correctly in all cases since the exception was turned into aBBHandledException()and the logfile piece was lost which is handled at the top task level.The easiest way to avoid this is to allow the ExecutionError exceptions to be raised to a higher level, we don't need the traceback for them.
Signed-off-by Richard Purdie <[email protected]>--- lib/bb/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/bb/utils.py +1
-2@@ -402,7 +402,7 @@ def better_exec(code, context, text = None, realfile = "<code>", pythonexception code = better_compile(code, realfile, realfile) try: exec(code, get_context(), context) - except (bb.BBHandledException, bb.parse.SkipRecipe, bb.data_smart.ExpansionError): + except (bb.BBHandledException, bb.parse.SkipRecipe, bb.data_smart.ExpansionError, bb.process.ExecutionError): # Error already shown so passthrough, no need for traceback raise except Exception as e: --
Quoted 1 line
2.32.0
This needs to be cherry-picked to Honister. There are corresponding patches for oe-selftest as well to exercise the above change, but I'm not sure if you normally backport them too.
//Peter