[PATCH] Allow manipulating files with long names on Windows

Jason Harris jason at jasonfharris.com
Tue Jan 25 07:38:00 CST 2011


On Jan 25, 2011, at 10:17 PM, Sune Foldager wrote:

> On 20-01-2011 18:02, Aaron Cohen wrote:
>> 
>> Windows by default has a MAX_PATH of 260 characters. A while ago the
>> "fncache" format was added which allows repositories on Windows to
>> contain very long paths. At the time, a patch was proposed,
>> "longpath.patch" which enabled handling of those files in the working
>> copy but it was tabled.
>> 
>> From http://mercurial.selenic.com/bts/issue839, I infer that the
>> reason for this is that many tools on Windows don't handle long file
>> names gracefully. Time has passed though and more programs now work,
>> including all Java programs.
> 
> ...but excluding all Windows' built-in tools such as Explorer, cmd.exe, PowerShell.exe, compression and so on. In practice, I find it intolerable, as you need specialized tools for any work you need to do with files like these.
> 
> If Microsoft would fix their damn tools, it would be a different story :)
> 
>> + - cmd.exe has trouble manipulating long pathnames (del, move, rename will all
>> +    fail). Use powershell.
> 
> In PowerShell:
> 
> C:\ $ mkdir ('\lalalalalalalalalalalalalalalalalalala' * 20)
> New-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the dir
> ectory name must be less than 248 characters.

Just so everyone is aware on OSX which currently uses the HFS+ file system, the file name components must be less than 255 characters and the full path name must be less than 1024 characters.

See
http://support.apple.com/kb/TA20771?viewlocale=en_US
http://developer.apple.com/library/mac/#technotes/tn/tn1150.html

(This appears similar to OpenBSD according to some googling I did...)

Cheers,
  Jas


More information about the Mercurial-devel mailing list