Ignore Permissions / Different mtimes on Android Sdcard

Hello,

It seems that the SDCARD only preserves only even integer seconds, not odd ones. Any odd integer second is preserved during a session, but not across reboots, so there is some volatile caching of metadata. At least on my Android system.

I did this (forgive me for not having done it before):

  1. Create a shared dir with the syncthing source (plus ./git/* stuff)

  2. Syncthing share with Android

  3. Start syncthing on phone - wait until all up to date on both sides.

  4. Reboot phone.

  5. Install Busybox. Busybox find does not seem to support -printf options.

  6. Create tiny shell ‘find-stat.sh’ script on Android syncthing-repo:

STAT=$(stat -c "ctime: %z mtime: %y" $1)
SHA1=$(sha1sum $1)
echo -ne "$(echo "$SHA1 $STAT" |tr -d '\n' )\n"
  1. Run:

find . -type f -exec sh find-stat.sh {} \; > first.txt

first.txt # After reboot but before reverting.

  1. Revert files.

  2. Run:

find . -type f -exec sh find-stat.sh {} \; > second.txt

second.txt #after reverting.

  1. Reboot phone and start syncthing

  2. Run:

find . -type f -exec sh find-stat.sh {} \; > third.txt

third.txt #after reboot but before reverting.

Revert files.

Run:

find . -type f -exec sh find-stat.sh {} \; > fourth.txt

fourth.txt # after reversion.

Diff second.txt and fourth.txt #Ctime diffs but no mtime diffs.

Diff second.txt and third.txt mtime diffs only

An example:

From second.txt:

2ec3c7a83daa7bef0eccf1cb8108058a3368c1ea  ./lib/fs/fakefs.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-05-31 13:24:33.000000000
80f3091a614e5d7a2b5ebd9c79837d0fe1ed6f50  ./lib/fs/basicfs_test.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-04-11 11:20:21.000000000
11f41fb9a098b4f8db3865ee3e81b21954cee840  ./lib/fs/basicfs_watch_eventtypes_inotify.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2018-05-03 10:16:25.000000000
8cc8e4ad846ddaef09de8ba32304f8f65a64f440  ./lib/fs/basicfs_fileinfo_windows.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-02-25 15:34:33.000000000
29f4bb75d21be3cb4b2f3d82b736fe3ac8247d29  ./lib/fs/basicfs_watch_errors_others.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2017-10-31 14:26:57.000000000
f164fa42565d2500e7933f0262cb505aa76844e9  ./lib/fs/basicfs_fileinfo_unix.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-02-25 15:34:33.000000000
feeb19f66d443877f4c4f94594702b59d0714a97  ./lib/fs/filesystem.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-05-31 13:24:33.000000000

From third.txt:

2ec3c7a83daa7bef0eccf1cb8108058a3368c1ea  ./lib/fs/fakefs.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-05-31 13:24:32.000000000
80f3091a614e5d7a2b5ebd9c79837d0fe1ed6f50  ./lib/fs/basicfs_test.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-04-11 11:20:20.000000000
11f41fb9a098b4f8db3865ee3e81b21954cee840  ./lib/fs/basicfs_watch_eventtypes_inotify.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2018-05-03 10:16:24.000000000
8cc8e4ad846ddaef09de8ba32304f8f65a64f440  ./lib/fs/basicfs_fileinfo_windows.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-02-25 15:34:32.000000000
29f4bb75d21be3cb4b2f3d82b736fe3ac8247d29  ./lib/fs/basicfs_watch_errors_others.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2017-10-31 14:26:56.000000000
f164fa42565d2500e7933f0262cb505aa76844e9  ./lib/fs/basicfs_fileinfo_unix.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-02-25 15:34:32.000000000
feeb19f66d443877f4c4f94594702b59d0714a97  ./lib/fs/filesystem.go ctime: 2019-06-24 19:34:34.000000000 mtime: 2019-05-31 13:24:32.000000000

A mtime configurable window, similar to the rsync --modify-window option would be very handy.

Once again, sorry for not having done this previously.

Attached archive with all four txt files.

===Rich

sha1ctimemtime.tar.xz (94.9 KB)