[elbe-devel] [PATCH] elbepack: hdimg: don't report success if copy to target fails

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed May 22 10:29:26 CEST 2024


Failing to copy files to the target is a serious issue.
Don't swallow the error, but abort the build.

Example before:

   [CMD] mount /dev/loop0 /var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/imagemnt
   [CMD] cp -a "/var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/filesystems/0/." "/var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/imagemnt/"

   ...

   cp: cannot create directory '/var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/imagemnt/./srv': No space left on device
   cp: cannot create directory '/var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/imagemnt/./root': No space left on device
   [CMD] umount /var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/imagemnt
   [CMD] losetup --detach /dev/loop0
   [CMD] mv "/var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/filesystems/0"/* "/var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/target/"
   [CMD] /usr/sbin/chroot /var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/chroot debconf-set-selections /var/cache/elbe/preseed.txt
   [CMD] /usr/sbin/chroot /var/cache/elbe/018f9abf-209a-7e85-8515-2aa3e5b32e61/chroot chpasswd --encrypted
   [INFO]Build finished successfully

   Build finished !

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/hdimg.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index 3dc1af82c619..b8ca060a8aea 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -303,8 +303,7 @@ def create_label(disk, part, ppart, fslabel, target, grub):
             _execute_fs_commands(entry.fs_path_commands, dict(path=mount_path))
             do(
                 f'cp -a "{os.path.join(target, "filesystems", entry.id)}/." '
-                f'"{mount_path}/"',
-                check=False)
+                f'"{mount_path}/"')
 
     return ppart
 

---
base-commit: dfb4a8a89573e88f4d2d9e297b23973092a524e8
change-id: 20240522-enospc-78befdf49b24

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list