Skip to content

Limit search pattern and directory recursion #4647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

asbjornu
Copy link
Member

@asbjornu asbjornu commented Aug 8, 2025

Description

Narrow the scope of the search pattern to only include project files and limit directory recursion to 255 subdirectories to avoid infinite loops and subsequent PathTooLongException.

Related Issue

May fix GH-4411.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Copilot Copilot AI review requested due to automatic review settings August 8, 2025 23:10
@asbjornu asbjornu added this to the 6.x milestone Aug 8, 2025
Copilot

This comment was marked as outdated.

@asbjornu asbjornu force-pushed the gh-4411-enumerate-files branch 2 times, most recently from da62f4a to 86ca875 Compare August 8, 2025 23:13
@asbjornu asbjornu requested a review from Copilot August 8, 2025 23:14
@asbjornu asbjornu assigned arturcic and unassigned arturcic Aug 8, 2025
Copilot

This comment was marked as outdated.

@asbjornu asbjornu requested a review from arturcic August 8, 2025 23:14
@asbjornu asbjornu force-pushed the gh-4411-enumerate-files branch from 86ca875 to 3693ec5 Compare August 8, 2025 23:16
@asbjornu asbjornu requested a review from Copilot August 8, 2025 23:16
Copilot

This comment was marked as outdated.

Narrow the scope of the search pattern to only include project files and
limit directory recursion to 255 subdirectories to avoid infinite loops
and subsequent `PathTooLongException`. May fix GitToolsGH-4411.
@asbjornu asbjornu requested a review from Copilot August 8, 2025 23:20
Copilot

This comment was marked as outdated.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the project file discovery mechanism by limiting the scope and depth of directory traversal to prevent infinite loops and PathTooLongException errors. The changes specifically target scenarios where directory recursion could become problematic.

  • Introduces a maximum recursion depth limit of 255 subdirectories
  • Narrows the search pattern from "*" to "*proj" to focus on actual project files
  • Replaces the legacy SearchOption.AllDirectories with modern EnumerationOptions

Copy link

sonarqubecloud bot commented Aug 8, 2025

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.

[ISSUE]: Recursing symlinks infinitely - PathTooLongException
2 participants