← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/normalize-before-using into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/normalize-before-using into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/normalize-before-using/+merge/195463

Avoid throwing an exception due to a None element in a patch sequence.

None elements in a (non-normalized) patch sequence are perfectly normal.  With the current code in the patched function, it is certainly possible to hit a crash due a None.  See http://lists.nongnu.org/archive/html/duplicity-talk/2013-11/msg00005.html

This branch fixes that by normalizing the sequence before using it in the logging code.  It's acceptable to bring the normalize_ps() call outside the try/except block because normalize_ps is not expected to throw.  It's relatively simple and doesn't really use its objects besides checking if they are None.
-- 
https://code.launchpad.net/~mterry/duplicity/normalize-before-using/+merge/195463
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/normalize-before-using into lp:duplicity.
=== modified file 'duplicity/patchdir.py'
--- duplicity/patchdir.py	2013-09-19 00:26:01 +0000
+++ duplicity/patchdir.py	2013-11-16 03:48:51 +0000
@@ -498,13 +498,14 @@
     """
     collated = collate_iters( iter_list )
     for patch_seq in collated:
+        normalized = normalize_ps(patch_seq)
         try:
-            final_ropath = patch_seq2ropath(normalize_ps(patch_seq))
+            final_ropath = patch_seq2ropath(normalized)
             if final_ropath.exists():
                 # otherwise final patch was delete
                 yield final_ropath
         except Exception, e:
-            filename = patch_seq[-1].get_ropath().get_relative_path()
+            filename = normalized[-1].get_ropath().get_relative_path()
             log.Warn(_("Error '%s' patching %s") % 
                      (str(e), filename),
                      log.WarningCode.cannot_process,


Follow ups