json_pretty inserts formatting inside strings, corrupting values and producing invalid JSON
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
Línea de trabajo
Start with lib/json.eigs:55–94 and run the supplied program through src/eigenscript to observe the corruption. Add regression coverage for punctuation, escaped quotes, backslashes, and nested arrays or objects, using an independent JSON validity check. Done means formatting occurs only outside strings and all string values remain exact; docs/STDLIB.md:488 describes the promised API.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
json.json_pretty inserts indentation inside JSON strings. Valid JSON becomes invalid JSON, and the string value changes if the output is decoded by EigenScript's permissive string decoder.
Reproduce
Save this program and run it with src/eigenscript:
import json
original is "{\"s\":\"a,b\"}"
pretty is json.json_pretty of original
print of pretty
print of (json_encode of (json_decode of pretty))
Actual formatted text:
{
"s":"a,
b"
}
Expected: the value remains exactly a,b; formatting whitespace is inserted only outside JSON strings. Python's json.loads rejects the actual text with Invalid control character. EigenScript's decoder accepts the raw newline and re-encodes the changed value as {"s":"a,\n b"}.
Cause and coverage
lib/json.eigs:55–94 reacts to every brace, bracket and comma without tracking whether the current character is inside a JSON string or follows an escape. The public API promises indented JSON output.
No existing test calls json_pretty. Regression cases should preserve exact string values containing punctuation, escaped quotes and backslashes, while still indenting real arrays/objects. Merely checking that EigenScript's decoder accepts the output is insufficient: its permissive decoder accepts this corrupted result. Include an independent JSON validity check or verify that no unescaped control characters were inserted into string tokens.
Confirmed with a fresh default release build of b91768e23c5a874a64e76e4af9ab291e6aa49983, with inherited EIGS_* variables removed.
- Lenguaje dominante
- C
- Estrellas
- 3
- Forks
- 7
- Merge medio
- 4 h 15 min
- PR fusionados (30 d)
- 106
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la 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 InauguralSystems/EigenScript
-
area:lint-tooling bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
InauguralSystems/EigenScript#1340 ·
Los mantenedores suelen responder en 1 día
-
area:stdlib found-by:code-review kind:silent-wrong
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
InauguralSystems/EigenScript#1338 ·
Los mantenedores suelen responder en 1 día
-
area:lint-tooling found-by:critic kind:docs-drift
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
InauguralSystems/EigenScript#1335 ·
Los mantenedores suelen responder en 1 día
-
area:ci found-by:critic kind:gate-defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
InauguralSystems/EigenScript#1311 ·
Los mantenedores suelen responder en 1 día
-
enrolment: decide test_gc_runner_controls.py (exempt vs enrol) and whether floors need a ratchetAbiertoarea:gates found-by:critic kind:decision
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
InauguralSystems/EigenScript#1280 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de InauguralSystems/EigenScript
Issues similares
-
bug needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
netdata/netdata#24062 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
BasedHardware/omi#19463 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
EchoTools/nevr-runtime#30 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
riscv-software-src/riscv-isa-sim#2448 ·
Los mantenedores suelen responder en 2 días