Skip to content

build(labels): pin demangle 0.5.1 so plugins cannot replace built-ins - #383

Merged
danielplohmann merged 1 commit into
danielplohmann:masterfrom
r0ny123:demangle-0.5.1
Oct 14, 2026
Merged

danielplohmann merged 1 commit into
danielplohmann:masterfrom
r0ny123:demangle-0.5.1

Conversation

@r0ny123

@r0ny123 r0ny123 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #379, point 6 of the review: an installed plugin should not be able to replace a built-in demangling scheme.

Before: with demangle==0.5.0, the first demangle call read every demangle.languages entry point, and a plugin registered as itanium, msvc, rust or swift replaced that scheme for the whole process, so an unrelated package could change smda's labels.

After: smda pins demangle==0.5.1. That release reads entry points only when a caller calls load_plugins(), which smda never does. Its demangling schemes are unchanged from 0.5.0, so labels are the same.

tests/testDemangleSchemes.py installs a fake distribution advertising all four names. It then checks in a fresh interpreter that smda's demanglers give their usual answers and that each name still resolves to the built-in scheme. It fails on 0.5.0. The CHANGELOG line for #379 now names the new pin.

Full suite: 2,233 passed, 1 skipped. ruff, ruff format and ty are clean.

demangle 0.5.0 read the demangle.languages entry points on first use,
and a plugin registered under a built-in name such as itanium replaced
that scheme for every caller in the process, so an unrelated install
could change smda's labels. 0.5.1 reads entry points only when a caller
calls load_plugins(), which smda never does. The schemes themselves are
unchanged between the two releases.

The test installs a fake distribution advertising all four names smda
uses and checks, in a fresh interpreter, that each still resolves to
the built-in. It fails on 0.5.0.

@danielplohmann danielplohmann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approving for 4.10.0. I diffed the 0.5.0 and 0.5.1 wheels and sdists from PyPI. Only __init__.py, api.py, cli.py and core/registry.py changed, and nothing under schemes/, so labels are byte-for-byte the same. Entry points are now read only in load_plugins(), which only the demangle CLI calls and smda never does. There are no new dependencies, no build hooks and no import-time side effects. The new test fails on 0.5.0 (an advertised plugin answered), passes on 0.5.1 in 0.24 s, and turns red again when load_plugins() is forced on 0.5.1, so it would catch a regression. Keeping the exact == pin is right for the label-stability reason in #379.

Nits, take them or leave them:

  • A host application in the same process can still call demangle.load_plugins() / register_language() itself. Itanium, MSVC and Swift then fail silently, with the name left mangled. One sentence in the pin comment would record that.
  • CHANGELOG: the bullet has no (#379, #383). "The four demangler modules" is harder to grep than the module names it replaced. And the Cost sentence lost its baseline ("than the native build did").

@danielplohmann
danielplohmann merged commit 3b623e6 into danielplohmann:master Oct 14, 2026
23 checks passed
r0ny123 added a commit to r0ny123/smda that referenced this pull request Oct 14, 2026
0.6.0 keeps entry points behind load_plugins() and returns the same
output as 0.5.1 for all 20,430 names the test suite passes it.

The pin comment notes that a host calling load_plugins() or
register_language() itself can still replace a scheme. The CHANGELOG
entry names the four modules again, restores the native-build baseline
for the cost figure and links danielplohmann#379 and danielplohmann#383.
danielplohmann pushed a commit that referenced this pull request Oct 14, 2026
* build(labels): bump demangle to 0.6.0, take #383 review nits

0.6.0 keeps entry points behind load_plugins() and returns the same
output as 0.5.1 for all 20,430 names the test suite passes it.

The pin comment notes that a host calling load_plugins() or
register_language() itself can still replace a scheme. The CHANGELOG
entry names the four modules again, restores the native-build baseline
for the cost figure and links #379 and #383.

* docs(changelog): give the demangle 0.6.0 bump its own entry

0.6.0 moves labels on non-ASCII Itanium and Swift names and on ARM64e
MSVC names, none of which the fixtures contain. The #379 entry goes
back to describing the 0.5.1 pin it was measured on, and the bump gets
its own bullet naming those changes. The pin comment now says a
replacing plugin can change labels, not only leave them mangled.
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