avoid accidentally thawing git-annex symlink

It did nothing, since at this point the link is dangling. But when there
is a thaw hook, it would probably not be happy to be asked to run on a
symlink, or might do something unexpected.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-02-24 14:21:23 -04:00
parent f4b046252a
commit 51c528980c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 22 additions and 9 deletions

View file

@ -631,15 +631,16 @@ removeAnnex (ContentRemovalLock key) = withObjectLoc key $ \file ->
where
-- Check associated pointer file for modifications, and reset if
-- it's unmodified.
resetpointer file = ifM (isUnmodified key file)
( adjustedBranchRefresh (AssociatedFile (Just file)) $
depopulatePointerFile key file
-- Modified file, so leave it alone.
-- If it was a hard link to the annex object,
-- that object might have been frozen as part of the
-- removal process, so thaw it.
, void $ tryIO $ thawContent file
)
resetpointer file = unlessM (liftIO $ isSymbolicLink <$> getSymbolicLinkStatus (fromRawFilePath file)) $
ifM (isUnmodified key file)
( adjustedBranchRefresh (AssociatedFile (Just file)) $
depopulatePointerFile key file
-- Modified file, so leave it alone.
-- If it was a hard link to the annex object,
-- that object might have been frozen as part of the
-- removal process, so thaw it.
, void $ tryIO $ thawContent file
)
{- Moves a key out of .git/annex/objects/ into .git/annex/bad, and
- returns the file it was moved to. -}

View file

@ -175,3 +175,5 @@ filing as a bug since I think I satisfied all desires of git-annex for ensuring
edit 1: I thought that may be "Locking down a directory only needs to do the equivilant of removing its write bit, does not need to lockdown the files within it." from [lockdown_hooks](https://git-annex.branchable.com/todo/lockdown_hooks/) does not really "work", so I added `-R` to above nfs4_facl calls, but seems the effect is the same -- annex doesn' like me :-/
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,10 @@
[[!comment format=mdwn
username="joey"
subject="""comment 7"""
date="2022-02-24T18:13:20Z"
content="""
[2022-02-24 13:50:11.885644532] (Annex.Perms) thawing content ./foo
This turns out to be due to removeAnnex's resetpointer.
It was not intended to run on symlinks. I've fixed this too.
"""]]