← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/fix-local-backend-validation into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/fix-local-backend-validation into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/fix-local-backend-validation/+merge/74222

Looks like I forgot to retest the local backend after I made a change to validate_block in my check-volumes branch.

The local backend likes to rename when possible, and afterwards, the original path object has a None stat object because it no longer exists.  So validate_block should be careful to avoid asking for stat info after upload.
-- 
https://code.launchpad.net/~mterry/duplicity/fix-local-backend-validation/+merge/74222
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/fix-local-backend-validation into lp:duplicity.
=== modified file 'duplicity-bin'
--- duplicity-bin	2011-08-29 03:34:55 +0000
+++ duplicity-bin	2011-09-06 13:58:23 +0000
@@ -269,15 +269,15 @@
             end_block -= 1
         return start_index, start_block, end_index, end_block
 
-    def validate_block(tdp, dest_filename):
+    def validate_block(orig_size, dest_filename):
         info = backend.query_info([dest_filename])[dest_filename]
         if 'size' not in info:
             return # backend didn't know how to query size
         size = info['size']
         if size is None:
             return # error querying file
-        if size != tdp.getsize():
-            code_extra = "%s %d %d" % (util.escape(dest_filename), tdp.getsize(), size)
+        if size != orig_size:
+            code_extra = "%s %d %d" % (util.escape(dest_filename), orig_size, size)
             log.FatalError(_("File %s was corrupted during upload.") % dest_filename,
                            log.ErrorCode.volume_wrong_size, code_extra)
 
@@ -290,7 +290,7 @@
         putsize = tdp.getsize()
         if globals.skip_volume != vol_num: # for testing purposes only
             backend.put(tdp, dest_filename)
-        validate_block(tdp, dest_filename)
+        validate_block(putsize, dest_filename)
         if tdp.stat:
             tdp.delete()
         return putsize


Follow ups