From 506452012c9acaa95589b8f7119c0013c9cdeb40 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 30 Jul 2015 13:29:45 -0400 Subject: [PATCH] Fix rsync special remote to work when -Jn is used for concurrent uploads. --- Remote/Rsync.hs | 11 ++--------- debian/changelog | 2 ++ doc/bugs/rsync_remote_with_-J2_fails.mdwn | 2 ++ ...ment_1_793bbc86b495dda0328c35cb5abe4fad._comment | 13 +++++++++++++ 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 doc/bugs/rsync_remote_with_-J2_fails/comment_1_793bbc86b495dda0328c35cb5abe4fad._comment diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 3986863b3c..b9cdc458e2 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -39,6 +39,7 @@ import Logs.Transfer import Types.Creds import Types.Key (isChunkKey) import Annex.DirHashes +import Utility.Tmp import qualified Data.Map as M @@ -252,16 +253,8 @@ sendParams = ifM crippledFileSystem - up trees for rsync. -} withRsyncScratchDir :: (FilePath -> Annex a) -> Annex a withRsyncScratchDir a = do - p <- liftIO getPID t <- fromRepo gitAnnexTmpObjectDir - createAnnexDirectory t - let tmp = t "rsynctmp" show p - nuke tmp - liftIO $ createDirectoryIfMissing True tmp - nuke tmp `after` a tmp - where - nuke d = liftIO $ whenM (doesDirectoryExist d) $ - removeDirectoryRecursive d + withTmpDirIn t "rsynctmp" a rsyncRetrieve :: RsyncOpts -> Key -> FilePath -> Maybe MeterUpdate -> Annex Bool rsyncRetrieve o k dest meterupdate = diff --git a/debian/changelog b/debian/changelog index 7ca0944d63..d6cf550232 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ git-annex (5.20150728) UNRELEASED; urgency=medium * webapp: Support enabling known gitlab.com remotes. + * Fix rsync special remote to work when -Jn is used for concurrent + uploads. -- Joey Hess Mon, 27 Jul 2015 15:57:07 -0400 diff --git a/doc/bugs/rsync_remote_with_-J2_fails.mdwn b/doc/bugs/rsync_remote_with_-J2_fails.mdwn index 93b317694c..766f671d7d 100644 --- a/doc/bugs/rsync_remote_with_-J2_fails.mdwn +++ b/doc/bugs/rsync_remote_with_-J2_fails.mdwn @@ -53,3 +53,5 @@ Repo config: annex-uuid = f05581cc-7236-41ed-9db8-49424f863307 """]] + +> [[fixed|done]] --[[Joey]] diff --git a/doc/bugs/rsync_remote_with_-J2_fails/comment_1_793bbc86b495dda0328c35cb5abe4fad._comment b/doc/bugs/rsync_remote_with_-J2_fails/comment_1_793bbc86b495dda0328c35cb5abe4fad._comment new file mode 100644 index 0000000000..eeb4b34af8 --- /dev/null +++ b/doc/bugs/rsync_remote_with_-J2_fails/comment_1_793bbc86b495dda0328c35cb5abe4fad._comment @@ -0,0 +1,13 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2015-07-30T17:18:24Z" + content=""" +The -J1 is a red herring; there's no progress output for -J modes, so the +whole transfer runs quietly there. + +The -J2 failure is because the rsync special remote implementation uses a +local scratch directory which is supposed to be empty. But, since it uses +the pid of the process to create the directory name, concurrently transfers +will use the same scratch directory and so interfere with one-another. +"""]]