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

Guard against too long filenames on eCryptFS. #2217

Merged
merged 4 commits into from
Aug 17, 2023

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Aug 12, 2023

The AtomicDirectory mechanism inflates the target directory file name
length when deriving a work directory name. In the case of unlocked
operation in particular, this can lead to file name length violations
when the PEX_ROOT is the default ~/.pex and the home dir is encrypted
with eCryptFS, which generally limits file name lengths to 143
characters. Guard against this explicitly.

Fixes #2087

The `AtomicDirectory` mechanism inflates the target directory file name
length. In the case of unlocked operation in particular, this can lead
to file name length violations when the PEX_ROOT is the default `~/.pex`
and the home dir is encrypted with eCryptFS, which generally limits
file name lengths to 143 characters. Guard against this explicitly.

Fixes pex-tool#2087
@jsirois jsirois requested review from benjyw and huonw August 12, 2023 23:26
@jsirois
Copy link
Member Author

jsirois commented Aug 12, 2023

@konstin if you have time to try installing Pex from "pex @ git+https://github.com/jsirois/pex@1e8182997a0633cc229ed926104ca8f2330a6730" to test this out under your eCryptFS home dir, I'd be grateful.

Copy link
Collaborator

@huonw huonw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice approach 👍

Is it worth preserving a little more context than just the hash, so that someone introspecting/debugging can match directories up more easily? I imagine this would be useful only very rarely though, so might not be worth the effort.

For example pycryptodome-3.16.0-overlongABC123... would at least hint that the directory in question is associated with some work about pycryptodome, if there's a crash or some error including that path. (The rule there being the first 20 characters of the original base name plus a label string that can be grepped-for in the PEX codebase (overlong in this example), but no particular attachment to that in particular).

@benjyw
Copy link
Collaborator

benjyw commented Aug 14, 2023

Yeah, I think not worth the effort. This is an unusual case, and you'd have to have some very specific debugging needs on top of that unusual case for this to matter.

@jsirois
Copy link
Member Author

jsirois commented Aug 16, 2023

I agree this won't actually ever happen, but there is also ~0 effort involved.

@jsirois jsirois merged commit c92dec0 into pex-tool:main Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pex fails to build pycryptodome due to filename too long
3 participants