From 6b3d0cb11a52ab36ce4b53b16bed2b86d77d2ae0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 30 Dec 2014 13:07:06 -0400 Subject: [PATCH] bittorrent: Fix locking problem when using addurl file:// Fixes: /home/joey/tmp/xxx/.git/annex/misctmp/torrent18347: openFile: resource busy (file is locked) --- Remote/BitTorrent.hs | 3 ++- debian/changelog | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Remote/BitTorrent.hs b/Remote/BitTorrent.hs index 4e4b954460..d0a35fa307 100644 --- a/Remote/BitTorrent.hs +++ b/Remote/BitTorrent.hs @@ -200,7 +200,8 @@ downloadTorrentFile u = do return ok else do misctmp <- fromRepo gitAnnexTmpMiscDir - withTmpFileIn misctmp "torrent" $ \f _h -> do + withTmpFileIn misctmp "torrent" $ \f h -> do + liftIO $ hClose h ok <- Url.withUrlOptions $ Url.download u f when ok $ liftIO $ renameFile f torrent diff --git a/debian/changelog b/debian/changelog index cead4170fe..e3bf961c24 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ git-annex (5.20141220) UNRELEASED; urgency=medium * Run shutdown cleanup actions even if there were failures processing the command. Amoung other fixes, this means that addurl will stage added files even if adding one of the urls fails. + * bittorrent: Fix locking problem when using addurl file:// -- Joey Hess Mon, 22 Dec 2014 15:16:38 -0400