[ python-Bugs-1682940 ] os.walk should traverse outward symlinks

SourceForge.net noreply at sourceforge.net
Sun Mar 18 09:19:25 CET 2007


Bugs item #1682940, was opened at 2007-03-18 02:42
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682940&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
>Status: Closed
>Resolution: Out of Date
Priority: 5
Private: No
Submitted By: Tasci Synx (synx13)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.walk should traverse outward symlinks

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-18 08:19

Message:
Logged In: YES 
user_id=849994
Originator: NO

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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682940&group_id=5470


More information about the Python-bugs-list mailing list