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

Ouverte Adaptée aux débutants
#356 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 5 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
1/5
Temps estimé
Moins d'une heure
Accessibilité débutants
88/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Calme
Stack technique
cmake, git, shell
Domaine
build-system

Piste de recherche

Ouvrez cmake/patches/apply_patch_toml.sh et examinez comment il vérifie si le patch tomlplusplus a déjà été appliqué ; lisez également la guard correspondante dans cmake/toml.cmake. Effectuez une configuration vierge, puis une deuxième configuration, afin de vérifier que le patch s’applique sans erreurs de sonde, reste idempotent et signale toujours les véritables échecs d’application.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
C++
Étoiles
241
Forks
48
Merge moyen
4 j 21 h
PR mergées (30 j)
11

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de intel/ScalableVectorSearch

Toutes les issues de intel/ScalableVectorSearch

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.