This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.walk should traverse outward symlinks
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, synx13
Priority: normal Keywords:

Created on 2007-03-18 02:42 by synx13, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
os.outward_links.diff synx13, 2007-03-18 02:42 walk through symlinked dirs, if those dirs are outward links
Messages (2)
msg31565 - (view) Author: Tasci Synx (synx13) Date: 2007-03-18 02:42
To my dismay, I discovered that os.walk will ignore all symlinks, even symlinks that link to somewhere outside of the directory being walked. So I made a little patch to os.py, I hope you apply it, or some figment thereof.
msg31566 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-18 08:19
The detection of "outward" symlinks is unreliable because there may be a link there which links "back" into the walked hierarchy.
For 2.6, os.walk already has a "followlinks" keyword argument, which will follow *all* symlinks. You can easily restrict them by removing them from the "dirs" list yielded to the caller.

Closing as outdated.
IMO, the one thing that could be improved is to have a cache of visited directories, and to not visit one if it's in the cache.
History
Date User Action Args
2022-04-11 14:56:23adminsetgithub: 44737
2007-03-18 02:42:58synx13create