[Distutils] easy_install fails with tarfile.ExtractError: could not change mode

Michael Dunstan michael.dunstan at gmail.com
Sat Apr 14 03:33:38 CEST 2007


Hi,

I've found that for easy_install fails to install zc.recipe.testrunner
for python 2.3 on OS X.

% easy_install-2.3 zc.recipe.testrunner
Searching for zc.recipe.testrunner
Reading http://cheeseshop.python.org/pypi/zc.recipe.testrunner/
Reading http://svn.zope.org/zc.buildout
Reading http://cheeseshop.python.org/pypi/zc.recipe.testrunner/1.0.0b6
Best match: zc.recipe.testrunner 1.0.0b6
Downloading http://cheeseshop.python.org/packages/source/z/zc.recipe.testrunner/zc.recipe.testrunner-1.0.0b6.tar.gz#md5=108e0e4b961cf6301b49a85678b8f0a9
Processing zc.recipe.testrunner-1.0.0b6.tar.gz
Traceback (most recent call last):
  File "/opt/local/bin/easy_install-2.3", line 7, in ?
    sys.exit(
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/command/easy_install.py",
line 1670, in main
    with_ei_usage(lambda:
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/command/easy_install.py",
line 1659, in with_ei_usage
    return f()
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/command/easy_install.py",
line 1674, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/opt/local/lib/python2.3/distutils/core.py", line 149, in setup
    dist.run_commands()
  File "/opt/local/lib/python2.3/distutils/dist.py", line 907, in run_commands
    self.run_command(cmd)
  File "/opt/local/lib/python2.3/distutils/dist.py", line 927, in run_command
    cmd_obj.run()
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/command/easy_install.py",
line 211, in run
    self.easy_install(spec, not self.no_deps)
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/command/easy_install.py",
line 446, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/command/easy_install.py",
line 471, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/command/easy_install.py",
line 626, in install_eggs
    unpack_archive(dist_filename, tmpdir, self.unpack_progress)
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/archive_util.py",
line 67, in unpack_archive
    driver(filename, extract_dir, progress_filter)
  File "/opt/local/lib/python2.3/site-packages/setuptools-0.6c5-py2.3.egg/setuptools/archive_util.py",
line 192, in unpack_tarfile
    tarobj._extract_member(member,dst)  # XXX Ugh
  File "/opt/local/lib/python2.3/tarfile.py", line 1414, in _extract_member
    self.chmod(tarinfo, targetpath)
  File "/opt/local/lib/python2.3/tarfile.py", line 1532, in chmod
    raise ExtractError, "could not change mode"
tarfile.ExtractError: could not change mode
zsh: 1148 exit 1     easy_install-2.3 zc.recipe.testrunner


The root of the problem seems to a file mode with the
set-group-ID-on-execution bit set in the source distribution of
zc.recipe.testrunner. Here is a demonstration of that:

>>> import os
>>> import tempfile
>>> tmp_dir = tempfile.mkdtemp(prefix="easy_install-")
>>> example_dir = os.path.join(tmp_dir, 'example')
>>> os.mkdir(example_dir)
>>> os.chmod(example_dir, 02755)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 1] Operation not permitted: '/tmp/easy_install-UlgpCH/example'


I see the same failing behaviour for handling of tempfile and chmod
for Python 2.4 on OS X. However there is an explicit egg for python
2.4:

  http://cheeseshop.python.org/pypi/zc.recipe.testrunner/1.0.0b6#download

which does not have set-group-ID-on-execution bit set for any of the
archive members. So the egg easy installs just fine in that case.

And I don't see any such problems using FreeBSD.


Michael


More information about the Distutils-SIG mailing list