summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-19 13:56:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-19 13:56:20 -0400
commit639008307a2a299bd8c2ee5b1a12b576646bc0f0 (patch)
treeaf92db1e3fbb7dd6d96d06d4034100a29071363e
parent09e65da8e2b4e3b81a1d1772a9d490fcda22a7a6 (diff)
get, copy, move: Display an error message when an identical transfer is already in progress, rather than failing with no indication why.
-rw-r--r--Logs/Transfer.hs25
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/Cannot_copy_to_a_git-annex_remote.mdwn3
-rw-r--r--doc/bugs/get_failed__44___but_remote_has_the_file.mdwn5
4 files changed, 25 insertions, 10 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs
index c6f240be0..e73933172 100644
--- a/Logs/Transfer.hs
+++ b/Logs/Transfer.hs
@@ -113,20 +113,25 @@ runTransfer t file shouldretry a = do
info <- liftIO $ startTransferInfo file
(meter, tfile, metervar) <- mkProgressUpdater t info
mode <- annexFileMode
+ fd <- liftIO $ prep tfile mode info
ok <- retry info metervar $
- bracketIO (prep tfile mode info) (cleanup tfile) (a meter)
+ bracketIO (return fd) (cleanup tfile) (a meter)
unless ok $ recordFailedTransfer t info
return ok
where
- prep tfile mode info = catchMaybeIO $ do
- fd <- openFd (transferLockFile tfile) ReadWrite (Just mode)
- defaultFileFlags { trunc = True }
- locked <- catchMaybeIO $
- setLock fd (WriteLock, AbsoluteSeek, 0, 0)
- when (locked == Nothing) $
- error $ "transfer already in progress"
- writeTransferInfoFile info tfile
- return fd
+ prep tfile mode info = do
+ mfd <- catchMaybeIO $
+ openFd (transferLockFile tfile) ReadWrite (Just mode)
+ defaultFileFlags { trunc = True }
+ case mfd of
+ Nothing -> return mfd
+ Just fd -> do
+ locked <- catchMaybeIO $
+ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
+ when (locked == Nothing) $
+ error $ "transfer already in progress"
+ void $ tryIO $ writeTransferInfoFile info tfile
+ return mfd
cleanup _ Nothing = noop
cleanup tfile (Just fd) = do
void $ tryIO $ removeFile tfile
diff --git a/debian/changelog b/debian/changelog
index 8fa002604..9bd45da81 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ git-annex (4.20130315) UNRELEASED; urgency=low
* webapp: Force wrap long filenames in transfer display.
* assistant: The ConfigMonitor left one zombie behind each time
it checked for changes, now fixed.
+ * get, copy, move: Display an error message when an identical transfer
+ is already in progress, rather than failing with no indication why.
-- Joey Hess <joeyh@debian.org> Fri, 15 Mar 2013 00:10:07 -0400
diff --git a/doc/bugs/Cannot_copy_to_a_git-annex_remote.mdwn b/doc/bugs/Cannot_copy_to_a_git-annex_remote.mdwn
index cb05338cb..c9e0309b8 100644
--- a/doc/bugs/Cannot_copy_to_a_git-annex_remote.mdwn
+++ b/doc/bugs/Cannot_copy_to_a_git-annex_remote.mdwn
@@ -9,3 +9,6 @@ I do "git copy --to storage FILE" and it says "Copying FILE... failed". That's
How do I fix things so that I can copy again? Nothing that I tried had any effect on the problem.
Thanks!
+
+> Thanks to Jim's smart correlation of this with another bug, I've fixed
+> them both. [[done]] --[[Joey]]
diff --git a/doc/bugs/get_failed__44___but_remote_has_the_file.mdwn b/doc/bugs/get_failed__44___but_remote_has_the_file.mdwn
index 7f0b8612b..254e3d820 100644
--- a/doc/bugs/get_failed__44___but_remote_has_the_file.mdwn
+++ b/doc/bugs/get_failed__44___but_remote_has_the_file.mdwn
@@ -33,3 +33,8 @@ Same `git annex version` on both `pilot` and `bucket`, and I ran `git annex sync
upgrade supported from repository versions: 0 1 2
How should I debug this?
+
+> [[done]], in c6fbed48 I had made some changes to allow transfers
+> to work from readonly filesystems, but a too broad error trapping
+> hid the "transfer already in progress" error it is supposed to display
+> in this case. --[[Joey]]