lambdaclass / lambdaclass/lambda_compiler_kit
bug: CLI readAll stops reading at first empty line instead of reading to EOF
Nessuno ha ancora preso questa issue.
- Lingua principale
- Lean
- Stelle
- 2
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con gli helper readAll in cli/LckJsonFmt.lean e cli/LckJsonTree.lean, quindi esamina come ogni CLI legge stdin. Verifica il comportamento con un input contenente una riga vuota e conferma che la lettura continui attraverso le righe vuote e termini solo a EOF, senza troncare il JSON.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 68/100