This is an archive of the discontinued Mercurial Phabricator instance.

[RFC] setup: increase MAX_PATH limit on Windows 10 Anniversary Update
AbandonedPublic

Authored by indygreg on Sep 30 2017, 5:46 AM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

As documented at
https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247(v=vs.85).aspx
system settings or per-application settings can now opt in to increasing
the length of MAX_PATH, removing the 260 character restriction. This
impacts the following API calls:

CreateDirectoryW, CreateDirectoryExW, GetCurrentDirectoryW,
RemoveDirectoryW, SetCurrentDirectoryW, CopyFileW, CopyFile2,
CopyFileExW, CreateFileW, CreateFile2, CreateHardLinkW,
CreateSymbolicLinkW, DeleteFileW, FindFirstFileW, FindFirstFileExW,
FindNextFileW, GetFileAttributesW, GetFileAttributesExW,
SetFileAttributesW, GetFullPathNameW, GetLongPathNameW, MoveFileW,
MoveFileExW, MoveFileWithProgressW, ReplaceFileW, SearchPathW,
FindFirstFileNameW, FindNextFileNameW, FindFirstStreamW,
FindNextStreamW, GetCompressedFileSizeW, GetFinalPathNameByHandleW.

Adding an application manifest to hg.exe will activate this setting
and possibly eliminate some 260 character path length limitations
in Mercurial without having to convert all paths to absolute and use
the "\\?\" prefix, which was previously the only supported mechanism
for using longer paths.

I HAVE NOT YET TESTED THIS PATCH.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

indygreg created this revision.Sep 30 2017, 5:46 AM
abuehl added a subscriber: abuehl.Sep 30 2017, 7:18 AM

What about file I/O done via Python lib (e.g. python27.dll)?

In D851#14300, @abuehl wrote:

What about file I/O done via Python lib (e.g. python27.dll)?

I /think/ this works at the process - not DLL - level. But I need to test on a Windows machine to be sure. One of the reasons this is marked RFC.

In D851#14300, @abuehl wrote:

What about file I/O done via Python lib (e.g. python27.dll)?

I /think/ this works at the process - not DLL - level. But I need to test on a Windows machine to be sure. One of the reasons this is marked RFC.

Maybe, but what does the Python library itself do with long paths?
What do you expect from calling e.g. os.unlink with a long path? Can the Python lib handle it?

In addition, Mercurial is not using the ...W Windows API functions.

I think, for example

https://phab.mercurial-scm.org/diffusion/HG/browse/default/mercurial/cext/osutil.c;da8bdeb1be28b976909a963c89e974264686e2bb$1207

would have to be changed to call CreateFileW in order for this to have an effect.

indygreg abandoned this revision.Dec 24 2017, 12:54 PM

Support for this was added in ed5acd3fd7e1.