From: Daan De Meyer Date: Thu, 22 Feb 2024 09:11:24 +0000 (+0100) Subject: Only do st_uid check in have_cache() if we're root X-Git-Tag: v21~35^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f752e7d0be8b0f753a49cffc2db3310c65e55ab1;p=thirdparty%2Fmkosi.git Only do st_uid check in have_cache() if we're root If we're not root then the check doesn't make any sense so skip it. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 505d01b72..2522b64d1 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2637,7 +2637,7 @@ def have_cache(config: Config) -> bool: # namespace and we'll think the cache is owned by root. However, if we're running as root and the cache was # generated by an unprivileged build, the cache will not be owned by root and we should not use it. for p in (final, build): - if p.exists() and p.stat().st_uid != 0: + if p.exists() and os.getuid() == 0 and p.stat().st_uid != 0: return False return True