summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/Ssh.hs19
-rw-r--r--Remote/Git.hs10
-rw-r--r--Remote/Rsync.hs9
-rw-r--r--Utility/Process.hs14
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/Calls_to_rsync_don__39__t_always_use__annex-rsync-options.mdwn3
6 files changed, 39 insertions, 18 deletions
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 294270e43..2dd73a8a0 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -99,17 +99,14 @@ sshCleanup = do
stopssh socketfile = do
let (host, port) = socket2hostport socketfile
(_, params) <- sshInfo (host, port)
- void $ liftIO $ do
- -- "ssh -O stop" is noisy on stderr even with -q
- let cmd = unwords $ toCommand $
- [ Params "-O stop"
- ] ++ params ++ [Param host]
- boolSystem "sh"
- [ Param "-c"
- , Param $ "ssh " ++ cmd ++ " >/dev/null 2>/dev/null"
- ]
- -- Cannot remove the lock file; other processes may
- -- be waiting on our exclusive lock to use it.
+ -- "ssh -O stop" is noisy on stderr even with -q
+ void $ liftIO $ catchMaybeIO $
+ withQuietOutput createProcessSuccess $
+ proc "ssh" $ toCommand $
+ [ Params "-O stop"
+ ] ++ params ++ [Param host]
+ -- Cannot remove the lock file; other processes may
+ -- be waiting on our exclusive lock to use it.
hostport2socket :: String -> Maybe Integer -> FilePath
hostport2socket host Nothing = host
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 860a53e18..334c8144a 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -429,10 +429,12 @@ commitOnCleanup r a = go `after` a
| otherwise = void $ do
Just (shellcmd, shellparams) <-
git_annex_shell r "commit" [] []
+
-- Throw away stderr, since the remote may not
-- have a new enough git-annex shell to
-- support committing.
- let cmd = shellcmd ++ " "
- ++ unwords (map shellEscape $ toCommand shellparams)
- ++ ">/dev/null 2>/dev/null"
- liftIO $ boolSystem "sh" [Param "-c", Param cmd]
+ liftIO $ catchMaybeIO $ do
+ print "!!!!!!!!!!!!!"
+ withQuietOutput createProcessSuccess $
+ proc shellcmd $
+ toCommand shellparams
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index c3ef94a71..d89699270 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -166,9 +166,12 @@ checkPresent r o k = do
-- to connect, and the file not being present.
Right <$> check
where
- check = untilTrue (rsyncUrls o k) $ \u ->
- liftIO $ boolSystem "sh" [Param "-c", Param (cmd u)]
- cmd u = "rsync --quiet " ++ shellEscape u ++ " 2>/dev/null"
+ check = untilTrue (rsyncUrls o k) $ \u ->
+ liftIO $ catchBoolIO $ do
+ withQuietOutput createProcessSuccess $
+ proc "rsync" $ toCommand $
+ rsyncOptions o ++ [Param u]
+ return True
{- Rsync params to enable resumes of sending files safely,
- ensure that files are only moved into place once complete
diff --git a/Utility/Process.hs b/Utility/Process.hs
index 613dd8b0f..0ef043424 100644
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -23,6 +23,7 @@ module Utility.Process (
createBackgroundProcess,
withHandle,
withBothHandles,
+ withQuietOutput,
createProcess,
runInteractiveProcess,
stdinHandle,
@@ -185,6 +186,19 @@ withBothHandles creator p a = creator p' $ a . bothHandles
, std_err = Inherit
}
+{- Forces the CreateProcessRunner to run quietly;
+ - both stdout and stderr are discarded. -}
+withQuietOutput
+ :: CreateProcessRunner
+ -> CreateProcess
+ -> IO ()
+withQuietOutput creator p = withFile "/dev/null" WriteMode $ \devnull -> do
+ let p' = p
+ { std_out = UseHandle devnull
+ , std_err = UseHandle devnull
+ }
+ creator p' $ const $ return ()
+
{- Extract a desired handle from createProcess's tuple.
- These partial functions are safe as long as createProcess is run
- with appropriate parameters to set up the desired handle.
diff --git a/debian/changelog b/debian/changelog
index b65d12e6a..7acdb38ee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,8 @@ git-annex (3.20121018) UNRELEASED; urgency=low
which doesn't work with LDAP or NIS.
* assistant: Can use XMPP to notify other nodes that cannot be directly
pushed to about pushes.
+ * rsync special remote: Include annex-rsync-options when running rsync
+ to test a key's presence.
-- Joey Hess <joeyh@debian.org> Wed, 17 Oct 2012 14:24:10 -0400
diff --git a/doc/bugs/Calls_to_rsync_don__39__t_always_use__annex-rsync-options.mdwn b/doc/bugs/Calls_to_rsync_don__39__t_always_use__annex-rsync-options.mdwn
index b70415bb6..df1163b46 100644
--- a/doc/bugs/Calls_to_rsync_don__39__t_always_use__annex-rsync-options.mdwn
+++ b/doc/bugs/Calls_to_rsync_don__39__t_always_use__annex-rsync-options.mdwn
@@ -30,3 +30,6 @@ OS: Ubuntu 12.04
Please provide any additional information below.
I think this fix is as easy as including the annex-rsync-options wherever rsync is called.
+
+> I belive there was only the one place this was neglected. [[done]]
+> --[[Joey]]