diff --git a/Annex/Init.hs b/Annex/Init.hs index 8ac3c4ebe1..de5aefd1dc 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -51,6 +51,7 @@ import qualified Utility.LockFile.Posix as Posix #endif import qualified Data.Map as M +import Data.Either checkCanInitialize :: Annex a -> Annex a checkCanInitialize a = inRepo (noAnnexFileContent . Git.repoWorkTree) >>= \case @@ -233,9 +234,10 @@ probeLockSupport = do mode <- annexFileMode liftIO $ do nukeFile f - ok <- catchBoolIO $ do - Posix.dropLock =<< Posix.lockExclusive (Just mode) f - return True + let locktest = + Posix.lockExclusive (Just mode) f + >>= Posix.dropLock + ok <- isRight <$> tryNonAsync locktest nukeFile f return ok #endif diff --git a/CHANGELOG b/CHANGELOG index 59867528d6..dc2448c072 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ git-annex (7.20190826) UNRELEASED; urgency=medium fix a bug that prevented annex.thin from taking effect for the files in working tree. * Avoid making a commit when upgrading from direct mode to v7. + * init: Catch more exceptions when testing locking. -- Joey Hess Sat, 24 Aug 2019 12:54:35 -0400 diff --git a/doc/bugs/regression__58___fails_to_detect_need_for_pidlock_on_an_NSF_mount/comment_1_82a71d4e9656c83e2d50143cb8a31602._comment b/doc/bugs/regression__58___fails_to_detect_need_for_pidlock_on_an_NSF_mount/comment_1_82a71d4e9656c83e2d50143cb8a31602._comment new file mode 100644 index 0000000000..3f0f18e569 --- /dev/null +++ b/doc/bugs/regression__58___fails_to_detect_need_for_pidlock_on_an_NSF_mount/comment_1_82a71d4e9656c83e2d50143cb8a31602._comment @@ -0,0 +1,16 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2019-08-29T16:11:14Z" + content=""" +No changes in the code of the lock test. Somehow the exception +was not caught, and it's only catching IO exceptions, so it must +be another type of exception. + +Oddly, I can't find any indication that waitToSetLock can throw anything +other than an IO exception. + +I've changed it to catch all exceptions, which will presumably fix the +problem, but not closing this bug as I don't fully understand it and so am +not certian of the fix. +"""]]