As I continue my quest to make sure I understand rclone's behaviors, I have been playing with --track-renames-strategy modtime (since I will be syncing to an encrypted remote). I noticed in testing that in the face of ambiguity (more than one file with the same size and modtime), rclone will pick one (the first?).
Personally, in the face of ambiguity, I would prefer that rclone just decide it can't track that rename and do a new transfer + delete. It will alleviate some of the unsafeness of this strategy.
Would it be possible to add a flag to do that? Actually, I would say the default should be to not pick one and instead print a warning and then not track that rename.
(If spent some time analyzing my files and found that I had a lot of files with the exact size and modtime. Turns out they were from a macOS sparsediskbundle. Some common operations on them set all bands to the same modtime and by construction, all bands have the same size. Furthermore, it can get really nasty if they get messed up).
Had you run rclone dedupe to get rid of all the duplicates? I'm interested in this too, since I plan to keep a crypted remote in sync with my non encrypted remote, all server-side
Aw man, I suspect that would be your answer. I really need to learn Go just so I can do this kind of thing.
Maybe I'll take a look this weekend if the baby naps well and long enough to try
Otherwise, if anyone else wants to do it, feel free.
I am guessing, based on what I gather from this code and the descriptions as it comes out, that dst.ModTime is some kind of mapping. But here would be my best guess:
if s.trackRenamesStrategy.modTime() {
i = -1
c = 0
srcModTime := src.ModTime(s.ctx)
for j, dst := range dsts {
dstModTime := dst.ModTime(s.ctx)
dt := dstModTime.Sub(srcModTime)
if dt < s.modifyWindow && dt > -s.modifyWindow {
i = j
c++
}
}
// If nothing matched or more than one then return nil
if (i < 0 || c > 1) {
return nil
}
}
(Again, I do not know golag, but I am not sure what is returned otherwise, it breaks but that's it)
This was actually my plan. Before the initial backup, i was going to go through and find all same size and modtime files and then randomly perturb them (in python). That would seed my initial backup with unique files.
The problem is, it does not stop it from happening again. Sure, I could run all kinds of scripts to figure out what is new and what has matching times and then again change the mtime but that is also very, very hacky! I am certainly not opposed to hacks but I would prefer to avoid it.