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.
This commit is contained in:
Joey Hess 2014-02-21 13:06:39 -04:00
parent 764090d58f
commit ded4ab5704
3 changed files with 21 additions and 9 deletions

View file

@ -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

7
debian/changelog vendored
View file

@ -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 <joeyh@debian.org> Fri, 21 Feb 2014 13:03:04 -0400
git-annex (5.20140221) unstable; urgency=medium
* metadata: New command that can attach metadata to files.

View file

@ -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]]