Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Preserve UTF-8 characters split across FreeBSD console reads

Open LunaStev opened this issue 3 weeks ago • 0 comments

Problem

Console decodes each arbitrary read chunk with from_utf8_lossy. A valid multibyte character split across reads becomes replacement characters in the matching buffer even though the raw log is correct.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

Executed Console with a Read+Write fake stream containing the UTF-8 bytes for 정상 followed by CRLF. With reads returning the whole payload, expect("정상", None) succeeds; with reads returning one byte each, it errors that the console closed before the pattern. Both raw logs contain the original valid bytes. No VM boot is needed.

Scope

Carry incomplete UTF-8 sequences between reads and define treatment of actually invalid input separately from chunk boundaries.

Starting points: tools/src/freebsd.rs:84.

Completion criteria

  • [ ] Whole/split reads produce identical matching behavior for multibyte characters.
  • [ ] Prefix consumption, EOF, buffer limits and raw logs are preserved.
  • [ ] Add focused stream fixtures without requiring QEMU.

This is a bounded newcomer task with the starting point and focused negative/positive checks above.

Related: #653. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

LunaStev avatar Nov 12 '26 12:11 LunaStev