From: Joey Hess Date: Thu, 24 Feb 2022 18:21:23 +0000 (-0400) Subject: avoid accidentally thawing git-annex symlink X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~75^2~199 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=51c528980c55f750575378368212127791a2d599;p=git-annex.git 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 --- diff --git a/Annex/Content.hs b/Annex/Content.hs index d4dac5caeb..141f8e206a 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -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. -} diff --git a/doc/bugs/can__39__t_make_annex_happy_in_freeze__47__thaw.mdwn b/doc/bugs/can__39__t_make_annex_happy_in_freeze__47__thaw.mdwn index bd4461a178..008294071a 100644 --- a/doc/bugs/can__39__t_make_annex_happy_in_freeze__47__thaw.mdwn +++ b/doc/bugs/can__39__t_make_annex_happy_in_freeze__47__thaw.mdwn @@ -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]] diff --git a/doc/bugs/can__39__t_make_annex_happy_in_freeze__47__thaw/comment_7_f0a3a944479e52a7789ff9a346001a6d._comment b/doc/bugs/can__39__t_make_annex_happy_in_freeze__47__thaw/comment_7_f0a3a944479e52a7789ff9a346001a6d._comment new file mode 100644 index 0000000000..5825a1cf13 --- /dev/null +++ b/doc/bugs/can__39__t_make_annex_happy_in_freeze__47__thaw/comment_7_f0a3a944479e52a7789ff9a346001a6d._comment @@ -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. +"""]]