Formatter silently changes whitespace and operators inside multiline string literals
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #1525 của @InauguralPhysicist — đã đóng, không merge
Đá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
- 84/100
Hướng nghiên cứu
Start in src/fmt.c around lines 333–344 and inspect how fix_spacing handles physical lines, then review multiline literal handling in src/lexer.c around line 485. Extend tests/test_fmt.sh with the reproducer, blank lines, operator/comment-like text, and a single-line control. Done means formatted output preserves literal bytes and ordinary source whitespace normalization still works through the shared formatting path.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The formatter edits the contents of a valid multiline string: it changes indentation, removes trailing spaces, and inserts spaces around apparent operators inside the literal. The resulting program still exits successfully but produces different data. --fmt --write persists that corruption; LSP formatting uses the same function.
Exact reproduction
Create a fixture with literal newlines inside its quoted string. The middle line has two leading and two trailing spaces:
python3 - <<'PYFIXTURE'
from pathlib import Path
Path('multiline.eigs').write_text('value is "start\n a+b \nend"\nprint of value\n')
PYFIXTURE
eigenscript multiline.eigs
eigenscript --fmt multiline.eigs > formatted.eigs
eigenscript formatted.eigs
Both executions and formatting exit 0. Exact stdout, shown as escaped strings:
before: "start\n a+b \nend\n"
after: "start\n a + b\nend\n"
The formatter emits this source:
value is "start
a + b
end"
print of value
Cause
The lexer accepts the multiline literal and retains these bytes. src/fmt.c:333–344 strips leading/trailing whitespace from every physical line before knowing whether it is inside a string. fix_spacing also starts each physical line with string state cleared, so a+b is treated as source code.
This breaks the formatter's string-preservation behavior already checked for single-line strings by tests/test_fmt.sh (string content not modified). The existing corpus parseability check cannot detect this case: both programs parse.
Regression acceptance
- The formatted reproducer's exact stdout equals the original, including leading/trailing spaces and newlines inside the literal.
- Cover blank lines and operator/comment-looking text inside multiline strings, alongside a normal single-line string control.
- Keep ordinary source whitespace normalization working outside literals; verify the shared formatting path preserves literal data.
Distinct from the operator-table fixes in #729/#750.
Verification
Confirmed with a fresh default make build of b91768e23c5a874a64e76e4af9ab291e6aa49983 in a clean isolated worktree. The original, formatter, and transformed program were executed separately with inherited EIGS_* variables removed; exit status and output were captured for each.
- Ngôn ngữ chính
- C
- Star
- 3
- Fork
- 7
- Merge trung bình
- 11 giờ 45 phút
- Pull request đã merge (30 ngày)
- 273
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 kind:docs-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
InauguralSystems/EigenScript#1887 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
lib/eigen.eigs lexes "\r" as "r": under eigen_run, "a\rb" == "arb" is true (the VM says false)Đang mởarea:stdlib kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
InauguralSystems/EigenScript#1878 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
phase2: test_bitwise.eigs cites ctl.scan.* rows; the MAP's refusal controls are ctl.N8.refuse-*Đang mởarea:gates kind:docs-drift
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
InauguralSystems/EigenScript#1851 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:gates area:gfx found-by:critic kind:gate-defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
InauguralSystems/EigenScript#1825 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atĐang mởarea:runtime-vm kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
InauguralSystems/EigenScript#1748 · 1 bình luận ·
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ự
-
[WinReg] update to v12.0.0Đang mởcategory:port-update
Độ 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 2 ngày
-
type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
feat(palindrome): add C solutionCó thể đã có người làm @aadiitya2007 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
techcsispit/code-corner#58 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[LOGO] Add Ruxt Linux LogoĐang mởlogo request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
fastfetch-cli/fastfetch#2661 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mark ignored Mac OS partitions RecoveryOSContainer and iBootSystemContainerCó thể đã có người làm @meven đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
storaged-project/udisks#1559 ·