Rename changing '_' to '-' causes file delete

Hello,

Just joined Syncthing today, got everything setup, and the with the first rename that I make I stumble into this issue which apperently was never fixed: Renaming caused file deletion bug..

Setup: I have 3 devices running syncthing:

  • Ubuntu server
  • PC running xubuntu (synching to the server only)
  • Android phone (synching to the server only)

Repro:

  1. Rename a file on the PC by only changing an underscore ‘_’ to a dash ‘-’ (eg. test_01 to test-01)
  2. Watch as the change gets synced to the server correctly
  3. Shortly after the change gets synced to the Android phone which also deletes the rename filed (test-01)
  4. This deletion then gets synced back to the server and the PC, so test-01 no longer exists on any machine.

A bit of an issue considering this is loss of data =(

Which versions of Syncthing are running on the PC, phone, Ubuntu Server?

I often rename files, switching between underscores and dashes, and hadn’t noticed an issue. Following your 4-step process worked just fine with no loss of data for me.

This was a problem with the Android media framework which considers dash and underscore equivalent. We’d do the rename and then tell the media framework “we deleted the file with the dash in it” and it would go “yah I see the file with underscore, I’ll delete it then”.

We solved it by not sending delete notifications to the Android media framework any more. IIRC - this is Android stuff so I was only tangentially involved in trying to troubleshooting it.

2 Likes

Oh nice, thanks for remembering - I didn’t: Spurious file deletion due to MediaStore/ContentResolver delete race · Issue #1801 · syncthing/syncthing-android · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.