RFR: 8273922: (fs) UserDefinedFileAttributeView doesn't handle file names that are just under the MAX_PATH limit (win) [v5]
Mike Hearn
duke at openjdk.java.net
Wed Nov 3 18:51:16 UTC 2021
On Tue, 2 Nov 2021 23:37:44 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Modify `sun.nio.fs.WindowsUserDefinedFileAttributeView.join(WindowsPath,String)` to handle file names which exceed the limit.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8273922: Change getNameCount() != 1 tp getParent() != null
@bplb Unfortunately this doesn't work for me and actually, yields a regression. After trying the patch I now get this error:
Caused by: java.lang.AssertionError: Illegal character [?] in path at index 2: \?\C:\BuildAgent\work\88d980e906e2ca5f\modules\hydraulic.parts.testing\build\tests\parts\cache\entries\4b\4f\4b4f0c6a0f0d079b\content\Hello World.app\Contents\Frameworks\Sparkle.framework\Versions\A\Resources\Base.lproj\SUUpdatePermissionPrompt.nib\keyedobjects-110000.nib:posixmode
at java.base/sun.nio.fs.WindowsPath.createFromNormalizedPath(WindowsPath.java:119)
at java.base/sun.nio.fs.WindowsPath.createFromNormalizedPath(WindowsPath.java:129)
at java.base/sun.nio.fs.WindowsUserDefinedFileAttributeView.join(WindowsUserDefinedFileAttributeView.java:65)
at java.base/sun.nio.fs.WindowsUserDefinedFileAttributeView.write(WindowsUserDefinedFileAttributeView.java:215)
The stack trace is truncated because AssertionError is rethrown without a cause, but the problem seems to be coming from the `nextSlash` method. Basically, now the `\?` prefixed path is being passed to `createFromNormalizedPath` but it's not expecting that - the code (eventually) tries to scan past slashes and is unhappy because ? is not a valid character for a Windows path, except when it's in the magic prefix.
I don't know why the unit test doesn't pick up on this problem or how exactly the code gets to that position. As you can see, the path it's trying to set an EA on here is very long indeed. Perhaps this is a pre-existing bug in WindowsPath.java exposed by the change?
I'm not sure which version you mean sorry. Version 2 of this PR? Which commit does that correspond to? I can try it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5594
More information about the nio-dev
mailing list