Merge branch 'assistantpointerrace'
This commit is contained in:
commit
487a11a4af
5 changed files with 45 additions and 8 deletions
|
@ -290,19 +290,34 @@ handleAdds lockdowndir havelsof largefilematcher annexdotfiles delayadd cs = ret
|
||||||
refillChanges postponed
|
refillChanges postponed
|
||||||
|
|
||||||
returnWhen (null toadd) $ do
|
returnWhen (null toadd) $ do
|
||||||
|
(addedpointerfiles, toaddrest) <- partitionEithers
|
||||||
|
<$> mapM checkpointerfile toadd
|
||||||
(toaddannexed, toaddsmall) <- partitionEithers
|
(toaddannexed, toaddsmall) <- partitionEithers
|
||||||
<$> mapM checksmall toadd
|
<$> mapM checksmall toaddrest
|
||||||
addsmall toaddsmall
|
addsmall toaddsmall
|
||||||
addedannexed <- addaction toadd $
|
addedannexed <- addaction toadd $
|
||||||
catMaybes <$> addannexed toaddannexed
|
catMaybes <$> addannexed toaddannexed
|
||||||
return $ addedannexed ++ toaddsmall ++ otherchanges
|
return $ addedannexed ++ toaddsmall ++ addedpointerfiles ++ otherchanges
|
||||||
where
|
where
|
||||||
(incomplete, otherchanges) = partition (\c -> isPendingAddChange c || isInProcessAddChange c) cs
|
(incomplete, otherchanges) = partition (\c -> isPendingAddChange c || isInProcessAddChange c) cs
|
||||||
|
|
||||||
returnWhen c a
|
returnWhen c a
|
||||||
| c = return otherchanges
|
| c = return otherchanges
|
||||||
| otherwise = a
|
| otherwise = a
|
||||||
|
|
||||||
|
checkpointerfile change = do
|
||||||
|
let file = toRawFilePath $ changeFile change
|
||||||
|
mk <- liftIO $ isPointerFile file
|
||||||
|
case mk of
|
||||||
|
Nothing -> return (Right change)
|
||||||
|
Just key -> do
|
||||||
|
mode <- liftIO $ catchMaybeIO $ fileMode <$> R.getFileStatus file
|
||||||
|
liftAnnex $ stagePointerFile file mode =<< hashPointerFile key
|
||||||
|
return $ Left $ Change
|
||||||
|
(changeTime change)
|
||||||
|
(changeFile change)
|
||||||
|
(LinkChange (Just key))
|
||||||
|
|
||||||
checksmall change
|
checksmall change
|
||||||
| not annexdotfiles && dotfile f =
|
| not annexdotfiles && dotfile f =
|
||||||
return (Right change)
|
return (Right change)
|
||||||
|
|
|
@ -196,11 +196,8 @@ shouldRestage :: DaemonStatus -> Bool
|
||||||
shouldRestage ds = scanComplete ds || forceRestage ds
|
shouldRestage ds = scanComplete ds || forceRestage ds
|
||||||
|
|
||||||
onAddFile :: Bool -> Handler
|
onAddFile :: Bool -> Handler
|
||||||
onAddFile symlinkssupported f fs = do
|
onAddFile symlinkssupported f fs =
|
||||||
mk <- liftIO $ isPointerFile $ toRawFilePath f
|
onAddFile' contentchanged addassociatedfile addlink samefilestatus symlinkssupported f fs
|
||||||
case mk of
|
|
||||||
Nothing -> onAddFile' contentchanged addassociatedfile addlink samefilestatus symlinkssupported f fs
|
|
||||||
Just k -> addlink f k
|
|
||||||
where
|
where
|
||||||
addassociatedfile key file =
|
addassociatedfile key file =
|
||||||
Database.Keys.addAssociatedFile key
|
Database.Keys.addAssociatedFile key
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
git-annex (10.20240702) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* assistant: Fix a race condition that could cause a pointer file to
|
||||||
|
get ingested into the annex.
|
||||||
|
|
||||||
|
-- Joey Hess <id@joeyh.name> Tue, 02 Jul 2024 12:14:53 -0400
|
||||||
|
|
||||||
git-annex (10.20240701) upstream; urgency=medium
|
git-annex (10.20240701) upstream; urgency=medium
|
||||||
|
|
||||||
* git-annex remotes can now act as proxies that provide access to
|
* git-annex remotes can now act as proxies that provide access to
|
||||||
|
|
|
@ -104,3 +104,6 @@ on laptop where I dive into inception: 10.20240129
|
||||||
|
|
||||||
[[!meta author=yoh]]
|
[[!meta author=yoh]]
|
||||||
[[!tag projects/repronim]]
|
[[!tag projects/repronim]]
|
||||||
|
|
||||||
|
[[!meta title="inception: pointer file can be ingested into the annex due to assistant bug or manually"]]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 7"""
|
||||||
|
date="2024-07-02T16:15:28Z"
|
||||||
|
content="""
|
||||||
|
I've fixed this race in the assistant.
|
||||||
|
|
||||||
|
Question now is, can this bug be closed, or does it need to be left open,
|
||||||
|
and git-annex made to recover from this situation? Given the complexity
|
||||||
|
of making git-annex notice this, I'm sort of inclined to not have it
|
||||||
|
auto-recover. Manual recovery seems pretty simple, just delete the file and
|
||||||
|
re-add it with the right key.
|
||||||
|
|
||||||
|
Thoughts?
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue