[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

Eryk Sun report at bugs.python.org
Wed Dec 15 13:30:10 EST 2021


Eryk Sun <eryksun at gmail.com> added the comment:

> but errors in DirEntry.is_dir() and DirEntry.is_symlink() 
> are always ignored

In Windows, is_symlink() won't fail due to a long path, since that information comes from the directory listing, but is_dir() might fail for a long path if it's a symlink to a directory. Windows requires that a symlink to a directory is also a directory (i.e. the symlink reparse point is set on an empty directory), but it's not enough to check that it's a directory symlink. is_dir() requires checking that the target exists, which may fail if the path of the link is too long to open and resolve the link target.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46084>
_______________________________________


More information about the Python-bugs-list mailing list