Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/fs: Handle DST changes on FAT on Android (fixes #9227) #9231

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

calmh
Copy link
Member

@calmh calmh commented Nov 17, 2023

Here, you guys can argue about this. I'll go diving in the meantime.

@Catfriend1
Copy link
Contributor

Catfriend1 commented Dec 5, 2023

@calmh I cannot determine if this is ready to work "as is" . Do you think there's a chance as I expect you did not test it on Android because that's not your main OS to work on.

If you're fine with it, I could throw it into a Syncthing-Fork prerelease and grab feedback from users if it works.

What is the best way to simulate DST changes? Is it sufficient if the user disables "automatically retrieve time from provider" and disables NTP by going into airplane mode?

The fork has a "recent changes" UI , showing what has scanned (so was detected as changed). I would need a user with enough knowledge to test this fairly and not just run the app and "oh it is syncing".

Maybe it can also be verified in emulator?

Could I please have a log line indicating if the "time is off by one hour exactly" fired or not?

Ref https://forum.syncthing.net/t/unwanted-full-rescan-resync-sd-card-syncthing-android-after-timezone-daylight-saving-change/21064

* main:
  lib/fs: Reduce memory usage in xattrs handling (syncthing#9251)
  lib/model: Improve LastSeen handling (syncthing#9256)
  lib/scanner: Record inode change time for directories and symlinks (syncthing#9250)
  lib/api: Improve ignore loading error handling (fixes syncthing#9253) (syncthing#9254)
  gui, man, authors: Update docs, translations, and contributors
  lib/fs: Better equality comparison in mtimefs
  cmd/stcrashreceiver: Add metrics for diskstore inventory
  cmd/stcrashreceiver: Minor cleanup, stricter file permissions
  cmd/stcrashreceiver: Add metrics for incoming reports
  cmd/ursrv: Add metrics for incoming reports
  gui, man, authors: Update docs, translations, and contributors
  gui: Specialize a special-purpose checkbox style (syncthing#9236)
  gui, man, authors: Update docs, translations, and contributors
  build: Support new nested namespaces in Weblate downloads
  lib/model: Acquire fmut lock in ensureIndexHandler (fixes syncthing#9234) (syncthing#9235)
  gui: Allow to translate "unknown device" (syncthing#9229)
@calmh
Copy link
Member Author

calmh commented Dec 5, 2023

Indeed I have not even compiled for Android, only simulated what I hope are similar conditions.

I added a log line, needs STTRACE=fs to fire.

@Catfriend1
Copy link
Contributor

@calmh Perfect, thank you.

@Catfriend1
Copy link
Contributor

Catfriend1 commented Dec 9, 2023

Editing...

I'm just giving this a shot on the android emulator...

	 Invoking git fetch ...
	 Invoking git describe ...
	 Cleaning go-build cache
	 Building syncthing version v1.27.0-13-g32d74f4d4
	 
	 *** Building for arm
	 Notice: Next generation GUI will not be built; see --with-next-gen-gui.

STARTING STICK: v1.27.1.0 (without this PR)
image

image

image

Initial scan done. Now let's change the DST from GMT+0 to GMT+1...

image

I didn't get any recent changes by hitting RESCAN in Syncthing.

image

I expected to reproduce the original problem that all files on the shared SD folger were rescanned... :o

Even setting from GMT-1 to GMT+6 doesn't trigger the rescan listing files as "recent changes" on Syncthing's Web UI.

I'm at a loss how to reproduce the original problem.
Maybe ...
a) it's not happening on the emulator but on a real device?
b) it is just happening in older Android versions (I'm currently too lazy to setup new AVDs for every version before 14)

@er-pa
Copy link
Member

er-pa commented Dec 9, 2023

it is just happening in older Android versions (I'm currently too lazy to setup new AVDs for every version before 14)

Most likely, yes (or perhaps devices with separate SD-cards? If that still exists).

My guess is that it mostly (or only) affects devices running Android < 11 ór a kernel version below 5.4; as that's when the old FS was deprecated (SDCardFS).

Android Emulators running a recent version (Just tested a Pixel 7 - API 33) use EXT4 combined with a FUSE-implementation, the same is noticeable on my Galaxy S21 FE (although there F2FS is also used). As this seems to be a FAT-specific issue, it most likely isn't relevant anymore for devices running Android >= 11 ánd kernel >= 5.4.

@tomasz1986
Copy link
Contributor

tomasz1986 commented Dec 9, 2023

I think you should be able to reproduce this easily on a real device with an external SD card inserted. Those are always formatted as FAT, also in the newest versions of Android (unless you mount them as "internal storage").

In the original issue (https://forum.syncthing.net/t/unwanted-full-rescan-resync-sd-card-syncthing-android-after-timezone-daylight-saving-change/21064), the problem happened specifically with files located on an SD card.

@Catfriend1
Copy link
Contributor

@tomasz1986 the problem here is, I do not own a device with sdcard slot :-(. Maybe my emulator was Fuse based.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants