[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#539187: (no subject)



reassign 539187 python-support
retitle 539187 Moving symlink fails where linkdest is also moved
affects 539187 libgv-python
tags 539187 patch
thanks

Hi,

I've tracked this problem down to the 'rename_subtle' function in
'movemodules'.

This function is designed to modify relative symlinks that are being
moved to pyshared so they continue to point to the correct place.
However it fails to take account of the case where the link destination
is *also* going to be moved to pyshared.  This causes it to create a
dangling symlink pointing to where the destination file used to be.

I think the case here - where both the symlink and destination are in
the same site-packages directory - is probably the most obvious way this
bug manifests, although there may be more unusual possibilities.  The
attached patch should fix this common case.

Cheers,

	David.

--- movemodules	2009-12-02 22:50:03.000000000 +0000
+++ movemodules.new	2009-12-02 22:49:41.000000000 +0000
@@ -68,7 +68,7 @@
 def rename_subtle (source, destination):
   if os.path.islink (source):
     linkdest = os.readlink (source)
-    if not os.path.isabs (linkdest):
+    if not os.path.isabs (linkdest) and os.path.normpath(linkdest).count('/') > 0:
       linkdest = os.path.normpath(os.path.join(os.path.dirname(source),linkdest))
       prefix = os.path.dirname(os.path.commonprefix((linkdest, destination)))
       linkdest = os.path.normpath(destination)[len(prefix)+1:].count('/') * '../' + \

Reply to: