Repository navigation
Skip paths the path type rejects instead of aborting the scan - #173
Merged
Merged
Conversation
ktsu.Semantics.Paths rejects '<', '>', '|' and paths over 256 characters, all of which Unix file systems accept. One such file anywhere in the tree threw out of FileScanner.ScanForFiles and took every verb down with it. The scan now names and skips the file, as the hasher does for a file it cannot read, and a root that cannot be represented fails in one line with exit code 1. Fixes #140 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL
|
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.



Fixes #140
What changed
FileScanner.ScanForFilescatches theArgumentExceptionfromAs<AbsoluteFilePath>()for each enumerated path, printsSkipped <path>: <reason>, and carries on. This matches howFileHasherhandles a file it cannot read. A file name with<,>or|, or a path over 256 characters, no longer stops every verb on that root.BaseVerb<T>.Runchecks that the root itself converts before it callsIsScannableDirectory. A root that cannot be represented now prints one line,Cannot scan <path>: <reason>, and exits 1 instead of throwing a stack trace.The upstream relaxation of the limits stays with ktsu-dev/Semantics#330, as the triage comment says.
Tests
ScanSkipsAFileWhoseNameThePathTypeRejectsandScanSkipsAFileWhosePathIsTooLongForThePathType: the scan returns the two representable duplicates and skips the rest.EveryVerbSkipsAnUnrepresentableFileAndReportsTheRest: Scan, DryRun, Stats and Deduplicate each exit 0, name the skipped file, and still handle the duplicate pair next to it.ScanOfAnUnrepresentableRootReportsItInOneLine: a root namedleft|rightexits 1 with a one-line message.<or|on Windows), the staging helper marks the test inconclusive.With the two production files reverted, all four new tests fail. With the fix, the full suite passes locally on Linux: 83 passed, 3 skipped. The 3 skips already existed; they need a non-root user.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL
Generated by Claude Code