lambdaclass / lambdaclass/lambda_compiler_kit
bug: CLI readAll stops reading at first empty line instead of reading to EOF
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the readAll helpers in cli/LckJsonFmt.lean and cli/LckJsonTree.lean, then inspect how each CLI reads stdin. Verify the behavior with input containing a blank line and confirm that reading continues through blank lines and ends only at EOF without truncating the JSON.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100