Conflict: cannot rename file

v0.11.1. I get a Puller rename/delete error when I try to save conflicting versions of files. I do not think it’s the same as this:

…because it’s not a case of deleting a file that’s syncing. Instead, what I did was:

  • Create v1 of a Word doc on Computer 1
  • Allow it to sync to Computer 2
  • Open the Word doc on both computers
  • Edit the doc to v2 on Computer 1; to v3 on Computer 2
  • Save both documents within quick succession
  • Leave the document open in Word on Computer 2 (and hence the file locked)

I get the following error on Computer 1:

Puller: final: rename \\?\S:\Test\test.docx: The process cannot access the file because it is being used by another process

And the following on Computer 2:

Puller: final: rename \\?\D:\Test\test.docx \\?\D:\Test\test.sync-conflict-20150429-123457.docx: The process cannot access the file because it is being used by another process

The files are locked, presumably by Word, so syncthing is not allowed to sync them.

I see.

In one sense, Syncthing is working as intended. It’s syncing the folders, but it’s unable to rename a file in the case of a conflict due to the user.

In another sense, it’s a common use pattern that (I think) most people would not expect. Most people do not understand that common software like Word locks files for writing.

How about keeping both files, but performing different renames on different peers?

For example, whereas at the moment you see this happening:

Computer 1
Computer 1's version: file.doc
Computer 2's version: file.sync-conflict-20150429-000000.doc

Computer 2
Computer 1's version: file.doc
Computer 2's version: file.sync-conflict-20150429-000000.doc

We could see this:

Computer 1
Computer 1's version: file.doc
Computer 2's version: file.sync-conflict-20150429-000000.doc

Computer 2
Computer 1's version: file.sync-conflict-20150429-000007.doc
Computer 2's version: file.doc

This way, no renames occur and locked files in conflict can be still be dealt with.

Syncthing DB would of course have to be aware of this. Any other peers would receive files using the “correct” names which is what Computer 1 sees. The only peer in the network that has “special” naming is Computer 2.

That would leave the two devices out of sync (since file.doc is different), and possibly also lie about it and cause general confusion.