fix: build release binaries on an older glibc, and refuse to ship a bad one - #30
Merged
Conversation
…ad one The 0.4.0 linux artifacts do not load on Debian bookworm: could not load library ".../typeid.so": /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found bookworm is the base for cloudnative-pg and the official postgres images, so in practice the release was unusable there. It took down a production database that installs the extension from the latest release. Cause is the move off BuildJet. Those runners were Ubuntu 22.04 (glibc 2.35); ubuntu-latest is 24.04 (glibc 2.39), and glibc is backward but not forward compatible — the linker records a minimum version per symbol and the loader refuses anything it cannot satisfy. Three symbols crossed the line: __isoc23_sscanf GLIBC_2.38 pidfd_getpid GLIBC_2.39 pidfd_spawnp GLIBC_2.39 The first is the subtle one. Nothing asked for a C23 API: from glibc 2.38 the headers redirect plain sscanf to __isoc23_sscanf, so ordinary code picks up a 2.38-only symbol purely from the build host's headers. Build the linux release jobs on ubuntu-22.04 and ubuntu-22.04-arm instead. 2.35 loads on bookworm (2.36), trixie (2.41) and anything newer; the rule is to build against the oldest runtime supported, not the newest available. Compilation and linking succeed either way — this only fails at dlopen on the target, which no test in this repository reaches. So the release now also inspects the built object and fails if any symbol requires more than glibc 2.35. Checked against both binaries: the 0.3.0 object reports 2.34 and passes, the 0.4.0 object reports 2.39 and fails. Released as 0.4.1 because 0.4.0 is already published; the upgrade script is empty since nothing about the schema changed.
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.
The 0.4.0 linux artifacts do not load on Debian bookworm:
bookworm is the base for cloudnative-pg and the official postgres images, so the release is effectively unusable there. It took down a production database that installs the extension from the latest release.
Cause
The move off BuildJet in #29. Those runners were Ubuntu 22.04 (glibc 2.35);
ubuntu-latestis 24.04 (glibc 2.39).glibc is backward but not forward compatible: the linker records a minimum version per symbol, and the loader refuses anything it cannot satisfy. Three symbols crossed the line:
The first is the subtle one. Nothing asked for a C23 API — from glibc 2.38 the headers redirect plain
sscanfto__isoc23_sscanf, so ordinary code picks up a 2.38-only symbol purely from the build host's headers. No source change involved.Fix
Linux release jobs build on
ubuntu-22.04/ubuntu-22.04-arm. glibc 2.35 loads on bookworm (2.36), trixie (2.41) and anything newer. The rule is to build against the oldest runtime supported, not the newest available.The guard
Compilation and linking succeed either way — this only fails at
dlopenon the target, which no test in this repo reaches. A green CI told me nothing. So the release now inspects the built object and fails if any symbol needs more than glibc 2.35:Verified against both binaries before committing:
Version
Released as 0.4.1 — 0.4.0 is already published and republishing different binaries under the same version would be worse. The upgrade script is empty; nothing about the schema changed.
🤖 Generated with Claude Code