GNU bug report logs - #64309
Python dlopen()s musl libc

Previous Next

Package: guix;

Reported by: Athena Martin <secure <at> alm.website>

Date: Tue, 27 Jun 2023 00:44:02 UTC

Severity: normal

Tags: moreinfo

Full log


Message #34 received at 64309 <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <lars <at> 6xq.net>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: jgart <at> dismail.de, Ludovic Courtès <ludo <at> gnu.org>,
 Athena Martin <secure <at> alm.website>, 64309 <at> debbugs.gnu.org
Subject: Re: bug#64309: Python dlopen()s musl libc
Date: Tue, 11 Jul 2023 14:43:36 +0200
[Message part 1 (text/plain, inline)]
Hi,

there’s a similar issue #63912 and a thread on the guix-devel
mailinglist at
https://lists.gnu.org/archive/html/guix-devel/2023-06/msg00066.html

> So, looks like the default Python behavior is to load the usercustomize
> after the sitecustomize [1], which leads to exactly the behavior you're
> experiencing.  I don't know what we should do here, maybe pass `-s` to
> the shebang line of Python to disable loading the usercustomize?  That
> would probably be a world-rebuild though.  CC'ing the Python team to see
> what they think.

I think the problem is bigger than usercustomize. Any custom PYTHONPATH
also slips through and causes this issue, as well as any custom
GUIX_PYTHONPATH, because the executable wrapper appends it (think nested
`guix shell` invokations with different versions of a library for
an example where this could go wrong).

Guix-managed Python packages (libraries nor applications) should
generally not pick up dependencies from random paths – only those
from their package description, so we can keep Guix’ promise of being
self-contained.

I have experimented with customizing Python’s importing mechanism
through a custom MetaPathFinder. It works by adding a __guix_pythonpath__
variable to every Python package’s __init__.py file and modifying the
module loader’s search path accordingly if such a variable exists. It
would provide exactly that guarantee, but it’s just a PoC at this
point – see attached file.

Apart from that I don’t see a good short-term solution right now. It’s
just how Python works.

Cheers,
Lars

[mysitecustomize.py (text/plain, attachment)]

This bug report was last modified 1 year and 338 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.