[Bug 1838866] [NEW] Mailman 2.1: hardcoded site-packages dir prefix doesn't work on some 64 bit filesystem layouts
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-f... -- 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
I appreciate the patch. Thank you. One issue is that site.getsitepackages() requires Python 2.7. It is probably time to stop supporting older versions anyway, so this shouldn't be a problem. -- 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
I have now looked at the code for site.getsitepackages() at https://github.com/python/cpython/blob/master/Lib/site.py#L319 and it seems no better than what's in paths.py.in, so I'm not sure this will be effective unless your distro hacks site.py. Is that the case? It appears Ubuntu does hack site.getsitepackages() to actually return ['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist- packages']. I am reluctant to do anything without a better understanding of what site.getsitepackages() returns in various distros. -- 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
I'm on Gentoo, seems it also patches the site.py accordingly: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev- lang/python/python-2.7.16.ebuild#n106 -- 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
** Branch linked: lp:mailman/2.1 -- 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
** Changed in: mailman Importance: Undecided => Low ** Changed in: mailman Status: New => Fix Committed ** Changed in: mailman Milestone: None => 2.1.30 ** Changed in: mailman Assignee: (unassigned) => Mark Sapiro (msapiro) -- 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
** Also affects: ubuntu Importance: Undecided Status: New -- 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
** Package changed: ubuntu => mailman (Ubuntu) -- 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
Please could someone confirm if this actually requires patching in Ubuntu? I'm not aware that Ubuntu uses "lib64", and "/usr/local" isn't used by system-provided packages anyway. What is the use case that fails in Ubuntu? Once answered please change the Ubuntu bug task status accordingly (Invalid or New depending on the answer I guess). ** Changed in: mailman (Ubuntu) Status: New => Incomplete -- 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
** Changed in: mailman Status: Fix Committed => Fix Released -- 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
It seems the Ubuntu task was created in error. ** Changed in: mailman (Ubuntu) Status: Incomplete => Invalid -- 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
participants (6)
-
Hanno Böck
-
Keith Brian Tomo
-
Launchpad Bug Tracker
-
Mark Sapiro
-
Paul White
-
Robie Basak