Repository navigation
Wave B residuals: #1521 grep/diff clamp band, #1523 uniq overflow clamp, #1524 split ERANGE suffix, #1522 text-reader wide paths - #1525
Merged
Conversation
…Refs #1523) GNU uniq's size_opt (uniq.c:233-250) accepts LONGINT_OK and LONGINT_OVERFLOW from xstrtoumax and clamps via MIN(size, SIZE_MAX) (uniq.c:237-247), so uniq counts past UINT64_MAX are accepted. The shared parser's UInt path (#1519) still died there. - cmd_meta: OptionType::UIntClamp (+ help suffix grouping, macro UINT_CLAMP_TYPE). - opt: parse_int_value now takes the OptionType; UIntClamp stores UINT64_MAX when the uint64 parse itself overflows on a pure digit run. Signed-first storage is unchanged, so negative diagnostics keep their shape. All seven parse sites and the dispatcher role pre-pass group UIntClamp with UInt. - uniq: -f/-s/-w/-NUM declare UINT_CLAMP_TYPE; the existing get<int> reads saturate the clamped store, reproducing SIZE_MAX clamping. - locate is deliberately NOT migrated: locate.c:1677-1681 sends any err != LONGINT_OK (overflow included) to xstrtol_fatal, so -l past UINT64_MAX stays a parse error; pinned as the asymmetry face. Pins: uniq_skip_fields_above_uint64_clamps_issue1523, uniq_skip_chars_above_uint64_clamps_issue1523, uniq_obsolete_num_above_uint64_clamps_issue1523, locate_limit_above_uint64_still_errors_issue1523. Format: files hand-formatted to surrounding style; the VM's clang-format (pip 23.1.3) is not the repo-pinned formatter, so scripts/format.py was not run (same skip as the #1520 lane).
GNU grep parses -m via xstrtoimax accepting LONGINT_OVERFLOW (grep.c:2681-2692) and context lengths via context_length_arg (grep.c:826-841, same acceptance); diff parses -U/-C/-NUM and the -c/-u attached values with strtoimax and clamps (diff.c:358-367). Both families therefore accept the (INT64_MAX, UINT64_MAX] band, clamping to INTMAX_MAX; WinuxCmd still declared them INT_TYPE and died in the shared parser. - grep: -m/-A/-B/-C/-NUM declare UINT_TYPE. The context occurrence loop now reads the unsigned store through the saturating bridge (a bare get_if<int64_t> would silently drop band occurrences -- the #1519 trap); -m already read via get<int64_t>. - diff: -C/-U/-NUM declare UINT_TYPE, -c/-u OPTIONAL_UINT_TYPE, and all five occurrence reads go through a saturating helper lambda. The bare -c/-u sentinel (-1) still arrives in the signed store. Negatives keep their consumer diagnostics byte-identically (signed-first storage): grep "-1: invalid context length argument" (rc 2) and diff "invalid context length '-5'" both pinned. Pins: grep_max_count_unsigned_band_issue1521, grep_context_unsigned_band_issue1521, grep_negative_max_count_shape_kept_issue1521, diff_unified_context_unsigned_band_issue1521, diff_context_forms_unsigned_band_issue1521, diff_negative_context_still_errors_issue1521. Format: hand-formatted; repo-pinned formatter not run (VM clang-format 23.1.3 is not the pinned one, as in the #1520 lane).
Family adjudication against GNU source: strtoint_die (split.c:1301-1305) is error(EXIT_FAILURE, errno == EINVAL ? 0 : errno, "%s: %s", msgid, quote(arg)) -- so the ": Numerical result out of range" suffix appears exactly when the failing xstrtoimax scan left errno == ERANGE: an invalid-suffix death whose digit run also overflowed, or a range death on an overflowed scan (negative overflow clamped to INTMAX_MIN). Pure-invalid deaths (EINVAL) and clean range deaths (0, -5, 2fb) get no suffix, and "invalid chunk number" never routes through strtoint_die at all. - quoted_number_error gains an erange flag appending the suffix. - Every strtoint_die-shaped call site (-b/-C/-l, both parse_chunk deaths via fail_chunks, and the ---io-blksize validation that mirrors -b) passes number_scan_erange(arg): the quoted text's own scan_intmax overflow bit. Probe-verified against GNU coreutils 9.4 split for the K/N head, -l suffix-junk, and negative-overflow shapes (byte-identical); the pre-existing exact-match battery for clean deaths is untouched and still exact. Pins: split_overflow_deaths_carry_erange_suffix_issue1524, split_non_overflow_deaths_have_no_erange_suffix_issue1524. i18n note: verified locally with scripts/check_i18n_drift.py against a fresh winuxcmd-i18n clone -- drift OK, no new recorded items (the assembled split error strings are not legacy-extracted). Format: hand-formatted; repo-pinned formatter not run (VM clang-format 23.1.3 is not the pinned one, as in the #1520 lane).
…1522) The three remaining #342-class readers fed a UTF-8 std::string from normalize_api_operand into std::ifstream's narrow ctor (ANSI code page decoding). Per-applet CRLF adjudication: all three are TEXT readers whose current behavior includes the CRT CRLF translation, so the fix swaps only the path boundary -- make_api_path_operand + std::filesystem::path(operand.extended), WITHOUT ios::binary: - dircolors: parse_db_line treats '\r' as whitespace, so the translation is semantically invisible; the wide path is the fix. - hexdump -f: the format parser skips via isspace and the blank/ comment scan already lists '\r'; translation-neutral either way, kept in text mode to leave byte behavior untouched. - hostname -F: the first line is printed verbatim, so the translation IS observable -- a binary open would leak '\r' into the printed name; text mode preserves it exactly. Each applet gets a U+00FF filename pin whose file content is CRLF, proving the name opens and the CRLF semantics are unchanged. Pins: dircolors_opens_non_ascii_filename_issue1522, hexdump_f_opens_non_ascii_filename_issue1522, hostname_file_opens_non_ascii_filename_issue1522. Format: hand-formatted; repo-pinned formatter not run (VM clang-format 23.1.3 is not the pinned one, as in the #1520 lane).
caomengxuan666
marked this pull request as ready for review
November 4, 2026 10:49
caomengxuan666
marked this pull request as draft
November 4, 2026 10:50
caomengxuan666
force-pushed
the
wave-b-winx-residuals
branch
from
November 4, 2026 10:51
d39ac34 to
1905e6b
Compare
caomengxuan666
marked this pull request as ready for review
November 4, 2026 23:25
This was referenced Nov 5, 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.
Wave B residuals R1–R4: #1521 / #1522 / #1523 / #1524
Refs #1521, Refs #1522, Refs #1523, Refs #1524. All four are residuals of PR #1520 (BAD-5 + #1519), landed as one PR with one commit per issue. GNU source first for every item; oracle coreutils 9.4 / grep 3.11 / diffutils 3.10 / findutils 4.9.0 sources under the audit tree, plus byte probes against the GNU 9.4 binaries.
#1521 — grep/diff xstrtoimax-clamp family
GNU: grep
-mxstrtoimax with LONGINT_OVERFLOW accepted (grep.c:2681-2692); context lengths viacontext_length_arg(grep.c:826-841, same acceptance); diff context via strtoimax + clamp (diff.c:358-367). The (INT64_MAX, UINT64_MAX] band was dying in the shared parser because all of these were declared INT_TYPE.-m/-A/-B/-C/-NUM→ UINT_TYPE; the context occurrence loop now reads the unsigned store through the saturating bridge (a bareget_if<int64_t>would silently drop band occurrences — the [G18 后续] 共享选项解析器缺无符号路径:(INT64_MAX, UINT64_MAX] 对 uintmax 类选项仍解析失败 #1519 trap).-C/-U/-NUM→ UINT_TYPE,-c/-u→ OPTIONAL_UINT_TYPE; all five occurrence reads go through a saturating helper. The bare-c/-usentinel (-1) still arrives signed.-1: invalid context length argument(rc 2) and diffinvalid context length '-5'.#1523 — uniq past-UINT64 clamp (+ locate disposition)
GNU: uniq
size_opt(uniq.c:233-250) accepts LONGINT_OK and LONGINT_OVERFLOW, thenMIN(size, SIZE_MAX)(uniq.c:237-247).OptionType::UIntClamp: signed-first like UInt, but a positive digit run that overflows even uint64 stores UINT64_MAX; every reader bridge then saturates it (GNU's clamp). Grouped with UInt in all seven parse sites and the dispatcher role pre-pass.-f/-s/-w/-NUM→ UINT_CLAMP_TYPE.err != LONGINT_OK— LONGINT_OVERFLOW included — toxstrtol_fatal. Solocate -lpast UINT64_MAX stays a parse error; the asymmetry is GNU's own, and it is pinned (locate_limit_above_uint64_still_errors_issue1523).#1524 — split ERANGE suffix: family adjudication = APPEND, GNU-shaped
strtoint_die(split.c:1301-1305) iserror(EXIT_FAILURE, errno == EINVAL ? 0 : errno, "%s: %s", msgid, quote(arg)). Adjudication across allquoted_number_errorcall sites:0,-5,2fb)invalid chunk number(not strtoint_die; split.c parse_chunk plainerror(..., 0, ...))Implementation:
quoted_number_errorgains anerangeflag; every strtoint_die-shaped site (-b/-C/-l, both parse_chunk deaths, and the---io-blksizevalidation that mirrors-b) passesnumber_scan_erange(arg)— the quoted text's ownscan_intmaxoverflow bit. Byte-probed against GNU coreutils 9.4splitfor the K/N-head,-lsuffix-junk, and negative-overflow shapes; the pre-existing exact-match battery for clean deaths is untouched and still exact.#1522 — text-mode narrow-ctor readers: wide path, KEEP text mode
The three remaining #342-class readers. Per-applet CRLF adjudication: all three are text readers whose current behavior includes the CRT CRLF translation, so the swap changes only the path boundary —
make_api_path_operand+std::filesystem::path(operand.extended), withoutios::binary:parse_db_linetreats'\r'as whitespace → translation semantically invisible; wide path is the whole fix.isspace, blank/comment scan already lists'\r'→ translation-neutral; kept text mode to leave byte behavior untouched.'\r'into the printed name; text mode preserves it exactly.Each pin uses a U+00FF filename and CRLF content, proving both the open and the unchanged CRLF semantics.
本 PR 删除了什么
get_if<int64_t>读(被饱和桥读取代——带值此前会被静默丢弃)。std::ifstream(normalize_api_operand(...))打开(被宽路径打开取代)。quoted_number_error的无条件裸形)——按全族裁定删除,改为仅 ERANGE 死亡带后缀。Pins (all named by issue)
grep ×3, diff ×3, uniq ×3, locate ×1 (#1523 asymmetry), split ×2, dircolors ×1, hexdump ×1, hostname ×1 — 15 new tests. Per-stem Passed lines from the
build-windows (x64, x64, x64, default)ctest log are listed in the lane report (only that job runs ctest).i18n
No new user-visible strings. The #1524 suffix is an assembled fragment of an existing message; verified locally with
scripts/check_i18n_drift.pyagainst a freshunixwin/winuxcmd-i18nclone: drift OK, no new recorded items (the split error strings are not legacy-extracted), so no baseline update and no catalog sync arise from this PR.Format
Files hand-formatted to surrounding style; the VM's clang-format (pip 23.1.3) is not the repo-pinned formatter, so
scripts/format.pywas not run — same recorded skip as the #1520 lane.