Skip to content
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

Do not stop ReadDirRecursive* on broken symlinks #30

Merged
merged 4 commits into from
Jan 15, 2024

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Jan 12, 2024

Previously if a broken symlink was found the ReadDirRecursive stopped with an error.
Now the broken symlink is returned as a file.

$ tree testdata/loops/regular_3/
testdata/loops/regular_3/
|-- dir1
|   `-- file1
|-- dir2
|   |-- dir1 -> ../dir1
|   `-- file2
`-- link -> broken

ReadDirRecursive() on testdata/loops/regular_3/ now returns:

testdata/loops/regular_3/dir1
testdata/loops/regular_3/dir1/file1
testdata/loops/regular_3/dir2
testdata/loops/regular_3/dir2/dir1
testdata/loops/regular_3/dir2/dir1/file1
testdata/loops/regular_3/dir2/file2
testdata/loops/regular_3/link

(cc @matthijskooijman This is part of your PR #13 was trying to do)

Instead return the symlink as a file in the file list
@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3226a11) 67.83% compared to head (075c5c8) 69.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #30      +/-   ##
==========================================
+ Coverage   67.83%   69.00%   +1.16%     
==========================================
  Files           7        7              
  Lines         401      400       -1     
==========================================
+ Hits          272      276       +4     
+ Misses         94       92       -2     
+ Partials       35       32       -3     
Flag Coverage Δ
unit 69.00% <100.00%> (+1.16%) ⬆️

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.

readdir.go Show resolved Hide resolved
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.

Note for us of the future: if we spot some regression, it could be related to the calling of path.IsDir() instead of path.IsDirCheck().

@cmaglie cmaglie force-pushed the improve_recursive_dirread branch from 702b184 to 075c5c8 Compare January 15, 2024 09:20
@cmaglie cmaglie merged commit 4ac75f3 into master Jan 15, 2024
7 checks passed
@cmaglie cmaglie deleted the improve_recursive_dirread branch January 16, 2024 16:07
@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