From f09bc3d009b2b7856e8817b86f6ebc2a522b5dc9 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Sat, 23 May 2026 07:36:43 -0500 Subject: [PATCH] Validate AppImage SquashFS offsets --- scripts/ci/_common.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/ci/_common.sh b/scripts/ci/_common.sh index fde5754ee..28190bd3d 100755 --- a/scripts/ci/_common.sh +++ b/scripts/ci/_common.sh @@ -862,7 +862,7 @@ extract_appimage_tool() { return 1 } - offset="$(LC_ALL=C grep -abo -m1 'hsqs' "${appimage}" | awk -F: '{ print $1 }' || true)" + offset="$(appimage_squashfs_offset "${appimage}")" if [ -z "${offset}" ]; then echo "Could not locate embedded SquashFS payload in AppImage: ${appimage}" >&2 return 1 @@ -887,6 +887,20 @@ extract_appimage_tool() { rm -rf "${tmp}" } +appimage_squashfs_offset() { + local appimage="$1" + local offset _ + + while IFS=: read -r offset _; do + if unsquashfs -s -o "${offset}" "${appimage}" >/dev/null 2>&1; then + printf '%s\n' "${offset}" + return 0 + fi + done < <(LC_ALL=C grep -abo 'hsqs' "${appimage}" || true) + + return 1 +} + print_tree_hash() { local dir="$1" local label="${2:-$(repo_relative_path "${dir}")}"