RFR(S): 8188122: Path length limits on Windows leads to obscure class loading failures
Calvin Cheung
calvin.cheung at oracle.com
Wed Oct 25 19:48:48 UTC 2017
I've reworked this fix by using the Unicode version of open (wopen) to
handle path name longer than max path with the path prefixed to indicate
an extended length path as described in [1].
The Unicode version of stat (wstat) doesn't work well with long path
[2]. So FindFirstFileW will be used.The data in WIN32_FIND_DATA returned
from FindFirstFileW needs to be transferred to the stat structure since
the caller expects a return stat structure and other platforms return a
stat structure.
In classLoader.cpp, calculate the size of buffer required instead of
limiting it to JVM_MAXPATHLEN.
In os_windows.cpp, dynamically allocate buffers in os::open and os::stat.
updated webrev: http://cr.openjdk.java.net/~ccheung/8188122/webrev.01/
It passed hs-tier2 testing using mach5.
thanks,
Calvin
[1]
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#MAX_PATH
[2]
https://social.msdn.microsoft.com/Forums/vstudio/en-US/3c093ea9-f0aa-446d-b648-2dabe8480430/stat-and-long-names?forum=vcgeneral
On 10/16/17, 3:15 PM, Calvin Cheung wrote:
> JBS: https://bugs.openjdk.java.net/browse/JDK-8188122
>
> Adding a warning message if the full path or the directory length
> exceeds MAX_PATH on windows.
>
> Example warning messages.
>
> 1) The full path exceeds MAX_PATH:
>
> Java HotSpot(TM) 64-Bit Server VM warning: construct full path name
> failed: total length 270 exceeds max length of 260
> dir
> T:\\testoutput\\jtreg\\JTwork\\classes\\2\\runtime\\LoadClass\\LongPath.d\\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> length 259
> name Hello.class length 11
>
> 2) The directory path exceeds MAX_PATH:
>
> Java HotSpot(TM) 64-Bit Server VM warning: os::stat failed: path
> length 265 exceeds max length 260
> path
> T:\\testoutput\\jtreg\\JTwork\\classes\\2\\runtime\\LoadClass\\LongPath.d\\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxx
>
> webrev:
> http://cr.openjdk.java.net/~ccheung/8188122/webrev.00/
>
> Testing:
> JPRT (including the new test)
>
> thanks,
> Calvin
More information about the hotspot-runtime-dev
mailing list