Buildout -- Software for automating application assembly

file checking problem with Python 2.5, Mac OS X

Reported by Fred Drake on 2007-12-20
2
Affects Status Importance Assigned to Milestone
Buildout
Undecided
Unassigned

Bug Description

This was spotted on Mac OS X "Leopard", and I was unable to reproduce this on Ubuntu Linux 6.10 with Python 2.5.1.

Using Python 2.5 (either 2.5.1 or the current state of the 2.5.2 maintenance branch), running bin/buildout with a download cache directory that's a symlink to another location (or has a directory with a parent that is such a symlink), causes an error to be generated. This only happens for a file that's already in the download cache; there is no error if only uncached distributions are needed.

In my case, I have these directories:

  /Users/fdrake/env/dot_buildout/
  /Users/fdrake/env/dot_buildout/downloads/
  /Users/fdrake/env/dot_buildout/downloads/dist/

and this symlink:

  /Users/fdrake/.buildout -> env/dot_buildout

Bootstrapping with Python 2.5.1 or the pending 2.5.2 works as expected.

Running the generated bin/buildout generates an error like this for the cases I've tried (the zc.buildout and zc.catalog trunks):

Develop: '/Users/fdrake/projects/Zope/zc.catalog-testing/.'
Getting distribution for 'zc.recipe.testrunner'.
While:
  Installing.
  Getting section test.
  Initializing section test.
  Installing recipe zc.recipe.testrunner.
  Getting distribution for 'zc.recipe.testrunner'.

An internal error occured due to a bug in either zc.buildout or in a
recipe being used:

Error:
`/Users/fdrake/env/dot_buildout/downloads/dist/zc.recipe.testrunner-1.0.0.tar.gz` and `/Users/fdrake/.buildout/downloads/dist/zc.recipe.testrunner-1.0.0.tar.gz` are the same file

Adding the "-D" flag on the command line produces this traceback:

Develop: '/Users/fdrake/projects/Zope/zc.catalog-testing/.'
Getting distribution for 'zc.recipe.testrunner'.
While:
  Installing.
  Getting section test.
  Initializing section test.
  Installing recipe zc.recipe.testrunner.
  Getting distribution for 'zc.recipe.testrunner'.
Traceback (most recent call last):
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/buildout.py", line 1382, in main
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/buildout.py", line 292, in install
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/buildout.py", line 789, in __getitem__
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/buildout.py", line 869, in _initialize
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/buildout.py", line 828, in _install_and_load
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/easy_install.py", line 739, in install
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/easy_install.py", line 595, in install
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/easy_install.py", line 450, in _get_dist
  File "/private/var/folders/N7/N7hps6ydGn0UU+9GZXKXW++++TI/-Tmp-/tmpK1Daa2/zc.buildout-1.0.0b31-py2.5.egg/zc/buildout/easy_install.py", line 420, in _fetch
  File "/Users/fdrake/local/python-2.5.1/lib/python2.5/shutil.py", line 91, in copy2
    copyfile(src, dst)
  File "/Users/fdrake/local/python-2.5.1/lib/python2.5/shutil.py", line 41, in copyfile
    raise Error, "`%s` and `%s` are the same file" % (src, dst)
Error: `/Users/fdrake/env/dot_buildout/downloads/dist/zc.recipe.testrunner-1.0.0.tar.gz` and `/Users/fdrake/.buildout/downloads/dist/zc.recipe.testrunner-1.0.0.tar.gz` are the same file

Starting pdb:
> /Users/fdrake/local/python-2.5.1/lib/python2.5/shutil.py(41)copyfile()
-> raise Error, "`%s` and `%s` are the same file" % (src, dst)
(Pdb)

Fred Drake (fdrake) wrote :

I should note that the ~/.buildout/default.cfg file identifies the cache directories using the path involving the symlink:

[buildout]
download-cache = /Users/fdrake/.buildout/downloads/
eggs-directory = /Users/fdrake/.buildout/eggs/
index = http://download.zope.org/ppix/

Fred Drake (fdrake) wrote :

I've confirmed that using the non-symlinked paths to identify the cache directories makes zc.buildout work with the pending Python 2.5.2; that's an acceptable work-around, but the behavior is still surprising. I think it should be considered a bug.

It smells like some files are being tested for sameness by comparing paths, and one is being sent through os.realpath() at some point before the comparison, but only on Mac OS X.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers