Skip to content

Verify C++ binaries run with right stdlib - #604

Merged
nikobockerman merged 1 commit into
mainfrom
verify-cpp-binaries-run-with-correct-stdlib
Jul 25, 2026
Merged

Verify C++ binaries run with right stdlib#604
nikobockerman merged 1 commit into
mainfrom
verify-cpp-binaries-run-with-correct-stdlib

Conversation

@nikobockerman

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 2, 2026 18:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a CI/runtime guard to ensure C++ artifacts produced by the solver build actually load the intended C++ standard library at runtime (not just link against it), preventing silent fallback to system-provided libstdc++/libc++.

Changes:

  • Introduces a new mise task (cpp:verify-runtime-stdlib) that scans a CMake build directory and verifies resolved runtime library paths via ldd (Linux) / otool (macOS).
  • Integrates the verification into the C++ GitHub Actions workflow, selecting the expected runtime prefix based on the matrix (libstdc++ vs libc++, hardened vs non-hardened).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
mise-tasks/cpp/verify-runtime-stdlib.py New verifier script that inspects built binaries and asserts libstdc++/libc++ loads from an expected prefix.
.github/workflows/cpp-build-test-run.yaml Adds a workflow step to run the verifier with an expected prefix derived from the build matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/cpp-build-test-run.yaml
Comment thread mise-tasks/cpp/verify-runtime-stdlib.py Outdated
@nikobockerman
nikobockerman force-pushed the verify-cpp-binaries-run-with-correct-stdlib branch from 7c1c91d to f6b0a83 Compare July 2, 2026 19:10
Copilot AI review requested due to automatic review settings July 2, 2026 19:41
@nikobockerman
nikobockerman force-pushed the verify-cpp-binaries-run-with-correct-stdlib branch from f6b0a83 to e091b2b Compare July 2, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread mise-tasks/cpp/verify-runtime-stdlib.py
Comment thread mise-tasks/cpp/verify-runtime-stdlib.py Outdated
Comment thread mise-tasks/cpp/verify-runtime-stdlib.py
@nikobockerman
nikobockerman force-pushed the verify-cpp-binaries-run-with-correct-stdlib branch from e091b2b to 3c44a71 Compare July 2, 2026 20:44
@nikobockerman
nikobockerman requested a review from Copilot July 2, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread mise-tasks/cpp/verify-runtime-stdlib.py Outdated
@nikobockerman
nikobockerman force-pushed the verify-cpp-binaries-run-with-correct-stdlib branch from 3c44a71 to d833628 Compare July 2, 2026 21:29
@nikobockerman
nikobockerman requested a review from Copilot July 2, 2026 21:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread mise-tasks/cpp/verify-runtime-stdlib.py Outdated
@nikobockerman
nikobockerman force-pushed the verify-cpp-binaries-run-with-correct-stdlib branch from d833628 to 3edc7a9 Compare July 2, 2026 22:03
Copilot AI review requested due to automatic review settings July 25, 2026 19:33
@nikobockerman
nikobockerman force-pushed the verify-cpp-binaries-run-with-correct-stdlib branch from 3edc7a9 to cff15fb Compare July 25, 2026 19:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

mise-tasks/cpp/verify-runtime-stdlib.py:139

  • On macOS, _resolve_install_name treats @loader_path/@executable_path expansions as resolvable only if the expanded string starts with /. If the scanned binary path is relative (e.g. when <build_dir> is passed as a relative path), the expansion becomes a relative path and will be incorrectly reported as <not-found> even when the file exists.
    expanded = _expand_at_path(name, str(binary.parent), is_dylib=is_dylib)
    if expanded.startswith("/"):  # @loader_path, or @executable_path for an executable
        return expanded if Path(expanded).exists() else _NOT_FOUND
    return _NOT_FOUND  # e.g. @executable_path in a dylib: not statically resolvable

mise-tasks/cpp/verify-runtime-stdlib.py:215

  • rstrip("/") can turn an intended root prefix ("/") into the empty string, which then makes _under_prefix compare against the current working directory instead of /. This is a surprising edge case for callers that may want to allow system libraries by passing /.
    expected_prefix = os.environ["usage_expected_prefix"].rstrip("/")  # noqa: SIM112

Comment thread mise-tasks/cpp/verify-runtime-stdlib.py
Copilot AI review requested due to automatic review settings July 25, 2026 21:15
@nikobockerman
nikobockerman force-pushed the verify-cpp-binaries-run-with-correct-stdlib branch from cff15fb to 7a1a5ea Compare July 25, 2026 21:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread mise-tasks/cpp/verify-runtime-stdlib.py
Comment thread mise-tasks/cpp/verify-runtime-stdlib.py
@nikobockerman
nikobockerman merged commit 953f7b3 into main Jul 25, 2026
53 checks passed
@nikobockerman
nikobockerman deleted the verify-cpp-binaries-run-with-correct-stdlib branch July 25, 2026 21:43
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