How does pants doeal with symlinks?
# general
s
How does pants doeal with symlinks?
f
it doesn’t currently support them. you can configure pants to ignore the paths where symlinks are, but Pants does not currently know how to snapshot a symlink in order to replicate it with the execution sandbox. see https://github.com/pantsbuild/pants/issues/13122 and https://github.com/pantsbuild/pants/issues/13284. https://github.com/pantsbuild/pants/issues/10271 covers potentially supporting symlinks in the future as the Remote Execution API does support them.
s
Okay thanks, good to know!
h
@some-farmer-97614 if you have a use-case for symlinks can you mention it on https://github.com/pantsbuild/pants/issues/10271 ?
s
Thanks. In my case I’ll work around the restriction. Maybe symlinks weren’t the best option to begin with for it.
w
to be clear: Pants will capture the content of symlinks as long as they are within the repository
symlinks that escape the repository will cause an error
as Tom said: because we capture symlink content, your tests or binaries will never see a symlink as input
h
So in the sandbox your symlinks will be turned into regular files, and only if the content the symlinks pointed to was in the repo, and not elsewhere on the system
b
Symlinks handling is an issue for many build tools. I wonder if "How Pants' sandbox handles symlinks" should be a new section, or even page, somewhere in the docs. Right now the only mention is in https://www.pantsbuild.org/docs/reference-pex#advanced-options
w
agreed. has been on my todo list for a while
b
Do you have time to dump the main points from this thread into an appropriate place? It can always be elaborated on some other time.
w
it’s going to need to stay in the queue at least another week.
👍 1
b
That's not bad