Repository navigation
Fix symlink prefixes for multiple globstar captures - #239
Conversation
facelessuser
left a comment
There was a problem hiding this comment.
@shkyyy18 This is a good catch. Please see comments and address them.
|
Addressed both review comments in fb97480: moved the eight regression cases into tests/test_globmatch.py and backticked the globstar term in the real-symlink test docstring. The source fix is unchanged. Local Python 3.12 verification: 1251 passed, 167 skipped, 98% coverage; Ruff and mypy passed. The local test run uses a workspace-local temporary directory because the default Windows temp directory was inaccessible. I could not run pyspelling locally because hunspell/aspell is unavailable; the updated docstring uses the inline-code exclusion already configured in .pyspelling.yml. The new remote CI run is not yet reported as passed. |
|
@gir-bot lgtm |
Reproduction
With GLOBSTAR | REALPATH, the pattern
**/literal/**/file.txtcan incorrectly matchouter/literal/link/leaf/final/file.txtwhenlinkis a symlink and FOLLOW is disabled. The second globstar checksouter/linkinstead ofouter/literal/link. Conversely, a symlink at unrelatedouter/linkincorrectly rejects the real path._fs_match initializes base only for the first nonempty capture, losing literal components between later captures.
Fix
Initialize the filesystem prefix from each capture's actual start offset. No changes to parsing, symlink caching, or FOLLOW behavior.
Regression tests and validation
Read contributing guidance; checked current main and existing issues/PRs. AI-assisted investigation, implementation and synthetic tests; listed validation was executed locally. No personal data or unrelated refactoring.