summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-06-11 14:46:03 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-06-11 14:46:03 -0400
commit37f848ace7eec5c73185e9c15b7063975bbcd4c8 (patch)
tree3156905921b44cb184391b9dee2b55b30821f1ad
parent73c8710be16359d3cf6e165f862c9759447d6219 (diff)
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.
-rw-r--r--Utility/InodeCache.hs11
-rw-r--r--debian/changelog4
-rw-r--r--doc/bugs/FAT:_Date_resolution_for_mtime_2s--__62___implications.mdwn1
3 files changed, 14 insertions, 2 deletions
diff --git a/Utility/InodeCache.hs b/Utility/InodeCache.hs
index a24bce546..c142114cb 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 c4205ac12..9b9f93d9c 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 <joeyh@debian.org> 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 675292317..d4dcc26e3 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]]