Skip to content

fix(helper): remove our dyld entry by name on teardown#80

Merged
0xnirapod merged 1 commit into
mainfrom
fix/dyld-teardown-by-name
Jun 29, 2026
Merged

fix(helper): remove our dyld entry by name on teardown#80
0xnirapod merged 1 commit into
mainfrom
fix/dyld-teardown-by-name

Conversation

@athexweb3

Copy link
Copy Markdown
Contributor

Teardown matched the shared DYLD_INSERT_LIBRARIES entry by exact path and resolved that path through the slice locator. A slice that moved or was deleted between arm and disarm made the locator return nil, so clearInjection skipped the removal and stranded a stale entry pointing at a missing dylib; a merely relocated slice failed the exact-path match the same way. Both then needed a manual launchctl unsetenv to clear.

  • Match shared-variable entries by file name, so teardown finds our slice after its path moves or only its canonical name is known.
  • Remove on teardown by the platform's canonical slice name, independent of the locator, so a relocated or absent slice still tears down.
  • composed() replaces an entry carrying the same file name, so re-arming a moved slice never doubles ours.

InjectionEnv unit tests extended with the moved-path and bare-name cases; the existing distinct-basename cases are unchanged. The full swift test gate across all four packages and fence-check.sh pass locally.

Teardown resolved the slice path through the locator and matched the shared
DYLD_INSERT_LIBRARIES entry by exact path. A slice moved or deleted between
arm and disarm made the locator return nil, so clearInjection skipped the
removal and stranded an entry pointing at a missing dylib; a merely relocated
slice failed the exact-path match the same way, and both then needed a manual
launchctl unsetenv.

Match entries by file name, and remove on teardown by the platform's canonical
slice name, independent of the locator, so a relocated or absent slice still
tears down. composed() now replaces an entry carrying the same file name, so
re-arming a moved slice never doubles ours.
@athexweb3
athexweb3 requested a review from 0xnirapod as a code owner June 29, 2026 16:22

@0xnirapod 0xnirapod left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Teardown removes our entry by canonical name, independent of the locator; moved-path and bare-name cases covered. CI green.

@0xnirapod
0xnirapod merged commit 4ce78ac into main Jun 29, 2026
3 checks passed
@0xnirapod
0xnirapod deleted the fix/dyld-teardown-by-name branch June 29, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants