[Distutils] sdist.py::findall chokes on broken links

Greg Ward gward@python.net
Wed, 26 Jul 2000 21:51:29 -0400

On 14 July 2000, Bastian Kleineidam said:
> the findall function in sdist.py gives an error when a broken link is
> found. The responsible function call is os.stat().
> I replaced the stat() calls with os.path.{isfile,islink,isdir}. This is
> somewhat more robust. The new findall is now a member function of the
> sdist class so I can use self.announce to warn about broken links.

I've looked into this a bit and decided it's a feature.  (Ie., it'd be
too hard to fix it properly.)  It boils down to this: the 'findall()'
routine in sdist.py isn't the only place that pokes about the filesystem
looking for stuff; to do this right, we would have to detect dangling
links in all such places.  (The only other place I can think of offhand
is in built_py.py, where we turn the packages listed in the 'packages'
list into a list of filenames.)  Or we could have a single function or
class whose job it is to walk the filesystem looking for stuff: that's
probably the right way, and the filesystem-searching code in sdist.py is 
general enough that it wouldn't take much to extract it and make it into 
something useful across the whole of the Distutils.

But, on reflection, I'm not going to bother.  In an ideal world, we'd
warn about dangling links and then skip them.  In a bad world, we'd
include dangling links in tarballs.  Blowing up when we hit dangling
links isn't the best, but it isn't the worst either.


PS. what an appropriate fortune for this post...

Greg Ward - maladjusted nerd                            gward@python.net
Save energy: be apathetic.