`wrap` layer expansion can loop forever when the core content contains `{CORE_TEMPLATE}`
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- bash
- Área
- tooling
Línea de trabajo
Comienza en scripts/bash/common.sh:606 e inspecciona el bucle de expansión de marcadores de posición de la estrategia wrap. Ejecuta una capa wrap cuyo contenido central contenga el literal {CORE_TEMPLATE} y confirma que la expansión termina mientras reemplaza el marcador de posición de cada capa y conserva el contenido circundante.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 138k
- Forks
- 12.4k
- Merge medio
- 3 d 6 h
- PR fusionados (30 d)
- 145
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/spec-kit
-
enhancement needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
enhancement needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
enhancement needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
enhancement needs-triage triage-can-wait
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
triage-can-wait
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Todos los issues de github/spec-kit
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
canonical/paas-charm#368 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
addition to tracking list Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
StevenBlack/hosts#3256 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
qualcomm/qai-appbuilder#275 ·