-
Notifications
You must be signed in to change notification settings - Fork 723
Description
Issue #3430 was about exceeding PATH_MAX because of long hashes in package-ids.
I am running cabal-install built with #3431 and #3954 applied and am running into a similar issue.
This time the problem is because PATH_MAX is exceeded due to lots of nested directories within the "dist-newstyle" directory. The problem happens when the following 2 condition are met:
- The users project directory is "medium" length (such as
C:\Users\bitc\stuff\experiments\projects\testing\test-project) - One of the dependencies has a very long name (such as "data-default-instances-containers")
Here is what happens during cabal new-build:
During the build of the dependency(data-default-instances-containers), suspicious haddock warnings shed light on a very long path:
C:\Users\bitc\stuff\experiments\projects\testing\test-project\dist-newstyle\tmp\data-default-instances-containers-9408\data-default-instances-containers-0.0.1\dist\doc\html\data-default-instances-containers
and the dependency finally fails with:
ghc-pkg.exe: dist\package.conf.inplace\:
openBinaryTempFileWithDefaultPermissions: does not exist (No such file or
directory)
The above error is a sign of a PATH_MAX problem.
In my situation, all of the other dependencies built ok. But the length of the string "data-default-instances-containers" is the longest of all of the dependencies, and apparently is just above the threshold that causes it to fail to build. When I move my project directory down a few levels in the filesystem (making it shorter), everything builds fine.
Recommendation: Dependencies should not be built inside "dist-newstyle/tmp" but rather in some temporary directory completely outside of the project dir, probably in some system tmp dir (which can hopefully be assumed to be quite short)