Fix off-by-one and char encoding issue #3649 #3702 #3735
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As described in #3649, stack fails on Windows when building project dependencies because the paths it generates for cached files are too long. #3702 and 36c1226 are fixes to this but contain an off-by-one error so builds still fail when a cache path is exactly 260 characters long. This patch fixes the off-by-one error.
Additionally, the Windows 260 character path limit is counted in 16-bit utf-16 code units, not unicode characters. This patch also addresses this.
This is only tested on Windows, but the non-Windows functionality should not have changed.
To test this I rebuilt stack and a simple yesod app and all their dependencies using this modified stack. This had previously failed. I also edited the CPP constant to ensure the non-Windows branch of the code compiles without error.