bug: CLI readAll stops reading at first empty line instead of reading to EOF
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 领域
- cli
调研方向
先从 cli/LckJsonFmt.lean 和 cli/LckJsonTree.lean 中的 readAll helpers 开始,然后检查每个 CLI 如何读取 stdin。使用包含空行的输入验证其行为,并确认读取会继续跨过空行,且仅在 EOF 时结束,不会截断 JSON。
由索引模型根据 Issue 内容生成。
描述
Problem
Both cli/LckJsonFmt.lean and cli/LckJsonTree.lean define a readAll helper that reads stdin line-by-line, stopping as soon as it reads an empty line:
repeat
let line ← stdin.getLine
if line.isEmpty then break -- WRONG: also breaks on blank lines mid-input
buf := buf ++ line
This means any JSON that contains a blank line (e.g., pretty-printed JSON piped from another tool, or JSON with embedded newlines before/after values) will be silently truncated.
Expected fix
Read until EOF. IO.Stream.getLine returns "" on EOF — use IO.Stream.isEof or check for EOF after each read instead of treating an empty line as the terminator. Example:
repeat
let line ← stdin.getLine
if (← stdin.isEof) then break
buf := buf ++ line
References
- Flagged by AI code review on PR #8
- 主要语言
- Lean
- 星标
- 2
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
lambdaclass/lambda_compiler_kit 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
-
难度 1/5 1 小时以内 新手友好度 68/100
-
Enable --wfail axiom-guard gate once warnings are clean可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 48/100
-
难度 2/5 1-3 小时 新手友好度 50/100
-
难度 1/5 1 小时以内 新手友好度 55/100
查看 lambdaclass/lambda_compiler_kit 的全部 Issue
相似的 Issue
-
area:manager bug triage:confirmed
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
area: cli priority: P2 type: defect
难度 2/5 1-3 小时 新手友好度 88/100
jiegui2025/hwspec#55 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
topgrade-rs/topgrade#2395 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
columnar-tech/dbc#513 ·
维护者通常 1 天内回复
-
editor good first issue
难度 2/5 1-3 小时 新手友好度 65/100
funnyboy-roks/inq#54 ·