[PATCH] better handling of symlinks in path

Robert Collins robertc at robertcollins.net
Mon Oct 10 09:37:57 BST 2005


On Mon, 2005-10-10 at 09:49 +0200, David Allouche wrote:
> On Mon, 2005-10-10 at 09:57 +1000, Robert Collins wrote:
> > On Sun, 2005-10-09 at 22:43 +0200, David Allouche wrote:
> > > +            # check that relpath knows about symlinks
> > > +            # TODO: SKIP these tests on win32
> > 
> > 
> > To do this, guard the portion of the test, or the whole test case with
> > 
> > if osutils.has_symlinks():
> 
> Gah... I had fixed it, but did not save the file before making the
> patch...
> 
> Fixed that, and made the _relpath implementation a little bit simpler by
> calling os.path.realpath directly if it's available instead of using a
> (pointless IMO) osutils helper.

Ok, two things here.

I think that inlining the function reduces clarity: before we had two
functions that roughly do one thing each, now we have one function that
does a couple of things and works around stdlib limitations. 

More importantly, I think this is flawed in that the condition to be
able to save the last element can be applied recursively:
You say that you are preserving the last element in case it is a
symlink, but what if there is are two symlinks? I.e. if preserving the
tail element saves you from one, what happens with two? 

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051010/afcbca06/attachment.pgp 


More information about the bazaar mailing list