Skip to content

Detection of recursion loops in ReadDirRecursive* methods #29

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

Merged
merged 4 commits into from
Jan 12, 2024

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Jan 11, 2024

Now the ReadDirRecursive* can detect symlink loops as they emerge during the search.

Previously the ReadDirRecursive* methods would fail later in the search with a "path too long" error or, in the worst case, they may lead to an exponentially long loop if the "too-long" symlinks were filtered out with a custom filter.

This prepares for the next change that requires to keep a shared state
in the recursive calls.

This change also avoids the need to pass `recursionFilter` and `filters`
back into the recursive call.
@codecov-commenter
Copy link

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (b3ef88d) 68.56% compared to head (b49819c) 68.00%.

Files Patch % Lines
readdir.go 86.66% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #29      +/-   ##
==========================================
- Coverage   68.56%   68.00%   -0.57%     
==========================================
  Files           7        7              
  Lines         404      400       -4     
==========================================
- Hits          277      272       -5     
  Misses         93       93              
- Partials       34       35       +1     
Flag Coverage Δ
unit 68.00% <87.50%> (-0.57%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@alessio-perugini alessio-perugini left a comment

Choose a reason for hiding this comment

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

lgtm. Nice work 🚀

@cmaglie cmaglie merged commit dcc3db3 into master Jan 12, 2024
@cmaglie cmaglie deleted the recursion_loops branch January 12, 2024 14:01
@per1234 per1234 added type: bug Perceived defect in any part of project topic: code Related to content of the project itself labels Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: bug Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants