Doesn't work if using musl libc: find_library is broken
I'm trying to construct a Docker image based on Alpine Linux, which uses the musl libc implementation. There is an existing issue in python that causes the find_library call to fail, which is rather unfortunate.
It's also reported on the Docker image repository. It's not really an issue with this library I guess, but this report could be helpful to others coming here with the same issue.
I'm not following the issue. What would the fix look like?
This issue is really the result of a bug in Python, but this library could work around it (although I'd understand it if you wouldn't want to).
I patched magic.py by making line 150 just return libmagic.so.1, but that is perhaps a bit messy. You could do what ctypes.utils.find_library should probably do: just look in /usr/lib/ if libmagic.so exists.
Is this package not maintained anymore?
Alpine has been tested for a while so this seems to be fixed.
find_library is no longer used on Linux: https://github.com/ahupp/python-magic/blob/2a01b18ae0fe27e51977a54f0589910ddcc05804/magic/loader.py#L32-L34
That function is a generator that produces candidate libraries, a the top
ever platform calls find_library("magic"):
https://github.com/ahupp/python-magic/blob/2a01b18ae0fe27e51977a54f0589910ddcc05804/magic/loader.py#L9
On Mon, Aug 28, 2023, 2:29 AM Thom Wiggers @.***> wrote:
find_library is no longer used on Linux: https://github.com/ahupp/python-magic/blob/2a01b18ae0fe27e51977a54f0589910ddcc05804/magic/loader.py#L32-L34
— Reply to this email directly, view it on GitHub https://github.com/ahupp/python-magic/issues/114#issuecomment-1695357211, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAJ5ERQRZN3PDRS4BXC6YLXXRQHTANCNFSM4COSEVRA . You are receiving this because you modified the open/close state.Message ID: @.***>
Right, anyway, the quoted lines then indeed still tackle musl