Skip to contentSkip to conversation

cookerdata: Fix log messages and ensure we exit

PATCH In review Richard Purdie 2 participants 3 messages May 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cookerdata: Fix log messages and ensure we exit

The string formatting wasn't correct and we should exit if we hit errors here similar to the other exception handlers.

lib/bb/cookerdata.py +2 -1
index 50259a9..fba95af 100644
@@ -192,7 +192,8 @@ def catch_parse_error(func):
                 fn, _, _, _ = traceback.extract_tb(tb, 1)[0]
                 if not fn.startswith(bbdir):
                     break
-            parselog.critical("Unable to parse %s", fn, exc_info=(exc_class, exc, tb))
+            parselog.critical("Unable to parse %s" % fn, exc_info=(exc_class, exc, tb))
+            sys.exit(1)
         except bb.parse.ParseError as exc:
             parselog.critical(str(exc))
             sys.exit(1)
#1 lore raw
Quoted 10 lines · Richard Purdie

The string formatting wasn't correct and we should exit if we hit errors here similar to the other exception handlers.

lib/bb/cookerdata.py +0 -0
index 50259a9..fba95af 100644

lib/bb/cookerdata.py def catch_parse_error(func): · line 199

Quoted 9 lines
lib/bb/cookerdata.py +2 -1
@@ -192,7 +192,8 @@ def catch_parse_error(func):
                 fn, _, _, _ = traceback.extract_tb(tb, 1)[0]
                 if not fn.startswith(bbdir):
                     break
-            parselog.critical("Unable to parse %s", fn,
 exc_info=(exc_class, exc, tb))
+            parselog.critical("Unable to parse %s" % fn,
 exc_info=(exc_class, exc, tb))
+            sys.exit(1)
 

The python logging module supports passing the % format values as arguments, you don't have to format the string at call time. What was the error here?

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 17 lines · Christopher Larson
Quoted 14 lines · Richard Purdie

The string formatting wasn't correct and we should exit if we hit errors here similar to the other exception handlers.

lib/bb/cookerdata.py +0 -1
index 50259a9..fba95af 100644
@@ -192,7 +192,8 @@ def catch_parse_error(func):
                 fn, _, _, _ = traceback.extract_tb(tb, 1)[0]
                 if not fn.startswith(bbdir):
                     break
-            parselog.critical("Unable to parse %s", fn,
Quoted 8 lines

lib/bb/cookerdata.py def catch_parse_error(func): · line 199

Quoted 5 lines
lib/bb/cookerdata.py +2 -0
 exc_info=(exc_class, exc, tb))
+            parselog.critical("Unable to parse %s" % fn,
 exc_info=(exc_class, exc, tb))
+            sys.exit(1)
 

The python logging module supports passing the % format values as arguments, you don't have to format the string at call time. What was the error here?

I had a whole load of debug here and distilled it down to this as it looked inconsistent with the rest of our code. Its possible the real problem was with exc_info as mentioned in another patch...

Cheers,

Richard