From 2d88b1197e61f45c3ec123d3b3e62ad2cafb3585 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 14 Apr 2022 22:32:22 +0200 Subject: [PATCH 1/2] Fix EXDEV handler on windows wrt #345 --- lib/GHCup/Utils/Prelude.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/GHCup/Utils/Prelude.hs b/lib/GHCup/Utils/Prelude.hs index 21b7173..db2fbdc 100644 --- a/lib/GHCup/Utils/Prelude.hs +++ b/lib/GHCup/Utils/Prelude.hs @@ -473,7 +473,7 @@ recyclePathForcibly fp liftIO (moveFile fp dest) `catch` (\e -> if | isDoesNotExistError e -> pure () - | isPermissionError e {- EXDEV on windows -} -> recover (liftIO $ removePathForcibly fp) + | isPermissionError e || ioeGetErrorType e == UnsupportedOperation {- EXDEV on windows -} -> recover (liftIO $ removePathForcibly fp) | otherwise -> throwIO e) `finally` liftIO (handleIO (\_ -> pure ()) $ removePathForcibly tmp) @@ -515,7 +515,7 @@ recycleFile fp let dest = tmp takeFileName fp liftIO (moveFile fp dest) `catch` - (\e -> if isPermissionError e {- EXDEV on windows -} then recover (liftIO $ removePathForcibly fp) else throwIO e) + (\e -> if isPermissionError e || ioeGetErrorType e == UnsupportedOperation {- EXDEV on windows -} then recover (liftIO $ removePathForcibly fp) else throwIO e) `finally` liftIO (handleIO (\_ -> pure ()) $ removePathForcibly tmp) | otherwise = liftIO $ removeFile fp From dcbee9c7dce1a63889a27a0b5240af850f3ded3b Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 15 Apr 2022 16:02:07 +0200 Subject: [PATCH 2/2] Fix tests --- cabal.project | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cabal.project b/cabal.project index 019d44d..8751e9c 100644 --- a/cabal.project +++ b/cabal.project @@ -15,7 +15,9 @@ source-repository-package constraints: http-io-streams -brotli, any.Cabal ==3.6.2.0, - any.aeson >= 2.0.1.0 + any.aeson >= 2.0.1.0, + -- https://github.com/typeable/generic-arbitrary/issues/14 + any.generic-arbitrary < 0.2.1 package libarchive flags: -system-libarchive