RFR: 8295753: (fs) UnixPath::toRealPath does not return correct case when links not followed [v2]
Brian Burkhalter
bpb at openjdk.org
Thu Nov 3 01:10:12 UTC 2022
On Tue, 1 Nov 2022 07:47:19 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>>
>> - Merge
>> - 8295753: Use UnixDirectoryStream; compare UnixFileKeys; add SecurityManager
>> - 8295753: (fs) UnixPath::toRealPath does not return correct case when links not followed
>
> src/java.base/unix/classes/sun/nio/fs/UnixPath.java line 871:
>
>> 869:
>> 870: // Return if the file system is not both case insensitive and retentive
>> 871: if (!fs.isCaseInsensitiveAndRetentive())
>
> I think we need to find a better name for this method. Maybe "Preserving" rather than "Retentive" would work better here.
Renamed in 49d18c6a39d9d70b7da91c5b4b3740ba3c890948.
> src/java.base/unix/classes/sun/nio/fs/UnixPath.java line 906:
>
>> 904: // Check readbility of path thus far
>> 905: if (sm != null)
>> 906: sm.checkRead(path.getPathForPermissionCheck());
>
> I don't think this permission check is needed here. The "checkRead" at line 816 does the require check for the method.
Removed in 49d18c6a39d9d70b7da91c5b4b3740ba3c890948.
> src/java.base/unix/classes/sun/nio/fs/UnixPath.java line 914:
>
>> 912: attributes = UnixFileAttributes.get(toUnixPath(p), false);
>> 913: } catch (UnixException x) {
>> 914: x.rethrowAsIOException(this);
>
> This is problematic as it means that toRealPath can fail trying to access a file that is not in the path. Also given that it is only looking for one file then it might be simpler to just handle in the loop rather than as a filter.
Addressed in 49d18c6a39d9d70b7da91c5b4b3740ba3c890948.
-------------
PR: https://git.openjdk.org/jdk/pull/10843
More information about the nio-dev
mailing list