hluk run: non-UTF-8 bytes in guest stdout reach the host as U+FFFD
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Find the write host function and trace how Console echoes guest output through GuestOutput and Console::emit; the issue names these entry points but no file paths. First inspect the raw-byte handling and the captured-output path (take_output / drain_output). Add a regression test based on the provided printf '\377\376x' repro; done means the CLI preserves those bytes while captured output remains a String.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug: hluk run replaces non-UTF-8 bytes in guest stdout with U+FFFD
What happens
A guest program that writes bytes that aren't UTF-8 to stdout doesn't get those bytes through to the host's stdout. Each invalid byte arrives as U+FFFD (ef bf bd).
Repro (hluk 0.21.0, x86_64 Linux, GitHub Actions runner with KVM)
Inside the guest, the bytes are intact:
$ hluk run --runtime bash --exec "printf '\377\376x' | od -An -tx1"
ff fe 78
Piped out to the host, they're replaced:
$ hluk run --runtime bash --exec "printf '\377\376x'" | od -An -tx1
ef bf bd ef bf bd 78
Expected: ff fe 78 in both cases.
Cause
The write host function receives raw bytes (its doc comment says "Bytes, not a string: what a program writes need not be UTF-8"), but Console decodes them through GuestOutput before echoing them, and Console::emit writes the decoded text with print!/eprint!. GuestOutput documents that "bytes that are not UTF-8 read as U+FFFD", so the replacement looks intended for the captured text. For the echo to the CLI's own stdout and stderr, though, it means any binary output can't get through: gzip -c, tar c, images, protobuf, or a program printing Latin-1.
Proposed fix
When echo is on, write the guest's bytes to the host's stdout/stderr as they are (std::io::stdout().write_all(&bytes) plus flush), and keep decoding only for the captured output (take_output / drain_output), so the library API stays String and doesn't change. Two notes:
- A failed write to stdout currently panics through
print!, which is what makeshluk run | head -1end with its reader. The byte path would keep that behaviour. - A character split across two writes needs no special handling in the echo path, because the bytes simply go out in order.
A bytes accessor for captured output (next to take_output) could be a separate follow-up if that's wanted.
I'm happy to send a PR for the echo-path change, with a test along the lines of the repro above, if this approach sounds right to you.
- Lingua principale
- Rust
- Stelle
- 77
- Fork
- 14
- Merge medio
- 2g 1h
- PR unite (30g)
- 24
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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.
Altre issue di hyperlight-dev/hyperlight-unikraft
-
dependencies
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
hyperlight-dev/hyperlight-unikraft#136 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
ci/nightly
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
hyperlight-dev/hyperlight-unikraft#306 ·
I maintainer di solito rispondono entro 1 giorno
-
ci/nightly
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
hyperlight-dev/hyperlight-unikraft#305 ·
I maintainer di solito rispondono entro 1 giorno
-
ci/nightly
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
hyperlight-dev/hyperlight-unikraft#304 ·
I maintainer di solito rispondono entro 1 giorno
-
hostnet: a port-0 bind can collide with another listener's guest port under the listener redirectApertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
hyperlight-dev/hyperlight-unikraft#294 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di hyperlight-dev/hyperlight-unikraft
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jelmer/buildlog-consultant#364 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
solutionscay/skiff#310 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
valkey-io/valkey-large-object#222 ·
I maintainer di solito rispondono entro 1 giorno
-
bug user-priority/P1
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno