You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
read -n/-N: limit counts transport units, splitting the last kept carrier pair #714
read -n N / -N N counts transport characters, so a carrier pair (U+E000 + U+E0xx, the internal encoding of one raw byte outside the transport set) is counted as two characters. When the limit lands inside a pair, the byte budget lands mid-pair, the cooked half pair gets emitted on the decode channel, and the affected byte shows up as a stray carrier instead of the raw byte.
Environment: found during the fd-0 cursor investigation (PR #711); cross-checked against GNU bash 5.2/5.3.
ESC (0x1B) is transported as a carrier pair; the limit counts the pair as two characters and consumes exactly half of it, leaving the split pair on the stream. read -n3 must emit exactly the first three raw bytes 41 42 1b.
Location & fix shape
src/builtins/read_io.rs (read_function_stdin): the limit check runs on transport text. The limit must count decoded units: one carrier pair consumes one unit of the budget, never can be split.
Dependency
Same read-builtin file as the /dev/stdin + EOF-rc work (rubash#700 / #701). Land that first, or rebase this on it, to avoid colliding in read_io.rs.
changed the title [-]: limit counts transport units, splitting the last kept carrier pair[/-][+]read -n/-N: limit counts transport units, splitting the last kept carrier pair[/+]on Oct 17, 2026
Activity
[-]: limit counts transport units, splitting the last kept carrier pair[/-][+]read -n/-N: limit counts transport units, splitting the last kept carrier pair[/+]fix(read): count decoded units for read -n/-N carrier-pair limits (#714…
fix(executor): count bytes for read -n/-N in single-byte locale (Refs #…