When re-execing git-annex, use current program location, rather than ~/.config/git-annex/program, when possible.
Most of the time, there will be no discreprancy between programPath and readProgramFile. But, the programFile might have been written by an old version of git-annex that is still installed, while a newer one is currently running. In this case, we want to run the same one that's currently running. This is especially important for things like the GIT_SSH=git-annex used for ssh connection caching. The only code that still uses readProgramFile directly is the upgrade code, which needs to know where the standalone git-annex was installed, in order to upgrade it.
This commit is contained in:
parent
b9275b65f9
commit
450ee53ab6
14 changed files with 28 additions and 25 deletions
|
@ -31,7 +31,7 @@ import qualified Annex
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import qualified Git.Url
|
import qualified Git.Url
|
||||||
import Config
|
import Config
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Utility.Env
|
import Utility.Env
|
||||||
import Types.CleanupActions
|
import Types.CleanupActions
|
||||||
import Annex.Index (addGitEnv)
|
import Annex.Index (addGitEnv)
|
||||||
|
@ -273,7 +273,7 @@ sshOptionsTo remote gc g
|
||||||
case msockfile of
|
case msockfile of
|
||||||
Nothing -> return g
|
Nothing -> return g
|
||||||
Just sockfile -> do
|
Just sockfile -> do
|
||||||
command <- liftIO readProgramFile
|
command <- liftIO programPath
|
||||||
prepSocket sockfile
|
prepSocket sockfile
|
||||||
let val = toSshOptionsEnv $ concat
|
let val = toSshOptionsEnv $ concat
|
||||||
[ sshConnectionCachingParams sockfile
|
[ sshConnectionCachingParams sockfile
|
||||||
|
|
|
@ -104,7 +104,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
|
||||||
( liftIO $ withFile devNull WriteMode $ \nullh -> do
|
( liftIO $ withFile devNull WriteMode $ \nullh -> do
|
||||||
loghandle <- openLog logfile
|
loghandle <- openLog logfile
|
||||||
e <- getEnvironment
|
e <- getEnvironment
|
||||||
cmd <- readProgramFile
|
cmd <- programPath
|
||||||
ps <- getArgs
|
ps <- getArgs
|
||||||
(_, _, _, pid) <- createProcess (proc cmd ps)
|
(_, _, _, pid) <- createProcess (proc cmd ps)
|
||||||
{ env = Just (addEntry flag "1" e)
|
{ env = Just (addEntry flag "1" e)
|
||||||
|
|
|
@ -19,7 +19,7 @@ import qualified Types.Remote as Remote
|
||||||
import Logs.FsckResults
|
import Logs.FsckResults
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
import Utility.Batch
|
import Utility.Batch
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Assistant.Sync
|
import Assistant.Sync
|
||||||
import Assistant.Alert
|
import Assistant.Alert
|
||||||
import Assistant.DaemonStatus
|
import Assistant.DaemonStatus
|
||||||
|
@ -105,7 +105,7 @@ runRepair u mrmt destructiverepair = do
|
||||||
return ok
|
return ok
|
||||||
|
|
||||||
backgroundfsck params = liftIO $ void $ async $ do
|
backgroundfsck params = liftIO $ void $ async $ do
|
||||||
program <- readProgramFile
|
program <- programPath
|
||||||
batchCommand program (Param "fsck" : params)
|
batchCommand program (Param "fsck" : params)
|
||||||
|
|
||||||
{- Detect when a git lock file exists and has no git process currently
|
{- Detect when a git lock file exists and has no git process currently
|
||||||
|
|
|
@ -19,9 +19,9 @@ import Utility.Url
|
||||||
import Utility.PID
|
import Utility.PID
|
||||||
import qualified Git.Construct
|
import qualified Git.Construct
|
||||||
import qualified Git.Config
|
import qualified Git.Config
|
||||||
import Config.Files
|
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import qualified Git
|
import qualified Git
|
||||||
|
import Annex.Path
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
|
@ -110,7 +110,7 @@ assistantListening url = catchBoolIO $ exists url' def
|
||||||
-}
|
-}
|
||||||
startAssistant :: FilePath -> IO ()
|
startAssistant :: FilePath -> IO ()
|
||||||
startAssistant repo = void $ forkIO $ do
|
startAssistant repo = void $ forkIO $ do
|
||||||
program <- readProgramFile
|
program <- programPath
|
||||||
(_, _, _, pid) <-
|
(_, _, _, pid) <-
|
||||||
createProcess $
|
createProcess $
|
||||||
(proc program ["assistant"]) { cwd = Just repo }
|
(proc program ["assistant"]) { cwd = Just repo }
|
||||||
|
|
|
@ -15,7 +15,7 @@ import Assistant.Common
|
||||||
import Assistant.DaemonStatus
|
import Assistant.DaemonStatus
|
||||||
import Utility.NotificationBroadcaster
|
import Utility.NotificationBroadcaster
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Logs.Schedule
|
import Logs.Schedule
|
||||||
import Utility.Scheduled
|
import Utility.Scheduled
|
||||||
import Types.ScheduledActivity
|
import Types.ScheduledActivity
|
||||||
|
@ -181,7 +181,7 @@ runActivity urlrenderer activity nowt = do
|
||||||
|
|
||||||
runActivity' :: UrlRenderer -> ScheduledActivity -> Assistant ()
|
runActivity' :: UrlRenderer -> ScheduledActivity -> Assistant ()
|
||||||
runActivity' urlrenderer (ScheduledSelfFsck _ d) = do
|
runActivity' urlrenderer (ScheduledSelfFsck _ d) = do
|
||||||
program <- liftIO $ readProgramFile
|
program <- liftIO programPath
|
||||||
g <- liftAnnex gitRepo
|
g <- liftAnnex gitRepo
|
||||||
fsckresults <- showFscking urlrenderer Nothing $ tryNonAsync $ do
|
fsckresults <- showFscking urlrenderer Nothing $ tryNonAsync $ do
|
||||||
void $ batchCommand program (Param "fsck" : annexFsckParams d)
|
void $ batchCommand program (Param "fsck" : annexFsckParams d)
|
||||||
|
@ -196,7 +196,7 @@ runActivity' urlrenderer (ScheduledRemoteFsck u s d) = dispatch =<< liftAnnex (r
|
||||||
dispatch Nothing = debug ["skipping remote fsck of uuid without a configured remote", fromUUID u, fromSchedule s]
|
dispatch Nothing = debug ["skipping remote fsck of uuid without a configured remote", fromUUID u, fromSchedule s]
|
||||||
dispatch (Just rmt) = void $ case Remote.remoteFsck rmt of
|
dispatch (Just rmt) = void $ case Remote.remoteFsck rmt of
|
||||||
Nothing -> go rmt $ do
|
Nothing -> go rmt $ do
|
||||||
program <- readProgramFile
|
program <- programPath
|
||||||
void $ batchCommand program $
|
void $ batchCommand program $
|
||||||
[ Param "fsck"
|
[ Param "fsck"
|
||||||
-- avoid downloading files
|
-- avoid downloading files
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Assistant.Threads.RemoteControl where
|
||||||
|
|
||||||
import Assistant.Common
|
import Assistant.Common
|
||||||
import RemoteDaemon.Types
|
import RemoteDaemon.Types
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Utility.Batch
|
import Utility.Batch
|
||||||
import Utility.SimpleProtocol
|
import Utility.SimpleProtocol
|
||||||
import Assistant.Alert
|
import Assistant.Alert
|
||||||
|
@ -28,7 +28,7 @@ import qualified Data.Set as S
|
||||||
|
|
||||||
remoteControlThread :: NamedThread
|
remoteControlThread :: NamedThread
|
||||||
remoteControlThread = namedThread "RemoteControl" $ do
|
remoteControlThread = namedThread "RemoteControl" $ do
|
||||||
program <- liftIO readProgramFile
|
program <- liftIO programPath
|
||||||
(cmd, params) <- liftIO $ toBatchCommand
|
(cmd, params) <- liftIO $ toBatchCommand
|
||||||
(program, [Param "remotedaemon"])
|
(program, [Param "remotedaemon"])
|
||||||
let p = proc cmd (toCommand params)
|
let p = proc cmd (toCommand params)
|
||||||
|
|
|
@ -39,7 +39,7 @@ import Git.Index
|
||||||
import Assistant.Unused
|
import Assistant.Unused
|
||||||
import Logs.Unused
|
import Logs.Unused
|
||||||
import Logs.Transfer
|
import Logs.Transfer
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Types.Key (keyBackendName)
|
import Types.Key (keyBackendName)
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
#ifdef WITH_WEBAPP
|
#ifdef WITH_WEBAPP
|
||||||
|
@ -182,7 +182,7 @@ dailyCheck urlrenderer = do
|
||||||
{- Run git-annex unused once per day. This is run as a separate
|
{- Run git-annex unused once per day. This is run as a separate
|
||||||
- process to stay out of the annex monad and so it can run as a
|
- process to stay out of the annex monad and so it can run as a
|
||||||
- batch job. -}
|
- batch job. -}
|
||||||
program <- liftIO readProgramFile
|
program <- liftIO programPath
|
||||||
let (program', params') = batchmaker (program, [Param "unused"])
|
let (program', params') = batchmaker (program, [Param "unused"])
|
||||||
void $ liftIO $ boolSystem program' params'
|
void $ liftIO $ boolSystem program' params'
|
||||||
{- Invalidate unused keys cache, and queue transfers of all unused
|
{- Invalidate unused keys cache, and queue transfers of all unused
|
||||||
|
|
|
@ -11,13 +11,13 @@ import Assistant.Common
|
||||||
import Assistant.TransferQueue
|
import Assistant.TransferQueue
|
||||||
import Assistant.TransferSlots
|
import Assistant.TransferSlots
|
||||||
import Logs.Transfer
|
import Logs.Transfer
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Utility.Batch
|
import Utility.Batch
|
||||||
|
|
||||||
{- Dispatches transfers from the queue. -}
|
{- Dispatches transfers from the queue. -}
|
||||||
transfererThread :: NamedThread
|
transfererThread :: NamedThread
|
||||||
transfererThread = namedThread "Transferrer" $ do
|
transfererThread = namedThread "Transferrer" $ do
|
||||||
program <- liftIO readProgramFile
|
program <- liftIO programPath
|
||||||
batchmaker <- liftIO getBatchCommandMaker
|
batchmaker <- liftIO getBatchCommandMaker
|
||||||
forever $ inTransferSlot program batchmaker $
|
forever $ inTransferSlot program batchmaker $
|
||||||
maybe (return Nothing) (uncurry genTransfer)
|
maybe (return Nothing) (uncurry genTransfer)
|
||||||
|
|
|
@ -28,7 +28,7 @@ import qualified Remote
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
import Annex.Content
|
import Annex.Content
|
||||||
import Annex.Wanted
|
import Annex.Wanted
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Utility.Batch
|
import Utility.Batch
|
||||||
|
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
@ -284,7 +284,7 @@ startTransfer t = do
|
||||||
alterTransferInfo t $ \i -> i { transferPaused = False }
|
alterTransferInfo t $ \i -> i { transferPaused = False }
|
||||||
liftIO $ throwTo tid ResumeTransfer
|
liftIO $ throwTo tid ResumeTransfer
|
||||||
start info = do
|
start info = do
|
||||||
program <- liftIO readProgramFile
|
program <- liftIO programPath
|
||||||
batchmaker <- liftIO getBatchCommandMaker
|
batchmaker <- liftIO getBatchCommandMaker
|
||||||
inImmediateTransferSlot program batchmaker $
|
inImmediateTransferSlot program batchmaker $
|
||||||
genTransfer t info
|
genTransfer t info
|
||||||
|
|
|
@ -28,7 +28,7 @@ import Logs.UUID
|
||||||
import Assistant.RemoteControl
|
import Assistant.RemoteControl
|
||||||
import Types.Creds
|
import Types.Creds
|
||||||
import Assistant.CredPairCache
|
import Assistant.CredPairCache
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Utility.Tmp
|
import Utility.Tmp
|
||||||
import Utility.FileMode
|
import Utility.FileMode
|
||||||
import Utility.ThreadScheduler
|
import Utility.ThreadScheduler
|
||||||
|
@ -381,7 +381,7 @@ sshAuthTranscript sshinput opts input = case inputAuthMethod sshinput of
|
||||||
Just (fromMaybe "" input)
|
Just (fromMaybe "" input)
|
||||||
|
|
||||||
setupAskPass = do
|
setupAskPass = do
|
||||||
program <- liftIO readProgramFile
|
program <- liftIO programPath
|
||||||
v <- getCachedCred login
|
v <- getCachedCred login
|
||||||
liftIO $ case v of
|
liftIO $ case v of
|
||||||
Nothing -> go [passwordprompts 0] Nothing
|
Nothing -> go [passwordprompts 0] Nothing
|
||||||
|
|
|
@ -20,6 +20,7 @@ import Assistant.MakeRemote
|
||||||
import Assistant.Sync
|
import Assistant.Sync
|
||||||
import qualified Command.Sync
|
import qualified Command.Sync
|
||||||
import qualified Annex.Branch
|
import qualified Annex.Branch
|
||||||
|
import Annex.Path
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
import Logs.UUID
|
import Logs.UUID
|
||||||
import Annex.TaggedPush
|
import Annex.TaggedPush
|
||||||
|
@ -27,7 +28,6 @@ import Annex.CatFile
|
||||||
import Config
|
import Config
|
||||||
import Git
|
import Git
|
||||||
import qualified Git.Branch
|
import qualified Git.Branch
|
||||||
import Config.Files
|
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
import qualified Remote as Remote
|
import qualified Remote as Remote
|
||||||
import Remote.List
|
import Remote.List
|
||||||
|
@ -173,7 +173,7 @@ xmppPush cid gitpush = do
|
||||||
installwrapper tmpdir = liftIO $ do
|
installwrapper tmpdir = liftIO $ do
|
||||||
createDirectoryIfMissing True tmpdir
|
createDirectoryIfMissing True tmpdir
|
||||||
let wrapper = tmpdir </> "git-remote-xmpp"
|
let wrapper = tmpdir </> "git-remote-xmpp"
|
||||||
program <- readProgramFile
|
program <- programPath
|
||||||
writeFile wrapper $ unlines
|
writeFile wrapper $ unlines
|
||||||
[ shebang_local
|
[ shebang_local
|
||||||
, "exec " ++ program ++ " xmppgit"
|
, "exec " ++ program ++ " xmppgit"
|
||||||
|
|
|
@ -11,6 +11,7 @@ import Common.Annex
|
||||||
import Command
|
import Command
|
||||||
import qualified Command.Watch
|
import qualified Command.Watch
|
||||||
import Annex.Init
|
import Annex.Init
|
||||||
|
import Annex.Path
|
||||||
import Config.Files
|
import Config.Files
|
||||||
import qualified Build.SysConfig
|
import qualified Build.SysConfig
|
||||||
import Utility.HumanTime
|
import Utility.HumanTime
|
||||||
|
@ -69,7 +70,7 @@ autoStart startdelay = do
|
||||||
when (null dirs) $ do
|
when (null dirs) $ do
|
||||||
f <- autoStartFile
|
f <- autoStartFile
|
||||||
error $ "Nothing listed in " ++ f
|
error $ "Nothing listed in " ++ f
|
||||||
program <- readProgramFile
|
program <- programPath
|
||||||
haveionice <- pure Build.SysConfig.ionice <&&> inPath "ionice"
|
haveionice <- pure Build.SysConfig.ionice <&&> inPath "ionice"
|
||||||
forM_ dirs $ \d -> do
|
forM_ dirs $ \d -> do
|
||||||
putStrLn $ "git-annex autostart in " ++ d
|
putStrLn $ "git-annex autostart in " ++ d
|
||||||
|
|
|
@ -49,7 +49,7 @@ import Remote.Helper.Git
|
||||||
import Remote.Helper.Messages
|
import Remote.Helper.Messages
|
||||||
import qualified Remote.Helper.Ssh as Ssh
|
import qualified Remote.Helper.Ssh as Ssh
|
||||||
import qualified Remote.GCrypt
|
import qualified Remote.GCrypt
|
||||||
import Config.Files
|
import Annex.Path
|
||||||
import Creds
|
import Creds
|
||||||
import Annex.CatFile
|
import Annex.CatFile
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ fsckOnRemote r params
|
||||||
Nothing -> return False
|
Nothing -> return False
|
||||||
Just (c, ps) -> batchCommand c ps
|
Just (c, ps) -> batchCommand c ps
|
||||||
| otherwise = return $ do
|
| otherwise = return $ do
|
||||||
program <- readProgramFile
|
program <- programPath
|
||||||
r' <- Git.Config.read r
|
r' <- Git.Config.read r
|
||||||
environ <- getEnvironment
|
environ <- getEnvironment
|
||||||
let environ' = addEntries
|
let environ' = addEntries
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -19,6 +19,8 @@ git-annex (5.2015022) UNRELEASED; urgency=medium
|
||||||
git-annex:git-annex push, as long as the remote branch
|
git-annex:git-annex push, as long as the remote branch
|
||||||
is an ancestor of the local branch, to better support bare git repos.
|
is an ancestor of the local branch, to better support bare git repos.
|
||||||
(This used to be done, but it forgot to do it since version 4.20130909.)
|
(This used to be done, but it forgot to do it since version 4.20130909.)
|
||||||
|
* When re-execing git-annex, use current program location, rather than
|
||||||
|
~/.config/git-annex/program, when possible.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 19 Feb 2015 14:16:03 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 19 Feb 2015 14:16:03 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue