json_pretty inserts formatting inside strings, corrupting values and producing invalid JSON
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C
- 星标
- 3
- 派生
- 7
- 平均合并
- 4 小时 5 分钟
- 30 天内合并 PR
- 116
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InauguralSystems/EigenScript 的其他 Issue
-
area:docs good first issue kind:docs-drift
难度 1/5 1 小时以内 新手友好度 92/100
InauguralSystems/EigenScript#1400 ·
维护者通常 1 天内回复
-
area:docs good first issue kind:docs-drift
难度 2/5 1-3 小时 新手友好度 90/100
InauguralSystems/EigenScript#1396 ·
维护者通常 1 天内回复
-
docs/BUILTINS.md: task_spawn row says task_yield/task_join 'land in a later increment'; both exist未关闭area:docs good first issue kind:docs-drift
难度 2/5 1-3 小时 新手友好度 88/100
InauguralSystems/EigenScript#1392 ·
维护者通常 1 天内回复
-
area:embed kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1387 ·
维护者通常 1 天内回复
-
area:stdlib kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 86/100
InauguralSystems/EigenScript#1378 ·
维护者通常 1 天内回复
查看 InauguralSystems/EigenScript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
python-pillow/Pillow#10087 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
OpenPrinting/cups#1729 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
awslabs/amazon-kinesis-video-streams-webrtc-sdk-c#2406 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
DaveGamble/cJSON#1094 ·
-
status:needs-triage
难度 2/5 1-3 小时 新手友好度 90/100
PX4/PX4-Autopilot#28923 ·
维护者通常 1 天内回复