Skip to contentSkip to conversation

fetch: Fix uninitialised variable issue

PATCH New Richard Purdie 1 participant 1 message Nov 11

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch: Fix uninitialised variable issue

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]

---
 lib/bb/fetch/__init__.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/fetch/__init__.py +1 -0
index eb3483a48ae..233eb6dc49e 100644
@@ -1904,6 +1904,7 @@ class Fetch(object):
             m = ud.method
             done = False
 
+            lf = None
             try:
                 lf = bb.utils.lockfile(ud.lockfile, shared=True)