[commit: packages/directory] master: Revert long path support for setCurrentDirectory (2d43c13)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:35:47 UTC 2017


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2d43c136586505e85b46d21f9ed1a46788411ae7/directory

>---------------------------------------------------------------

commit 2d43c136586505e85b46d21f9ed1a46788411ae7
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Mon Mar 6 02:06:03 2017 -0500

    Revert long path support for setCurrentDirectory
    
    SetCurrentDirectoryW does not accept long paths even with the \\?\
    prefix, despite what the MSDN says.  It's probably best to revert the
    change to reduce the risk of breakage.
    
    Still, getCurrentDirectory gets to keep the fromExtendedLengthPath
    postprocessing, in case the user sets to a path with \\?\.  The presence
    of \\?\ in paths can cause surprises so it's best to strip it.
    
    https://ghc.haskell.org/trac/ghc/ticket/13373#comment:6


>---------------------------------------------------------------

2d43c136586505e85b46d21f9ed1a46788411ae7
 System/Directory.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index f83838f..94c7549 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -1479,8 +1479,9 @@ getCurrentDirectory =
 setCurrentDirectory :: FilePath -> IO ()
 setCurrentDirectory path = do
 #ifdef mingw32_HOST_OS
-  (`ioeSetFileName` path) `modifyIOError` do
-    Win32.setCurrentDirectory (toExtendedLengthPath path)
+  -- SetCurrentDirectory does not support long paths even with the \\?\ prefix
+  -- https://ghc.haskell.org/trac/ghc/ticket/13373#comment:6
+  Win32.setCurrentDirectory path
 #else
   Posix.changeWorkingDirectory path
 #endif



More information about the ghc-commits mailing list