All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tinfoil: Disable data tracking also when the operation fails
@ 2026-11-23 20:36 Stefano Tondo
  0 siblings, 0 replies; only message in thread
From: Stefano Tondo @ 2026-11-23 20:36 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Richard Purdie, Peter Marko, Stefano Tondo

From: Stefano Tondo <stefano.tondo.ext@siemens.com>

_data_tracked_if_enabled() enables data tracking before the operation
and disables it after the operation. If the operation raises an
exception, the second step does not run and tracking stays enabled in
the server for the rest of the tinfoil session.

Disable tracking in a finally block.

Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
---
 lib/bb/tinfoil.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 9b9925e51..4fd2a9af8 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -789,10 +789,11 @@ class Tinfoil:
             self.run_command('enableDataTracking')
 
         # Here goes the operation with the optional data tracking
-        yield
-
-        if self.tracking:
-            self.run_command('disableDataTracking')
+        try:
+            yield
+        finally:
+            if self.tracking:
+                self.run_command('disableDataTracking')
 
     def finalizeData(self):
         """
-- 
2.56.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23 20:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 20:36 [PATCH] tinfoil: Disable data tracking also when the operation fails Stefano Tondo

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.