[Distutils] [jerome: Re: real vs effective user id]

Phillip J. Eby pje at telecommunity.com
Mon Jun 11 23:02:23 CEST 2007


At 10:18 PM 6/11/2007 +0200, Jerome Alet wrote:
>On Mon, Jun 11, 2007 at 04:00:34PM -0400, Phillip J. Eby wrote:
> > >
> > >Wouldn't it be better to use the effective user id when expanding
> > >the user's home directory in setuptools or in Python ?
> >
> > That wouldn't fix your problem.  The egg cache location is determined
> > exactly *once* for the life of the process, unless you explicitly
> > create and use ResourceManagers -- and unfortunately the process of
> > importing C code from a zipped egg uses only the default ResourceManager.
>
>So you mean that if for example another (different) module installed
>with setuptools was imported *before* the seteuid() call, then the
>mysqldb module import (done *after* the seteuid() call) would
>succeed ?

No.  I'm saying that the directory for the default ResourceManager's 
cache is determined exactly once, and can't be changed thereafter for 
the effective life of the process.  Thus, you must choose a location 
that is readable and writable by every user id that the process will 
be executing as, whether real or effective.


>Then maybe setuptools should continue to work without creating/writing
>any file in an user's .python-eggs directory if this is not allowed
>to do so because of permissions (or different effective user).
>
>Instead it fails hard. Any plan to improve this ?

You have several options.  First, setuptools can build RPMs which 
install files in the usual way.  Second, you can install eggs 
containing C code as directories instead of files (using easy_install 
--always-unzip), which then avoids the need for the use of the egg 
cache.  Third, you can select an appropriate cache directory, either 
with the environment variable, or programmatically.



More information about the Distutils-SIG mailing list