mirror of
https://github.com/morluto/rea
synced 2026-10-27 14:42:18 -04:00
30ba5e99f9
inspect-macho listed the LC_ID_DYLIB command of a dylib as a dependency, so every dylib reported a self-dependency and an inflated exhaustive count, while trace-dylib-resolution correctly treats that name as the image identity. The dependency collector now skips LC_ID_DYLIB; the command, with its install name, remains in the raw load commands. Fixes #3872 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import { NativeMacOSProvider } from "../../../../src/native/NativeMacOSProvider.js";
|
|
import {
|
|
NativeFixtureRunner,
|
|
nativeFixture,
|
|
nativeMachoTarget,
|
|
withOtoolMachHeader,
|
|
} from "../../../fixtures/nativeCommands.js";
|
|
|
|
it("retains native re-export dependencies alongside ordinary and identity commands", async () => {
|
|
const runner = new NativeFixtureRunner({
|
|
otool: withOtoolMachHeader(
|
|
await nativeFixture("native-reexport/otool-load.txt"),
|
|
),
|
|
});
|
|
const client = new NativeMacOSProvider({}, runner, "darwin").createClient(
|
|
nativeMachoTarget("/owned/libOuter.dylib"),
|
|
);
|
|
const result = await client.execute("inspect_macho", {});
|
|
if (!result.ok) throw result.error;
|
|
expect(result.value.result).toMatchObject({
|
|
dependencies: {
|
|
exhaustive: true,
|
|
total: 2,
|
|
items: [
|
|
expect.objectContaining({
|
|
kind: "LC_REEXPORT_DYLIB",
|
|
path: "@rpath/libLeaf.dylib",
|
|
}),
|
|
expect.objectContaining({
|
|
kind: "LC_LOAD_DYLIB",
|
|
path: "/usr/lib/libSystem.B.dylib",
|
|
}),
|
|
],
|
|
},
|
|
load_commands: {
|
|
items: expect.arrayContaining([
|
|
expect.objectContaining({ kind: "LC_ID_DYLIB" }),
|
|
]),
|
|
},
|
|
});
|
|
});
|