Repository navigation
Conversation
The #698 LD_LIBRARY_PATH libstdc++ injection is only needed and ABI-safe on NixOS. Gate the two injection-presence tests to NixOS and add an FHS-only guard asserting the Nix C++ runtime is not exposed on LD_LIBRARY_PATH (it breaks host binaries with GLIBC_ABI_DT_X86_64_PLT). Fails until the dev-shell gate lands. Refs: #703
…ixOS The #698 dev-shell exported the Nix C++ runtime (stdenv.cc.cc.lib, linked against glibc 2.42) onto LD_LIBRARY_PATH unconditionally. On an FHS host with an older system glibc (Ubuntu 24.04 = 2.39) that libstdc++ leaks into host binaries — every just recipe's '#!/usr/bin/env bash', and anything an /etc/ld.so.preload agent pulls libstdc++ into — dragging in the Nix libm.so.6 and aborting with 'GLIBC_ABI_DT_X86_64_PLT not found'. Inject only on NixOS ([ -e /etc/NIXOS ]), where it is both required and ABI-safe; FHS hosts resolve libstdc++ from the system loader, so the injection is a no-op and nothing leaks. Refs: #703
This was referenced Jul 1, 2026
Closed
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.
Description
Closes #703. Fixes a regression from #698 that broke every
justrecipe insidenix developon non-NixOS (FHS) hosts with:Root cause: #698 exported
${stdenv.cc.cc.lib}/lib(the Nix C++ runtime, linkedagainst glibc 2.42) onto the dev-shell
LD_LIBRARY_PATHunconditionally — sothe pymarkdown pre-commit wheel could resolve
libstdc++.so.6. On an FHS hostwhose system glibc is older (Ubuntu 24.04 = 2.39), that Nix
libstdc++ispulled into host binaries — every
justrecipe runs via#!/usr/bin/env bash,and on hosts with an
/etc/ld.so.preloadagent that linkslibstdc++it reaches/usr/bin/envdirectly — dragging in the Nixlibm.so.6, which requires theGLIBC_ABI_DT_X86_64_PLTsymbol version the host's 2.39libcdoes not export.It worked on NixOS only because there the system glibc is the Nix glibc.
Type of Change
fix-- Bug fixChanges Made
flake.nix(mkProjectShell): inject the Nix C++ runtime ontoLD_LIBRARY_PATHonly on NixOS (
[ -e /etc/NIXOS ]), where it is both required (libstdc++is off the default loader path) and ABI-safe (system glibc is the Nix glibc).
On FHS hosts the system loader already resolves
libstdc++, so the injection isa no-op and nothing leaks into host binaries.
tests/test_flake_devshell.py: the [BUG] pre-commit: make the pymarkdown hook (pyjson5 C-extension / libstdc++) run on NixOS #698 injection-presence tests are gated toNixOS, and a new FHS-only
test_devshell_no_nix_cxx_runtime_leak_on_fhs_hostasserts the Nix C++ runtime is not exposed on
LD_LIBRARY_PATH(the REDanchor for this fix).
CHANGELOG.md(+ synced workspace copy):### Fixedentry.Changelog Entry
Testing
pytest tests/test_flake_devshell.py: 8 passed, 2skipped (the two NixOS-only injection tests skip on this FHS host; the
leak-guard passes).
Manual Testing Details
On Ubuntu 24.04 (glibc 2.39), inside
nix develop:LD_LIBRARY_PATHcarried…/gcc-15.2.0-lib/lib;just build/just test-batsaborted with the GLIBC error above.LD_LIBRARY_PATHis empty;/usr/bin/env bashruns;just lintpassesand
just buildproceeds into the real Nix image build.a818fb7), then the flakegate made it GREEN (
e27962a).Checklist
CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)