From ac40cb5ee24a8ef44b941c4b9bbf6eec6f61d13c Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Sun, 23 Jun 2024 17:03:49 -0700 Subject: bitbake: cache: Remove invalid symlink for bb_cache.dat The bb_cache.dat might be an invalid symlink when error happens, then os.path.exists(symlink) would return False for it, the invalid symlink wouldn't be removed and os.symlink can't update it any more. Use os.path.islink(symlink) can fix the problem. (Bitbake rev: 1387d7b9ee3f270488f89b29f36f9f240e44accc) Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- bitbake/lib/bb/cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 18d5574a31..4a96f5b313 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py @@ -441,7 +441,7 @@ class Cache(object): else: symlink = os.path.join(self.cachedir, "bb_cache.dat") - if os.path.exists(symlink): + if os.path.exists(symlink) or os.path.islink(symlink): bb.utils.remove(symlink) try: os.symlink(os.path.basename(self.cachefile), symlink) -- cgit v1.2.3-54-g00ecf