diff mbox series

fetch: Fix uninitialised variable issue

Message ID 20261111181907.2627513-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit f22df7e0e00be1f3c406138b8b7269d47ea491fe
Headers show
Series fetch: Fix uninitialised variable issue | expand

Commit Message

Richard Purdie Nov. 11, 2026, 6:19 p.m. UTC
Running fetcher functions directly from bitbake-setup with an invalid
DL_DIR can result in an obtuse error:

ERROR: cannot access local variable 'lf' where it is not associated with a value

Make sure lf has some value, which means the real error isn't hidden.

[YOCTO #16494]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/fetch/__init__.py | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py
index eb3483a48ae..233eb6dc49e 100644
--- a/lib/bb/fetch/__init__.py
+++ b/lib/bb/fetch/__init__.py
@@ -1904,6 +1904,7 @@  class Fetch(object):
             m = ud.method
             done = False
 
+            lf = None
             try:
                 lf = bb.utils.lockfile(ud.lockfile, shared=True)