From: Deniz Adrian Date: Wed, 23 Jul 2025 20:04:53 +0000 (+0200) Subject: ensure builds with cache over device boundaries X-Git-Tag: v26~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec4475a84699ec639dfa5c4e75fdc4c9291d90ad;p=thirdparty%2Fmkosi.git ensure builds with cache over device boundaries when running mkosi with the default cache dir/XDG_CACHE_HOME on a different device than the mkosi working directory, mkosi falls back to trying to copy the cache using `copy_tree` from tree.py. the cache contains symlinks which are pointing to files on the host: e.g. `mkosi.cache/debian...cache/usr/bin/mt -> /etc/alternatives/mt` `os.listxattr()` defaults to `follow_symlinks=True`, which leads to `FileNotFoundError`s if the files don't exist on the host, which stops the build. this patch ignores symlinks, but feels like a workaround, as our assumption would be that such absolute links should not be traversed outside the chroot in the first place. Co-authored-by: ZauberNerd --- diff --git a/mkosi/tree.py b/mkosi/tree.py index 2090db8ed..f90ed8ca9 100644 --- a/mkosi/tree.py +++ b/mkosi/tree.py @@ -88,7 +88,7 @@ def maybe_make_nocow(path: Path) -> None: def tree_has_selinux_xattr(path: Path) -> bool: - return any("security.selinux" in os.listxattr(p) for p in (path, *path.rglob("*"))) + return any("security.selinux" in os.listxattr(p, follow_symlinks=False) for p in (path, *path.rglob("*"))) def copy_tree(