]> dgit.raspbian.org Git - git-annex.git/commitdiff
catch more exceptions
authorJoey Hess <joeyh@joeyh.name>
Fri, 13 Aug 2021 20:16:46 +0000 (16:16 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 13 Aug 2021 20:16:46 +0000 (16:16 -0400)
I saw this:

  .git/annex/tmp/SHA256E-s1234376--5ba8e06e0163b217663907482bbed57684d7188024155ddc81da0710dfd2687d: openBinaryFile: resource busy (file is locked)

 guess catching IO exceptions did not catch that one.

Annex/Verify.hs

index d9045a627e79aab368902c93c48c4241a36ee32c..9605788d9f650e7367a09c2a3168efa7c2b52fc4 100644 (file)
@@ -166,19 +166,19 @@ startVerifyKeyContentIncrementally verifyconfig k =
 tailVerify :: IncrementalVerifier -> RawFilePath -> TMVar () -> IO (Maybe (IO ()))
 #if WITH_INOTIFY
 tailVerify iv f finished = 
-       tryIO go >>= \case
+       tryNonAsync go >>= \case
                Right r -> return r
                Left _ -> do
                        failIncremental iv
                        return Nothing
   where
        f' = fromRawFilePath f
-       waitforfiletoexist i = tryIO (openBinaryFile f' ReadMode) >>= \case
+       waitforfiletoexist i = tryNonAsync (openBinaryFile f' ReadMode) >>= \case
                Right h -> return (Just h)
                Left _ -> do
                        hv <- newEmptyTMVarIO
                        wd <- inotifycreate i $
-                               tryIO (openBinaryFile f' ReadMode) >>= \case
+                               tryNonAsync (openBinaryFile f' ReadMode) >>= \case
                                        Right h -> 
                                                unlessM (atomically $ tryPutTMVar hv h) $
                                                        hClose h
@@ -219,7 +219,7 @@ tailVerify iv f finished =
        
        go = INotify.withINotify $ \i -> do
                h <- waitforfiletoexist i
-               tryIO (go' i h) >>= \case
+               tryNonAsync (go' i h) >>= \case
                        Right r -> return r
                        Left _ -> do
                                maybe noop hClose h
@@ -274,7 +274,7 @@ tailVerify iv f finished =
                                now <- getPOSIXTime
                                if now - starttime > 0.5
                                        then return $ Just $
-                                               tryIO (deferredfinish h) >>= \case
+                                               tryNonAsync (deferredfinish h) >>= \case
                                                        Right () -> noop
                                                        Left _ -> failIncremental iv
                                        else finish h starttime