Skip to content

fix: avoid panic on multibyte char boundary in log message truncation#176

Merged
Marenz merged 2 commits intospacedriveapp:mainfrom
Marenz:fix/log-truncation-char-boundary
Feb 23, 2026
Merged

fix: avoid panic on multibyte char boundary in log message truncation#176
Marenz merged 2 commits intospacedriveapp:mainfrom
Marenz:fix/log-truncation-char-boundary

Conversation

@Marenz
Copy link
Collaborator

@Marenz Marenz commented Feb 23, 2026

The tracing formatter truncated log messages at a fixed byte offset (280) using a direct string slice, causing a panic when the cut point landed inside a multibyte UTF-8 character (e.g. '→').

Use floor_char_boundary to find the nearest valid char boundary at or before the limit before slicing. Fixes both occurrences in src/daemon.rs.

Triggered by a shell tool result containing '→' in its stderr output.

@Marenz Marenz force-pushed the fix/log-truncation-char-boundary branch 2 times, most recently from de63d62 to 867c535 Compare February 23, 2026 19:34
@Marenz Marenz force-pushed the fix/log-truncation-char-boundary branch from 867c535 to 7419468 Compare February 23, 2026 19:35
@Marenz Marenz merged commit 0b5b5a6 into spacedriveapp:main Feb 23, 2026
3 checks passed
@Marenz Marenz deleted the fix/log-truncation-char-boundary branch February 23, 2026 21:27
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