Repository navigation
read: byte-domain unit accounting across the read serves - #3302
Merged
Merged
Conversation
caomengxuan666
marked this pull request as ready for review
November 10, 2026 23:41
This was referenced Nov 10, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One wave over the read family's serve paths, four faces:
read -r -ain a single-byte locale dropped empty fields when the IFS delimiter was a multibyte character: the array splitter sliced the original line by byte ranges that can fall inside a character. The-r -aproducer now works at value level in the byte domain (the existingread_byte_domainfamily), keeping empty fields; the scalar, non--rarray, and ordinary word-splitting paths are untouched.-ddelimiter as a whole UTF-8 sequence; GNU compares the delimiter's first byte at character starts (read.def:385, read.def:834). The three fd_table readers now share one incremental scan replay: read_mbchar units with the delimiter compared as its first stream byte at unit starts in multibyte locales, the historical sequence match in byte locales, post-escape unit counting at unit completion.-ttimed judge, so a slow producer's second read returned data instead of timing out, and its mirror rewrite silently desynchronized the arrival schedule for later reads. The serve is now judged like the character scan's records (a timeout serves only the in-time prefix), and a rewrite re-bases the schedule into the rewritten mirror's coordinates.read -n/-Nunit accounting counted each byte of an invalid UTF-8 sequence separately on the text serves, byte-stopped at the lead byte on the file serve, and truncated even valid characters there. All serves now count one read_mbchar unit per consumption — nominal width first, continuation validation deferred to completion, the invalidating byte joining the unit unless it is the delimiter byte.Refs #3191
Refs #3291
Refs #3293
Refs #3294
What this PR deletes
fd_table'sReadEscapeTrackerandutf8_first_byte_lenhelpers: the fd-table readers' ad-hoc escape tracker and whole-sequence delimiter stepping are replaced by the sharedFdRecordScanreplay. The escape tracker itself survives inread_io.rs, where the coproc loop still drives it.Tests
Four new pin stems, one per face, each with fail-first evidence on the base and all cells green on this head; the joined-delimiter stem of the previous wave stays 14/14, 26 read-family neighbour stems stay green, lib tallies match the base (1233 passed / 0 failed / 4 ignored), and the warnings-denied check, fmt check, marker lint, UTF-8 boundary hygiene, and test-target check all pass. No new libc FFI call sites.