gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recursive directory iterator tries to follow symlink on macOS

wolfv opened this issue · comments

Describe the bug
I am recursing over a directory with symlinks inside. These symlinks have no valid target though. Unfortunately when running over this with a recursive directory iterator, it throws with "No such file or directory" when incrementing the iterator.

drwxr-xr-x  4 wolfvollprecht  staff  128 May 12 17:14 .
drwxr-xr-x  5 wolfvollprecht  staff  160 May 12 17:14 ..
lrwxrwxr-x  1 wolfvollprecht  staff   29 Feb 21 15:30 libcrypto.1.1.dylib -> ../../lib/libcrypto.1.1.dylib
lrwxrwxr-x  1 wolfvollprecht  staff   26 Feb 21 15:30 libssl.1.1.dylib -> ../../lib/libssl.1.1.dylib

To Reproduce
Downloading, unpacking and iterating over the contents of this file https://anaconda.org/conda-forge/mysql-libs/8.0.23/download/osx-64/mysql-libs-8.0.23-hbeb7981_1.tar.bz2 should lead to the same issue. It contains the missing symlinks mentioned above. I observed this on macOS only so far.

The STL implementation does not have this problem.

This came up in mamba: mamba-org/mamba#950

Expected behavior
I'd like the iterator to move to the next item.

Thanks for reporting, I'll look into it.

This is now part of release v1.5.6

Thanks!