RFR: 8073061: (fs) Files.copy(foo, bar, REPLACE_EXISTING) deletes bar even if foo is not readable [v3]
Brian Burkhalter
bpb at openjdk.org
Thu Sep 7 16:14:43 UTC 2023
On Thu, 7 Sep 2023 16:08:41 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8073061: Address reviewer comments
>
> src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 920:
>
>> 918: // ensure source can be moved
>> 919: try {
>> 920: access(source, R_OK|W_OK);
>
> I wonder this should be changed to R_OK and done after the rename attempt has failed. I think that would make it consistent with the copy case (as move falls back to a copy when rename fails).
But the existing target would be deleted after line 928 before rename() is called.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15501#discussion_r1318837705
More information about the nio-dev
mailing list