From ded4ab5704371dc7452c58fe11b3151d5cd2b68d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Feb 2014 13:06:39 -0400 Subject: [PATCH] Fix handling of rsync remote urls containing a username, including rsync.net. This breakage seems to have been caused way back in a1eded86, but I am pretty sure rsync.net support has not been entirely broken since last April. AFAICS, the generated .ssh/config has not changed since then -- it has never included a Username setting line. So, I am puzzled at when this reversion was introduced. Note that the breakage only affected checkpresent and remove. Upload and download use the ssh connection caching, which includes a -l username. --- Remote/Rsync.hs | 18 +++++++++--------- debian/changelog | 7 +++++++ ...sync_transport:_username_not_respected.mdwn | 5 +++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 570725bcfe..a905d1be31 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -112,26 +112,26 @@ genRsyncOpts c gc transport url = RsyncOpts | otherwise = True rsyncTransport :: RemoteGitConfig -> RsyncUrl -> Annex ([CommandParam], RsyncUrl) -rsyncTransport gc rawurl - | rsyncUrlIsShell rawurl = - (\rsh -> return (rsyncShell rsh, resturl)) =<< +rsyncTransport gc url + | rsyncUrlIsShell url = + (\rsh -> return (rsyncShell rsh, url)) =<< case fromNull ["ssh"] (remoteAnnexRsyncTransport gc) of "ssh":sshopts -> do let (port, sshopts') = sshReadPort sshopts - host = takeWhile (/=':') resturl + userhost = takeWhile (/=':') url -- Connection caching (Param "ssh":) <$> sshCachingOptions - (host, port) + (userhost, port) (map Param $ loginopt ++ sshopts') "rsh":rshopts -> return $ map Param $ "rsh" : loginopt ++ rshopts rsh -> error $ "Unknown Rsync transport: " ++ unwords rsh - | otherwise = return ([], rawurl) + | otherwise = return ([], url) where - (login,resturl) = case separate (=='@') rawurl of - (h, "") -> (Nothing, h) - (l, h) -> (Just l, h) + login = case separate (=='@') url of + (_h, "") -> Nothing + (l, _) -> Just l loginopt = maybe [] (\l -> ["-l",l]) login fromNull as xs = if null xs then as else xs diff --git a/debian/changelog b/debian/changelog index 085f9347d2..d39e4fbd17 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +git-annex (5.20140222) UNRELEASED; urgency=medium + + * Fix handling of rsync remote urls containing a username, + including rsync.net. + + -- Joey Hess Fri, 21 Feb 2014 13:03:04 -0400 + git-annex (5.20140221) unstable; urgency=medium * metadata: New command that can attach metadata to files. diff --git a/doc/bugs/rsync_transport:_username_not_respected.mdwn b/doc/bugs/rsync_transport:_username_not_respected.mdwn index f4db3b70ca..467e676438 100644 --- a/doc/bugs/rsync_transport:_username_not_respected.mdwn +++ b/doc/bugs/rsync_transport:_username_not_respected.mdwn @@ -36,3 +36,8 @@ Type: prebuilt # End of transcript or log. """]] + +> Argh! How did that break? I know it used to work. +> I have fixed it, unfortunately the fix was too late for today's release, +> but it will be available in autobuilds shortly. +> [[fixed|done]] --[[Joey]]