duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #00701
[Merge] lp:~ed.so/duplicity/numowner+hashverbose into lp:duplicity
edso has proposed merging lp:~ed.so/duplicity/numowner+hashverbose into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
Related bugs:
Bug #524922 in Duplicity: "duplicity does not have numeric uid/gid support"
https://bugs.launchpad.net/duplicity/+bug/524922
For more details, see:
https://code.launchpad.net/~ed.so/duplicity/numowner+hashverbose/+merge/72087
--
https://code.launchpad.net/~ed.so/duplicity/numowner+hashverbose/+merge/72087
Your team duplicity-team is requested to review the proposed merge of lp:~ed.so/duplicity/numowner+hashverbose into lp:duplicity.
=== modified file 'Changelog.GNU'
--- Changelog.GNU 2011-07-16 18:37:47 +0000
+++ Changelog.GNU 2011-08-18 18:35:24 +0000
@@ -1,3 +1,9 @@
+2011-08-18 Ede <edgar.soldin AT web.de>
+ - introduce --numeric-owner parameter
+ patch courtesy of Lukas Anzinger <l.anzinger AT gmail.com>
+ - duplicity:restore_check_hash
+ "Invalid data - *** hash mismatch" error now tells the offending filename
+
2011-07-16 Ede <edgar.soldin AT web.de>
branch encrypt-sign-key:
- introduce --encrypt-sign-key parameter
=== modified file 'duplicity-bin'
--- duplicity-bin 2011-07-29 21:13:16 +0000
+++ duplicity-bin 2011-08-18 18:35:24 +0000
@@ -636,7 +636,16 @@
parseresults = file_naming.parse(filename)
tdp = dup_temp.new_tempduppath(parseresults)
backend.get(filename, tdp)
- restore_check_hash(volume_info, tdp)
+
+ """ verify hash of the remote file """
+ verified, hash_pair, calculated_hash = restore_check_hash(volume_info, tdp)
+ if not verified:
+ log.FatalError("%s\n %s\n %s\n %s\n" %
+ (_("Invalid data - %s hash mismatch for file:") % hash_pair[0],
+ filename,
+ _("Calculated hash: %s") % calculated_hash,
+ _("Manifest hash: %s") % hash_pair[1]),
+ log.ErrorCode.mismatched_hash)
fileobj = tdp.filtered_open_with_delete("rb")
if parseresults.encrypted and globals.gpg_profile.sign_key:
@@ -648,18 +657,16 @@
"""
Check the hash of vol_path path against data in volume_info
- @rtype: void
- @return: void
+ @rtype: boolean
+ @return: true (verified) / false (failed)
"""
hash_pair = volume_info.get_best_hash()
if hash_pair:
calculated_hash = gpg.get_hash(hash_pair[0], vol_path)
if calculated_hash != hash_pair[1]:
- log.FatalError("%s\n%s\n%s\n" %
- (_("Invalid data - %s hash mismatch:") % hash_pair[0],
- _("Calculated hash: %s") % calculated_hash,
- _("Manifest hash: %s") % hash_pair[1]),
- log.ErrorCode.mismatched_hash)
+ return False, hash_pair, calculated_hash
+ """ reached here, verification passed """
+ return True
def restore_add_sig_check(fileobj):
=== modified file 'duplicity.1'
--- duplicity.1 2011-08-06 15:57:54 +0000
+++ duplicity.1 2011-08-18 18:35:24 +0000
@@ -537,6 +537,13 @@
the directory statistics file.
.TP
+.B --numeric-owner
+On restore always use the numeric uid/gid from the archive and not the
+archived user/group names, which is the default behaviour.
+Recommended for restoring from live cds which might have the users with
+identical names but different uids/gids.
+
+.TP
.BI "--num-retries " number
Number of retries to make on errors before giving up.
=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py 2011-08-06 15:57:54 +0000
+++ duplicity/commandline.py 2011-08-18 18:35:24 +0000
@@ -378,6 +378,9 @@
# --num-retries <number>
parser.add_option("--num-retries", type="int", metavar=_("number"))
+ # File owner uid keeps number from tar file. Like same option in GNU tar.
+ parser.add_option("--numeric-owner", action="store_true")
+
# Whether the old filename format is in effect.
parser.add_option("--old-filenames", action="callback",
dest="old_filenames",
=== modified file 'duplicity/globals.py'
--- duplicity/globals.py 2011-03-29 17:00:36 +0000
+++ duplicity/globals.py 2011-08-18 18:35:24 +0000
@@ -156,6 +156,9 @@
# support european for now).
s3_european_buckets = False
+# File owner uid keeps number from tar file. Like same option in GNU tar.
+numeric_owner = False
+
# Whether to use plain HTTP (without SSL) to send data to S3
# See <https://bugs.launchpad.net/duplicity/+bug/433970>.
s3_unencrypted_connection = False
=== modified file 'duplicity/path.py'
--- duplicity/path.py 2011-07-07 17:12:13 +0000
+++ duplicity/path.py 2011-08-18 18:35:24 +0000
@@ -198,12 +198,20 @@
self.mode = tarinfo.mode
self.stat = StatResult()
- # Set user and group id
+ """ Set user and group id
+ use numeric id if name lookup fails
+ OR
+ --numeric-owner is set
+ """
try:
+ if globals.numeric_owner:
+ raise KeyError
self.stat.st_uid = tarfile.uname2uid(tarinfo.uname)
except KeyError:
self.stat.st_uid = tarinfo.uid
try:
+ if globals.numeric_owner:
+ raise KeyError
self.stat.st_gid = tarfile.gname2gid(tarinfo.gname)
except KeyError:
self.stat.st_gid = tarinfo.gid
Follow ups