`wrap` layer expansion can loop forever when the core content contains `{CORE_TEMPLATE}`
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 84/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- bash
- Domaine
- tooling
Piste de recherche
Commencez à scripts/bash/common.sh:606 et inspectez la boucle d’expansion des espaces réservés de la stratégie wrap. Exécutez une couche wrap dont le contenu central contient le littéral {CORE_TEMPLATE}, puis confirmez que l’expansion se termine tout en remplaçant l’espace réservé de chaque couche et en préservant le contenu environnant.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Affected: scripts/bash/common.sh:606, confirmed present at tag v0.11.9
(fetched from raw.githubusercontent.com/github/spec-kit/v0.11.9/scripts/bash/common.sh).
The wrap strategy substitutes the core content into the layer at each {CORE_TEMPLATE}
placeholder:
case "$layer_content" in
*'{CORE_TEMPLATE}'*) ;;
*) echo "Error: wrap strategy missing {CORE_TEMPLATE} placeholder" >&2; return 1 ;;
esac
while [[ "$layer_content" == *'{CORE_TEMPLATE}'* ]]; do
local before="${layer_content%%\{CORE_TEMPLATE\}*}"
local after="${layer_content#*\{CORE_TEMPLATE\}}"
layer_content="${before}${content}${after}"
done
The loop condition re-tests the string it just substituted into. If $content itself
contains the literal {CORE_TEMPLATE}, every iteration reintroduces the placeholder, the
condition never goes false, and layer_content grows by ${#content} each pass — an
unbounded loop that ends in memory exhaustion rather than an error message.
The guard above it does not cover this: it rejects a layer that is missing the
placeholder, and says nothing about the content being substituted in.
Suggested fix — scan left to right and never re-scan what was already substituted, which
also preserves the multi-placeholder behaviour the loop exists for:
out=""; rest="$layer_content"
while [[ "$rest" == *'{CORE_TEMPLATE}'* ]]; do
out="${out}${rest%%\{CORE_TEMPLATE\}*}${content}"
rest="${rest#*\{CORE_TEMPLATE\}}"
done
layer_content="${out}${rest}"
Reachability / why we are reporting rather than patching. Found while adopting a
Spec Kit-based plugin in a downstream repo. It is not reachable through that plugin: it
ships nothing that declares {CORE_TEMPLATE}, so $content never carries the placeholder
on that path (grep -rl CORE_TEMPLATE over the plugin returns nothing). It is reachable for
any consumer that authors a wrap template layer whose core content includes the literal
token — which is a normal thing to do by accident when a template documents its own
placeholder syntax.
- Langage dominant
- Python
- Étoiles
- 138k
- Forks
- 12.4k
- Merge moyen
- 2 j 7 h
- PR mergées (30 j)
- 158
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de github/spec-kit
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
Windows: Copilot integration hardcodes `copilot.cmd`, breaking installs that ship `copilot.exe`Ouvertebug-assess severity-medium triage-nice-to-have
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
github/spec-kit#4755 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
triage-nice-to-have
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: 给 slug 添加默认值Ouverteenhancement needs-triage triage-can-wait
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
github/spec-kit#4627 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
needs-triage triage-nice-to-have
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
github/spec-kit#4527 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de github/spec-kit
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
PedestrianDynamics/pyFDS-Evac#199 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
521xueweihan/HelloGitHub#3790 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
sandialabs/atlas-ui-3#978 ·
Les mainteneurs répondent en général sous 1 jour
-
area: tests perceived difficulty: 2
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Nitjsefnie-Harness-Commons/daedalus#1255 ·
Les mainteneurs répondent en général sous 1 jour
-
hf-audiolm-qwen: `generate_until` hardcodes `.to("cuda")` and aborts on non-CUDA acceleratorsOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
EleutherAI/lm-evaluation-harness#4256 ·
Les mainteneurs répondent en général sous 1 jour