]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
tree: Ignore symlinks when checking for subvolumes in rmtree()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 26 Feb 2025 12:35:04 +0000 (13:35 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 26 Feb 2025 13:17:37 +0000 (14:17 +0100)
mkosi/tree.py

index 59307605d22198deb2450d89525c67eb2fb80e87..93dd40710a8de370bc296c1e601b2059217464e3 100644 (file)
@@ -184,7 +184,7 @@ def rmtree(*paths: Path, sandbox: SandboxProtocol = nosandbox) -> None:
 
     paths = tuple(p.absolute() for p in paths)
 
-    if subvolumes := sorted({p for p in paths if p.exists() and is_subvolume(p)}):
+    if subvolumes := sorted({p for p in paths if not p.is_symlink() and p.exists() and is_subvolume(p)}):
         # 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(