Skip to content

Commit 8e6efa1

Browse files
committed
ghidra: derive the 7-Zip platform assertion from uname, not from my host
CI caught this on amd64, and the failure is the useful kind: sevenzip_native: grep -q 'PLATFORM=Linux-arm64' exit code 1 stdout: PLATFORM=Linux-amd64 ENTRY=SEVENZIP_PARITY_OK.txt The test was wrong, not the package. I hardcoded the architecture I happened to build on. Note what the same output proves: on amd64 the native initialised AND decompressed the container — ENTRY is right there — so 7z works on both arches and only the assertion was too specific. Now derived from uname: Linux-arm64 on aarch64, Linux-amd64 on x86_64, and an explicit failure on anything else rather than a silently skipped assertion. It still catches the regression it exists for. On arm64 the answer is Linux-arm64 ONLY because build.sh swaps the all-platforms jar for the per-platform one; if that regresses, the platform list stops being a single entry, getPlatformBestMatch() falls back to matching os.arch ("aarch64") against "Linux-arm64", and cannot succeed — so an arm64 host reports Linux-amd64 and the test fails. Verified that case explicitly: uname=x86_64 want=Linux-amd64 vs CI's real output PASS uname=aarch64 want=Linux-arm64 vs our build PASS uname=aarch64 serving Linux-amd64 (the regression) FAIL This is the first real feedback from the amd64 path, which I had flagged as untested — the [ -f ] guard that takes upstream's natives on x86_64 now has evidence behind it too. 14/14 on arm64 after the change.
1 parent 024fc72 commit 8e6efa1

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

packages/ghidra/build.ncl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,36 @@ let version = "12.1.2" in
208208
# ...and resolved to the ARM platform specifically. If the swap ever
209209
# regresses to shipping the all-platforms jar, the list stops being a
210210
# single entry and this is what notices.
211-
["/bin/bash", "-c", "grep -q 'PLATFORM=Linux-arm64' /build/7z.out"],
211+
# ...and resolved to THIS HOST's platform. Deliberately derived from
212+
# uname rather than hardcoded: the first version of this test
213+
# asserted Linux-arm64 unconditionally and failed CI on amd64, where
214+
# the correct answer is Linux-amd64 — the assertion encoded the
215+
# architecture I happened to build on.
216+
#
217+
# Still catches the regression that matters. On arm64 the answer is
218+
# Linux-arm64 ONLY because build.sh replaced the all-platforms jar
219+
# with the per-platform one; if that swap regresses, the platform
220+
# list stops being a single entry, getPlatformBestMatch() falls back
221+
# to matching os.arch ("aarch64") against "Linux-arm64", and fails —
222+
# so this reports Linux-amd64 or nothing on an arm64 host, and the
223+
# test fails.
224+
[
225+
"/bin/bash",
226+
"-c",
227+
m%"
228+
set -eu
229+
case "$(uname -m)" in
230+
aarch64 | arm64) want=Linux-arm64 ;;
231+
x86_64) want=Linux-amd64 ;;
232+
*) echo "unsupported arch $(uname -m)" >&2; exit 1 ;;
233+
esac
234+
grep -q "PLATFORM=$want" /build/7z.out || {
235+
echo "expected PLATFORM=$want for $(uname -m); got:" >&2
236+
cat /build/7z.out >&2
237+
exit 1
238+
}
239+
"%
240+
],
212241
# ...and genuinely decompressed the container: the inner filename can
213242
# only appear if 7-Zip enumerated the archive.
214243
["/bin/bash", "-c", "grep -q 'ENTRY=SEVENZIP_PARITY_OK.txt' /build/7z.out"],

0 commit comments

Comments
 (0)