Skip to content

fix: prefix vendored mpack symbols#1880

Merged
jpnurmi merged 3 commits into
masterfrom
jpnurmi/fix/mpack
Jul 17, 2026
Merged

fix: prefix vendored mpack symbols#1880
jpnurmi merged 3 commits into
masterfrom
jpnurmi/fix/mpack

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Similar to getsentry/crashpad#143, but in C, we don't have namespaces, so the symbol rename comes with some less-nice define trickery... Includes a test to catch unprefixed mpack symbols:

$ tests/test_build_static.py::test_static_mpack
...
FAILED tests/test_build_static.py::test_static_mpack - AssertionError: libsentry.a contains 322 unprefixed MPack symbols: mpack_discard, mpack_done_array, mpack_done_bin, mpack_done_map, mpack_done_str, mpack_done_type, mpack_error_to_string, mpack_expect_array, mpack_expect_array_alloc_impl, mpack_expect_array_match

Close: #1878

@jpnurmi jpnurmi changed the title [WIP] fix: prefix mpack symbols to avoid conflicts [WIP] fix: prefix vendored mpack symbols Jul 17, 2026
jpnurmi added 3 commits July 17, 2026 11:56
Compile MPack through a Sentry-owned wrapper that maps externally linked
MPack symbols to a sentry__mpack_ prefix. Route internal consumers through
the wrapper and leave the vendored sources unchanged.
@jpnurmi
jpnurmi force-pushed the jpnurmi/fix/mpack branch from c7b83b0 to 396dd4c Compare July 17, 2026 09:56
Comment thread src/sentry_mpack.h

@jpnurmi jpnurmi Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is quite ugly but i still find it better than the alternative of prefixing all symbols in the vendored mpack sources. we should upgrade to the latest mpack, and then it gets painful if ours is heavily modified...

Note

Sentry Native vendors MPack 1.0, released upstream on October 20, 2018—about 7 years and 9 months old today: ludocode/mpack@e150cb7

It was imported into Sentry Native on February 24, 2020, with the Crashpad integration—about 6 years and 5 months ago: e4bed02

It has never been upgraded from 1.0. The vendored files only received two local patches:

  • September 15, 2020: work around missing _Static_assert support in MSVC: f143733
  • July 23, 2024: use Sentry’s allocator for MPack allocations: e58b655

The latest upstream release remains MPack 1.1.1 from January 2023.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 34.57447% with 123 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.15%. Comparing base (88e7bae) to head (396dd4c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1880      +/-   ##
==========================================
- Coverage   75.56%   75.15%   -0.42%     
==========================================
  Files          90       91       +1     
  Lines       21154    21342     +188     
  Branches     3759     3759              
==========================================
+ Hits        15986    16040      +54     
- Misses       4334     4476     +142     
+ Partials      834      826       -8     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jpnurmi jpnurmi changed the title [WIP] fix: prefix vendored mpack symbols fix: prefix vendored mpack symbols Jul 17, 2026

@JoshuaMoelans JoshuaMoelans 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.

nice, lgtm

@jpnurmi
jpnurmi merged commit 2b7e962 into master Jul 17, 2026
107 of 108 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/fix/mpack branch July 17, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants