mirror of
https://github.com/morluto/rea.git
synced 2026-12-02 11:33:10 +00:00
fix(target): name the raw-binary load when no route recognizes a header
When header detection admitted no route for a file, open_binary and inspect_artifact refused it with the generic "select a supported, well-formed target", leaving no next step for a headerless firmware or memory image. The explicit raw-binary load is the only route that admits such a file, so the producer now names it with its required architecture and entry_point. inspect_artifact shares the same detection, so it is not offered as a way to identify the file. Refs #15319 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
1 parent
a7039c73e5
commit
630ce39c22
2 files changed
+11
-1
No files matched your search
@@ -567,6 +567,10 @@ const readOpenedBinaryTarget = async (
|
||||
new BinaryTargetError(path, reason, {
|
||||
constraint: "file_format_rejected",
|
||||
...(diagnostics === undefined ? {} : { diagnostics }),
|
||||
// inspect_artifact shares this detection, so only the explicit
|
||||
// raw-binary load admits a file whose header no route recognizes.
|
||||
remediationAction:
|
||||
'Select a supported, well-formed target. To analyze a headerless firmware or memory image, open it with format "raw-binary", architecture and entry_point.',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,8 +72,14 @@ cliTest(
|
||||
XDG_CACHE_HOME: root,
|
||||
},
|
||||
});
|
||||
// Detection never assumes raw-binary; the refusal names the explicit load.
|
||||
expect(before.exitCode).not.toBe(0);
|
||||
expect(JSON.stringify(before.json)).not.toContain("raw-binary");
|
||||
expect(before.json).toMatchObject({
|
||||
details: { constraint: "file_format_rejected" },
|
||||
remediation: {
|
||||
action: expect.stringContaining('format "raw-binary", architecture'),
|
||||
},
|
||||
});
|
||||
const missing = await cli.run({
|
||||
arguments: ["inspect", path, "--target-format", "raw-binary", "--json"],
|
||||
environment: {
|
||||
|
||||
Reference in new issue
Block a user