mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-18 11:05:14 +00:00
lib/fs: Ignore inode change time on Android (#9177)
lib/fs: Fix conflicts on Android due to fluctuating inode change time
[1] added inode change time to file info in order to support syncing
extended attributes. However, in the case of Android, this inode change
time fluctuates, leading to unexpected conflicts even when the user has
not even touched the files on the Android device itself. Thus, in order
to prevent those conflicts from happening, do not write inode change
time on Android.
[1] 6cac308bcd
Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
This commit is contained in:
parent
11f508d9be
commit
16ae1fbe5e
@ -12,9 +12,17 @@ package fs
|
||||
import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/build"
|
||||
)
|
||||
|
||||
func (fi basicFileInfo) InodeChangeTime() time.Time {
|
||||
// On Android, mtime and inode-change-time fluctuate, which can cause
|
||||
// conflicts even when nothing has been modified on the device itself.
|
||||
// Ref: https://forum.syncthing.net/t/keep-getting-conflicts-generated-on-android-device-for-files-modified-only-on-a-desktop-pc/19060
|
||||
if build.IsAndroid {
|
||||
return time.Time{}
|
||||
}
|
||||
if sys, ok := fi.FileInfo.Sys().(*syscall.Stat_t); ok {
|
||||
return time.Unix(0, sys.Ctim.Nano())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user