[engine] Use scandir, and preserve symlink paths in output

Review Request #3991 - Created June 9, 2016 and submitted

Information
Stu Hood
pants
3497, 3575
Reviewers
pants-reviews
kwlzn, nhoward_tw, wisechengyi

This patch fixes an issue where symlinked directories and files were resolved to their canonical names during execution. That meant that a glob for d.ln/2.txt (where d.ln was a symlink to a directory a) might result in a match for the path a/2.txt. Instead, users expect that the symlink is treated as if it had the same type as the underlying file.

Additionally, this review switches to using scandir to compute directory listings, which should result in 1 syscall per directory listing, rather than N+1.

  • Convert Path into a holder for a symbolic name and the Stat that underlies it.
  • Generate directory listings via scandir: fewer syscalls, and fewer FilesystemNodes.
  • Satisfy a point lookup for a literal Path using the directory listing that contains it (to allow the same underlying syscall to be reused there).
  • Preserve file ordering in EagerFilesetWithSpec, and cover with a test (resolves #3497.)

http://jenkins.pantsbuild.org/job/pantsbuild/job/pants/branch/PR-3575/5/

Kris Wilson
Nick Howard (Twitter)
Stu Hood
Stu Hood
Stu Hood
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as 387bb116c96863aaf2e07fff278a363e15bbfd34

Loading...