From 1c18056e15d5830587106d64c962eff093416d13 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 11 Jun 2014 14:46:03 -0400 Subject: [PATCH] deal with FAT on Linux timestamp issue Deal with FAT's low resolution timestamps, which in combination with Linux's caching of higher res timestamps while a FAT is mounted, caused direct mode repositories on FAT to seem to have modified files after they were unmounted and remounted. This commit was sponsored by Fabrice Rossi. --- Utility/InodeCache.hs | 11 +++++++++-- debian/changelog | 4 ++++ ..._resolution_for_mtime_2s--__62___implications.mdwn | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Utility/InodeCache.hs b/Utility/InodeCache.hs index a24bce546f..c142114cbf 100644 --- a/Utility/InodeCache.hs +++ b/Utility/InodeCache.hs @@ -28,10 +28,17 @@ compareStrong (InodeCache x) (InodeCache y) = x == y {- Weak comparison of the inode caches, comparing the size and mtime, - but not the actual inode. Useful when inodes have changed, perhaps - - due to some filesystems being remounted. -} + - due to some filesystems being remounted. + - + - The weak mtime comparison treats any mtimes that are within 2 seconds + - of one-anther as the same. This is because FAT has only a 2 second + - resolution. When a FAT filesystem is used on Linux, higher resolution + - timestamps are cached and used by Linux, but this is lost on unmount, + - so after a remount, the timestamp can appear to have changed. + -} compareWeak :: InodeCache -> InodeCache -> Bool compareWeak (InodeCache (InodeCachePrim _ size1 mtime1)) (InodeCache (InodeCachePrim _ size2 mtime2)) = - size1 == size2 && mtime1 == mtime2 + size1 == size2 && (abs (mtime1 - mtime2) < 2) compareBy :: InodeComparisonType -> InodeCache -> InodeCache -> Bool compareBy Strongly = compareStrong diff --git a/debian/changelog b/debian/changelog index c4205ac12e..9b9f93d9ce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,10 @@ git-annex (5.20140607) UNRELEASED; urgency=medium * Windows: Fix opening webapp when repository is in a directory with spaces in the path. * Fix build with wai 0.3.0. + * Deal with FAT's low resolution timestamps, which in combination with + Linux's caching of higher res timestamps while a FAT is mounted, caused + direct mode repositories on FAT to seem to have modified files after + they were unmounted and remounted. -- Joey Hess Mon, 09 Jun 2014 14:44:09 -0400 diff --git a/doc/bugs/FAT:_Date_resolution_for_mtime_2s--__62___implications.mdwn b/doc/bugs/FAT:_Date_resolution_for_mtime_2s--__62___implications.mdwn index 6752923176..d4dcc26e3f 100644 --- a/doc/bugs/FAT:_Date_resolution_for_mtime_2s--__62___implications.mdwn +++ b/doc/bugs/FAT:_Date_resolution_for_mtime_2s--__62___implications.mdwn @@ -135,3 +135,4 @@ Here's an konsole session to show this behaviour: +Modifiziert: 2014-05-03 19:44:38.000000000 +0200 +> fixed [[done]] --[[Joey]]