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. .idea/
  2. bin/
  3. config/
  4. docs/
  5. lib/
  6. plugin/
  7. pmd/
  8. scripts/
  9. src/
  10. test/
  11. testdata/
  12. third-party/
  13. .buckconfig
  14. .classpath
  15. .gitignore
  16. .project
  17. .travis.yml
  18. buck.iml
  19. build.xml
  20. DEFS
  21. LICENSE
  22. README.md
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