Fix: Panic on overly long filenames instead of silently dropping files#1287
Merged
Fix: Panic on overly long filenames instead of silently dropping files#1287
Conversation
- Replace silent None return with explicit panic when a filename is too long - Add detailed error message showing filename, sizes, and limits - Add comprehensive unit tests to validate the panic behavior - Prevents silent file skipping that could lead to incomplete checking Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
j178
reviewed
Dec 30, 2025
Add defensive bounds check to prevent potential index out of bounds panic with unhelpful error message. Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix potential bug with long command lines dropping files
Fix: Panic on overly long filenames instead of silently dropping files
Dec 30, 2025
Changed from verbose multi-line message to simple single-line format:
"Filename `{}` ({} bytes) is too long to fit in command line"
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1287 +/- ##
==========================================
+ Coverage 89.94% 90.00% +0.05%
==========================================
Files 80 80
Lines 15808 15881 +73
==========================================
+ Hits 14219 14293 +74
+ Misses 1589 1588 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (16.7 MiB → 16.7 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
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.
The
Partitionsiterator would silently returnNonewhen encountering a filename too long to fit in a command line batch, causing all subsequent files to be skipped without warning.Changes
crates/prek/src/run.rs:157-174: Replace silentNonereturn with explicit panic including:crates/prek/src/run.rs:220-358: Add unit tests covering:Error message
The minimum
max_cli_lengthis 4096 bytes (non-Unix/Windows platforms), making this scenario rare but critical when it occurs.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.