RFR(S): 8188122: Path length limits on Windows leads to obscure class loading failures
Ioi Lam
ioi.lam at oracle.com
Mon Oct 16 23:15:38 UTC 2017
Hi Calvin,
From your test case:
44 private static final int MAX_PATH = 260;
...
53 int subDirLen = MAX_PATH - classDir.toString().length() - 2;
54 if (subDirLen > 0) {
55 char[] chars = new char[subDirLen];
56 Arrays.fill(chars, 'x');
57 String subPath = new String(chars);
58 destDir =
Paths.get(System.getProperty("test.classes"), subPath);
59 }
60
61 CompilerUtils.compile(sourceDir, destDir);
It looks like at least part of the JDK is able to read and write files
that are in paths longer than 260 characters.
For JDK-8188122, it seems the problem exists only with -Xbootclasspath/a
is used. Have you tested if you can use -cp to load classes from the
long directory?
If that's the case, maybe we should fix -Xbootclasspath/a so that it can
handle over 260 chars on Windows?
Thanks
- Ioi
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