-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
regression in 1.3.8.0type: a-bugThe described behavior is not working as intended.The described behavior is not working as intended.
Description
on Windows,
copyFile nonexistent shouldnotexist
succeeds and leaves 0-byte files for both nonexistent
and shouldnotexist
.
I would expect it to throw an exception and not create either source or destination file, which is what happens on Linux and MacOS.
The behaviour seems to have started in directory-1.3.8.0 and I bisected it to 78b3e59. I'm fairly sure it's directory
because I did things
like holding Win32 and trying with a range of GHCs. With default versions we only noticed it starting with GHC 9.6, but I get the same
behaviour with GHC 9.4.8+Win32 2.13.3.0+directory 1.3.8.0 (for example).
I used this test program to track down where the problem started:
module Main where
import Control.Exception
import System.Directory
import System.IO.Error (isDoesNotExistError)
main :: IO ()
main = do
removeFile "nonexistent.source" `catch` (\e -> if isDoesNotExistError e then return () else throwIO e)
removeFile "shouldnotexist.target" `catch` (\e -> if isDoesNotExistError e then return () else throwIO e)
(copyFile "nonexistent.source" "shouldnotexist.target" >> putStrLn "BAD: copyFile did not throw") `catch` (\e -> if isDoesNotExistError e then putStrLn "OK: copyFile threw" else throwIO e)
doesFileExist "nonexistent.source" >>= \b -> if b then putStrLn "BAD: nonexistent.source exists" else putStrLn "OK: nonexistent.source does not exist"
doesFileExist "shouldnotexist.target" >>= \b -> if b then putStrLn "BAD: shouldnotexist.target exists" else putStrLn "OK: shouldnotexist.target does not exist"
removeFile "nonexistent.source" `catch` (\e -> if isDoesNotExistError e then return () else throwIO e)
removeFile "shouldnotexist.target" `catch` (\e -> if isDoesNotExistError e then return () else throwIO e)
return ()
ref: https://bugs.darcs.net/issue2721
hasufell
Metadata
Metadata
Assignees
Labels
regression in 1.3.8.0type: a-bugThe described behavior is not working as intended.The described behavior is not working as intended.