Repository navigation
Conversation
The grouped-results display truncates directory paths longer than 50 bytes with a raw byte slice (dir.len() - 47), which panics when the cut lands inside a multi-byte UTF-8 character (e.g. 'é' in a French path). Extract the truncation into dir_display() and use ceil_char_boundary() for the cut, matching the pattern already used in pipe_cmd, json_cmd and analytics. Add regression tests. Fixes #2851 Co-Authored-By: Claude Fable 5 <[email protected]>
Collaborator
|
Thanks for tracking this down to the grouped directory display rather than the unknown-flag path. The find rewrite in #3603 (merged 2026-08-26) replaced that byte slice with a chars-based truncation and added a long_unicode_dir_label_does_not_panic test, so the repro from #2851 now runs clean on develop. The helper extraction here is the one piece develop does not carry, but the truncation itself is already char-safe. If you see a case that still panics, please comment and we can reopen. |
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.
Problem
rtk findpanics when the grouped-results display truncates a directory path longer than 50 bytes and the raw byte slice&dir[dir.len() - 47..]lands inside a multi-byte UTF-8 character:Reported in #2851. Note the issue title mentions the unknown-flag path, but while preparing this fix I narrowed it down: the flag is irrelevant — the actual trigger is any grouped display of a matched directory path > 50 bytes with a multi-byte character straddling the cut point (
"Les Plongées de Juliette/5-Pipeline/Versions-imprimables"is 57 bytes, so the cut lands at byte 10, inside theé). I've noted this on the issue.Fix
dir_display()helper and round the cut up withstr::ceil_char_boundary(), the same pattern already used inpipe_cmd.rs,json_cmd.rs,gain.rsandsession_cmd.rsfor the sibling bugs (rtk gain --history panics on non-ASCII (CJK) filenames in command history #2318 / Panic 'not a char boundary' in output filter (src/parser/mod.rs:191) on large CJK output — affects all wrapped commands (same root as #1837) #2509 family).Validation
cargo test: 2417 passed.🤖 Generated with Claude Code