Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

core: Fix race detected by go race detector

Nick Craig-Woode09ef62d5b78
diff --git a/fs/operations.go b/fs/operations.go
index 6b56792e5..28bed028b 100644
--- a/fs/operations.go
+++ b/fs/operations.go
@@ -4,7 +4,6 @@ package fs
import (
"fmt"
- "log"
"sync"
)
@@ -225,12 +224,10 @@ func Copier(in ObjectPairChan, fdst Fs, wg *sync.WaitGroup) {
func DeleteFiles(to_be_deleted ObjectsChan) {
var wg sync.WaitGroup
wg.Add(Config.Transfers)
- var fs Fs
for i := 0; i < Config.Transfers; i++ {
go func() {
defer wg.Done()
for dst := range to_be_deleted {
- fs = dst.Fs()
if Config.DryRun {
Debug(dst, "Not deleting as --dry-run")
} else {
@@ -247,8 +244,7 @@ func DeleteFiles(to_be_deleted ObjectsChan) {
}
}()
}
-
- Log(fs, "Waiting for deletions to finish")
+ Log(nil, "Waiting for deletions to finish")
wg.Wait()
}
@@ -520,7 +516,6 @@ func Purge(f Fs) error {
}
} else {
DeleteFiles(f.List())
- log.Printf("Deleting path")
Rmdir(f)
}
return nil
diff --git a/notes.txt b/notes.txt
index 054c579e8..8ee47cb0b 100644
--- a/notes.txt
+++ b/notes.txt
@@ -3,6 +3,12 @@ Remove FIXME skipping directory
Change lsd command so it doesn't show -1
* Make sure all Fses show -1 for objects Zero for dates etc
+Make unit tests for the fses
+ * Make them try to load a TestFSName config
+ * Then do a proper unit test of each one
+ * If there is no TestFSName config it should exit quietly
+ * However the Local FS should default to a tmpdir
+
Todo
* FIXME: More -dry-run checks for object transfer
* Might be quicker to check md5sums first? for swift <-> swift certainly, and maybe for small files