[mirrorbrain-commits] r7964 - /trunk/tools/null-rsync

From: <poeml_at_mirrorbrain.org>
Date: Mon, 08 Mar 2010 13:47:38 -0000
Author: poeml
Date: Mon Mar  8 14:47:38 2010
New Revision: 7964

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=7964&view=rev
Log:
null-rsync:
- Broken links that are replaced by a directory, and point outside the tree,
  are now correctly removed in the destination tree. (That's a really special case.)

Modified:
    trunk/tools/null-rsync

Modified: trunk/tools/null-rsync
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/tools/null-rsync?rev=7964&r1=7963&r2=7964&view=diff
==============================================================================
--- trunk/tools/null-rsync (original)
+++ trunk/tools/null-rsync Mon Mar  8 14:47:38 2010
@@ -176,8 +176,14 @@
             # symlink
             name, name_to = name.split(' -> ')
 
+        path = os.path.join(rsync_dst, name)
+
+        # this special case also deals with broken links that point outside the tree
+        if attrs[1] == 'd' and os.path.islink(path.rstrip('/')):
+            print 'removing link %r, to be replaced by directory' % path.rstrip('/')
+            os.unlink(path.rstrip('/'))
+
         # for safety
-        path = os.path.join(rsync_dst, name)
         canonical_path = os.path.realpath(path)
         if not canonical_path.startswith(rsync_dst):
             sys.exit("Error: After canonicalization, %r is outside the rsync destination path (%r):\n       %r" \




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Mon Mar 08 2010 - 13:47:40 GMT

This archive was generated by hypermail 2.2.0 : Mon Mar 08 2010 - 14:17:11 GMT