From f971b199edf9b160f37e07f075bfbd6d04fee1c6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 26 Apr 2023 16:09:49 -0400 Subject: [PATCH] fix init .git/annex/ perms for core.sharedRepository init: Bug fix: Create .git/annex/ and .git/annex/fsckdb/ directories with permissions configured by core.sharedRepository. The fsckfb being created happens to create .git/annex/ and it was not using createAnnexDirectory. Probably a reversion partly, but maybe the database directory was always created not honoring core.sharedRepository? Sponsored-by: Noam Kremen on Patreon --- CHANGELOG | 2 ++ Database/Init.hs | 12 ++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8b5c6bc81f..4e7384b6e8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -29,6 +29,8 @@ git-annex (10.20230408) UNRELEASED; urgency=medium --json-error-messages is enabled, output a JSON object indicating the problem. (But git ls-files --error-unmatch still displays errors about such files in some situations.) + * init: Bug fix: Create .git/annex/ and .git/annex/fsckdb/ directories with + permissions configured by core.sharedRepository. * Warn about unsupported core.sharedRepository=0xxx when set. -- Joey Hess Sat, 08 Apr 2023 13:57:18 -0400 diff --git a/Database/Init.hs b/Database/Init.hs index 570cf5b32a..ac33fdae03 100644 --- a/Database/Init.hs +++ b/Database/Init.hs @@ -10,10 +10,8 @@ module Database.Init where import Annex.Common -import qualified Annex import Annex.Perms import Utility.FileMode -import Utility.Directory.Create import qualified Utility.RawFilePath as R import Database.Persist.Sqlite @@ -35,14 +33,8 @@ initDb db migration = do let tmpdbdir = dbdir <> ".tmp" let tmpdb = tmpdbdir P. "db" let tdb = T.pack (fromRawFilePath tmpdb) - gc <- Annex.getGitConfig - top <- parentDir <$> fromRepo gitAnnexDir - let tops = case annexDbDir gc of - Just topdbdir -> [top, parentDir (parentDir topdbdir)] - Nothing -> [top] - liftIO $ do - createDirectoryUnder tops tmpdbdir - runSqliteInfo (enableWAL tdb) migration + createAnnexDirectory tmpdbdir + liftIO $ runSqliteInfo (enableWAL tdb) migration setAnnexDirPerm tmpdbdir -- Work around sqlite bug that prevents it from honoring -- less restrictive umasks.