-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix ctypes usage with Python 3.9 #3000
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
Conversation
There is a regression in Python 3.9 with the `find_library()` function: >>> import ctypes.util >>> ctypes.util.find_library("libc") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.9/ctypes/util.py", line 341, in find_library _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name)) File "/usr/lib/python3.9/ctypes/util.py", line 147, in _findLib_gcc if not _is_elf(file): File "/usr/lib/python3.9/ctypes/util.py", line 99, in _is_elf with open(filename, 'br') as thefile: FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a' A workaround is to use `find_library("c")` instead. It also works in older versions of Python and that's already what's used in `contrib/isotp.py`. Python issue reported here: https://bugs.python.org/issue42580 Signed-off-by: Vincent Bernat <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
On which operating system did you get the issue? It works fine on macOS with Python3.9. |
On Debian unstable. If it helps, note https://docs.python.org/3/library/ctypes.html
|
Python 3.9.0 (under ArchLinux) gets no error: >>> import ctypes.util
>>> ctypes.util.find_library("libc") But: >>> ctypes.util.find_library("c")
'libc.so.6' Which is probably what one expects. |
The embedded version of Scapy is using `find_library("libc")` which is incorrect. This does not work anymore with Python 3.9. This should use `find_library("c")` instead (which also works for older versions). See secdev/scapy#3000 for more details. Anoher option would be to upgrade Scapy to 2.4.5, where this bug is fixed. Signed-off-by: Vincent Bernat <[email protected]>
The embedded version of Scapy is using `find_library("libc")` which is incorrect. This does not work anymore with Python 3.9. This should use `find_library("c")` instead (which also works for older versions). See secdev/scapy#3000 for more details. Anoher option would be to upgrade Scapy to 2.4.5, where this bug is fixed. Signed-off-by: Vincent Bernat <[email protected]>
The embedded version of Scapy is using `find_library("libc")` which is incorrect. This does not work anymore with Python 3.9. This should use `find_library("c")` instead (which also works for older versions). See secdev/scapy#3000 for more details. Anoher option would be to upgrade Scapy to 2.4.5, where this bug is fixed. Signed-off-by: Vincent Bernat <[email protected]>
There is a regression in Python 3.9 with the
find_library()
function:
A workaround is to use
find_library("c")
instead. It also works inolder versions of Python and that's already what's used in
contrib/isotp.py
.Python issue reported here:
https://bugs.python.org/issue42580
Signed-off-by: Vincent Bernat [email protected]