-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on Windows, copyFile makes empty source and destination files when the source file is absent #177
Comments
I can confirm. The relevant code is here: directory/System/Directory/OsPath.hs Lines 746 to 772 in a97a8a8
|
Fix is here: #178 However, I suggest @Rufflewind that we consider to use the package file-io for this in the future so that we can consolidate such low-level functionality. Having complicated Win32 code spread around different packages is problematic. The openExistingFile function from that package does not suffer from this issue. |
@bgamari do you have visibility which GHC versions ship with this bug? |
Thanks for the quick fix/release! |
This affects directory 1.3.8.0 through 1.3.8.4, which maps to GHC 9.6.1 through 9.10.1 according to https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history |
I have opened GHC#24843 to ensure that this bump is performed in future minor releases. |
Would be good to add this info in the release notes. |
on Windows,
copyFile nonexistent shouldnotexist
succeeds and leaves 0-byte files for both
nonexistent
andshouldnotexist
.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 thingslike 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:
ref: https://bugs.darcs.net/issue2721
The text was updated successfully, but these errors were encountered: