Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Follow symlinks, when requested. (Drop recursion detection) #23

Merged
merged 1 commit into from

2 participants

@jbraeuer

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

dir/
main-1234/
file1
file2
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.

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

dir/
    main-1234/
              file1
              file2
    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.
22c60c1
@mludvig
Owner

Thanks for the contribution, looks good. Merging it now.

@mludvig mludvig merged commit add5f2b into s3tools:master
@jbraeuer

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 31, 2012
  1. @jbraeuer

    Remove recursion detection for symlinks.

    jbraeuer authored
    Recursion detection on symlinks was too restrictive. It would detect the following as recursion:
    
    dir/
        main-1234/
                  file1
                  file2
        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.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 8 deletions.
  1. +2 −8 S3/FileLists.py
View
10 S3/FileLists.py
@@ -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
Something went wrong with that request. Please try again.