fix(apple): gate shared-cache answers on platform and verified subcaches
- Use a supplied cache for a process only when it serves the process's CPU family and one of its LC_BUILD_VERSION or LC_VERSION_MIN platforms matches the cache's platform or alternate platform; slices now report platforms. A limitation names each root the cache was not used for, and why. - Treat an image listed in the cache but mapped in a missing or UUID-mismatched subcache as undetermined, list it in coverage.unverified_shared_cache_images, and mark coverage partial. - Keep a cache hit conditional when an earlier candidate is undeterminable. - Open a development cache's named subcaches beside its base name. - Describe absolute paths as not evaluated only when no cache is supplied. - Preflight dyld_info in verify:dyld-shared-cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
202661f83b
commit
305474df6c
@@ -6,6 +6,7 @@ import { describe, expect } from "vitest";
|
||||
import {
|
||||
FILE_TYPE,
|
||||
LC,
|
||||
buildVersionCommand,
|
||||
dylibCommand,
|
||||
machoImage,
|
||||
rpathCommand,
|
||||
@@ -202,15 +203,23 @@ describe("trace-dylib-resolution CLI inputs", () => {
|
||||
await writeFiles(directory, {
|
||||
tool: machoImage({
|
||||
commands: [
|
||||
buildVersionCommand(1),
|
||||
dylibCommand(LC.LOAD_DYLIB, "/usr/lib/libSystem.B.dylib"),
|
||||
dylibCommand(LC.LOAD_DYLIB, "/usr/lib/libnotcached.dylib"),
|
||||
dylibCommand(LC.LOAD_DYLIB, "/usr/lib/swift/libswiftCore.dylib"),
|
||||
],
|
||||
}),
|
||||
// The .01 subcache holding libswiftCore is not written.
|
||||
dyld_shared_cache_arm64e: dyldCacheFixture([
|
||||
{
|
||||
path: "/usr/lib/libSystem.B.dylib",
|
||||
bytes: machoImage({ fileType: FILE_TYPE.dylib }),
|
||||
},
|
||||
{
|
||||
path: "/usr/lib/swift/libswiftCore.dylib",
|
||||
bytes: machoImage({ fileType: FILE_TYPE.dylib }),
|
||||
inSubcache: true,
|
||||
},
|
||||
]).main,
|
||||
});
|
||||
const result = await cli.run({
|
||||
@@ -234,7 +243,12 @@ describe("trace-dylib-resolution CLI inputs", () => {
|
||||
expect(trace.edges.map(({ resolution }) => resolution.status)).toEqual([
|
||||
"shared-cache",
|
||||
"undetermined",
|
||||
"undetermined",
|
||||
]);
|
||||
expect(trace.coverage).toMatchObject({
|
||||
status: "partial",
|
||||
unverified_shared_cache_images: ["/usr/lib/swift/libswiftCore.dylib"],
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user