fix(ghidra): say how to build a missing macOS or Linux arm64 decompiler

Official Ghidra release archives ship no macOS decompiler and may ship
none for Linux arm64, but doctor's native_decompiler remediation only
named the expected path. On those hosts it now says the archive's
decompiler source builds it and points to the installation guide's build
steps for that platform.

Fixes #7018

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
gensokyo-devandgensokyo-dev authored and Ysopwnable committed 2026-11-21 20:44:21 +01:00
1 parent 905090c0ca
commit cc8716ce22
2 files changed
+58 -1

No files matched your search

+42
View File
@@ -665,6 +665,48 @@ describe("Ghidra installation rejection diagnostics", () => {
});
});
describe("Ghidra native decompiler remediation", () => {
it.each([
["darwin", "x64", "installation.md#missing-macos-native-decompiler"],
["darwin", "arm64", "installation.md#macos-arm64-native-decompiler"],
["linux", "arm64", "installation.md#ghidra"],
["linux", "x64", undefined],
] as const)(
"points a missing %s/%s decompiler to how to build it",
async (platform, architecture, instructions) => {
const result = await inspectGhidraInstallation(
{
resourceOwner: inspectionResources.owner,
installDir: INSTALL,
platform,
architecture,
environment: {},
},
host({
executable: (path) => path === HEADLESS,
probeJava: () =>
javaProbeOk<GhidraJavaObservation>({
...JAVA,
osArch: architecture === "arm64" ? "aarch64" : "amd64",
osName: platform === "darwin" ? "Mac OS X" : "Linux",
}),
}),
);
const check = result.checks.find(
(candidate) =>
candidate.name === "native_decompiler" &&
candidate.status === "failed",
);
expect(check).toMatchObject({ code: "executable_missing" });
if (check?.status !== "failed")
throw new Error("Expected a failed native_decompiler check");
if (instructions === undefined)
expect(check.remediation).not.toContain("Official Ghidra release");
else expect(check.remediation).toContain(instructions);
},
);
});
describe("Ghidra configuration directory identity", () => {
it.each([
[
+16 -1
View File
@@ -980,10 +980,25 @@ const nativeDecompilerCheck = ({
remediation:
compatibility?.status === "incompatible"
? compatibility.remediation
: `Provide an executable Ghidra/Features/Decompiler/os/${NATIVE_PLATFORMS[platform]?.[architecture] ?? "<platform>"}/${platform === "win32" ? "decompile.exe" : "decompile"}, or its build/os equivalent. REA does not build or install native tools.`,
: `Provide an executable Ghidra/Features/Decompiler/os/${NATIVE_PLATFORMS[platform]?.[architecture] ?? "<platform>"}/${platform === "win32" ? "decompile.exe" : "decompile"}, or its build/os equivalent.${nativeDecompilerBuildHint(platform, architecture)} REA does not build or install native tools.`,
});
};
/**
* Where to get a decompiler that official release archives omit. Ghidra's
* official archives ship no macOS decompiler, and may ship none for Linux
* arm64; the archive's decompiler source builds it.
*/
const nativeDecompilerBuildHint = (
platform: NodeJS.Platform,
architecture: NodeJS.Architecture,
): string =>
platform === "darwin" && (architecture === "x64" || architecture === "arm64")
? ` Official Ghidra release archives include no macOS decompiler; build it from the archive's decompiler source as described in docs/getting-started/installation.md#${architecture === "arm64" ? "macos-arm64-native-decompiler" : "missing-macos-native-decompiler"}.`
: platform === "linux" && architecture === "arm64"
? " Official Ghidra release archives may not include a Linux arm64 decompiler; build Ghidra's native components for this host as described in docs/getting-started/installation.md#ghidra."
: "";
/**
* Whether a JVM os.name value selects the host platform's native OS directory.
* Unknown values never align with the validated host directory; admission