From e09ef62d5b78b085d93a063f908308c335f37a89 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 22 Jul 2014 23:03:14 +0100 Subject: [PATCH] core: Fix race detected by go race detector --- fs/operations.go | 7 +------ notes.txt | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) 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