Repository navigation
Canonicalize scanned paths to avoid self-duplicates - #6
Merged
Merged
Conversation
WalkDir yields paths relative to the base argument, so scanning "." stored "./song.mp3" while scanning an absolute path stored the full path. The same physical file reached via different spellings landed in the DB twice (the path column is UNIQUE but keyed on the string) and was reported as an "exact copy" duplicate of itself. Canonicalize each discovered path before storing so one physical file always maps to one absolute, symlink-resolved path. This also makes scan consistent with exclude/include/`find --for`, which already canonicalize.
zas
approved these changes
Jul 10, 2026
zas
left a comment
Owner
There was a problem hiding this comment.
Thanks for the contribution, LGTM.
As an improvement, we could store the original (non-canonicalized) path as the display path, so output and --exec reference the path the user actually sees in their filesystem.
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.
WalkDiryields paths relative to the base argument, so scanning.stored./song.mp3while scanning an absolute path stored the full path. The same physical file reached via different spellings landed in the DB twice (thepathcolumn is UNIQUE but keyed on the string) and was reported as an "exact copy" duplicate of itself.Canonicalize each discovered path before storing so one physical file always maps to one absolute, symlink-resolved path. This also makes
scanconsistent withexclude/include/find --for, which already canonicalize.