diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,13 @@
+Darcs 2.8.5, 25 August 2014
+  * GHC 7.8 support
+  * Resolve issue2364: Download problems with GHC 7.8
+  * Bump some dependencies: base, network, unix, process, array, mtl, text
+  * Support matching on short patch hash
+  * Resolve issue2345: Fix bug where configure script reported missing libiconv rather than libcurl
+  * Darcs API: Rename iconv functions imported from haskeline to avoid name clash
+
+
+Darcs 2.8.4, 7 February 2013
   * GHC 7.6 support
   * Bump some dependencies: base, network, unix, containers, bytestring, tar
   * Resolved issue2199: get --tag can include extra patches
diff --git a/Setup.lhs b/Setup.lhs
--- a/Setup.lhs
+++ b/Setup.lhs
@@ -10,6 +10,8 @@
 import qualified Distribution.InstalledPackageInfo as Installed
 import Distribution.Simple
          ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )
+import Distribution.Simple.Configure
+         ( checkForeignDeps )
 import Distribution.ModuleName( toFilePath )
 import Distribution.PackageDescription
          ( PackageDescription(executables), Executable(buildInfo, exeName)
@@ -143,12 +145,18 @@
         \genericDescript flags -> do
           lbi <- confHook simpleUserHooks genericDescript flags
           let pkgDescr = localPkgDescr lbi
+          let verb = fromFlag (configVerbosity flags)
+          checkForeignDeps pkgDescr lbi verb
           let Just lib = library pkgDescr
           let bi = libBuildInfo lib
           bi' <- maybeSetLibiconv flags bi lbi
           return lbi {localPkgDescr = pkgDescr {
                                   library = Just lib {
                                       libBuildInfo = bi'}}}
+              ,
+  postConf = \_ _ _ _ -> return () --- Usually this checked for external C
+             --- dependencies, but we already have performed such
+             --- check in the confHook
 }
 
 -- | For @./Setup build@ and @./Setup haddock@, do some unusual
diff --git a/darcs.cabal b/darcs.cabal
--- a/darcs.cabal
+++ b/darcs.cabal
@@ -1,5 +1,5 @@
 Name:           darcs
-version:        2.8.4
+version:        2.8.5
 License:        GPL
 License-file:   COPYING
 Author:         David Roundy <droundy@darcs.net>, <darcs-devel@darcs.net>
@@ -79,6 +79,10 @@
 flag http
   description: Use the pure Haskell HTTP package for HTTP support.
 
+flag network-uri
+  description: Get Network.URI from the network-uri package
+  default: True
+
 flag static
   description: Build static binary
   default:     False
@@ -147,7 +151,7 @@
   else
     buildable: True
 
-    build-tools: ghc >= 6.10 && < 7.8
+    build-tools: ghc >= 6.10 && < 7.10
 
     hs-source-dirs:   src
     include-dirs:     src
@@ -369,17 +373,17 @@
       cc-options:     -DHAVE_SIGINFO_H
 
     if os(windows)
-      build-depends:  base >= 4 && < 4.7
+      build-depends:  base >= 4 && < 4.8
     else
       if flag(force-char8-encoding)
-        build-depends:  base >= 4.5 && < 4.7
+        build-depends:  base >= 4.5 && < 4.8
         cpp-options:    -DFORCE_CHAR8_ENCODING
       else
         build-depends:  base >= 4 && < 4.4
 
     build-depends:   extensible-exceptions >= 0.1 && < 0.2,
                      regex-compat >= 0.95.1,
-                     mtl          >= 1.0 && < 2.2,
+                     mtl          >= 1.0 && < 2.3,
                      parsec       >= 2.0 && < 3.2,
                      html         == 1.0.*,
                      filepath     >= 1.1.0.0 && < 1.5.0.0,
@@ -393,15 +397,15 @@
       build-depends: haskeline <= 0.6.4.6
 
     if !os(windows)
-      build-depends: unix >= 1.0 && < 2.7
+      build-depends: unix >= 1.0 && < 2.8
 
     build-depends: bytestring >= 0.9.0 && < 0.11,
-                   text       >= 0.11.0.6 && < 0.12.0.0,
+                   text       >= 0.11.0.6 && < 1.2,
                    old-time   >= 1.0 && < 1.2,
                    directory  >= 1.0.0.0 && < 1.3.0.0,
-                   process    >= 1.0.0.0 && < 1.2.0.0,
+                   process    >= 1.0.0.0 && < 1.3.0.0,
                    containers >= 0.1 && < 0.6,
-                   array      >= 0.1 && < 0.5,
+                   array      >= 0.1 && < 0.6,
                    random     == 1.0.*
 
 
@@ -430,10 +434,13 @@
       cc-options:        -DHAVE_CURL
 
     if flag(http)
-        build-depends:    network >= 2.2 && < 2.5,
-                          HTTP    >= 4000.0.8 && < 4000.3
+        build-depends:    HTTP    >= 4000.0.8 && < 4000.3
         cpp-options:      -DHAVE_HTTP
         x-have-http:
+        if flag(network-uri)
+          build-depends: network >= 2.6, network-uri >= 2.6
+        else
+          build-depends: network >= 2.2, network < 2.6
 
     if (!flag(curl) && !flag(http))
         buildable: False
@@ -486,7 +493,7 @@
     buildable: False
   else
     buildable: True
-  build-tools: ghc >= 6.10 && < 7.8
+  build-tools: ghc >= 6.10 && < 7.10
 
   main-is:          darcs.hs
   hs-source-dirs:   src
@@ -547,17 +554,17 @@
     cc-options:     -DHAVE_SIGINFO_H
 
   if os(windows)
-    build-depends:  base >= 4 && < 4.7
+    build-depends:  base >= 4 && < 4.8
   else
     if flag(force-char8-encoding)
-      build-depends:  base >= 4.5 && < 4.7
+      build-depends:  base >= 4.5 && < 4.8
       cpp-options:    -DFORCE_CHAR8_ENCODING
     else
       build-depends:  base >= 4 && < 4.4
 
   build-depends:   extensible-exceptions >= 0.1 && < 0.2,
                    regex-compat >= 0.95.1,
-                   mtl          >= 1.0 && < 2.2,
+                   mtl          >= 1.0 && < 2.3,
                    parsec       >= 2.0 && < 3.2,
                    html         == 1.0.*,
                    filepath     >= 1.1.0.0 && < 1.5.0.0,
@@ -571,15 +578,15 @@
     build-depends: haskeline <= 0.6.4.6
 
   if !os(windows)
-    build-depends: unix >= 1.0 && < 2.7
+    build-depends: unix >= 1.0 && < 2.8
 
   build-depends:   bytestring >= 0.9.0 && < 0.11,
-                   text       >= 0.11.0.6 && < 0.12.0.0,
+                   text       >= 0.11.0.6 && < 1.2,
                    old-time   >= 1.0 && < 1.2,
                    directory  >= 1.0.0.0 && < 1.3.0.0,
-                   process    >= 1.0.0.0 && < 1.2.0.0,
+                   process    >= 1.0.0.0 && < 1.3.0.0,
                    containers >= 0.1 && < 0.6,
-                   array      >= 0.1 && < 0.5,
+                   array      >= 0.1 && < 0.6,
                    random     == 1.0.*
 
   if flag(curl)
@@ -590,10 +597,13 @@
     cc-options:        -DHAVE_CURL
 
   if flag(http)
-      build-depends:    network >= 2.2 && < 2.5,
-                        HTTP    >= 4000.0.8 && < 4000.3
+      build-depends:    HTTP    >= 4000.0.8 && < 4000.3
       cpp-options:      -DHAVE_HTTP
       x-have-http:
+      if flag(network-uri)
+        build-depends: network >= 2.6, network-uri >= 2.6
+      else
+        build-depends: network >= 2.2, network < 2.6
 
   if (!flag(curl) && !flag(http))
       buildable: False
@@ -643,7 +653,7 @@
 Executable          darcs-test
   main-is:          test.hs
 
-  build-tools: ghc >= 6.10 && < 7.8
+  build-tools: ghc >= 6.10 && < 7.10
 
 
   if !flag(test)
@@ -653,7 +663,7 @@
 
     build-depends:   extensible-exceptions >= 0.1 && < 0.2,
                      regex-compat >= 0.95.1,
-                     mtl          >= 1.0 && < 2.2,
+                     mtl          >= 1.0 && < 2.3,
                      parsec       >= 2.0 && < 3.2,
                      html         == 1.0.*,
                      filepath     >= 1.1.0.0 && < 1.5.0.0,
@@ -756,25 +766,25 @@
       cc-options:     -DHAVE_SIGINFO_H
 
     if os(windows)
-      build-depends:  base >= 4 && < 4.7
+      build-depends:  base >= 4 && < 4.8
     else
       if flag(force-char8-encoding)
-        build-depends:  base >= 4.5 && < 4.7
+        build-depends:  base >= 4.5 && < 4.8
         cpp-options:    -DFORCE_CHAR8_ENCODING
       else
         build-depends:  base >= 4 && < 4.4
 
     if !os(windows)
-      build-depends: unix >= 1.0 && < 2.7
+      build-depends: unix >= 1.0 && < 2.8
 
     build-depends: bytestring >= 0.9.0 && < 0.11,
                    haskeline    >= 0.6.3 && < 0.8,
-                   text       >= 0.11.0.6 && < 0.12.0.0,
+                   text       >= 0.11.0.6 && < 1.2,
                    old-time   >= 1.0 && < 1.2,
                    directory  >= 1.0.0.0 && < 1.3.0.0,
-                   process    >= 1.0.0.0 && < 1.2.0.0,
+                   process    >= 1.0.0.0 && < 1.3.0.0,
                    containers >= 0.1 && < 0.6,
-                   array      >= 0.1 && < 0.5,
+                   array      >= 0.1 && < 0.6,
                    hashed-storage >= 0.5.6 && < 0.6,
                    vector       >= 0.7,
                    tar        >= 0.3 && < 0.5,
@@ -796,8 +806,11 @@
       cpp-options:      -DHAVE_TERMINFO
 
     if flag(http)
-        build-depends:    network >= 2.2 && < 2.5,
-                          HTTP    >= 4000.0.8 && < 4000.3
+        build-depends:    HTTP    >= 4000.0.8 && < 4000.3
+        if flag(network-uri)
+          build-depends: network >= 2.6, network-uri >= 2.6
+        else
+          build-depends: network >= 2.2, network < 2.6
 
     if flag(color)
       x-use-color:
diff --git a/release/distributed-context b/release/distributed-context
--- a/release/distributed-context
+++ b/release/distributed-context
@@ -1,1 +1,1 @@
-Just "\nContext:\n\n[TAG 2.8.4\nGanesh Sittampalam <ganesh@earth.li>**20130127231845\n Ignore-this: d032f69540341ecfd5858fce7aee1457\n] \n\n[Resolve issue2155: Expurgate the non-functional annotate --xml-output option\nDave Love <fx@gnu.org>**20130127231835\n Ignore-this: eb03207031e75687968091d56fb008f8\n backported from HEAD by Ganesh Sittampalam <ganesh@earth.li>\n] \n\n[Resolve issue2155: Expurgate the non-functional annotate --xml-output option\nDave Love <fx@gnu.org>**20130120121739\n Ignore-this: 8a9ce6409a50b71cd0d2fdabbc181b1a\n backported from HEAD by Ganesh Sittampalam <ganesh@earth.li>\n] \n\n[note dependency bumps in NEWS\nGanesh Sittampalam <ganesh@earth.li>**20130120170310\n Ignore-this: 48cf181c89ec1b69fc6e9e701734ff19\n] \n\n[bump version to 2.8.4\nGanesh Sittampalam <ganesh@earth.li>**20130120154856\n Ignore-this: 2f2542e9825b66cda3a0a17275b5e311\n] \n\n[resolve issue2199: getMatchingTag needs to commute for dirty tags\nGanesh Sittampalam <ganesh@earth.li>**20121218191024\n Ignore-this: 947252cd8e084b793044aff564f0462d\n backported from HEAD\n] \n\n[accept issue2199: darcs get --tag gets too much\nGanesh Sittampalam <ganesh@earth.li>**20120528164525\n Ignore-this: 8c138a80c294e6181a3ef9250593fa31\n] \n\n[constrain haskeline version on old GHC\nGanesh Sittampalam <ganesh@earth.li>**20130119234432\n Ignore-this: 8af00cc3d3c1ad223a8b35712c06bae\n] \n\n[Add option -a to darcs changes in Setup.lhs\nBen Franksen <ben.franksen@online.de>**20120811195807\n Ignore-this: f23d2e558f7248fec8d07b0391d9a7e8\n \n Some (potential) contributors (like me) have 'changes interactive'\n in their ~/.darcs/defaults and then wonder why their build hangs.\n] \n\n[add copyright notices for the imported haskeline code\nGanesh Sittampalam <ganesh@earth.li>**20130119163610\n Ignore-this: afcdc8048f8b3233fa17d3ab0c9c311f\n licence/copyright taken from haskeline 0.6.4.7:\n BSD3, copyright Judah Jacobson\n] \n\n[import encoding code from haskeline: switch over\nGanesh Sittampalam <ganesh@earth.li>**20130118231907\n Ignore-this: b423a92ba93e74520d0578ac21aceab3\n] \n\n[import encoding code from haskeline: source files\nGanesh Sittampalam <ganesh@earth.li>**20130118225947\n Ignore-this: c2d1e228fa4cce3e66e90a14fa2f3200\n] \n\n[import encoding code from haskeline: cabal file changes\nGanesh Sittampalam <ganesh@earth.li>**20130118070642\n Ignore-this: d2ed13887d0c547cb7498bd5a2aef46f\n] \n\n[import encoding code from haskeline: Setup.lhs changes\nGanesh Sittampalam <ganesh@earth.li>**20130115181040\n Ignore-this: 31ccdca76001bff769464fb7a8e574e9\n] \n\n[ROLLBACK: conditionally use bytestring-handle\nGanesh Sittampalam <ganesh@earth.li>**20130111213829\n Ignore-this: d3c18b61f765bdfcb574b4977185197b\n It doesn't skip invalid byte sequences when decoding so breaks on \n repositories with non-UTF8 encoded metadata.\n] \n\n[bump network dependency\nGanesh Sittampalam <ganesh@earth.li>**20130111184607\n Ignore-this: 54e55fa09793008d55572b6acad1a7b8\n] \n\n[add some comments about \"nearby\" darcs, and print out the one that was found\nGanesh Sittampalam <ganesh@earth.li>**20130111211817\n Ignore-this: 57385f3248fc539435ed9de069a40bd5\n backported from HEAD\n] \n\n[make darcs-test look \"nearby\" for a darcs exe to use\nGanesh Sittampalam <ganesh@earth.li>**20130111211445\n Ignore-this: d952cf330c0d9510c5c973dd41b191e0\n backported from HEAD\n] \n\n[need different path separator on Windows\nGanesh Sittampalam <ganesh@earth.li>**20121219191221\n Ignore-this: 42c7ba1e46f5b6b600d23838e5a162cb\n] \n\n[test for issue2286: make sure we can read repos with non-UTF8 metadata\nGanesh Sittampalam <ganesh@earth.li>**20130102222735\n Ignore-this: adc6165d5d5d991383ebf0e6547f7bf4\n] \n\n[We can use chcp to switch encodings on Windows\nGanesh Sittampalam <ganesh@earth.li>**20130101122254\n Ignore-this: bc115467e31e144694a33e43dca3fb6c\n This means that the tests that require different encodings can run.\n] \n\n[Find latin9 locale on OS X too\nMichael Hendricks <michael@ndrix.org>**20120420202408\n Ignore-this: c87db3b97312234ed2380d2ca11a8ca0\n \n Most Linux systems describe latin9 as \"iso885915\".  OS X\n describes it with \"ISO8859-15\".  The new regex catches both.\n] \n\n[windows test fix: replace shell script with a Haskell program\nGanesh Sittampalam <ganesh@earth.li>**20121231224332\n Ignore-this: de01ab8647e7d62c18d8c266d514b054\n] \n\n[unsetting DARCS_TEST_PREFS_DIR in utf8 test doesn't seem to be necessary\nGanesh Sittampalam <ganesh@earth.li>**20130101120246\n Ignore-this: ed74710d8b358b920d742e86a7f008d8\n \n It was causing problems on Windows because getAppUserDataDirectory\n still returns the normal user directory.\n \n It also means that the repository type choice isn't picked up.\n] \n\n[improve diagnostics when utf8 test fails\nGanesh Sittampalam <ganesh@earth.li>**20121231224600\n Ignore-this: 63db587bc36f8826c66dc6913a4fdb2d\n] \n\n[need to do case-insensitive comparison on Windows\nGanesh Sittampalam <ganesh@earth.li>**20121228214823\n Ignore-this: ef309d4aef22e87d5c3da3222926af0e\n] \n\n[update NEWS\nGanesh Sittampalam <ganesh@earth.li>**20121216202654\n Ignore-this: aef3e47204a4157504f90554ffc3a327\n] \n\n[conditionally use bytestring-handle instead of haskeline for encoding\nGanesh Sittampalam <ganesh@earth.li>**20121216201745\n Ignore-this: fd758796b689d090d01e003e660e405\n This is transitional because we need to support GHC 6.10: we can switch\n over to bytestring-handle unconditionally on HEAD.\n] \n\n[bump deps for GHC 7.6/latest hackage\nGanesh Sittampalam <ganesh@earth.li>**20121216201543\n Ignore-this: 77829b074a4bff635a421879bdd04be0\n] \n\n[conditionally support tar 0.4\nGanesh Sittampalam <ganesh@earth.li>**20121216201014\n Ignore-this: 8eff0330e6af196727bdd736ef31db25\n] \n\n[recent test-framework seems to require Typeable\nGanesh Sittampalam <ganesh@earth.li>**20121216175601\n Ignore-this: a8cce6b69984bfc2335b5c19688950b3\n] \n\n[stop using Prelude.catch\nGanesh Sittampalam <ganesh@earth.li>**20121216163240\n Ignore-this: b4bfc48775b3337f8f7ebe275be1a058\n \n backported from HEAD\n] \n\n[import constructors of C types to deal with a GHC change\nGanesh Sittampalam <ganesh@earth.li>**20120401132500\n Ignore-this: ab7cf2fb5e9a2494c14fe7394200da9b\n] \n\n[TAG 2.8.3\nGanesh Sittampalam <ganesh@earth.li>**20121104174910\n Ignore-this: 3198f6deecf3d1b44df6e05a2657d9ca\n] \n"
+Just "\nContext:\n\n[TAG 2.8.5\nGanesh Sittampalam <ganesh@earth.li>**20140825204639\n Ignore-this: 4e6c90569ceab19a231cdd4c5089b4c2\n] \n"
diff --git a/release/distributed-version b/release/distributed-version
--- a/release/distributed-version
+++ b/release/distributed-version
@@ -1,1 +1,1 @@
-Just 1
+Just 0
diff --git a/src/Crypt/SHA256.hs b/src/Crypt/SHA256.hs
--- a/src/Crypt/SHA256.hs
+++ b/src/Crypt/SHA256.hs
@@ -14,12 +14,13 @@
 
 module Crypt.SHA256 ( sha256sum ) where
 
-import Foreign
+import Foreign hiding ( unsafePerformIO )
 import Foreign.C.Types
 import Numeric (showHex)
 import Foreign.C.String ( withCString )
 import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
 import qualified Data.ByteString as B
+import System.IO.Unsafe ( unsafePerformIO )
 
 sha256sum :: B.ByteString -> String
 sha256sum p = unsafePerformIO $
diff --git a/src/Darcs/Commands/Get.hs b/src/Darcs/Commands/Get.hs
--- a/src/Darcs/Commands/Get.hs
+++ b/src/Darcs/Commands/Get.hs
@@ -157,7 +157,8 @@
   copyRepo
   withRepository opts ((RepoJob $ \repository -> goToChosenVersion repository opts) :: RepoJob ())
   putInfo opts $ text "Finished getting."
-      where copyRepo =
+      where copyRepo :: IO ()
+            copyRepo =
                 withRepository opts $ RepoJob $ \repository ->
                   if formatHas HashedInventory rfsource
                    then do
diff --git a/src/Darcs/Global.hs b/src/Darcs/Global.hs
--- a/src/Darcs/Global.hs
+++ b/src/Darcs/Global.hs
@@ -61,8 +61,12 @@
 import Control.Monad ( when )
 import Control.Concurrent.MVar
 import Control.Exception.Extensible ( bracket_, catch, catchJust, SomeException
-                                    , block, unblock
                                     )
+#if (MIN_VERSION_base(4,4,0))
+import Control.Exception.Extensible ( mask )
+#else
+import Control.Exception.Extensible ( block, unblock )
+#endif
 import Data.IORef ( IORef, newIORef, readIORef, writeIORef )
 import Data.IORef ( modifyIORef )
 import Data.List ( isPrefixOf )
@@ -75,6 +79,9 @@
 import System.Environment ( getEnv )
 import Prelude hiding (catch)
 
+#if !(MIN_VERSION_base(4,4,0))
+mask f = block (f unblock)
+#endif
 
 windows :: Bool
 windows = "mingw" `isPrefixOf` os
@@ -106,12 +113,12 @@
         exit
         prog
   where
-    exit = block $ do
+    exit = mask $ \unmask -> do
         Just actions <- swapMVar atexitActions Nothing
         -- from now on atexit will not register new actions
-        mapM_ runAction actions
-    runAction action =
-        catch (unblock action) $ \(exn :: SomeException) -> do
+        mapM_ (runAction unmask) actions
+    runAction unmask action =
+        catch (unmask action) $ \(exn :: SomeException) -> do
             hPutStrLn stderr $ "Exception thrown by an atexit registered action:"
             hPutStrLn stderr $ show exn
 
@@ -239,7 +246,7 @@
 
 _badSourcesList :: IORef [String]
 _badSourcesList = unsafePerformIO $ newIORef []
-{- NOINLINE _badSourcesList -}
+{-# NOINLINE _badSourcesList #-}
 
 
 addBadSource :: String -> IO ()
@@ -258,7 +265,7 @@
 
 _reachableSourcesList :: IORef [String]
 _reachableSourcesList = unsafePerformIO $ newIORef []
-{- NOINLINE _reachableSourcesList -}
+{-# NOINLINE _reachableSourcesList #-}
 
 
 addReachableSource :: String -> IO ()
diff --git a/src/Darcs/Patch/Match.hs b/src/Darcs/Patch/Match.hs
--- a/src/Darcs/Patch/Match.hs
+++ b/src/Darcs/Patch/Match.hs
@@ -28,6 +28,7 @@
 import Text.ParserCombinators.Parsec.Expr
 import Text.Regex ( mkRegex, matchRegex )
 import Data.Maybe ( isJust )
+import Data.List ( isPrefixOf )
 import System.IO.Unsafe ( unsafePerformIO )
 
 import Darcs.Patch.PatchInfoAnd ( PatchInfoAnd, hopefully, info )
@@ -181,7 +182,9 @@
          , ["\"prevent deadlocks\""]
          , logmatch )
  , ("hash",  "match the darcs hash for a patch"
-          ,  ["20040403105958-53a90-c719567e92c3b0ab9eddd5290b705712b8b918ef"]
+          ,  ["20040403105958-53a90-c719567e92c3b0ab9eddd5290b705712b8b918ef"
+             ,"c719567e92c3b0ab9eddd5290b705712b8b918ef"
+             ,"c719567e"]
           ,  hashmatch )
  , ("date", "match the patch date"
           , ["\"2006-04-02 22:41\"", "\"tea time yesterday\""]
@@ -220,6 +223,8 @@
 
 hashmatch h (Sealed2 hp) = let rh = makeFilename (info hp) in
                                   (rh == h) || (rh == h++".gz")
+                                            || (h `isPrefixOf` drop 21 rh)
+                           -- enable matching on (prefix of) third part, like in darcs 2.10
 
 datematch d (Sealed2 hp) = let dm = unsafePerformIO $ parseDateMatcher d
                                   in dm $ piDate (info hp)
diff --git a/src/Darcs/SignalHandler.hs b/src/Darcs/SignalHandler.hs
--- a/src/Darcs/SignalHandler.hs
+++ b/src/Darcs/SignalHandler.hs
@@ -27,8 +27,13 @@
 import System.Exit ( exitWith, ExitCode ( ExitFailure ) )
 import Control.Concurrent ( ThreadId, myThreadId )
 import Control.Exception.Extensible
-            ( catch, throw, throwTo, block, unblock,
+            ( catch, throw, throwTo,
               Exception(..), SomeException(..), IOException )
+#if (MIN_VERSION_base(4,4,0))
+import Control.Exception.Extensible ( mask )
+#else
+import Control.Exception.Extensible ( block, unblock )
+#endif
 import System.Posix.Files ( getFdStatus, isNamedPipe )
 import System.Posix.IO ( stdOutput )
 import Data.Typeable ( Typeable, cast )
@@ -42,6 +47,10 @@
 import CtrlC ( withCtrlCHandler )
 #endif
 
+#if !(MIN_VERSION_base(4,4,0))
+mask f = block (f unblock)
+#endif
+
 stdoutIsAPipe :: IO Bool
 stdoutIsAPipe
  = catch
@@ -128,8 +137,8 @@
          | otherwise                             = throw ioe
 
 withSignalsBlocked :: IO a -> IO a
-withSignalsBlocked job = block (job >>= \r ->
-                           unblock(return r) `catchSignal` couldnt_do r)
+withSignalsBlocked job = mask (\unmask -> job >>= \r ->
+                           unmask (return r) `catchSignal` couldnt_do r)
     where couldnt_do r s | s == sigINT = oops "interrupt" r
                          | s ==  sigHUP = oops "HUP" r
                          | s ==  sigABRT = oops "ABRT" r
diff --git a/src/Darcs/Test/Patch.hs b/src/Darcs/Test/Patch.hs
--- a/src/Darcs/Test/Patch.hs
+++ b/src/Darcs/Test/Patch.hs
@@ -2,6 +2,9 @@
 #if __GLASGOW_HASKELL__ >= 700
 {-# LANGUAGE ImpredicativeTypes #-}
 #endif
+#if __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE AllowAmbiguousTypes #-}
+#endif
 --  Copyright (C) 2002-2005,2007 David Roundy
 --
 --  This program is free software; you can redistribute it and/or modify
diff --git a/src/Darcs/Test/Patch/Info.hs b/src/Darcs/Test/Patch/Info.hs
--- a/src/Darcs/Test/Patch/Info.hs
+++ b/src/Darcs/Test/Patch/Info.hs
@@ -28,7 +28,7 @@
 import Data.Text as T ( find, any )
 import Data.Text.Encoding ( decodeUtf8With )
 import Data.Text.Encoding.Error ( lenientDecode )
-import Foreign ( unsafePerformIO )
+import System.IO.Unsafe ( unsafePerformIO )
 import Test.QuickCheck ( Arbitrary(arbitrary), oneof, listOf, choose, shrink
                        , Gen )
 import Test.Framework.Providers.QuickCheck2 ( testProperty )
diff --git a/src/Encoding/IConv.hsc b/src/Encoding/IConv.hsc
--- a/src/Encoding/IConv.hsc
+++ b/src/Encoding/IConv.hsc
@@ -119,7 +119,7 @@
 type IConvT = ForeignPtr ()
 type IConvTPtr = Ptr ()
 
-foreign import ccall "haskeline_iconv_open" iconv_open
+foreign import ccall "darcs_iconv_open" iconv_open
     :: CString -> CString -> IO IConvTPtr
 
 iconvOpen :: String -> String -> IO IConvT
@@ -133,9 +133,9 @@
                                     else newForeignPtr iconv_close res
 
 -- really this returns a CInt, but it's easiest to just ignore that, I think.
-foreign import ccall "& haskeline_iconv_close" iconv_close :: FunPtr (IConvTPtr -> IO ())
+foreign import ccall "& darcs_iconv_close" iconv_close :: FunPtr (IConvTPtr -> IO ())
 
-foreign import ccall "haskeline_iconv" c_iconv :: IConvTPtr -> Ptr CString -> Ptr CSize
+foreign import ccall "darcs_iconv" c_iconv :: IConvTPtr -> Ptr CString -> Ptr CSize
                             -> Ptr CString -> Ptr CSize -> IO CSize
 
 data Result = Successful
diff --git a/src/URL.hs b/src/URL.hs
--- a/src/URL.hs
+++ b/src/URL.hs
@@ -22,7 +22,7 @@
 import System.IO.Unsafe ( unsafePerformIO )
 import Control.Concurrent ( forkIO )
 import Control.Concurrent.Chan ( isEmptyChan, newChan, readChan, writeChan, Chan )
-import Control.Concurrent.MVar ( isEmptyMVar, modifyMVar_, newEmptyMVar, newMVar, putMVar, readMVar, withMVar, MVar )
+import Control.Concurrent.MVar ( isEmptyMVar, modifyMVar_, modifyMVar, newEmptyMVar, newMVar, putMVar, readMVar, withMVar, MVar )
 import Control.Monad ( unless, when )
 import Control.Monad.Trans ( liftIO )
 import Control.Monad.State ( evalStateT, get, modify, put, StateT )
@@ -196,10 +196,10 @@
   debugMessage ("URL.copyUrlWithPriority ("++u++"\n"++
                 "                      -> "++f++")")
   v <- newEmptyMVar
-  let fn _ old_val = old_val
-  modifyMVar_ urlNotifications (return . (Map.insertWith fn u v))
-  let r = UrlRequest u f c p
-  writeChan urlChan r
+  old_mv <- modifyMVar urlNotifications (return . (\(a, b) -> (b, a)) . Map.insertLookupWithKey (\_k _n old -> old) u v)
+  case old_mv of
+      Nothing -> writeChan urlChan $ UrlRequest u f c p -- ok, new URL
+      Just _  -> debugMessage $ "URL.copyUrlWithPriority already in progress, skip (" ++ u ++ "\n" ++ "-> " ++ f ++ ")"
 
 waitNextUrl :: StateT UrlState IO ()
 waitNextUrl = do
diff --git a/src/Workaround.hs b/src/Workaround.hs
--- a/src/Workaround.hs
+++ b/src/Workaround.hs
@@ -31,7 +31,7 @@
 
 import qualified System.Directory ( renameFile, getCurrentDirectory, removeFile )
 import Control.Exception ( catch, IOException )
-import qualified Control.Exception ( block )
+import qualified Control.Exception ( mask )
 import qualified System.IO.Error ( isDoesNotExistError, ioError )
 
 #else
@@ -96,7 +96,7 @@
 renameFile :: FilePath
            -> FilePath
            -> IO ()
-renameFile old new = Control.Exception.block $
+renameFile old new = Control.Exception.mask $ \_ ->
    System.Directory.renameFile old new
    `catch` \(_ :: IOException) ->
    do System.Directory.removeFile new
diff --git a/src/h_iconv.c b/src/h_iconv.c
--- a/src/h_iconv.c
+++ b/src/h_iconv.c
@@ -1,15 +1,15 @@
 #include "h_iconv.h"
 
 // Wrapper functions, since iconv_open et al are macros in libiconv.
-iconv_t haskeline_iconv_open(const char *tocode, const char *fromcode) {
+iconv_t darcs_iconv_open(const char *tocode, const char *fromcode) {
     return iconv_open(tocode, fromcode);
 }
 
-void haskeline_iconv_close(iconv_t cd) {
+void darcs_iconv_close(iconv_t cd) {
     iconv_close(cd);
 }
 
-size_t haskeline_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
+size_t darcs_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
                 char **outbuf, size_t *outbytesleft) {
     // Cast inbuf to (void*) so that it works both on Solaris, which expects
     // a (const char**), and on other platforms (e.g. Linux), which expect
diff --git a/src/h_iconv.h b/src/h_iconv.h
--- a/src/h_iconv.h
+++ b/src/h_iconv.h
@@ -1,9 +1,9 @@
 #include <iconv.h>
 
-iconv_t haskeline_iconv_open(const char *tocode, const char *fromcode);
+iconv_t darcs_iconv_open(const char *tocode, const char *fromcode);
 
-void haskeline_iconv_close(iconv_t cd);
+void darcs_iconv_close(iconv_t cd);
 
-size_t haskeline_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
+size_t darcs_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
                 char **outbuf, size_t *outbytesleft);
 
diff --git a/tests/record_editor.sh b/tests/record_editor.sh
--- a/tests/record_editor.sh
+++ b/tests/record_editor.sh
@@ -8,7 +8,7 @@
 
 rm -rf temp1
 
-export DARCS_EDITOR="/bin/cat -n"
+export DARCS_EDITOR="cat -n"
 # editor: space in command
 mkdir temp1
 cd temp1
@@ -62,7 +62,7 @@
 cd ..
 rm -rf temp1
 
-export DARCS_EDITOR='/bin/echo'
+export DARCS_EDITOR='echo'
 # editor: evil filename
 mkdir temp1
 cd temp1
