"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
rclone check: show count of hashes that couldn't be checked #700
Nick Craig-Woodb7875fc02a1f
diff --git a/fs/operations.go b/fs/operations.goindex d81a8a319..8ae3e7697 100644--- a/fs/operations.go+++ b/fs/operations.go@@ -476,28 +476,32 @@ func Overlapping(fdst, fsrc Fs) bool {// checkIdentical checks to see if dst and src are identical//// it returns true if differences were found-func checkIdentical(dst, src Object) bool {+// it also returns whether it couldn't be hashed+func checkIdentical(dst, src Object) (bool, bool) {Stats.Checking(src.Remote())defer Stats.DoneChecking(src.Remote())if src.Size() != dst.Size() {Stats.Error()ErrorLog(src, "Sizes differ")- return true+ return true, false}if !Config.SizeOnly {- same, _, err := CheckHashes(src, dst)+ same, hash, err := CheckHashes(src, dst)if err != nil {// CheckHashes will log and count errors- return true+ return true, false+ }+ if hash == HashNone {+ return true, true}if !same {Stats.Error()- ErrorLog(src, "Md5sums differ")- return true+ ErrorLog(src, "%v differ", hash)+ return true, false}}Debug(src, "OK")- return false+ return false, false}// Check the files in fsrc and fdst according to Size and hash@@ -507,6 +511,7 @@ func Check(fdst, fsrc Fs) error {return err}differences := int32(0)+ noHashes := int32(0)// FIXME could do this as it goes along and make it use less// memory.@@ -550,9 +555,13 @@ func Check(fdst, fsrc Fs) error {go func() {defer checkerWg.Done()for check := range checks {- if checkIdentical(check[0], check[1]) {+ differ, noHash := checkIdentical(check[0], check[1])+ if differ {atomic.AddInt32(&differences, 1)}+ if noHash {+ atomic.AddInt32(&noHashes, 1)+ }}}()}@@ -560,6 +569,9 @@ func Check(fdst, fsrc Fs) error {Log(fdst, "Waiting for checks to finish")checkerWg.Wait()Log(fdst, "%d differences found", Stats.GetErrors())+ if noHashes > 0 {+ Log(fdst, "%d hashes could not be checked", noHashes)+ }if differences > 0 {return errors.Errorf("%d differences found", differences)}