init: Catch more exceptions when testing locking.
This commit is contained in:
parent
dc19fa8b04
commit
d6e1f09ed2
3 changed files with 22 additions and 3 deletions
|
@ -51,6 +51,7 @@ import qualified Utility.LockFile.Posix as Posix
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
import Data.Either
|
||||||
|
|
||||||
checkCanInitialize :: Annex a -> Annex a
|
checkCanInitialize :: Annex a -> Annex a
|
||||||
checkCanInitialize a = inRepo (noAnnexFileContent . Git.repoWorkTree) >>= \case
|
checkCanInitialize a = inRepo (noAnnexFileContent . Git.repoWorkTree) >>= \case
|
||||||
|
@ -233,9 +234,10 @@ probeLockSupport = do
|
||||||
mode <- annexFileMode
|
mode <- annexFileMode
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
nukeFile f
|
nukeFile f
|
||||||
ok <- catchBoolIO $ do
|
let locktest =
|
||||||
Posix.dropLock =<< Posix.lockExclusive (Just mode) f
|
Posix.lockExclusive (Just mode) f
|
||||||
return True
|
>>= Posix.dropLock
|
||||||
|
ok <- isRight <$> tryNonAsync locktest
|
||||||
nukeFile f
|
nukeFile f
|
||||||
return ok
|
return ok
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,6 +18,7 @@ git-annex (7.20190826) UNRELEASED; urgency=medium
|
||||||
fix a bug that prevented annex.thin from taking effect for the files
|
fix a bug that prevented annex.thin from taking effect for the files
|
||||||
in working tree.
|
in working tree.
|
||||||
* Avoid making a commit when upgrading from direct mode to v7.
|
* Avoid making a commit when upgrading from direct mode to v7.
|
||||||
|
* init: Catch more exceptions when testing locking.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Sat, 24 Aug 2019 12:54:35 -0400
|
-- Joey Hess <id@joeyh.name> Sat, 24 Aug 2019 12:54:35 -0400
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
"""]]
|
Loading…
Add table
Reference in a new issue