Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,249
    • Issues 5,249
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 576
    • Merge requests 576
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13373
Closed
Open
Issue created Mar 04, 2017 by Edward Z. Yang@ezyangDeveloper

Handle long file paths on Windows

In the past, Cabal and GHC have run into Windows' PATH_MAX path size limitation, which caps the length of file system paths at 260 characters. Examples:

  • https://github.com/haskell/cabal/issues/3972
  • #10777 (closed)

It would be really great if Haskell's base libraries handled long file system paths correctly. There are a few possibilities for achieving this:

  • Call GetShortPathName https://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx before calling any Windows API function, if we notice the file path is too long. The bad: Windows has to store the alias, and this aliasing mechanism may be disabled ~~(but maybe this never happens in practice).~~
  • Rewrite the core libraries to use the Unicode versions of functions, which support longer paths. We need to add the \\?\ prefix in this case. However, this prefix is not supported by all functions, and it turns off automatic expansion in the path string (so .. is not interpreted.) Care would need to be taken to not break existing code.
  • For Windows 10 only, opt into transparent long path support using a manifest. See the bottom of https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx\#maxpath Downside: this only works for Windows 10

An alternative plan is to build and publish an alternative Windows IO library, which is a drop-in replacement for the IO functionality implemented in base but is long paths. We can use this to test paths and provide better functionality to old versions of GHC, before merging the changes back into base proper.

Edited Mar 10, 2019 by Edward Z. Yang
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking