From e378490c60f1aeab8fafd9b59e0d3249cb85bc37 Mon Sep 17 00:00:00 2001 From: Will Greenberg Date: Wed, 22 Jul 2026 16:41:40 -0700 Subject: [PATCH] build_remote.py: better detection of invalid snaps (#10741) Another attempt at fixing #10617. Seems the recent armhf builds resulted in slightly different HTML output, so instead of checking if the output matches a specific failure case, just check if we've actually got a SquashFS lookin file. According to https://dr-emann.github.io/squashfs/squashfs.html#_the_superblock, a SquashFS file starts with the magic number "hsqs". --- tools/snap/build_remote.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/snap/build_remote.py b/tools/snap/build_remote.py index 5ed9f0e05..ba6f562eb 100755 --- a/tools/snap/build_remote.py +++ b/tools/snap/build_remote.py @@ -144,14 +144,17 @@ def _build_snap( for arch in archs: snap_path_list = glob.glob(join(workspace, f'{target}_*_{arch}.snap')) assert len(snap_path_list) == 1 - with open(snap_path_list[0], 'r') as f: + 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 first_block.startswith(b'hsqs'): + continue + failed_archs.add(arch) try: - first_line = f.readline().rstrip() + first_block_str = first_block.decode() except UnicodeDecodeError: - first_line = '' - if first_line == "": - failed_archs.add(arch) - print(f'The {target} {arch} snap file contains html instead of a snap') + first_block_str = first_block.hex(sep=',') + print(f'The {target} {arch} snap file began with invalid data: {first_block_str}') dump_output = bool(failed_archs) if not dump_output: