Re: [Distutils] [buildout] setuptools/buildout trying to use /root/.python-eggs after setuid()ing with Zope

2009-02-10 Thread Marius Gedminas
On Wed, Feb 04, 2009 at 05:17:01PM +0100, Andreas Jung wrote:
 Hi there,
 
 I am not sure which component is in charge for the following issue:
 
  - standard Plone 3.1 installation installed with paster/Zopeskel
with a 'zope' account without special privileges
  - in the instance is started from through /etc/init.d as root
but immediately setuid to effective-user 'zope'
 
  - after setuid(), setuptools is trying to write to /root/.python-eggs
during the startup-phase for (my own) module zopyx.textindexng3
 
 - it creates inside:
 
 new:~/.python-eggs # ls -la
 total 1
 drwxrwxrwx  3 root root   144 Feb  4 13:17 .
 drwxr-xr-x 24 root root  1200 Feb  4 17:10 ..
 -rw-r--r--  1 zope users0 Feb  4 13:17 a
 drwxr-xr-x  3 zope users   72 Feb  4 13:17
 zopyx.textindexng3-4.0.1-py2.4-linux-x86_64.egg-tmp
 
 Why is setuptools using /root/.python-eggs only for this particular
 module and isn't it using something like /home/zope/.python-eggs
 instead - especially having changed the UID already?

It doesn't look at UID, it looks at $HOME.  Actually, it looks at
$PYTHON_EGG_CACHE first, so you can set that.

I had the same problem with trac and matplotlib (which doesn't have a
sane separate environment variable), and in the end had to resort to an
ugly hack in my /etc/init.d/script:

  sudo -u $NONPRIVILEGED_USER env HOME=/path/writable/to/that/user \
start-stop-daemon --start --exec /path/to/executable -- $options

Marius Gedminas
-- 
HOST SYSTEM NOT RESPONDING, PROBABLY DOWN. DO YOU WANT TO WAIT? (Y/N)


signature.asc
Description: Digital signature
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] occasional zipimport.ZipImportError: bad local file header

2009-02-10 Thread P.J. Eby

At 06:43 PM 2/5/2009 +, Fadhley Salim wrote:

I'm working on an automatic testing framework which installs eggs
downloaded directly from the web-server. From time to time I get a very
long stacktrace leading to a ZipImportError (see the pastebin link).
Leading up to the error all I do is download the egg into the system's
%TEMP% folder. I'm installing the egg like this:

easy_install.main( ['-zma', '-f' , config.INSTALL_TOOLS_EGG_VALIDHOSTS,
filepath, ]

There is apparantly nothing wrong with the file - I can open it in
Winzip. If I re-run the process it seems to work fine. The file in
question appears to be identical. The error is rare, it seems to occur
in about 1 out of 100 easy_install operations. Any suggestions what
might be causing this?

Very long stacktrace on pastebin:
http://python.pastebin.com/m378949f3

I am using setuptools==0.6c9 on Python 2.4 running on Windows XP


This might be due to:

http://bugs.python.org/issue856103

Specifically, zipimport's caching doesn't notice that it's not 
working on the same zipfile any more.  easy_install is supposed to 
have some code in it to clear out the zipimport cache, but there is 
some possibility that it could have two versions of the path in there 
on a case-insensitive filesystem (e.g. Windows), and only one of them 
is getting cleared.  Dunno if that's the case or not, but it might be 
something to look into.  You could always stick a debugging print in 
the uncache_zipdir function and see if there's any correlation 
between what it's doing and when you're getting the error.


___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig