From: Daan De Meyer Date: Thu, 22 Aug 2024 13:46:06 +0000 (+0200) Subject: Add missing directory checks in copy_tree() X-Git-Tag: v25~345 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ccee64874ecb9e457f71ec40876ddc3e232aaa6;p=thirdparty%2Fmkosi.git Add missing directory checks in copy_tree() --- diff --git a/mkosi/tree.py b/mkosi/tree.py index c2cf5ab86..d2bf3003c 100644 --- a/mkosi/tree.py +++ b/mkosi/tree.py @@ -95,7 +95,7 @@ def copy_tree( src, dst, ] - if dst.exists() and any(dst.iterdir()) and cp_version(sandbox=sandbox) >= "9.5": + if dst.exists() and dst.is_dir() and any(dst.iterdir()) and cp_version(sandbox=sandbox) >= "9.5": cmdline += ["--keep-directory-symlink"] # If the source and destination are both directories, we want to merge the source directory with the @@ -111,7 +111,7 @@ def copy_tree( use_subvolumes == ConfigFeature.disabled or not preserve or not is_subvolume(src) or - (dst.exists() and any(dst.iterdir())) + (dst.exists() and (not dst.is_dir() or any(dst.iterdir()))) ): with ( preserve_target_directories_stat(src, dst)