apply_patch_toml.sh: reverse-check probe prints 'patch does not apply' errors on every fresh configure

未关闭 适合新手
#356 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
cmake, git, shell
领域
build-system

调研方向

打开 cmake/patches/apply_patch_toml.sh,检查它如何判断 tomlplusplus 补丁是否已经应用;同时阅读 cmake/toml.cmake 中相关的 guard。执行一次全新的 configure,再执行第二次 configure,以验证补丁应用时不会出现 probe 错误、仍然具有幂等性,并且仍会报告真实的应用失败。

由索引模型根据 Issue 内容生成。

描述

Summary

cmake/patches/apply_patch_toml.sh prints four error: lines on every fresh configure, even though everything works correctly:

[ 44%] Performing patch step for 'tomlplusplus-populate'
error: patch failed: include/toml++/impl/make_node.h:134
error: include/toml++/impl/make_node.h: patch does not apply
error: patch failed: CMakeLists.txt:31
error: CMakeLists.txt: patch does not apply
Cause

The script answers the question "was the patch already applied?" by attempting a reverse apply:

if ! git apply -R --ignore-whitespace ${TOML_PATCH} --check; then git apply --ignore-whitespace ${TOML_PATCH}; fi

git apply -R --check fails loudly when the patch is not yet applied — which is the normal case on every fresh FetchContent clone. The errors come from the probe, not from the actual application (which succeeds silently right after). Downstream consumers see scary patch does not apply errors in otherwise green build logs (we hit this building RediSearch → VectorSimilarity → SVS, and spent time confirming the patch was in fact applied).

Suggested fix

Probe the state instead of reverse-applying — the TOMLPLUSPLUS_INSTALL option that the patch itself adds to CMakeLists.txt is proof of appliedness:

if ! grep -q TOMLPLUSPLUS_INSTALL CMakeLists.txt; then git apply --ignore-whitespace ${TOML_PATCH}; fi
  • Same idempotence for CMake re-configures (the case the script guards against, per the comment in cmake/toml.cmake).
  • Nothing is silenced: the real git apply keeps its stderr, so a genuinely failing patch still surfaces.
  • Verified against a fresh marzer/tomlplusplus clone at v3.3.0: first run applies the patch with zero output, second run skips with zero output.

Happy to open a PR if you'd take one.

主要语言
C++
星标
241
派生
48
平均合并
4 天 21 小时
30 天内合并 PR
11

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

intel/ScalableVectorSearch 的其他 Issue

查看 intel/ScalableVectorSearch 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。