From 2a9077f4e92b588200eafcda4d485e95998917a2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Aug 2012 13:27:50 -0400 Subject: fix transfer log cleanup crash Avoid crashing when "git annex get" fails to download from one location, and falls back to downloading from a second location. The problem is that git annex get calls download recursively from within itself if the first download attempt fails. So the first time through, it writes a transfer info file, which is then overwritten on the second, recursive call. Then on cleanup, it tries to delete the file twice, which of course doesn't work. Fixed both by not crashing if the transfer file is removed, and by changing Get to not run download recursively like that. It's the only thing that did so, and it just seems like a bad idea. --- Logs/Transfer.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Logs') diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs index b6962262d..e7f35ccb7 100644 --- a/Logs/Transfer.hs +++ b/Logs/Transfer.hs @@ -98,8 +98,8 @@ transfer t file a = do writeFile tfile $ writeTransferInfo info return fd cleanup tfile fd = do - removeFile tfile - removeFile $ transferLockFile tfile + void $ tryIO $ removeFile tfile + void $ tryIO $ removeFile $ transferLockFile tfile closeFd fd {- If a transfer is still running, returns its TransferInfo. -} -- cgit v1.2.3