assistant: Make sanity checker tmp dir cleanup code more robust.

This commit is contained in:
Joey Hess 2014-05-30 15:08:49 -04:00
parent 0db43ccc81
commit 9c0f3ae7e1
3 changed files with 14 additions and 6 deletions

View file

@ -40,6 +40,7 @@ import Logs.Transfer
import Config.Files import Config.Files
import Utility.DiskFree import Utility.DiskFree
import qualified Annex import qualified Annex
import Annex.Exception
#ifdef WITH_WEBAPP #ifdef WITH_WEBAPP
import Assistant.WebApp.Types import Assistant.WebApp.Types
#endif #endif
@ -84,8 +85,9 @@ sanityCheckerStartupThread startupdelay = namedThreadUnchecked "SanityCheckerSta
liftIO $ fixUpSshRemotes liftIO $ fixUpSshRemotes
{- Clean up old temp files. -} {- Clean up old temp files. -}
liftAnnex cleanOldTmpMisc void $ liftAnnex $ tryAnnex $ do
liftAnnex cleanReallyOldTmp cleanOldTmpMisc
cleanReallyOldTmp
{- If there's a startup delay, it's done here. -} {- If there's a startup delay, it's done here. -}
liftIO $ maybe noop (threadDelaySeconds . Seconds . fromIntegral . durationSeconds) startupdelay liftIO $ maybe noop (threadDelaySeconds . Seconds . fromIntegral . durationSeconds) startupdelay
@ -310,7 +312,8 @@ cleanReallyOldTmp = do
| otherwise -> noop | otherwise -> noop
cleanOld :: (POSIXTime -> Bool) -> FilePath -> IO () cleanOld :: (POSIXTime -> Bool) -> FilePath -> IO ()
cleanOld check f = do cleanOld check f = go =<< catchMaybeIO getmtime
mtime <- realToFrac . modificationTime <$> getFileStatus f where
when (check mtime) $ getmtime = realToFrac . modificationTime <$> getSymbolicLinkStatus f
nukeFile f go (Just mtime) | check mtime = nukeFile f
go _ = noop

1
debian/changelog vendored
View file

@ -6,6 +6,7 @@ git-annex (5.20140530) UNRELEASED; urgency=medium
* webapp: Avoid stomping on existing description, group and * webapp: Avoid stomping on existing description, group and
preferred content settings when enabling or combining with preferred content settings when enabling or combining with
an already existing remote. 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 -- Joey Hess <joeyh@debian.org> Thu, 29 May 2014 20:10:59 -0400

View file

@ -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? 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 git-annex version: 5.20140517-gee56d21
[[!tag confirmed]]
> [[fixed|done]] --[[Joey]]