filesystem icon indicating copy to clipboard operation
filesystem copied to clipboard

recursive_directory_iterator for error symlink

Open Layty opened this issue 1 year ago • 1 comments

Describe the bug I want to get a floder size, like du -s but in a floder, there is a error symlink file like a loop

cd /tmp
ln -sf abc abc

then use fs::recursive_directory_iterator will report

Error occurred while calculating file size: Too many levels of symbolic links: '/tmp/abc'

To Reproduce Detailed steps to reproduce the behavior.

Expected behavior I think we can check it is a bad file ?

Layty avatar Jan 02 '24 06:01 Layty

While it would not solve the issue of longer loops (linking a few levels up the path) detecting such self-links might be something cheap enough to make it a feature. I'll think about a solution.

gulrak avatar Jan 06 '24 08:01 gulrak