json_pretty inserts formatting inside strings, corrupting values and producing invalid JSON
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 3
- Fork
- 7
- Merge trung bình
- 4 giờ 5 phút
- Pull request đã merge (30 ngày)
- 116
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InauguralSystems/EigenScript
-
area:docs good first issue kind:docs-drift
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
InauguralSystems/EigenScript#1400 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:docs good first issue kind:docs-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
InauguralSystems/EigenScript#1396 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs/BUILTINS.md: task_spawn row says task_yield/task_join 'land in a later increment'; both existĐang mởarea:docs good first issue kind:docs-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
InauguralSystems/EigenScript#1392 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:embed kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
InauguralSystems/EigenScript#1387 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:stdlib kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
InauguralSystems/EigenScript#1378 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của InauguralSystems/EigenScript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Failed to resolve logo sourceĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fastfetch-cli/fastfetch#2628 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FujiNetWIFI/fujinet-firmware#1736 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100