RFR: 8073061: (fs) Files.copy(foo, bar, REPLACE_EXISTING) deletes bar even if foo is not readable [v5]
Brian Burkhalter
bpb at openjdk.org
Fri Sep 15 15:57:42 UTC 2023
On Fri, 15 Sep 2023 14:12:02 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: Improve file access checking; modify a test; add a test
>
> src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 901:
>
>> 899: // ensure source can be moved
>> 900: try {
>> 901: access(source, W_OK);
>
> I think W_OK is correct but I wonder if this should move to where ensureEmptyDir is called as that is the additional checks for directories but copying.
That does not work. With this change the operation fails in `rename` and the existing target is deleted.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15501#discussion_r1327498227
More information about the nio-dev
mailing list