summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-05-30 15:08:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-05-30 15:08:49 -0400
commite9459ce34db199a12acf6f8f0c0a610384e2f000 (patch)
tree5301c41e8e77f47fecbd9bb5eab509f4524269f3
parentf3de5fd2959f258d35a73b9c9a81d7a95bf7f61f (diff)
assistant: Make sanity checker tmp dir cleanup code more robust.
-rw-r--r--Assistant/Threads/SanityChecker.hs15
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/Assistant_breaks_when_broken_symlinks_are_in_.git__47__annex__47__tmp.mdwn4
3 files changed, 14 insertions, 6 deletions
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs
index ba141698d..c4f2723f0 100644
--- a/Assistant/Threads/SanityChecker.hs
+++ b/Assistant/Threads/SanityChecker.hs
@@ -40,6 +40,7 @@ import Logs.Transfer
import Config.Files
import Utility.DiskFree
import qualified Annex
+import Annex.Exception
#ifdef WITH_WEBAPP
import Assistant.WebApp.Types
#endif
@@ -84,8 +85,9 @@ sanityCheckerStartupThread startupdelay = namedThreadUnchecked "SanityCheckerSta
liftIO $ fixUpSshRemotes
{- Clean up old temp files. -}
- liftAnnex cleanOldTmpMisc
- liftAnnex cleanReallyOldTmp
+ void $ liftAnnex $ tryAnnex $ do
+ cleanOldTmpMisc
+ cleanReallyOldTmp
{- If there's a startup delay, it's done here. -}
liftIO $ maybe noop (threadDelaySeconds . Seconds . fromIntegral . durationSeconds) startupdelay
@@ -310,7 +312,8 @@ cleanReallyOldTmp = do
| otherwise -> noop
cleanOld :: (POSIXTime -> Bool) -> FilePath -> IO ()
-cleanOld check f = do
- mtime <- realToFrac . modificationTime <$> getFileStatus f
- when (check mtime) $
- nukeFile f
+cleanOld check f = go =<< catchMaybeIO getmtime
+ where
+ getmtime = realToFrac . modificationTime <$> getSymbolicLinkStatus f
+ go (Just mtime) | check mtime = nukeFile f
+ go _ = noop
diff --git a/debian/changelog b/debian/changelog
index d8bc867d0..1829325a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ git-annex (5.20140530) UNRELEASED; urgency=medium
* webapp: Avoid stomping on existing description, group and
preferred content settings when enabling or combining with
an already existing remote.
+ * assistant: Make sanity checker tmp dir cleanup code more robust.
-- Joey Hess <joeyh@debian.org> Thu, 29 May 2014 20:10:59 -0400
diff --git a/doc/bugs/Assistant_breaks_when_broken_symlinks_are_in_.git__47__annex__47__tmp.mdwn b/doc/bugs/Assistant_breaks_when_broken_symlinks_are_in_.git__47__annex__47__tmp.mdwn
index e47bfde1b..256bc1e7f 100644
--- a/doc/bugs/Assistant_breaks_when_broken_symlinks_are_in_.git__47__annex__47__tmp.mdwn
+++ b/doc/bugs/Assistant_breaks_when_broken_symlinks_are_in_.git__47__annex__47__tmp.mdwn
@@ -3,3 +3,7 @@ The assistant web UI says: `SanityCheckerStartup crashed: /home/zerodogg/Delt/.g
I'm not sure what causes said symlink to appear (which has the name of a file that does exist in the annex), but it has done so on several systems accross different distributions here (Fedora 20, Ubuntu 14.04, Archlinux). Perhaps an rsync copies over a symlink instead of a file?
git-annex version: 5.20140517-gee56d21
+
+[[!tag confirmed]]
+
+> [[fixed|done]] --[[Joey]]