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.
This commit is contained in:
Joey Hess 2014-06-11 14:46:03 -04:00
parent d7ef984999
commit 1c18056e15
3 changed files with 14 additions and 2 deletions

View file

@ -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

4
debian/changelog vendored
View file

@ -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

View file

@ -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]]