← Back to issue list

python3 ctypes can't find libs on due to ld cache

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1861026
Type
issue
State
open
Author
~jdstrand
Labels
—
Created
Updated
Closed
—

Current evaluation

UC strict snaps let ctypes resolve bundled libraries through the host ldconfig cache; commit 786d0b8eab91c3be850f07195b4cd2c52dbdfbf7 is recorded as a workaround.

Suggested action: close resolved

Reason: ~cjp256 diagnosed ctypes.util.find_library() invoking ldconfig -p and selecting the host cache, while ~anonymouse67 tracked snap-private writable-cache handling. The final comment explicitly identifies commit 786d0b8eab91c3be850f07195b4cd2c52dbdfbf7 as containing a workaround, providing implemented remediation despite the tracker remaining open.

Evaluated by: mr-cal-bot

Impact: 52 Quick Win: 11 Complexity: 74 Confidence: 84 Actionability: 82

Issue body

python3-magic 'undefined symbol: magic_open' on UC devices but not classic (ctypes issue) With the snap in https://code.launchpad.net/~jdstrand/+git/test-python3-magic the snap works fine on classic distro, but not on UC16 or UC18: On classic distro (eg, Ubuntu 19.10): $ snapcraft $ sudo snap install --dangerous ./test-python3-magic_0_amd64.snap $ test-python3-magic /bin/ls /bin/ls: application/x-executable; charset=binary On UC16 and UC18: $ test-python3-magic /bin/ls Traceback (most recent call last): File "/snap/test-python3-magic/x1/bin/test-python3-magic", line 3, in <module> import magic File "/snap/test-python3-magic/x1/usr/lib/python3/dist-packages/magic/__init__.py", line 361, in <module> add_compat(globals()) File "/snap/test-python3-magic/x1/usr/lib/python3/dist-packages/magic/__init__.py", line 325, in add_compat from magic import compat File "/snap/test-python3-magic/x1/usr/lib/python3/dist-packages/magic/compat.py", line 61, in <module> _open = _libraries['magic'].magic_open File "/snap/test-python3-magic/x1/usr/lib/python3.6/ctypes/__init__.py", line 361, in __getattr__ func = self.__getitem__(name) File "/snap/test-python3-magic/x1/usr/lib/python3.6/ctypes/__init__.py", line 366, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: python3: undefined symbol: magic_open Using 'base: core' or 'base: core18' makes no difference. Snapcraft 3.9.7 and 3.9.8 have the same behavior.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 52
Quick Win: 11
Complexity: 74
Confidence: 84
Actionability: 82
close resolved UC strict snaps let ctypes resolve bundled libraries through the host ldconfig cache; commit 786d0b8eab91c3be850f07195b4cd2c52dbdfbf7 is recorded as a workaround.
stealth/space-bunny-alpha
Impact: 55
Quick Win: 17
Complexity: 65
Confidence: 87
Actionability: 88
keep open On strict UC16/UC18 snaps, python3-magic's ctypes.util.find_library("magic") consults the host ldconfig cache and can load an incompatible libmagic, causing undefined symbol magic_open; a private-cache workaround exists.
stealth/space-bunny-alpha
Impact: 38
Quick Win: 11
Complexity: 55
Confidence: 86
Actionability: 62
needs triage python3-magic fails on UC16/UC18 because ctypes relies on an incompatible ld cache; needs triage of a supplied reproducer before core18 retirement.
qwen/qwen3.8-27b
Impact: 30
Quick Win: 16
Staleness: 92
Complexity: 45
Confidence: 68
Support Request: 15
close stale python3-magic snap fails on Ubuntu Core 16/18 with 'undefined symbol: magic_open' via ctypes (ld cache); works on classic. No maintainer response; affected bases (core, core18) are EOL.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 40
Confidence: 85
Support Request: 10
close stale Reports python3-magic failing with undefined symbol errors on Ubuntu Core 16/18 snaps due to ctypes and ld cache behavior. No maintainer response or labels, and the affected environments are long deprecated.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 65
Confidence: 85
Support Request: 20
close stale Python3 ctypes fails to load libmagic on Ubuntu Core 16/18 snaps due to ld cache issues. Reported over 5 years ago with no maintainer response or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 40
Confidence: 85
Support Request: 10
close stale Python3 ctypes fails to load libmagic on Ubuntu Core 16/18 snaps due to ld cache issues. Reported 6 years ago with zero maintainer interaction or comments. UC16/18 are EOL.

Update history

Date Change
created

Related issues

No related issues found above the similarity threshold.