Skip to content

test(scripts): 独立检查 Linux 发布包的 glibc 版本要求 - #61

Merged
SXP-Simon merged 1 commit into
mainfrom
split/49-glibc
Nov 27, 2026
Merged

SXP-Simon merged 1 commit into
mainfrom
split/49-glibc

Conversation

@SXP-Simon

@SXP-Simon SXP-Simon commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

场景与改动

发布包可能在构建机上可用,却因某个后端要求更高版本的 glibc 而无法在目标系统启动。

增加本地可运行的 GNU readelf 检查脚本、合成 ELF 回归和发布文档,让调用者明确传入要验证的 glibc 版本上限。

维护者能定位是哪个已打包程序超出指定上限,并区分工具缺失、包损坏等原因。

独立验证

在有 C 编译器和 GNU readelf 的 Linux 上执行 python3 scripts/tests/test_linux_glibc.py -v。对实际解包目录执行 python3 scripts/check-linux-glibc.py <bundle> --max-glibc <version>。

从 #49 拆出,直接基于 main@06cfd43,可以独立审查。来源提交为 8f9eb02。

Summary by Sourcery

Add independent Linux release validation for detecting ELF files that require a newer glibc version than the target system supports.

New Features:

  • Add a local Linux bundle checker that validates ELF GLIBC requirements against an explicitly supplied maximum version and reports offending files.

Enhancements:

  • Provide distinct diagnostics and exit codes for missing tools, missing required backends, invalid bundles, malformed ELF metadata, and version-limit violations.

Documentation:

  • Document how to run the glibc compatibility check on unpacked Linux release bundles and interpret its results.

Tests:

  • Add Linux regression tests using synthesized ELF files to verify version parsing, compatibility limits, malformed bundles, missing dependencies, and argument validation.

背景:发布包可能在构建机上可用,却因某个后端要求更高版本的 glibc 而无法在目标系统启动。

解决手段:增加本地可运行的 GNU readelf 检查脚本、合成 ELF 回归和发布文档,让调用者明确传入要验证的 glibc 版本上限。

收益:维护者能定位是哪个已打包程序超出指定上限,并区分工具缺失、包损坏等原因。
@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

API

Define the checker’s command-line contract, including the required glibc ceiling and the distinct missing-tool result.

  • scripts/check-linux-glibc.py L81-88

Implementation

Implement ELF version-need parsing, bundle validation, ceiling comparison, and remaining command execution and error handling.

  • scripts/check-linux-glibc.py L1-80, L89-106

Documentation

Document how to run the checker locally, interpret its exit codes, and understand the reported release comparison.

  • docs/release.md L57-68

Tests

Exercise the checker with synthetic ELF files and cover version comparisons, malformed bundles, missing tools, and invalid arguments.

  • scripts/tests/test_linux_glibc.py L1-73

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@SXP-Simon

Copy link
Copy Markdown
Owner Author

拆分依据与实测

原 #49 留下的证据。 原 Linux 实包 12 个 ELF 中有两个后端要求 GLIBC_2.43,Debian 13 的 2.41 无法直接启动。当前 main 已固定 Ubuntu 24.04 构建;本稿给维护者一个额外的成品检查入口,不改 CI。 原 PR 说明 · Debian 实包失败、重建及前后核对

本次独立分支验证(2297f76)。 在本机 WSL Ubuntu 22.04 中以真实 C 编译器和 GNU readelf 执行 python3 scripts/tests/test_linux_glibc.py -v,5/5 通过、零跳过。覆盖库定义与真实导入、上限比较、损坏 ELF、后端缺失和工具缺失。 本次没有用正式发行包再次测目标系统启动。

七个分支都直接基于同一个 main 提交,21 对分支试合并均无冲突,正序和逆序七项合并得到相同文件树。组合后重新构建,18 个 MCP 单测通过,并核对握手、14 个工具的接口及相关的真实 stdio 场景。

@SXP-Simon
SXP-Simon marked this pull request as ready for review November 27, 2026 07:51
@sourcery-ai

sourcery-ai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Sorry @SXP-Simon, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@SXP-Simon
SXP-Simon merged commit ca9aa95 into main Nov 27, 2026
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.

1 participant