RFR: 8073061: (fs) Files.copy(foo, bar, REPLACE_EXISTING) deletes bar even if foo is not readable [v3]

Alan Bateman alanb at openjdk.org
Thu Sep 7 16:11:41 UTC 2023


On Tue, 5 Sep 2023 17:05:29 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Check that the source is readable before deleting the destination.
>
> 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).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15501#discussion_r1318832116


More information about the nio-dev mailing list