Repository navigation
test(builtins): pin inline printf width/precision overflow EOVERFLOW (Refs #3605) - #3671
Conversation
…field (Refs #3605) GNU hands `%.<digits>' verbatim to the host libc's printf(3) via the PF() macro (builtins/printf.def:152-175). On BSD/Darwin libc the precision digit run accumulates into an int field (xprintf.c:558-559), wrapping mod 2^32: `printf "%.9223372036854775825s" XY' prints XY, and the vendored printf.right golden expects exactly that. The previous EOVERFLOW+PRETURN model fits an inline field *width* (xprintf.c:604-625 feeds an INT_MAX-checked pad) but not precision. Precision overflow now wraps the digit run two's-complement into i32: positive results apply as precision, negative results are "as if it were missing". Inline width overflow keeps the EOVERFLOW error, and the printstr specs (b/q/Q/T/S/C/wide) keep GNU decodeint() erange semantics unchanged. Verified on macOS arm64 vs GNU bash 5.3.20: %.9223372036854775825s/d render as %.17s/%.17d, %.4294967295s prints the full string, and niubash run-printf is PASS (the only remaining diff is the Mach-O exec gap covered by PR #3586). New unit tests pin the wrap, the wrapped-negative case, and the width EOVERFLOW boundary. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
【WIN-AGENT-AUDIT】 机制核查:
F 点:
腿(逐项给数字与名字):
未跑/VOID 的腿:
平台局限:对照为 WSL Linux 5.3.20;PR 声称的 macOS 行为无法在本机复核,但结论只依赖「Linux 基线与 PR 行为相反」这一点,已实测。 |
|
【WIN-AGENT-AUDIT】PR #3671 第2轮 — 返工开工(T 波 t4) 按 s6 FAIL 报告逐条返工:
|
…(Refs #3605) Reverts the i32-wrap model for inline precision digits: on the glibc oracle (WSL GNU bash 5.3.20) both width and precision digit runs outside i32 fail the directive with EOVERFLOW, matching printf.def's PF() -> host libc printf(3) path. The BSD/Darwin wrap model is unverifiable here and is not the project oracle, so the product change is dropped; what remains is regression coverage asserting the verified verdict.
|
【WIN-AGENT-AUDIT】PR #3671 第2轮 — REWORK 完成,建议:PASS(已 mark ready;合入待 CI 复核,仅 issue2875 签名红可接受) F 点逐条回应:
腿(逐项,均对 merge 后 head 38fb2d0 实测):
续作记录:
未跑/VOID 的腿:无(base lib 以同码论证代替实跑,已注明;CI 待出)。 |
|
【WIN-AGENT-AUDIT】PR #3671 第2轮 — 追加:已合入 CI 跑完(head 38fb2d0):红 = 按 T 波 FAIL 返工口径合入:squash |
Refs #3605 (umbrella; merge does not close it).
Rework note (2026-11-16, t4 lane)
The original revision wrapped inline precision digits mod 2^32 (BSD/Darwin libc model) and was FAIL'd in audit: on the project oracle — WSL GNU Bash 5.3.20 (glibc) — an inline precision digit run outside i32 fails the directive with EOVERFLOW exactly like an overflowing width (
printf.defPF() → host libcprintf(3)→EOVERFLOW,builtin_error+ PRETURN). The wrap model was unverifiable on this machine and is not the oracle, so the product change is reverted;src/builtins/printf.rsis now byte-identical toorigin/master.What remains is regression coverage: two lib pins asserting the verified glibc verdict for inline width/precision overflow (
Value too large for defined data type, no output, rc 1), plus the unchanged printstr (b/q/Q/T/wide)Numerical result out of rangepath.Verification
target/t4-probes/p3671b.sh, 8 shapes): rubash reworked head matches GNU byte-for-byte (rc / stdout / stderr), including the%bprintstr path and thea%.<huge>sbmixed case.cargo test --lib builtins::printf: 58/58 (merged tree).cargo test --libfull: 1358 passed / 1 failed — sole failureapi::consumer_tests::issue2084_session_end_restores_host_process_state, the known Windows-side baseline flake present on master too (product code identical to master).RUSTFLAGS="-D warnings" cargo check --lib --bins: 0 warnings.rustfmt --checkboth files clean; marker-lint OK; utf8-boundary clean.本 PR 删除了什么
第二轮返工删除了第一轮引入的
wrap_digit_run_i32及其全部调用(产品代码回到 master 状态);PR 现为纯钉增量(printf_tests.rs+35)。