SyncThing 0.12.1 found a bug with overwtitten files

Hi everybody.

I think I found a tricky bug. First I’m gonna explain my setup.

I’ve set everything up in a sta toppology around my Linux server.

Trebonix: My server itself running Linux (nevest Ubuntu Server 64 bit)

S5: My Samsung Galaxy S5 Running latest stock rom and the official Syncthing from Google Play Market.

Tab S: My Samsung Galaxy Tab S running latest stock rom and official Syncthing from Google Play Market.

Geekalix: My desktop machine running Latest Linux Mint 64 Bit.

Babylix: My laptop running Latest Linux Mint 64 Bit.

Trebonix, S5, Tab S, babylix and Geekalix shares two repositories, movedoc and Pics.

So we’re gonna concentrate around the movedoc-repo.

I’ve got som notes in a folder called Notes. It is actually just plain txt-files. If I change one of those files with a app on the fone. Things is going to work fine and this file is very quickly propagated to the other nodes including my desktop computer and my laptop. I can even go to the other android devices and chang back and fourth as crazy as I like as long as I doing this on one of the Android based devices.

However

If I change the same file on the computer using a simple txt-editor the sync to the Android devices immediately breaks and stays at 99% or even 100% synced and stay there forever until I either removes the file from the repo using one of the computers or resets the database on the affected Android device OR, if one of the android devices happens to actually sync the file, rename the file to something other, wait for the conflict to clear by itself then rename back to original filename.

If I chhose to remove the file from the repo, i can just wait for the conflict to settle on the android device then put back the very same file in the repo. This will solve the conflict and will sync the file back on every device including the Android devices.

Also If I add a fresh TXT-file to the repo from the pc and let it sync and then edit using one of the Android devices the sync will again break immediately and I then have to do the above steps to remedy the drama again.

It seems like the android devices can do whatever they like to the files as long as it has not been modified by a regular pc. Very strange.

I’ve been running one of the android devices with strace=all and this is what is in the log during one of the confliucting situation where the file has been altered with regular computers

all.txt (36.0 KB)

What is wrong here and what can I do to make it work.

EDIT: None of the nodes is marked as master and I’m running Trebonix with Ignore permission but this does not help the situation.

EDIT2: And the computers are running 0.12.2 64bit

EDIT3: No exception rules in place in fact this is also broken in the Android version and gives a permission denied if I tried to change the .stignore from the web UI.

1 Like

This is a bug with the new error checking code, which completely ignores virtual mtimes. Namely this place: https://github.com/syncthing/syncthing/blob/283671fa9d5a9a82431bb5059c657965929882de/lib/model/rwfolder.go#L951

Open a new issue on github.

1 Like

I’ve already proposed a fix, so no need to open an issue.

1 Like

Thank you @AudriusButkevicius that was fast.

But, purely out of curriousity, why is it only pressent when files are edited from non Android-devices and why does it just work between Android devices only?

So I cannot explain that. In my opinion it should just not work on android, so the fact that we have android to android working is a bit of a puzzle to me.

I can only see it working if the file is synced within a second, or the other android device is able to adjust mtimes.

Hmmmm strange…