pants icon indicating copy to clipboard operation
pants copied to clipboard

remoting: support symlinks attribute in directories

Open tdyas opened this issue 4 years ago • 3 comments

https://github.com/pantsbuild/pants/pull/10155 refreshed the REv2 protos. The DirectoryNode proto now has a symlinks field that models symbolic links in a directory as a list of SymlinkNode protos. Pants should implement support for that in order to better conform to the REv2 API.

tdyas avatar Jul 06 '20 19:07 tdyas

Oof. Not terribly excited about that, but it is what it is.

stuhood avatar Jul 06 '20 20:07 stuhood

@compyman added a great example of a use case for symlinks over here: https://github.com/pantsbuild/pants/pull/15211#issuecomment-1135155501

stuhood avatar Jun 09 '22 23:06 stuhood

Some thoughts on how this might impact glob matching:

PosixFS does already have a notion of symlink awareness, which currently only controls whether scandir will ever return a symlink.

Glob matching (implemented in GlobMatchingImplementation::expand, which consumes an impl Vfs) is used in two primary cases:

  1. By @rule code, via the Snapshot node
    • In this case, the actual Vfs implementation is for Context, which implements the Vfs ops via Nodes (to give them invalidation and memoization).
    • Because we want to track symlinks via Nodes, this case is marked SymlinkBehavior::Aware : otherwise, the Vfs would never receive any read_link calls, because the operating system would already have expanded them.
  2. By sandbox outputs capture
    • In this case, the Vfs in use is directly impl Vfs for PosixFS, with less indirection.
    • Currently, this case is marked SymlinkBehavior::Oblivious. That will need to change: see below.

Since you are adding symlink awareness, the process-sandbox case will need to be marked Aware.

stuhood avatar Sep 14 '22 17:09 stuhood

@stuhood can we close this now because of https://github.com/pantsbuild/pants/pull/16844?

thejcannon avatar Nov 08 '22 21:11 thejcannon

Yes!

stuhood avatar Nov 08 '22 21:11 stuhood

<3 <3 <3 thanks!

compyman avatar Nov 09 '22 16:11 compyman