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

Alan Bateman alanb at openjdk.org
Fri Sep 15 14:14:43 UTC 2023


On Wed, 13 Sep 2023 02:32:31 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: 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.

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

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


More information about the nio-dev mailing list