Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion scripts/ci/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}")"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 set -e causes script to exit before error message when appimage_squashfs_offset returns 1

The script runs under set -euo pipefail (scripts/ci/_common.sh:2). When appimage_squashfs_offset finds no valid SquashFS offset, it return 1s (line 901). Since the call site uses a simple variable assignment offset="$(appimage_squashfs_offset ...)", the non-zero exit status triggers set -e to immediately exit the script. The subsequent if [ -z "${offset}" ] check (line 866) with its helpful error message ("Could not locate embedded SquashFS payload...") is never reached.

The old code avoided this with || true: offset="$(LC_ALL=C grep -abo -m1 'hsqs' "${appimage}" | awk -F: '{ print $1 }' || true)", which always produced exit code 0 and let the empty-string check handle the error path gracefully.

Suggested change
offset="$(appimage_squashfs_offset "${appimage}")"
offset="$(appimage_squashfs_offset "${appimage}" || true)"
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

if [ -z "${offset}" ]; then
echo "Could not locate embedded SquashFS payload in AppImage: ${appimage}" >&2
return 1
Expand All @@ -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}")}"
Expand Down
Loading