'''
Return if the dicts are equal in the stat keys
'''
- keys = [u'gid', u'type', u'mode',u'size', u'uid', u'mtime',
+ keys = [u'type', u'mode',u'size', u'mtime',
# TODO: check how to restore this correctly if possible
# u'inode', u'ctime'
]
+ # only if user is root, then also check gid/uid. otherwise do not check it,
+ # because tarfile can chown in case of being superuser
+ if hasattr(os, "geteuid") and os.geteuid() == 0:
+ keys.append('gid')
+ keys.append('uid')
+
if (not d1 and d2 != None) or (d1 != None and not d2):
return False
if self.prefixed(d1.get('path', -1), listsnapshot_equal) != self.prefixed(d2.get('path', -2), listsnapshot_equal):
return False
+ type = d1.get('type', '')
+
for key in keys:
+ # size doesn't matter for directories
+ if type == 'directory' and key == 'size':
+ continue
if d1.get(key, -1) != d2.get(key, -2):
return False
return True
Restores a backup.
Parameters:
- - backup_path: path where the back up will is stored.
- target_path: path to restore.
- backup_indexes_paths: path to backup indexes, in descending date order.
The indexes indicate the location of their respective backup volumes,