[Patches] [ python-Patches-629278 ] install lib-dynload .so files mode 555

noreply@sourceforge.net noreply@sourceforge.net
Fri, 08 Nov 2002 06:18:55 -0800


Patches item #629278, was opened at 2002-10-27 01:03
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=629278&group_id=5470

Category: Distutils and setup.py
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 5
Submitted By: J. Lewis Muir (jlmuir)
>Assigned to: Michael Hudson (mwh)
Summary: install lib-dynload .so files mode 555

Initial Comment:
This is a patch to the setup.py file to set the
permissions of the installed
shared libraries to have mode 555 (r xr xr x). This
fixes bug #549338
"lib-dynload/*.so permissions wrong" and a duplicate
bug #583206
"lib-dynload/*.so wrong permissions".

The problem was that the shared libraries are installed
by simply copying the
tree of built shared libraries from the build directory
to the installation
location. This means that the permissions of the
installed shared library
files will be whatever the permissions were on these
files in the build
directory. The permissions are never set. If the shared
libraries do not have
the execute bit set, then on some platforms (Linux, in
my case), python will
be broken. For example, if one tries to import the time
module, python will
raise an ImportError saying "No module named time".

To fix this, I've added a class
PyBuildInstallLib(install_lib) which does
exactly what install_lib does by invoking the super
implementation of the
install method, but then sets the permissions correctly
for the installed
shared library files. In the setup call in the main
function, I pass this
PyBuildInstallLib class in the cmdclass dictionary as
the class that should be
used for the 'install_lib' command.

Another approach would be to instead modify the
Makefile to set the correct
file modes of the installed shared library files in the
'sharedinstall' target
right after running '... setup.py install ...'. I
didn't do this because it
seemed other file modes were being set by other
commands in distutils so it
seemed appropriate to do the same.

Attached is a patch against the 2.2.2 release. This I
have tested on my
machine (x86, Mandrake 8.0 + updates, Linux 2.4.18).

I've also looked at what's in CVS and my changes can be
trivially made to the
setup.py that's in CVS as of Sat 2002-10-26 5pm CDT.

----------------------------------------------------------------------

>Comment By: Michael Hudson (mwh)
Date: 2002-11-08 14:18

Message:
Logged In: YES 
user_id=6656

Thanks for looking at this!

This is a bit of a hack, but ne'er mind; I've been trying to
think of a clean way of doing this for a while.

I'd prefer to use sysconfig.get_config_vars("SO") than your
hardcoded list of possible DSO extensions.  Can you try the
attached? (err, it's against HEAD but should apply to 2.2.2
with little difficulty).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=629278&group_id=5470