buck.py more permissive symlinking.

Summary:
f0dedaec09331f73b3970658344cf8f3cb37a83b introduced a symlink aware walk aimed
at preventing recursively symlink loops; however, it was too restrictive in
that it pruned all symlinks that it has visited before, not only those that
would result in recursive symlinks. This breaks legitimate uses of symlinking
to siblings and cousin directories.

This diff adds a second test before pruning the symlink: not only must the
target directory be one already visited, but it must also be a direct ancestor
of the current directory.

Test Plan:
Trigger the traversal code by using recursive `glob` and `buck test --all` on
directories with the following configurations:

Test that siblings are okay (`b` and `c` are both traversed):

  a/
    b/
    c -> b

Test that ancestors are still rejected (`c` is not traversed):

  a/
    b/
      c/ -> ../b
2 files changed
tree: b7f2bb24121342b769fd4c604faeea9163eb6171
  1. .buckconfig
  2. .classpath
  3. .gitignore
  4. .idea/
  5. .project
  6. .travis.yml
  7. DEFS
  8. LICENSE
  9. README.md
  10. bin/
  11. buck.iml
  12. build.xml
  13. config/
  14. docs/
  15. lib/
  16. plugin/
  17. pmd/
  18. scripts/
  19. src/
  20. test/
  21. testdata/
  22. third-party/
README.md

Buck

Buck is an Android build tool. To see what Buck can do for you, check out the documentation at http://facebook.github.io/buck/.

Build Status

Installation

To build Buck, run the following:

git clone git@github.com:facebook/buck.git
cd buck
ant
./bin/buck --help

License

Apache License 2.0