← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~m4ktub/duplicity/0.6-reliability into lp:duplicity/0.6-series

 

Claudio Gil has proposed merging lp:~m4ktub/duplicity/0.6-reliability into lp:duplicity/0.6-series.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~m4ktub/duplicity/0.6-reliability/+merge/242575

This branch contains the fix proposed in Bug #1395341.
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~m4ktub/duplicity/0.6-reliability into lp:duplicity/0.6-series.
=== modified file 'duplicity/gpg.py'
--- duplicity/gpg.py	2014-05-07 12:51:00 +0000
+++ duplicity/gpg.py	2014-11-22 21:38:02 +0000
@@ -323,25 +323,30 @@
     data_size = target_size - max_footer_size
     file = GPGFile(True, path.Path(filename), profile)
     at_end_of_blockiter = 0
-    while True:
-        bytes_to_go = data_size - get_current_size()
-        if bytes_to_go < block_iter.get_read_size():
-            break
-        try:
-            data = block_iter.next().data
-        except StopIteration:
-            at_end_of_blockiter = 1
-            break
-        file.write(data)
+    try:
+        while True:
+            bytes_to_go = data_size - get_current_size()
+            if bytes_to_go < block_iter.get_read_size():
+                break
+            try:
+                data = block_iter.next().data
+            except StopIteration:
+                at_end_of_blockiter = 1
+                break
+            file.write(data)
 
-    file.write(block_iter.get_footer())
-    if not at_end_of_blockiter:
-        # don't pad last volume
-        cursize = get_current_size()
-        if cursize < target_size:
-            top_off(target_size - cursize, file)
-    file.close()
-    return at_end_of_blockiter
+        file.write(block_iter.get_footer())
+        if not at_end_of_blockiter:
+            # don't pad last volume
+            cursize = get_current_size()
+            if cursize < target_size:
+                top_off(target_size - cursize, file)
+        file.close()
+        return at_end_of_blockiter
+    except Exception:
+        # ensure that GPG processing terminates
+        file.close()
+        raise
 
 
 def GzipWriteFile(block_iter, filename,


Follow ups