https://pantsbuild.org/ logo
s

some-farmer-97614

02/07/2022, 3:10 PM
How does pants doeal with symlinks?
f

fast-nail-55400

02/07/2022, 3:20 PM
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

some-farmer-97614

02/07/2022, 3:21 PM
Okay thanks, good to know!
h

happy-kitchen-89482

02/07/2022, 4:18 PM
@some-farmer-97614 if you have a use-case for symlinks can you mention it on https://github.com/pantsbuild/pants/issues/10271 ?
s

some-farmer-97614

02/07/2022, 4:37 PM
Thanks. In my case I’ll work around the restriction. Maybe symlinks weren’t the best option to begin with for it.
w

witty-crayon-22786

02/07/2022, 5:05 PM
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

happy-kitchen-89482

02/07/2022, 6:55 PM
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

busy-vase-39202

02/08/2022, 12:08 AM
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

witty-crayon-22786

02/08/2022, 12:09 AM
agreed. has been on my todo list for a while
b

busy-vase-39202

02/08/2022, 12:17 AM
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

witty-crayon-22786

02/08/2022, 12:18 AM
it’s going to need to stay in the queue at least another week.
👍 1
b

busy-vase-39202

02/08/2022, 12:19 AM
That's not bad
4 Views