-
Notifications
You must be signed in to change notification settings - Fork 701
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
Add support on Windows for copying to long paths. #4977
Conversation
cc @alexbiehl , @hvr |
Do you reckon it'd make sense to implement a compat filepath layer that'd use extended length paths and native operations on Windows, and standard operations ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -25,20 +27,36 @@ import System.IO.Error | |||
import System.Directory | |||
( doesFileExist, renameFile, removeFile ) | |||
import System.FilePath | |||
( takeDirectory ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the build on non-Windows, where takeDirectory
is still used, see e.g. https://travis-ci.org/haskell/cabal/jobs/321706530#L778.
@23Skidoo Well, I only quickly glanced but I don't believe the other functions use the I/O manager and so should be fine. A |
Build still fails on Linux, now due to
|
Merged, thanks! |
Great work! Especially the bit about trying to upstream into base... :) (Not that I'm using Windows, personally, but this has been a pain for Cabal users and package developers who want "cross-platform-by-default" for quite a while...) |
For future reference, this workaround is no longer need when |
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!
Tested by trying to compile cabal itself on a long path.
Should fix partially #3972, #4914, #4515. The reason why partial is because any operation that hits the GHC I/O manager will destroy device path support. Because the GHC I/O manager is using non-native posix like APIs which are mapped to the old Win32 APIs that are bound by MAX_PATH.
This patch works because it avoids touching the I/O manager for doing the file copy and instead does a direct copy using the Win32 API. The Windows APIs do not have the same limitations as the posix ones and so do not require the file to be on the same drive before issuing a copy/move. So this should be much faster too.