Fix data loss that can occur when annex.pidlock is set in a repository.

This commit is contained in:
Joey Hess 2016-03-01 12:12:57 -04:00
parent 2f48c0aa7c
commit 3e91cd13ba
Failed to extract signature
3 changed files with 20 additions and 2 deletions

View file

@ -47,8 +47,14 @@ tryLockExclusive :: Maybe FileMode -> LockFile -> Annex (Maybe LockHandle)
tryLockExclusive m f = tryPidLock m f $ Posix.tryLockExclusive m f
checkLocked :: LockFile -> Annex (Maybe Bool)
checkLocked f = Posix.checkLocked f
`pidLockCheck` Pid.checkLocked
checkLocked f = Posix.checkLocked f `pidLockCheck` checkpid
where
checkpid pidlock = do
v <- Pid.checkLocked pidlock
case v of
-- Only return true when the posix lock file exists.
Just _ -> Posix.checkLocked f
Nothing -> return Nothing
getLockStatus :: LockFile -> Annex LockStatus
getLockStatus f = Posix.getLockStatus f

1
debian/changelog vendored
View file

@ -1,6 +1,7 @@
git-annex (6.20160230) UNRELEASED; urgency=medium
* metadata: Added -r to remove all current values of a field.
* Fix data loss that can occur when annex.pidlock is set in a repository.
-- Joey Hess <id@joeyh.name> Mon, 29 Feb 2016 13:00:30 -0400

View file

@ -0,0 +1,11 @@
[[!comment format=mdwn
username="joey"
subject="""comment 2"""
date="2016-03-01T16:11:37Z"
content="""
A worse problem with annex.pidlock is that it completly broke checking
whether a key is present in the repository. That could lead to data loss
when eg, moving --to a repo with annex.pidlock set.
I've fixed that related bug.
"""]]