~ubuntu-branches/ubuntu/precise/deja-dup/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/fix_encryption_switch.patch

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2011-11-03 17:33:20 UTC
  • Revision ID: package-import@ubuntu.com-20111103173320-fekl17yx2fu4nq25
Tags: 21.1-0ubuntu2
* debian/patches/fix_encryption_switch.patch:
  - Backport patch from trunk to fix a bad bug that breaks backups after
    an interruption for some locales.  LP: #877631

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Don't try to parse a string that can be translated to determine encryption
 
2
Author: Michael Terry <michael.terry@canonical.com>
 
3
Bug: https://bugs.launchpad.net/deja-dup/+bug/877631
 
4
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/deja-dup/+bug/877631
 
5
 
 
6
Index: deja-dup-21.1/common/Duplicity.vala
 
7
===================================================================
 
8
--- deja-dup-21.1.orig/common/Duplicity.vala    2011-10-20 12:28:51.000000000 -0400
 
9
+++ deja-dup-21.1/common/Duplicity.vala 2011-11-03 17:31:21.790069746 -0400
 
10
@@ -103,6 +103,7 @@
 
11
   static File slash_root;
 
12
   static File slash_home;
 
13
   static File slash_home_me;
 
14
+  static Regex gpg_regex;
 
15
   
 
16
   bool has_checked_contents = false;
 
17
   bool has_non_home_contents = false;
 
18
@@ -143,6 +144,15 @@
 
19
       slash_home = File.new_for_path("/home");
 
20
       slash_home_me = File.new_for_path(Environment.get_home_dir());
 
21
     }
 
22
+
 
23
+    if (gpg_regex == null) {
 
24
+      try {
 
25
+        gpg_regex = new Regex(".*\\[.*\\.(g|gpg)'.*]$");
 
26
+      }
 
27
+      catch (Error e) {
 
28
+        error("%s\n", e.message); // this is a programmer error, so use error()
 
29
+      }
 
30
+    }
 
31
   }
 
32
 
 
33
   ~Duplicity() {
 
34
@@ -1108,16 +1118,13 @@
 
35
     if (firstline.length > 1) {
 
36
       switch (int.parse(firstline[1])) {
 
37
       case DEBUG_GENERIC:
 
38
-        // In non-modern versions of duplicity, this list of files is the only
 
39
-        // way to tell whether the backup is encrypted or not.  This message
 
40
-        // was not translated in duplicity before switching to a better method
 
41
-        // of detecting, so we can safely check for it.
 
42
         if (mode == Operation.Mode.STATUS &&
 
43
             !DuplicityInfo.get_default().reports_encryption &&
 
44
-            !detected_encryption &&
 
45
-            text.has_prefix("Extracting backup chains from list of files:")) {
 
46
-          detected_encryption = true;
 
47
-          existing_encrypted = text.contains(".gpg'") || text.contains(".g'");
 
48
+            !detected_encryption) {
 
49
+          if (gpg_regex != null && gpg_regex.match(text)) {
 
50
+            detected_encryption = true;
 
51
+            existing_encrypted = true;
 
52
+          }
 
53
         }
 
54
         break;
 
55
       }