Catfriend1 / syncthing-android

Syncthing-Fork - A Syncthing Wrapper for Android.
Mozilla Public License 2.0
1.2k stars 40 forks source link

(user error) Syncthing-fork deleted my entire /Sync/ folder #1038

Closed JacksonChen666 closed 9 months ago

JacksonChen666 commented 9 months ago

Description of the issue

EDIT: The cause of this issue was different. See https://github.com/Catfriend1/syncthing-android/issues/1038#issuecomment-1817672187

Syncthing-fork seems to have maybe deleted my entire /Sync/ folder after first launch (or settings import, but probably not that anyways).

(I'm not 100% sure on this, but I definitely do know that things happened to the /Sync/ after installing and setting up Syncthing-fork)

It does seem like the files are still there in .stversions, but still, don't just delete my data!

Reproduction Steps

  1. Have a folder at the root of internal storage called "Sync"
  2. Put stuff in it
  3. Run Syncthing-fork for the first time
  4. Likely have files in it completely deleted

Version Information

Device platform info

Android Log

Catfriend1 commented 9 months ago

Hi,

I have a folder with the name "sync" at my /storage/emulated/0 root. That's been the case for years. Including the latest release of the APK, I didn't have any problems with that. I'm not arguing something happened to your data, but its unlikely Syncthing(Native) does this on this own. If you found it in .stversions, all we could do in the wrapper app to protect you from data loss by e.g. accidentially clicking the "wrong button" or "using bad config" has worked correctly. This is a "feature" the official Syncthing app doesn't have.

I don't think there's anything I could do. Be advised to better backup your data first, before you learn/setup a new product (in common sense general advise). I'm sorry for your loss, but not personally responsible.

If you get a deeper understanding how syncthing works, you'll quickly notice that "just adding a folder" (without a partner device, without a sharing check box set) will do nothing but scan the folder "in read only mode".

Regards

--

If you need further assistance, you could export your settings and post them here, with deviceIDs replaced and passwords removed. Some screenshots would also been helpful. Most support in general means can be found on the Syncthing Forum where helpful people could have a look.

JacksonChen666 commented 9 months ago

Actually, I think I just found the root cause of my issue which lead to this whole data loss thing.

  1. A receive only folder was set to the entire /Sync/ folder
  2. I revert local changes (2023-11-18T15:00Z)
  3. It deletes (and saves a copy into .stversions)
  4. I realize the issue

I have no idea how I got into this situation in the first place, but I did import my config and stuff like that.

And the issue I filed is also not correct, at least in the reproduction step (I have no idea how I got into the above step 1, and that does not match).

JacksonChen666 commented 9 months ago

Status update (it's probably not necessary but I'm doing it anyways):

I used this python script to fix the filenames in the .stversions folder (it removes the last ~YYYYMMDD-hhmmss part in the filename):

import re

filenames = open("list").read()

result = re.sub(r"(.*)~\d{8}-\d{6}(.*)", r"\1\2", filenames, 0, re.MULTILINE)

if result:
    with open("list2", "w") as f:
        f.write(result)

(posting it just in case it helps anyone, feel free to do whatever (public domain/CC0-1.0))

And after creating a shell script which just runs a bunch of mv commands and running it on my phone (with Termux), it seems like I am back to how it originally was (at least, I think so).