Example #1
0
 def rbdir_equal(src_rorp, dest_rorp):
     """Like hardlink_equal, but make allowances for data directories"""
     if not src_rorp.index and not dest_rorp.index:
         return 1
     if (src_rorp.index and src_rorp.index[0] == 'rdiff-backup-data'
             and src_rorp.index == dest_rorp.index):
         # Don't compare dirs - they don't carry significant info
         if dest_rorp.isdir() and src_rorp.isdir():
             return 1
         if dest_rorp.isreg() and src_rorp.isreg():
             # Don't compare gzipped files because it is apparently
             # non-deterministic.
             if dest_rorp.index[-1].endswith('gz'):
                 return 1
             # Don't compare .missing increments because they don't matter
             if dest_rorp.index[-1].endswith('.missing'):
                 return 1
     if compare_eas and not eas_acls.ea_compare_rps(src_rorp, dest_rorp):
         Log("Different EAs in files %s and %s" %
             (src_rorp.get_indexpath(), dest_rorp.get_indexpath()))
         return None
     if compare_acls and not eas_acls.acl_compare_rps(src_rorp, dest_rorp):
         Log(
             "Different ACLs in files %s and %s" %
             (src_rorp.get_indexpath(), dest_rorp.get_indexpath()), 3)
         return None
     if compare_hardlinks:
         if Hardlink.rorp_eq(src_rorp, dest_rorp):
             return 1
     elif src_rorp.equal_verbose(dest_rorp,
                                 compare_ownership=compare_ownership):
         return 1
     Log("%s: %s" % (src_rorp.index, Hardlink.get_inode_key(src_rorp)), 3)
     Log("%s: %s" % (dest_rorp.index, Hardlink.get_inode_key(dest_rorp)), 3)
     return None
Example #2
0
	def equality_func(src_rorp, dest_rorp):
		"""Combined eq func returns true iff two files compare same"""
		if not src_rorp:
			Log("Source rorp missing: " + str(dest_rorp), 3)
			return 0
		if not dest_rorp:
			Log("Dest rorp missing: " + str(src_rorp), 3)
			return 0
		if not src_rorp.equal_verbose(dest_rorp,
									  compare_ownership = compare_ownership):
			return 0
		if compare_hardlinks and not Hardlink.rorp_eq(src_rorp, dest_rorp):
			Log("Hardlink compare failure", 3)
			Log("%s: %s" % (src_rorp.index,
							Hardlink.get_inode_key(src_rorp)), 3)
			Log("%s: %s" % (dest_rorp.index,
							Hardlink.get_inode_key(dest_rorp)), 3)
			return 0
		if compare_eas and not eas_acls.ea_compare_rps(src_rorp, dest_rorp):
			Log("Different EAs in files %s and %s" %
				(src_rorp.get_indexpath(), dest_rorp.get_indexpath()), 3)
			return 0
		if compare_acls and not eas_acls.acl_compare_rps(src_rorp, dest_rorp):
			Log("Different ACLs in files %s and %s" %
				(src_rorp.get_indexpath(), dest_rorp.get_indexpath()), 3)
			return 0
		return 1
Example #3
0
 def hardlink_rorp_eq(src_rorp, dest_rorp):
     Hardlink.add_rorp(dest_rorp)
     Hardlink.add_rorp(src_rorp, dest_rorp)
     rorp_eq = Hardlink.rorp_eq(src_rorp, dest_rorp)
     if not src_rorp.isreg() or not dest_rorp.isreg(
     ) or src_rorp.getnumlinks() == dest_rorp.getnumlinks() == 1:
         if not rorp_eq:
             Log("Hardlink compare error with when no links exist exist", 3)
             Log(
                 "%s: %s" %
                 (src_rorp.index, Hardlink.get_inode_key(src_rorp)), 3)
             Log(
                 "%s: %s" %
                 (dest_rorp.index, Hardlink.get_inode_key(dest_rorp)), 3)
             return 0
     elif src_rorp.getnumlinks() > 1 and not Hardlink.islinked(src_rorp):
         if rorp_eq:
             Log(
                 "Hardlink compare error with first linked src_rorp and no dest_rorp sha1",
                 3)
             Log(
                 "%s: %s" %
                 (src_rorp.index, Hardlink.get_inode_key(src_rorp)), 3)
             Log(
                 "%s: %s" %
                 (dest_rorp.index, Hardlink.get_inode_key(dest_rorp)), 3)
             return 0
         hash.compute_sha1(dest_rorp)
         rorp_eq = Hardlink.rorp_eq(src_rorp, dest_rorp)
         if src_rorp.getnumlinks() != dest_rorp.getnumlinks():
             if rorp_eq:
                 Log(
                     "Hardlink compare error with first linked src_rorp, with dest_rorp sha1, and with differing link counts",
                     3)
                 Log(
                     "%s: %s" %
                     (src_rorp.index, Hardlink.get_inode_key(src_rorp)), 3)
                 Log(
                     "%s: %s" %
                     (dest_rorp.index, Hardlink.get_inode_key(dest_rorp)),
                     3)
                 return 0
         elif not rorp_eq:
             Log(
                 "Hardlink compare error with first linked src_rorp, with dest_rorp sha1, and with equal link counts",
                 3)
             Log(
                 "%s: %s" %
                 (src_rorp.index, Hardlink.get_inode_key(src_rorp)), 3)
             Log(
                 "%s: %s" %
                 (dest_rorp.index, Hardlink.get_inode_key(dest_rorp)), 3)
             return 0
     elif src_rorp.getnumlinks() != dest_rorp.getnumlinks():
         if rorp_eq:
             Log(
                 "Hardlink compare error with non-first linked src_rorp and with differing link counts",
                 3)
             Log(
                 "%s: %s" %
                 (src_rorp.index, Hardlink.get_inode_key(src_rorp)), 3)
             Log(
                 "%s: %s" %
                 (dest_rorp.index, Hardlink.get_inode_key(dest_rorp)), 3)
             return 0
     elif not rorp_eq:
         Log(
             "Hardlink compare error with non-first linked src_rorp and with equal link counts",
             3)
         Log("%s: %s" % (src_rorp.index, Hardlink.get_inode_key(src_rorp)),
             3)
         Log(
             "%s: %s" %
             (dest_rorp.index, Hardlink.get_inode_key(dest_rorp)), 3)
         return 0
     Hardlink.del_rorp(src_rorp)
     Hardlink.del_rorp(dest_rorp)
     return 1