RFR: 8267820: (fs) Files.copy should attempt to copy POSIX attributes when target file in custom file system [v2]

Brian Burkhalter bpb at openjdk.java.net
Tue Mar 8 20:22:49 UTC 2022


On Sun, 27 Feb 2022 18:01:42 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8267820: Set permissions only, not owner nor group
>
> src/java.base/share/classes/java/nio/file/CopyMoveHelper.java line 164:
> 
>> 162:                         dstPosixView.setOwner(srcPosixAttrs.owner());
>> 163:                         dstPosixView.setGroup(srcPosixAttrs.group());
>> 164:                     } catch (ProviderMismatchException ignore) {
> 
> I don't think setOwner/setGroup can work here.  It may be possible to obtain a UserPrincipalLookupService from the target file system and use it to lookup the string representation of the source user/group but it may not be reliable. It's also likely that these setXXX will fail when the target file is on the default file system. Maybe it would be simpler to limit the copying to just POSIX file permissions.

So changed in commit beaf175.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7627


More information about the nio-dev mailing list