Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] python: patch for ctypes.util.find_library on musl is incorrect on glibc
@ 2021-12-22 20:33 tornaria
  2022-06-20  2:13 ` github-actions
  2022-07-04  2:15 ` [ISSUE] [CLOSED] " github-actions
  0 siblings, 2 replies; 3+ messages in thread
From: tornaria @ 2021-12-22 20:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1773 bytes --]

New issue by tornaria on void-packages repository

https://github.com/void-linux/void-packages/issues/34669

Description:
- Patch: https://github.com/void-linux/void-packages/blob/master/srcpkgs/python3/patches/musl-find_library.patch
- Original file: https://hg.python.org/cpython/file/tip/Lib/ctypes/util.py#l243
The patch unconditonally replaces the logic for `find_library` by a custom version _"for Alpine Linux / musl - search manually system paths"_. This is incorrect in glibc as in the following snippet:
```
Python 3.10.1 (main, Dec  8 2021, 19:45:26) [GCC 10.2.1 20201203] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes.util
>>> ctypes.util.find_library('m')
'libc.so.6'
>>> ctypes.util.find_library('pthread')
'libc.so.6'
>>> ctypes.util.find_library('crypt')
'libc.so.6'
```
The correct values should be `libm.so.6`, `libpthreads.so.0` and `libcrypt.so.1`. Note also that
```
>>> ctypes.util.find_library('bz2')
'libbz2.so'
```
instead of `libbz2.so.1`  just because I happen to have `bzip2-devel` installed. On unpatched python this always returns `libbz2.so.1` on glibc. On musl this fails (returns None) unless `bzip2-devel` (and `gcc` or `binutils`) are installed, and in this case it returns `libbz2.so.1`.

It seems to me that it would be more appropriate to place the implementation in the patch as a separate function `_find_library_musl` that it's only called *after*  the other cases in https://hg.python.org/cpython/file/tip/Lib/ctypes/util.py#l303 have been tried and failed.
Also, in addition to crypt, m and pthread, there are more libraries included in libc.so: dl, resolv, rt, util, xnet (this list obtained by looking at `xbps-query -f musl-devel | grep "\.a$"`).




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: python: patch for ctypes.util.find_library on musl is incorrect on glibc
  2021-12-22 20:33 [ISSUE] python: patch for ctypes.util.find_library on musl is incorrect on glibc tornaria
@ 2022-06-20  2:13 ` github-actions
  2022-07-04  2:15 ` [ISSUE] [CLOSED] " github-actions
  1 sibling, 0 replies; 3+ messages in thread
From: github-actions @ 2022-06-20  2:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/issues/34669#issuecomment-1159891931

Comment:
Issues become stale 90 days after last activity and are closed 14 days after that.  If this issue is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ISSUE] [CLOSED] python: patch for ctypes.util.find_library on musl is incorrect on glibc
  2021-12-22 20:33 [ISSUE] python: patch for ctypes.util.find_library on musl is incorrect on glibc tornaria
  2022-06-20  2:13 ` github-actions
@ 2022-07-04  2:15 ` github-actions
  1 sibling, 0 replies; 3+ messages in thread
From: github-actions @ 2022-07-04  2:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]

Closed issue by tornaria on void-packages repository

https://github.com/void-linux/void-packages/issues/34669

Description:
- Patch: https://github.com/void-linux/void-packages/blob/master/srcpkgs/python3/patches/musl-find_library.patch
- Original file: https://hg.python.org/cpython/file/tip/Lib/ctypes/util.py#l243
The patch unconditonally replaces the logic for `find_library` by a custom version _"for Alpine Linux / musl - search manually system paths"_. This is incorrect in glibc as in the following snippet:
```
Python 3.10.1 (main, Dec  8 2021, 19:45:26) [GCC 10.2.1 20201203] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes.util
>>> ctypes.util.find_library('m')
'libc.so.6'
>>> ctypes.util.find_library('pthread')
'libc.so.6'
>>> ctypes.util.find_library('crypt')
'libc.so.6'
```
The correct values should be `libm.so.6`, `libpthreads.so.0` and `libcrypt.so.1`. Note also that
```
>>> ctypes.util.find_library('bz2')
'libbz2.so'
```
instead of `libbz2.so.1`  just because I happen to have `bzip2-devel` installed. On unpatched python this always returns `libbz2.so.1` on glibc. On musl this fails (returns None) unless `bzip2-devel` (and `gcc` or `binutils`) are installed, and in this case it returns `libbz2.so.1`.

It seems to me that it would be more appropriate to place the implementation in the patch as a separate function `_find_library_musl` that it's only called *after*  the other cases in https://hg.python.org/cpython/file/tip/Lib/ctypes/util.py#l303 have been tried and failed.
Also, in addition to crypt, m and pthread, there are more libraries included in libc.so: dl, resolv, rt, util, xnet (this list obtained by looking at `xbps-query -f musl-devel | grep "\.a$"`).




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-04  2:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 20:33 [ISSUE] python: patch for ctypes.util.find_library on musl is incorrect on glibc tornaria
2022-06-20  2:13 ` github-actions
2022-07-04  2:15 ` [ISSUE] [CLOSED] " github-actions

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).