diff mbox series

[v3,1/4] bitbake-layers: ensure tinfoil.shutdown() gets executed when tinfoil.prepare() fails

Message ID 20241118162610.1423384-1-alex.kanavin@gmail.com
State Accepted, archived
Commit 06b8a18339434be8f754e534dacb790a2c9cb91d
Headers show
Series [v3,1/4] bitbake-layers: ensure tinfoil.shutdown() gets executed when tinfoil.prepare() fails | expand

Commit Message

Alexander Kanavin Nov. 18, 2024, 4:26 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

https://git.yoctoproject.org/poky/commit/bitbake/bin/bitbake-layers?id=f6de2b033d32c0f92f19f5a4a8c4c8874a00a8f7
erroneously moved tinfoil.prepare() out of try..finally block, where
'finally' contains a tinfoil.shutdown() call.

Without the shutdown, if there is an error in tinfoil.prepare() (such as parsing errors),
the tool locks up, as seen here:
https://valkyrie.yoctoproject.org/#/builders/71/builds/431

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bin/bitbake-layers | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

chris.laplante@agilent.com Nov. 25, 2024, 8:50 p.m. UTC | #1
Hi Alex,

> https://git.yocto/
> project.org%2Fpoky%2Fcommit%2Fbitbake%2Fbin%2Fbitbake-
> layers%3Fid%3Df6de2b033d32c0f92f19f5a4a8c4c8874a00a8f7&data=05%7C02
> %7Cchris.laplante%40agilent.com%7C97e94e28efaa4067611208dd07edc001%7
> Ca9c0bc098b46420693512ba12fb4a5c0%7C0%7C0%7C638675439912466855%
> 7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDA
> wMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C
> &sdata=Y05hVrsW%2Fo8KxXtUXrC62sAoPmA74U82IWtjyIGqxXo%3D&reserved=
> 0
> erroneously moved tinfoil.prepare() out of try..finally block, where 'finally'
> contains a tinfoil.shutdown() call.

Why not just use a 'with' statement here?

Thanks,
Chris
Alexander Kanavin Nov. 25, 2024, 9 p.m. UTC | #2
On Mon, 25 Nov 2024 at 21:50, chris.laplante@agilent.com
<chris.laplante@agilent.com> wrote:
> > erroneously moved tinfoil.prepare() out of try..finally block, where 'finally'
> > contains a tinfoil.shutdown() call.
>
> Why not just use a 'with' statement here?

Perhaps; can you send a followup? This already merged.

Alex
chris.laplante@agilent.com Nov. 25, 2024, 9:01 p.m. UTC | #3
> > Why not just use a 'with' statement here?
> 
> Perhaps; can you send a followup? This already merged.
> 
> Alex

Sure thing :).

Thanks,
Chris
diff mbox series

Patch

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index aebb5100c2c..613e675cb0d 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -59,13 +59,13 @@  def main():
     plugins = []
     tinfoil = bb.tinfoil.Tinfoil(tracking=True)
     tinfoil.logger.setLevel(logger.getEffectiveLevel())
-    if global_args.force > 1:
-        bbpaths = []
-    else:
-        tinfoil.prepare(True)
-        bbpaths = tinfoil.config_data.getVar('BBPATH').split(':')
-    
-    try: 
+    try:
+        if global_args.force > 1:
+            bbpaths = []
+        else:
+            tinfoil.prepare(True)
+            bbpaths = tinfoil.config_data.getVar('BBPATH').split(':')
+
         for path in ([topdir] + bbpaths):
             pluginpath = os.path.join(path, 'lib', 'bblayers')
             bb.utils.load_plugins(logger, plugins, pluginpath)