Author Alexander.Dutton
Recipients Alexander.Dutton, eric.araujo, tarek
Date 2011-09-02.13:57:21
SpamBayes Score 5.54334e-13
Marked as misclassified No
Message-id <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za>
In-reply-to
Content
If there are any broken symlinks in the same directory as a setup.py when e.g. sdist is run, findall() will fall over when attempting to os.stat() the symlink:

Traceback (most recent call last):
  File "setup.py", line 81, in run
    _sdist.run(self)
  File "/usr/lib/python2.6/distutils/command/sdist.py", line 144, in run
    self.get_file_list()
  File "/usr/lib/python2.6/distutils/command/sdist.py", line 238, in get_file_list
    self.filelist.findall()
  File "/usr/lib/python2.6/distutils/filelist.py", line 47, in findall
    self.allfiles = findall(dir)
  File "/usr/lib/python2.6/distutils/filelist.py", line 297, in findall
    stat = os.stat(fullname)
OSError: [Errno 2] No such file or directory: 'debian/tmp/usr/share/somepath/somesymlink'

Solutions would include replacing the call to os.stat() with one to os.lstat() (probably backwards-incompatible), or trying one and then the other.

This bug is present in Pythons 2.6.6 (Debian 6.0.2) and 2.7 (Fedora 14).

When attempting to reproduce in Python 3.1.2 (on Fedora) no error was encountered. However, looking at distutils/filelist.py, the same unadulterated call to os.stat() is present. I'll presume that for whatever reason distutils in Py3.1.2 never has cause to stat my broken symlink.
History
Date User Action Args
2011-09-02 13:57:23Alexander.Duttonsetrecipients: + Alexander.Dutton, tarek, eric.araujo
2011-09-02 13:57:23Alexander.Duttonsetmessageid: <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za>
2011-09-02 13:57:22Alexander.Duttonlinkissue12885 messages
2011-09-02 13:57:21Alexander.Duttoncreate