Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

lib/eigen.eigs lexes "\r" as "r": under eigen_run, "a\rb" == "arb" is true (the VM says false)

未关闭 适合新手
#1,878 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
backend, testing

调研方向

阅读 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 内容生成。

描述

area:stdlib kind:silent-wrong

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.eigs decode \r to CR, as src/lexer.c:565 and :696 do.
  • A suite test in the style of tests/test_meta_fstr_host_str.eigs compares eigen_run with the VM on both forms:
    check 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"]
    
    On v0.46.0 both checks fail, giving true where the VM gives false. With the two missing arms added to a scratch copy of lib/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

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

InauguralSystems/EigenScript 的其他 Issue

查看 InauguralSystems/EigenScript 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。