From: Joey Hess Date: Fri, 13 Aug 2021 20:16:46 +0000 (-0400) Subject: catch more exceptions X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~2^2^2~65^2~104 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=16dd3dd4cab0e0a681bf90e54daba63d6809948f;p=git-annex.git catch more exceptions I saw this: .git/annex/tmp/SHA256E-s1234376--5ba8e06e0163b217663907482bbed57684d7188024155ddc81da0710dfd2687d: openBinaryFile: resource busy (file is locked) guess catching IO exceptions did not catch that one. --- diff --git a/Annex/Verify.hs b/Annex/Verify.hs index d9045a627e..9605788d9f 100644 --- a/Annex/Verify.hs +++ b/Annex/Verify.hs @@ -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