diff options
author | Joey Hess <joey@kitenet.net> | 2011-07-29 15:28:21 +0200 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-07-29 15:28:21 +0200 |
commit | 45bbf210a1210172c7c7b87879ed74f7c8ccbdba (patch) | |
tree | 98552c21795608b165f26108bc7dd05513c86b07 /Remote | |
parent | 50edbb03eb0582dd568a6fb83fcdb410828c1ea1 (diff) |
Fix shell escaping in rsync special remote.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Rsync.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index f073e7bd7..953537609 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -93,10 +93,13 @@ rsyncSetup u c = do return c' rsyncKey :: RsyncOpts -> Key -> String -rsyncKey o k = rsyncUrl o </> hashDirMixed k </> f </> f +rsyncKey o k = rsyncUrl o </> hashDirMixed k </> shellEscape (f </> f) where f = keyFile k +rsyncKeyDir :: RsyncOpts -> Key -> String +rsyncKeyDir o k = rsyncUrl o </> hashDirMixed k </> shellEscape (keyFile k) + store :: RsyncOpts -> Key -> Annex Bool store o k = do g <- Annex.gitRepo @@ -136,7 +139,7 @@ remove o k = withRsyncScratchDir $ \tmp -> do [ Params "--delete --recursive" , partialParams , Param $ addTrailingPathSeparator dummy - , Param $ parentDir $ rsyncKey o k + , Param $ rsyncKeyDir o k ] checkPresent :: Git.Repo -> RsyncOpts -> Key -> Annex (Either IOException Bool) @@ -147,8 +150,7 @@ checkPresent r o k = do res <- liftIO $ boolSystem "sh" [Param "-c", Param cmd] return $ Right res where - cmd = "rsync --quiet " ++ testfile ++ " 2>/dev/null" - testfile = shellEscape $ rsyncKey o k + cmd = "rsync --quiet " ++ shellEscape (rsyncKey o k) ++ " 2>/dev/null" {- Rsync params to enable resumes of sending files safely, - ensure that files are only moved into place once complete |