Browse files

Remove recursion detection for symlinks.

Recursion detection on symlinks was too restrictive. It would detect the following as recursion:

    main -> main-1234

This is clearly not a recursion and a common pattern, eg when hosting package repositories.
Python's os.walk also does not do recursion detection. So lets behave like Python stdlib.
  • Loading branch information...
jbraeuer committed Jan 31, 2012
1 parent 9c57a3b commit 22c60c18ca5627b0af621fe355183a6092b2461c
Showing with 2 additions and 8 deletions.
  1. +2 −8 S3/
@@ -24,18 +24,12 @@ def _fswalk_follow_symlinks(path):
If a recursive directory link is detected, emit a warning and skip.
assert os.path.isdir(path) # only designed for directory argument
- walkdirs = set([path])
- targets = set()
+ walkdirs = [path]
for dirpath, dirnames, filenames in os.walk(path):
for dirname in dirnames:
current = os.path.join(dirpath, dirname)
- target = os.path.realpath(current)
if os.path.islink(current):
- if target in targets:
- warning("Skipping recursively symlinked directory %s" % dirname)
- else:
- walkdirs.add(current)
- targets.add(target)
+ walkdirs.append(current)
for walkdir in walkdirs:
for value in os.walk(walkdir):
yield value

0 comments on commit 22c60c1

Please sign in to comment.