lib/eigen.eigs lexes "\r" as "r": under eigen_run, "a\rb" == "arb" is true (the VM says false)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读 lib/eigen.eigs 第 324-337 行和第 413-422 行的转义开关,然后将它们与 src/lexer.c:565 和 :696 进行比较。按照 tests/test_meta_fstr_host_str.eigs 的风格为测试套件添加覆盖,并针对普通字符串和 f-string 运行这些检查,与 VM 对照。两种形式都将 \r 解码为回车符并与 VM 匹配,即为完成。
由索引模型根据 Issue 内容生成。
描述
Found while root-causing an EigenRegex probe for InauguralSystems/EigenRegex#37, on the v0.46.0 release binary. lib/eigen.eigs is the same blob (bb721a65) on v0.46.0 and on main 5a7b703e.
Repro
import eigen
print of ("a\rb" == "arb")
print of (eigen.eigen_run of "\"a\\rb\" == \"arb\"")
print of (eigen.eigen_run of "f\"a\\rb\" == \"arb\"")
This prints false, true, true and exits 0. The VM decodes \r to a carriage return. The meta-interpreter decodes it to the letter r, in plain strings and in f-strings. The file's header promises evaluator values at parity with the C evaluator.
Root cause
Neither escape switch in lib/eigen.eigs has an r arm, so \r falls into the catch-all buf is buf + esc. The f-string switch is at lines 324-337 and the plain-string switch at lines 413-422. src/lexer.c:565 (f-strings) and :696 (plain strings) decode \r to CR. ouroboros had the same gap and fixed it in src/frontend.eigs:237-246, where the bootstrap fixed point caught it. This copy never got that fix.
Done when
- Both escape switches in
lib/eigen.eigsdecode\rto CR, assrc/lexer.c:565and:696do. - A suite test in the style of
tests/test_meta_fstr_host_str.eigscompareseigen_runwith the VM on both forms:
On v0.46.0 both checks fail, givingcheck of ["meta plain string decodes the r escape like the VM", eigen.eigen_run of "\"a\\rb\" == \"arb\"", "a\rb" == "arb"] check of ["meta f-string decodes the r escape like the VM", eigen.eigen_run of "f\"a\\rb\" == \"arb\"", f"a\rb" == "arb"]truewhere the VM givesfalse. With the two missing arms added to a scratch copy oflib/eigen.eigs, both pass.
Out of scope here: unknown escapes (\q, \0, \u212a) silently dropping the backslash in all three lexers is #1641.
- 主要语言
- C
- 星标
- 3
- 派生
- 7
- 平均合并
- 11 小时 40 分钟
- 30 天内合并 PR
- 270
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InauguralSystems/EigenScript 的其他 Issue
-
area:docs kind:docs-drift
难度 2/5 1-3 小时 新手友好度 76/100
InauguralSystems/EigenScript#1887 ·
维护者通常 1 天内回复
-
area:gates kind:docs-drift
难度 1/5 1 小时以内 新手友好度 86/100
InauguralSystems/EigenScript#1851 ·
维护者通常 1 天内回复
-
area:gates area:gfx found-by:critic kind:gate-defect
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1825 ·
维护者通常 1 天内回复
-
area:runtime-vm kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 72/100
InauguralSystems/EigenScript#1748 · 1 条评论 ·
维护者通常 1 天内回复
-
area:gfx bug
难度 2/5 1-3 小时 新手友好度 66/100
InauguralSystems/EigenScript#1684 ·
维护者通常 1 天内回复
查看 InauguralSystems/EigenScript 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
valkey-io/valkey#4979 · 1 个 reaction ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
colbymchenry/codegraph#2770 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
OpenCyphal/libcanard#264 ·
-
area/ysql kind/enhancement priority/medium status/awaiting-triage
难度 2/5 1-3 小时 新手友好度 73/100
yugabyte/yugabyte-db#35578 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复