Merge lp:~ed.so/duplicity/numowner+hashverbose into lp:duplicity/0.6

Proposed by edso
Status: Merged
Merged at revision: 775
Proposed branch: lp:~ed.so/duplicity/numowner+hashverbose
Merge into: lp:duplicity/0.6
Diff against target: 131 lines (+43/-9)
6 files modified
Changelog.GNU (+6/-0)
duplicity-bin (+15/-8)
duplicity.1 (+7/-0)
duplicity/commandline.py (+3/-0)
duplicity/globals.py (+3/-0)
duplicity/path.py (+9/-1)
To merge this branch: bzr merge lp:~ed.so/duplicity/numowner+hashverbose
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+72087@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Changelog.GNU'
2--- Changelog.GNU 2011-07-16 18:37:47 +0000
3+++ Changelog.GNU 2011-08-18 18:35:24 +0000
4@@ -1,3 +1,9 @@
5+2011-08-18 Ede <edgar.soldin AT web.de>
6+ - introduce --numeric-owner parameter
7+ patch courtesy of Lukas Anzinger <l.anzinger AT gmail.com>
8+ - duplicity:restore_check_hash
9+ "Invalid data - *** hash mismatch" error now tells the offending filename
10+
11 2011-07-16 Ede <edgar.soldin AT web.de>
12 branch encrypt-sign-key:
13 - introduce --encrypt-sign-key parameter
14
15=== modified file 'duplicity-bin'
16--- duplicity-bin 2011-07-29 21:13:16 +0000
17+++ duplicity-bin 2011-08-18 18:35:24 +0000
18@@ -636,7 +636,16 @@
19 parseresults = file_naming.parse(filename)
20 tdp = dup_temp.new_tempduppath(parseresults)
21 backend.get(filename, tdp)
22- restore_check_hash(volume_info, tdp)
23+
24+ """ verify hash of the remote file """
25+ verified, hash_pair, calculated_hash = restore_check_hash(volume_info, tdp)
26+ if not verified:
27+ log.FatalError("%s\n %s\n %s\n %s\n" %
28+ (_("Invalid data - %s hash mismatch for file:") % hash_pair[0],
29+ filename,
30+ _("Calculated hash: %s") % calculated_hash,
31+ _("Manifest hash: %s") % hash_pair[1]),
32+ log.ErrorCode.mismatched_hash)
33
34 fileobj = tdp.filtered_open_with_delete("rb")
35 if parseresults.encrypted and globals.gpg_profile.sign_key:
36@@ -648,18 +657,16 @@
37 """
38 Check the hash of vol_path path against data in volume_info
39
40- @rtype: void
41- @return: void
42+ @rtype: boolean
43+ @return: true (verified) / false (failed)
44 """
45 hash_pair = volume_info.get_best_hash()
46 if hash_pair:
47 calculated_hash = gpg.get_hash(hash_pair[0], vol_path)
48 if calculated_hash != hash_pair[1]:
49- log.FatalError("%s\n%s\n%s\n" %
50- (_("Invalid data - %s hash mismatch:") % hash_pair[0],
51- _("Calculated hash: %s") % calculated_hash,
52- _("Manifest hash: %s") % hash_pair[1]),
53- log.ErrorCode.mismatched_hash)
54+ return False, hash_pair, calculated_hash
55+ """ reached here, verification passed """
56+ return True
57
58
59 def restore_add_sig_check(fileobj):
60
61=== modified file 'duplicity.1'
62--- duplicity.1 2011-08-06 15:57:54 +0000
63+++ duplicity.1 2011-08-18 18:35:24 +0000
64@@ -537,6 +537,13 @@
65 the directory statistics file.
66
67 .TP
68+.B --numeric-owner
69+On restore always use the numeric uid/gid from the archive and not the
70+archived user/group names, which is the default behaviour.
71+Recommended for restoring from live cds which might have the users with
72+identical names but different uids/gids.
73+
74+.TP
75 .BI "--num-retries " number
76 Number of retries to make on errors before giving up.
77
78
79=== modified file 'duplicity/commandline.py'
80--- duplicity/commandline.py 2011-08-06 15:57:54 +0000
81+++ duplicity/commandline.py 2011-08-18 18:35:24 +0000
82@@ -378,6 +378,9 @@
83 # --num-retries <number>
84 parser.add_option("--num-retries", type="int", metavar=_("number"))
85
86+ # File owner uid keeps number from tar file. Like same option in GNU tar.
87+ parser.add_option("--numeric-owner", action="store_true")
88+
89 # Whether the old filename format is in effect.
90 parser.add_option("--old-filenames", action="callback",
91 dest="old_filenames",
92
93=== modified file 'duplicity/globals.py'
94--- duplicity/globals.py 2011-03-29 17:00:36 +0000
95+++ duplicity/globals.py 2011-08-18 18:35:24 +0000
96@@ -156,6 +156,9 @@
97 # support european for now).
98 s3_european_buckets = False
99
100+# File owner uid keeps number from tar file. Like same option in GNU tar.
101+numeric_owner = False
102+
103 # Whether to use plain HTTP (without SSL) to send data to S3
104 # See <https://bugs.launchpad.net/duplicity/+bug/433970>.
105 s3_unencrypted_connection = False
106
107=== modified file 'duplicity/path.py'
108--- duplicity/path.py 2011-07-07 17:12:13 +0000
109+++ duplicity/path.py 2011-08-18 18:35:24 +0000
110@@ -198,12 +198,20 @@
111 self.mode = tarinfo.mode
112 self.stat = StatResult()
113
114- # Set user and group id
115+ """ Set user and group id
116+ use numeric id if name lookup fails
117+ OR
118+ --numeric-owner is set
119+ """
120 try:
121+ if globals.numeric_owner:
122+ raise KeyError
123 self.stat.st_uid = tarfile.uname2uid(tarinfo.uname)
124 except KeyError:
125 self.stat.st_uid = tarinfo.uid
126 try:
127+ if globals.numeric_owner:
128+ raise KeyError
129 self.stat.st_gid = tarfile.gname2gid(tarinfo.gname)
130 except KeyError:
131 self.stat.st_gid = tarinfo.gid

Subscribers

People subscribed via source and target branches

to all changes: