Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid symbolic link ~/.cache/pex/unzipped_pexes/<hash>/.bootstrap on Fedora Silverblue/Kinoite 41 #2634

Closed
tymonx opened this issue Dec 26, 2024 · 7 comments
Assignees

Comments

@tymonx
Copy link

tymonx commented Dec 26, 2024

The pants project uses pex and because of that it doesn't work on Linux distributions like Fedora Kinote or Silverblue (Atomic OS). Because of ~/ or /home/${USER}/ that is a symbolic link to /var/home/${USER}/. pex creates a symbolic link ~/.cache/pex/unzipped_pexes/<hash>/.bootstrap pointing to ../../../../../../var/home/${USER}/.cache/pex/bootstraps/<hash>. The main root cause is relative content of that created symbolic link. If pex file is run when current working directory is part of /home/${USER}/ then unpacking procedure fails with raised Python exception from ~/.cache/pex/unzipped_pexes/<hash>/__main__.py file:

from pex.globals import Globals

ModuleNotFoundError: No module named 'pex'

Because of invalid symbolic link added to sys.path[0] by above __main__.py file, the Python pex module cannot be found by Python interpreter.

It impacts pants: pantsbuild/pants#21799

Related issues: #2572 and #2626 Unfortunately it doesn't fix above issue for pants 2.31.1.

It looks like that fix should be fair easy to implement (using realpath).

@jsirois
Copy link
Member

jsirois commented Dec 26, 2024

@tymonx how did you determine  #2572 and #2626 do not fix the issue. Have you verified Pants and scie-pants use versions of Pex incorporating both of those fixes?

@jsirois
Copy link
Member

jsirois commented Dec 26, 2024

For example #2626 was only released in Pex 2.27.1 2 weeks ago: https://github.com/pex-tool/pex/releases/tag/v2.27.1

Surely the Pants folks haven't updated Pants and scie-pants to that already.

@jsirois
Copy link
Member

jsirois commented Dec 26, 2024

@tymonx this was in fact fixed in #2626 but you need Pants 2.25.0.dev3 or newer to get that fix.

See the example docker session here: pantsbuild/pants#21799 (comment)

@jsirois jsirois self-assigned this Dec 26, 2024
@jsirois
Copy link
Member

jsirois commented Dec 26, 2024

@tymonx I'm going to close this as an answered question since pantsbuild/pants#21799 (comment) proves the fixes in #2572 and #2626 do work. You just may have to wait awhile on Pants to get a stable 2.25 release out if you're not willing to use a Pants 2.25 dev release.

@tymonx
Copy link
Author

tymonx commented Dec 26, 2024

@jsirois You are right. It uses older version of pex 2.16.2 before fix. I will try Pants 2.25.dev3:

cat ~/.cache/pex/bootstraps/<hash>/pex/version.py

@tymonx
Copy link
Author

tymonx commented Dec 26, 2024

@jsirois I can confirm. If fixes the issue when changing pants version to 2.25.dev3 in pants.toml file and re-running the pants command again:

[GLOBAL]
pants_version = "2.25.0.dev3"

@jsirois
Copy link
Member

jsirois commented Dec 26, 2024

Great - thanks for confirming @tymonx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants