lib/fs: Properly handle case insensitive systems (fixes #1787, fixes #2739, fixes #5708)

With this change we emulate a case sensitive filesystem on top of
insensitive filesystems. This means we correctly pick up case-only renames
and throw a case conflict error when there would be multiple files differing
only in case.

This safety check has a small performance hit (about 20% more filesystem
operations when scanning for changes). The new advanced folder option
`caseSensitiveFS` can be used to disable the safety checks, retaining the
previous behavior on systems known to be fully case sensitive.

Co-authored-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Simon Frei
2020-07-28 11:15:11 +02:00
committed by Jakob Borg
co-authored by Jakob Borg
parent 21dd9d6b43
commit 932d8c69de
27 changed files with 1241 additions and 187 deletions
+1
View File
@@ -128,6 +128,7 @@ type Report struct {
DisableFsync int `json:"disableFsync,omitempty" since:"3"`
BlockPullOrder map[string]int `json:"blockPullOrder,omitempty" since:"3"`
CopyRangeMethod map[string]int `json:"copyRangeMethod,omitempty" since:"3"`
CaseSensitiveFS int `json:"caseSensitiveFS,omitempty" since:"3"`
} `json:"folderUsesV3,omitempty" since:"3"`
GUIStats struct {
+3
View File
@@ -269,6 +269,9 @@ func (s *Service) reportData(ctx context.Context, urVersion int, preview bool) (
}
report.FolderUsesV3.BlockPullOrder[cfg.BlockPullOrder.String()]++
report.FolderUsesV3.CopyRangeMethod[cfg.CopyRangeMethod.String()]++
if cfg.CaseSensitiveFS {
report.FolderUsesV3.CaseSensitiveFS++
}
}
sort.Ints(report.FolderUsesV3.FsWatcherDelays)