From 54eebf343e0a973ffde98e3911e116da5b59a578 Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Thu, 23 Jul 2026 13:26:18 -0700 Subject: [PATCH] integrate squashfs test --- tools/snap/build_remote_single.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/snap/build_remote_single.py b/tools/snap/build_remote_single.py index 80e85448a..482aaf9f6 100755 --- a/tools/snap/build_remote_single.py +++ b/tools/snap/build_remote_single.py @@ -136,14 +136,16 @@ def build_snap(target: str, arch: str) -> None: # Check if the snap file just contains html if not failed: - with open(snap_path_list[0], 'r') as f: - try: - first_line = f.readline().rstrip() - except UnicodeDecodeError: - first_line = '' - if first_line == "": + with open(snap_path_list[0], 'rb') as f: + first_block = f.read(10) + # 'hsqs' is the magic number that SquashFS files start with + if not first_block.startswith(b'hsqs'): failed = True - print(f'The {target} {arch} snap file contains html instead of a snap') + try: + first_block_str = first_block.decode() + except UnicodeDecodeError: + first_block_str = first_block.hex(sep=',') + print(f'The {target} {arch} snap file began with invalid data: {first_block_str}') if failed: print('Dumping snapcraft remote-build logs:')