Closed jasagredo closed 1 month ago
Tests that are currently marked as failing because of this:
PackageTests\Backpack\Includes2\cabal-internal.test.hs
PackageTests\Backpack\Includes3\cabal-external.test.hs
passing with GHC < 9.10
PackageTests\Backpack\Includes3\cabal-internal.test.hs
PackageTests\Backpack\T6385\cabal.test.hs
Cabal uses temporary files for writing files atomically. It then renames the file to the right name after writing it. However this cannot deal with long paths on Windows.
See how GetTempFileNameW specifies:
The string cannot be longer than MAX_PATH–14 characters or GetTempFileName will fail.
And actually there is a TODO in Win32Utils.c in GHC:
So my suggestion and the PR I'm preparing is to create temp files in the global temp directory instead of in the final destination. This is somewhat of a breaking change, but I don't think it will be too noticeable.
However this is kind of blocked on https://github.com/haskell/directory/issues/189 to make this transparent for cabal, as otherwise users with multiple drives might have a hard time.
Base should be fixed once WinIO was merged, but there are still tests which even in newer GHCs still fail with MAX_PATH issues:
Mistuke mentioned that Cabal uses its own logic for temp files, but this one looks like it uses the base one. This is worth investigating in any case, because Backpack results in very long paths always...
System information
cabal
,ghc
versions: 3.12.1.0 and 9.0.2-9.10.1