Skip to content

fix(od): mask high-order bit in named character output (-a / -t a) - #1897

Merged
caomengxuan666 merged 1 commit into
unixwin:mainfrom
dingyi580:fix/od-named-char-high-bit
Nov 27, 2026
Merged

caomengxuan666 merged 1 commit into
unixwin:mainfrom
dingyi580:fix/od-named-char-high-bit

Conversation

@dingyi580

Copy link
Copy Markdown

Summary

  • Mask input bytes with b & 0x7f in od::named_char, matching POSIX and GNU coreutils 9.4 src/od.c:511 (int masked_c = *p++ & 0x7f;).
  • Previously, bytes >= 0x80 under od -a / od -t a bypassed the 7-bit mask and emitted 2-byte UTF-8 Latin-1 characters instead of ASCII 3-column names (nul, sp, A, del), breaking both GNU byte parity and column alignment.
  • No user-visible I18N catalog strings (tr!) are modified.

What was removed

  • Removed unmasked high-bit fallthrough to (b as char).to_string() in named_char.

Verification

  • rustfmt --check --edition 2021 rust2/crates/winux-cmds/src/od.rs: passed
  • cargo check --workspace --tests --target x86_64-pc-windows-msvc & aarch64-pc-windows-msvc: passed
  • Windows cargo test execution (named_char_ignores_high_order_bit): owed to PR CI

@caomengxuan666

Copy link
Copy Markdown
Member

CAPTAIN 注记:CMake run 45946272131 重跑(attempt 3)已全绿——此前 engines-fs 分片在装 WSL 步被取消属 infra 件,与 od 无关;聚合 UNCOVERED cp/ls/mv 红随之清除。本 PR 证据面齐(rust-tests + i18n 绿、新测 ok、text-lines 分片绿),余 X299 运行时复验后终裁。

@caomengxuan666

Copy link
Copy Markdown
Member

CAPTAIN-VERIFY(X299 运行时复验):达合入门,队长合入。lib 1092/0、新钉实跑绿;全字节(0x00–0xFF)-An -a/-An -ta 输出与 GNU coreutils 9.4 逐字节全等。CI 侧 engines-fs 分片 infra 取消已重跑全绿(见前注)。

@caomengxuan666
caomengxuan666 merged commit 4025dcf into unixwin:main Nov 27, 2026
58 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants