get, copy, move: Display an error message when an identical transfer is already in progress, rather than failing with no indication why.
This commit is contained in:
parent
bb284cd980
commit
e9048ecec8
4 changed files with 25 additions and 10 deletions
|
@ -113,20 +113,25 @@ runTransfer t file shouldretry a = do
|
||||||
info <- liftIO $ startTransferInfo file
|
info <- liftIO $ startTransferInfo file
|
||||||
(meter, tfile, metervar) <- mkProgressUpdater t info
|
(meter, tfile, metervar) <- mkProgressUpdater t info
|
||||||
mode <- annexFileMode
|
mode <- annexFileMode
|
||||||
|
fd <- liftIO $ prep tfile mode info
|
||||||
ok <- retry info metervar $
|
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
|
unless ok $ recordFailedTransfer t info
|
||||||
return ok
|
return ok
|
||||||
where
|
where
|
||||||
prep tfile mode info = catchMaybeIO $ do
|
prep tfile mode info = do
|
||||||
fd <- openFd (transferLockFile tfile) ReadWrite (Just mode)
|
mfd <- catchMaybeIO $
|
||||||
defaultFileFlags { trunc = True }
|
openFd (transferLockFile tfile) ReadWrite (Just mode)
|
||||||
locked <- catchMaybeIO $
|
defaultFileFlags { trunc = True }
|
||||||
setLock fd (WriteLock, AbsoluteSeek, 0, 0)
|
case mfd of
|
||||||
when (locked == Nothing) $
|
Nothing -> return mfd
|
||||||
error $ "transfer already in progress"
|
Just fd -> do
|
||||||
writeTransferInfoFile info tfile
|
locked <- catchMaybeIO $
|
||||||
return fd
|
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 _ Nothing = noop
|
||||||
cleanup tfile (Just fd) = do
|
cleanup tfile (Just fd) = do
|
||||||
void $ tryIO $ removeFile tfile
|
void $ tryIO $ removeFile tfile
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -26,6 +26,8 @@ git-annex (4.20130315) UNRELEASED; urgency=low
|
||||||
* webapp: Force wrap long filenames in transfer display.
|
* webapp: Force wrap long filenames in transfer display.
|
||||||
* assistant: The ConfigMonitor left one zombie behind each time
|
* assistant: The ConfigMonitor left one zombie behind each time
|
||||||
it checked for changes, now fixed.
|
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
|
-- Joey Hess <joeyh@debian.org> Fri, 15 Mar 2013 00:10:07 -0400
|
||||||
|
|
||||||
|
|
|
@ -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.
|
How do I fix things so that I can copy again? Nothing that I tried had any effect on the problem.
|
||||||
|
|
||||||
Thanks!
|
Thanks!
|
||||||
|
|
||||||
|
> Thanks to Jim's smart correlation of this with another bug, I've fixed
|
||||||
|
> them both. [[done]] --[[Joey]]
|
||||||
|
|
|
@ -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
|
upgrade supported from repository versions: 0 1 2
|
||||||
|
|
||||||
How should I debug this?
|
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]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue