From 1aa0b05014ed1fc8b5e3eaef48c6169080b447bf Mon Sep 17 00:00:00 2001 From: Newbyte Date: Tue, 29 Oct 2024 14:21:01 +0100 Subject: [PATCH] pmb.install.blockdevice: Avoid reusing size_mb variable in create_and_mount_image() (MR 2464) Reusing this variable might lead to confusing bugs later if this code is changed in the future, and also leads to mypy being confused about the type of size_mb as it then gets assigned both str and int values. --- pmb/install/blockdevice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pmb/install/blockdevice.py b/pmb/install/blockdevice.py index 4ab36dea..c3e2868b 100644 --- a/pmb/install/blockdevice.py +++ b/pmb/install/blockdevice.py @@ -105,9 +105,9 @@ def create_and_mount_image(args: PmbArgs, size_boot, size_root, size_reserve, sp images = {img_path_full: size_mb_full} if split: images = {img_path_boot: size_mb_boot, img_path_root: size_mb_root} - for img_path, size_mb in images.items(): - logging.info(f"(native) create {img_path.name} " f"({size_mb})") - pmb.chroot.root(["truncate", "-s", size_mb, img_path]) + for img_path, image_size_mb in images.items(): + logging.info(f"(native) create {img_path.name} " f"({image_size_mb})") + pmb.chroot.root(["truncate", "-s", image_size_mb, img_path]) # Mount to /dev/install mount_image_paths = {img_path_full: "/dev/install"}