Why does pants complain about symlinks which are a...
# general
l
Why does pants complain about symlinks which are absolute links? We have a few places in our development environment where we symlink files with absolute paths. The source and target are both within the repository, but the target path is absolute. These files give us an error–
Copy code
Exception: Failed to read link "/Users/ryan.king/code/color/.git/hooks/post-checkout": Absolute symlink: "/Users/ryan.king/code/color/.git/hooks/post-checkout"
e
Hey Ryan! The genesis goes way back to here: https://github.com/twitter/pants/commit/f83e2b0272e2ff1c464e453c1f74d9335e18fcc3#diff-8e62b895888730006ec4dddb7b0[…]00348559a7bcf4118ad859eeaafc0R65 It looks like that was just maintained as things were ported to Rust. Its not clear to me if we still need this. We no longer use Watchman for fs watching and this may have just been an artifact of that. @witty-crayon-22786 will have the definitive voice here on whether we can relax things and admit any symlink as long as it points inside the build root. In the meantime - assuming Pants need not concern itself with these files - you can force them to be ignored by adding
[GLOBAL] pants_ignore
entries in your pants.toml: https://www.pantsbuild.org/docs/reference-global#section-pants-ignore
l
we actually do want pants to watch these, but I was able to work around it by making the links relative rather than absolute
w
ah, yea. we’re no longer using
watchman
, but absolute symlinks are still potentially a challenge on macOS. we might eventually be able to remove that restriction via https://github.com/pantsbuild/pants/issues/10842 , but it sounds like relative symlinks are the right approach here.
l
ok good to know.
Perhaps a newbie question, but is there a pants command to find all such problems like this in a repo?
w
./pants list ::
should be sufficient, because it will list all directories. and in CI, using the
./pants --changed-* …
commands should detect newly introduced issues: https://www.pantsbuild.org/docs/using-pants-in-ci#recommended-commands
👍 2