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
fix(ptx): slice context and fallback truncations on raw bytes like GNU - #1894
Keep input text, sort keys, and field truncation buffers in ptx as raw byte slices (Vec<u8> / &[u8]) instead of UTF-8 String slicing, matching GNU coreutils ptx (9.4) and the retired C++ ptx pipeline byte-for-byte on non-whitespace fallback truncations.
Eliminates runtime UTF-8 boundary panics when value.len() - limit or limit lands mid-codepoint while preserving GNU's raw partial-UTF-8 byte truncation behavior (e.g. hello\xe2/ under -w 16 and /\x96\x87\xe2\x80\x94 hello under -w 20).
No user-visible I18N catalog strings (tr!) are modified.
What was removed
Removed lossy String conversion (from_utf8_lossy) on source input and UTF-8 character-boundary clamping in rightmost_field / leftmost_field.
dingyi580
changed the title
fix(ptx): align fallback context truncation to UTF-8 char boundaries
fix(ptx): slice context and fallback truncations on raw bytes like GNU
Nov 27, 2026
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
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
ptxas raw byte slices (Vec<u8>/&[u8]) instead of UTF-8Stringslicing, matching GNU coreutilsptx(9.4) and the retired C++ptxpipeline byte-for-byte on non-whitespace fallback truncations.value.len() - limitorlimitlands mid-codepoint while preserving GNU's raw partial-UTF-8 byte truncation behavior (e.g.hello\xe2/under-w 16and/\x96\x87\xe2\x80\x94 hellounder-w 20).tr!) are modified.What was removed
Stringconversion (from_utf8_lossy) on source input and UTF-8 character-boundary clamping inrightmost_field/leftmost_field.Verification
rustfmt --check --edition 2021 rust2/crates/winux-cmds/src/ptx.rs: passedcargo check --workspace --tests --target x86_64-pc-windows-msvc&aarch64-pc-windows-msvc: passedptx::tests, includingutf8_multibyte_truncation_slices_raw_bytes_like_gnuprobed against GNUptx): 10 passed, 0 failed