From: Daan De Meyer Date: Wed, 3 Jul 2024 10:16:40 +0000 (+0200) Subject: Make sure rmtree() doesn't fail on paths that don't exist X-Git-Tag: v24~64^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e17aace1b13abbb12013da9ddb75fc3ce9f7846;p=thirdparty%2Fmkosi.git Make sure rmtree() doesn't fail on paths that don't exist --- diff --git a/mkosi/tree.py b/mkosi/tree.py index 13ddb54cc..94adc66c3 100644 --- a/mkosi/tree.py +++ b/mkosi/tree.py @@ -149,7 +149,7 @@ def rmtree(*paths: Path, sandbox: SandboxProtocol = nosandbox) -> None: if not paths: return - if subvolumes := sorted({p for p in paths if is_subvolume(p, sandbox=sandbox)}): + if subvolumes := sorted({p for p in paths if p.exists() and is_subvolume(p, sandbox=sandbox)}): # Silence and ignore failures since when not running as root, this will fail with a permission error unless the # btrfs filesystem is mounted with user_subvol_rm_allowed. run(["btrfs", "subvolume", "delete", *subvolumes],