fix(hopper): treat a directory launcher path as missing (#1426)
`HOPPER_LAUNCHER_PATH` availability was decided by an `X_OK` access check alone, which a searchable directory also passes. Pointing it at the `Hopper Disassembler.app` bundle instead of its launcher made `rea providers` report Hopper as available and `rea doctor` report it healthy, while analysis then failed with an unrelated `version_unresolved` rejection. Require a regular file in both the provider availability probe and the doctor executable probe, matching the Ghidra launcher check. A directory now reports `executable_missing`, and doctor reports `config_drift` with its existing HOPPER_LAUNCHER_PATH remediation. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
944981d8d5
commit
afdaf98117
@@ -1,6 +1,6 @@
|
||||
import { snapshotEnvironment } from "../process/snapshotEnvironment.js";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { accessSync, constants } from "node:fs";
|
||||
import { accessSync, constants, statSync } from "node:fs";
|
||||
|
||||
import { createAnalysisExecution } from "../application/AnalysisProvider.js";
|
||||
import type {
|
||||
@@ -75,6 +75,9 @@ export class HopperProvider implements AnalysisProviderCandidate {
|
||||
};
|
||||
try {
|
||||
accessSync(this.config.hopperLauncherPath, constants.X_OK);
|
||||
// A searchable directory, such as an .app bundle, also passes X_OK.
|
||||
if (!statSync(this.config.hopperLauncherPath).isFile())
|
||||
throw new TypeError("Hopper launcher is not a regular file");
|
||||
return {
|
||||
status: "available",
|
||||
code: null,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { dirname } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { parseConfig } from "../config/parseConfig.js";
|
||||
@@ -30,6 +32,19 @@ describe("Hopper provider discovery", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("reports a directory launcher path as missing", () => {
|
||||
const directory = dirname(process.execPath);
|
||||
expect(provider(directory).inspectAvailability()).toEqual({
|
||||
status: "unavailable",
|
||||
code: "executable_missing",
|
||||
reason: `Hopper launcher is missing or not executable: ${directory}`,
|
||||
diagnostics: {
|
||||
launcher_path: directory,
|
||||
platform: process.platform,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("separates target kind, format, and architecture support", () => {
|
||||
const hopper = provider(process.execPath);
|
||||
expect(hopper.inspectTargetSupport(databaseTarget())).toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user