From 6a0965a9129cdc552030ee7eecb9f0298a1e79c9 Mon Sep 17 00:00:00 2001 From: Tim Black Date: Fri, 27 Feb 2026 07:21:08 -0800 Subject: [PATCH] fix: use lexists() for symlink checks in do_adjust_git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit os.path.exists() follows symlinks and returns False for dangling symlinks. When DL_DIR is mounted at different paths across kas-container sessions (e.g. host path vs container mount point), the .git-downloads symlink becomes dangling. exists() fails to detect it, so the cleanup branch is skipped and the subsequent symlink() call fails with FileExistsError. Switch to os.path.lexists() which detects the symlink itself regardless of whether its target exists, allowing proper cleanup and re-creation. The os.path.exists() on line 66 (alternates file check) is intentionally left unchanged — alternates is a regular file, not a symlink. --- meta/classes-recipe/dpkg-base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/classes-recipe/dpkg-base.bbclass b/meta/classes-recipe/dpkg-base.bbclass index d8287e8de..8114574bd 100644 --- a/meta/classes-recipe/dpkg-base.bbclass +++ b/meta/classes-recipe/dpkg-base.bbclass @@ -27,10 +27,10 @@ python do_adjust_git() { dl_dir = d.getVar("DL_DIR") git_dl = os.path.join(dl_dir, "git") - if os.path.exists(git_link) and os.path.realpath(git_link) != os.path.realpath(git_dl): + if os.path.lexists(git_link) and os.path.realpath(git_link) != os.path.realpath(git_dl): os.unlink(git_link) - if not os.path.exists(git_link): + if not os.path.lexists(git_link): os.symlink(git_dl, git_link) for src_uri in (d.getVar("SRC_URI") or "").split():