[Bug 1838866] [NEW] Mailman 2.1: hardcoded site-packages dir prefix doesn't work on some 64 bit filesystem layouts

Hanno Böck hanno at hboeck.de
Sun Aug 4 03:54:40 EDT 2019


Public bug reported:

Mailman's paths.py.in contains code to add the python site-packages dir
to the path. This uses a hardcoded "lib" prefix:

 # Include Python's site-packages directory.
sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
                       'site-packages')
sys.path.append(sitedir)

On 64 bit systems this is usually lib64 and some distros started
removing the compatibility symlink lib->lib64 and split up lib and lib64
(e.g. latest Gentoo profiles). So relying on "lib" as a prefix is not
compatible any more.

Python has a function getsitepackages in the site module and I believe it's best to rely on python knowing best where its directories are. It returns an array, so this would look like this:
sitedirs = site.getsitepackages()
for sitedir in sitedirs:
    sys.path.append(sitedir)


Patch attached, please apply.

** Affects: mailman
     Importance: Undecided
         Status: New

** Attachment added: "fix sitedir path on 64 bit filesystem layouts"
   https://bugs.launchpad.net/bugs/1838866/+attachment/5280705/+files/mailman-fix-sitedir.diff

-- 
You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.
https://bugs.launchpad.net/bugs/1838866

Title:
  Mailman 2.1: hardcoded site-packages dir prefix doesn't work on some
  64 bit filesystem layouts

To manage notifications about this bug go to:
https://bugs.launchpad.net/mailman/+bug/1838866/+subscriptions


More information about the Mailman-coders mailing list