Repository navigation
Upgrade M2Crypto to 0.45.1 to build on Ubuntu 26.04 - #423
Merged
rtibbles merged 1 commit intoNov 12, 2026
Merged
Conversation
M2Crypto ships no Linux wheels, so the postgres and accelerated extras
build it from source with the system SWIG and glibc headers. On the
ubuntu-26.04 runner (SWIG 4.4, GCC 15), SWIG cannot evaluate the newer
feature-test expressions in glibc's features.h. It then picks the wrong
fd_set member name from sys/select.h, and the generated wrapper fails
to compile ("'fd_set' has no member named '__fds_bits'").
M2Crypto 0.45.0 added a workaround that shadows sys/types.h for SWIG,
and 0.45.1 is the first sdist that includes the shadow directory.
Morango only uses M2Crypto's BIO and RSA modules, which this upgrade
does not change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bjester
marked this pull request as ready for review
November 12, 2026 00:03
bjesterbot
approved these changes
Nov 12, 2026
bjesterbot
left a comment
There was a problem hiding this comment.
Upgrading M2Crypto to 0.45.1 in the postgres and accelerated extras cleanly resolves the Ubuntu 26.04 SWIG 4.4 and glibc fd_set build failure without altering M2CryptoKey behavior. Diffing the 0.41.0 and 0.45.1 sdists confirms that M2Crypto.BIO and M2Crypto.RSA preserve all signatures and semantics used in morango/models/fields/crypto.py, and CI confirms that "Python postgres unit tests" builds and passes on ubuntu-latest.
- Inline Comments: 1 ❓ Question
- ✅ Positive Highlight: Pinning
0.45.1hits the exact compatibility window for Morango's>=3.6,<3.15floor. It is the first sdist that packagessystem_shadowing/sys/types.hfor SWIG 4.4, and the last release before0.46.0through0.51.0dropped Python 3.7 and 3.8 from[build-system].requiresinpyproject.toml. Regeneratinguv.lockwithuv 0.13.7also keeps the lockfile diff isolated tom2crypto.
Verification Status
- Crypto unit suite: Passing (
PYTHONPATH=.:./tests/testapp .venv/bin/python -O -m pytest tests/testapp/tests/test_crypto.py -v, 39 passed, 0 skipped againstM2Crypto 0.45.1) - Lint and lockfile verification: Clean (
.venv/bin/prek run --all-files --show-diff-on-failure, includingruff,ruff-format,uv-lock,yamlfmt, andactionlint) - GitHub Actions CI:
"Python postgres unit tests","All file linting","SQLite migration tests","Python unit tests on Windows Server (3.8)", and all"Python unit tests + cryptography"jobs (3.6through3.14) passed (4 pure-Python SQLite matrix jobs still running at review time)
Generated by Antigravity using model Gemini 4 Carbon (Medium)
1 of 3 tasks
rtibbles
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades M2Crypto from 0.41.0 to 0.45.1 in the
postgresandacceleratedextras. With 0.41.0, M2Crypto doesn't build on Ubuntu 26.04, which GitHub now uses forubuntu-latest. That breaks the "Python postgres unit tests" job (for example, on #421), and it breakspip install morango[postgres]for users on 26.04.M2Crypto has no Linux wheels, so it always builds from source with the system SWIG and glibc headers. The 26.04 runner has SWIG 4.4 and GCC 15. The 24.04 runner had SWIG 4.2 and GCC 13. During the build, SWIG can't evaluate some
#ifexpressions in the newer glibcfeatures.h. It then reads the wrong branch offd_setinsys/select.h, and the generated wrapper doesn't compile:M2Crypto 0.45.0 added a workaround for this ("swig: Workaround for reading sys/select.h ending with wrong types"). The workaround gives SWIG an empty
sys/types.h, so SWIG never parsesfd_set. The 0.45.0 sdist left out that file, and 0.45.1 is the first sdist that includes it. I picked 0.45.1 because it's the smallest upgrade with the fix. Morango only usesM2Crypto.BIOandM2Crypto.RSA. 0.45.0 removed Engine support, which morango doesn't use. 0.45.1 still lists Python 3.6 to 3.12.Pinning the postgres job to
ubuntu-24.04would also make CI pass, but users on 26.04 still couldn't install the extras.TODO
tests/testapp/tests/test_crypto.pyalready testsM2CryptoKeywhenever M2Crypto is installed.CHANGELOG.md.pyproject.toml, and I regenerateduv.lock.Reviewer guidance
ubuntu-26.04. That job also runs the M2Crypto tests intest_crypto.pyagainst 0.45.1.uv.lockwith uv 0.13.7, the version that CI installs. An older uv (0.11.15) lowered the lockrevisionfrom 5 to 3 and rewrote markers across about 500 lines. With 0.13.7, the lock diff contains only them2cryptoentry.Issues addressed
No tracking issue. This fixes the "Python postgres unit tests" failure on #421. #419 passed because it ran on
ubuntu-24.04.Documentation
N/A. The only documentation change is the
CHANGELOG.mdentry.AI usage
I asked Claude Code to investigate the CI failure on #421. It read the job logs and compared the runner images and toolchains between #419 and #421. It then downloaded the M2Crypto 0.41.0, 0.45.1, and 0.51.0 sdists to find the upstream fix and the first release that includes it. Claude Code also made the change and regenerated
uv.lockwith the uv version that CI uses, after an older local uv produced a noisy lock diff. It drafted this description. It couldn't build M2Crypto in its sandbox, so CI on this PR is the verification step.🤖 Generated with Claude Code