pants
pants copied to clipboard
remoting: support symlinks attribute in directories
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.
Oof. Not terribly excited about that, but it is what it is.
@compyman added a great example of a use case for symlinks over here: https://github.com/pantsbuild/pants/pull/15211#issuecomment-1135155501
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:
- By
@rule
code, via theSnapshot
node- In this case, the actual
Vfs
implementation is forContext
, which implements theVfs
ops viaNode
s (to give them invalidation and memoization). - Because we want to track symlinks via
Node
s, this case is markedSymlinkBehavior::Aware
: otherwise, theVfs
would never receive anyread_link
calls, because the operating system would already have expanded them.
- In this case, the actual
- By sandbox outputs capture
- In this case, the
Vfs
in use is directlyimpl Vfs for PosixFS
, with less indirection. - Currently, this case is marked
SymlinkBehavior::Oblivious
. That will need to change: see below.
- In this case, the
Since you are adding symlink awareness, the process-sandbox case will need to be marked Aware
.
@stuhood can we close this now because of https://github.com/pantsbuild/pants/pull/16844?
Yes!
<3 <3 <3 thanks!