Skip to content

Locate libcrypt via find_library and raise a clear error if missing - #4843

Open
AmmaarBakshi wants to merge 1 commit into
archlinux:masterfrom
AmmaarBakshi:fix/libcrypt-loading
Open

AmmaarBakshi wants to merge 1 commit into
archlinux:masterfrom
AmmaarBakshi:fix/libcrypt-loading

Conversation

@AmmaarBakshi

@AmmaarBakshi AmmaarBakshi commented Oct 17, 2026 •

Copy link
Copy Markdown

ctypes.CDLL('libcrypt.so') fails on systems that only ship a versioned soname (e.g. libcrypt.so.2). Resolve the library with ctypes.util.find_library('crypt'), fall back to 'libcrypt.so', and raise an ImportError with a readable message if it still cannot be loaded.

  • This fix issue:

PR Description:

Tests and Checks

  • I have tested the code!

ctypes.CDLL('libcrypt.so') fails on systems that only ship a versioned
soname (e.g. libcrypt.so.2). Resolve the library with
ctypes.util.find_library('crypt'), fall back to 'libcrypt.so', and raise
an ImportError with a readable message if it still cannot be loaded.
@AmmaarBakshi
AmmaarBakshi requested a review from Torxed as a code owner October 17, 2026 18:36
@h8d13

h8d13 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

This correct. (And relevant to #4813)

I'm not sure if it might not be worth to check .1 .2 ( I think)

@Torxed Torxed left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if this could cause issues down the line, but as it stands, both /usr/lib/libcrypt.so and /usr/lib/libcrypt.so.2 currently point to libcrypt.so.2.0.0 so there should be no harm in doing this.

This branch has not been deployed

No deployments
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.

3 participants