Skip to content

fix: normalize --full-path matches for parent search paths (fixes #1513)#2002

Open
leno23 wants to merge 2 commits into
sharkdp:masterfrom
leno23:fix/full-path-parent-normalization-1513
Open

fix: normalize --full-path matches for parent search paths (fixes #1513)#2002
leno23 wants to merge 2 commits into
sharkdp:masterfrom
leno23:fix/full-path-parent-normalization-1513

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 16, 2026

Summary

Fixes #1513: --full-path matching failed when the search path contained .. (or .), because the match string was built as e.g. /tmp/1/2/../foo without normalization, while the pattern used the canonical /tmp/1/foo.

Approach

When building the absolute path for --full-path matching, normalize via normpath only if the relative entry path contains . or .. components; otherwise keep the existing join behavior.

Testing

  • New integration test test_full_path_normalizes_relative_search_path
  • cargo test full_path_normalizes
  • cargo clippy -- -D warnings

Note

Similar fix was proposed in #1969 (closed without merge); happy to credit @lawrence3699 if maintainers prefer that attribution.

Made with Cursor

When searching from a subdirectory with a relative root like `..`,
--full-path compared unnormalized paths (e.g. cwd/../foo) against
absolute patterns. Normalize paths that contain `.` or `..` components.

Fixes sharkdp#1513.

Co-authored-by: Cursor <cursoragent@cursor.com>
@leno23 leno23 force-pushed the fix/full-path-parent-normalization-1513 branch from 21907dd to 2784f08 Compare May 16, 2026 21:17
@leno23

This comment was marked as low quality.

Windows CI failed because backslashes in the temp-dir path were
interpreted as regex escapes. Build the pattern with regex::escape.

Co-authored-by: Cursor <cursoragent@cursor.com>
@leno23

This comment was marked as low quality.

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.

[BUG] Wrong result when --full-path and ..

1 participant