From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] event: Handle recursive events and the data store better
Date: Thu, 25 Jun 2015 22:52:17 +0100 [thread overview]
Message-ID: <1435269137.10583.19.camel@linuxfoundation.org> (raw)
Events can call each other recursively, e.g. an event handler can call
bb.note which in turn generates another event. If these loop, it
can lead to multiple deletions of 'd' from __builtins__ which
can fail since __builtins__ is global scope.
Add handling to only remove 'd' when we added it and it wasn't already
present.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 80e3796..6951e21 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -72,7 +72,10 @@ _eventfilter = None
def execute_handler(name, handler, event, d):
event.data = d
- __builtins__['d'] = d
+ addedd = False
+ if 'd' not in __builtins__:
+ __builtins__['d'] = d
+ addedd = True
try:
ret = handler(event)
except bb.parse.SkipRecipe:
@@ -88,7 +91,8 @@ def execute_handler(name, handler, event, d):
logger.error("Execution of event handler '%s' failed (exit code %s)" % (name, exc.code))
finally:
del event.data
- del __builtins__['d']
+ if addedd:
+ del __builtins__['d']
def fire_class_handlers(event, d):
if isinstance(event, logging.LogRecord):
reply other threads:[~2015-06-25 21:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435269137.10583.19.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.