RFR: 8073061: (fs) Files.copy(foo, bar, REPLACE_EXISTING) deletes bar even if foo is not readable [v6]
Alan Bateman
alanb at openjdk.org
Sun Sep 17 08:21:49 UTC 2023
On Fri, 15 Sep 2023 17:37:30 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: Tweak CopyMoveHelper.copyToForeignTarget
test/jdk/java/nio/file/Files/CopyMoveVariations.java line 129:
> 127: }
> 128:
> 129: if (Files.getFileStore(source).supportsFileAttributeView("posix")) {
The `@requires` at the top of the test restricts execution to Linux and macOS for now. I would have thought it's a hard requirement that the file system support POSIX file permissions.
test/jdk/java/nio/file/Files/CopyMoveVariations.java line 135:
> 133: Files.setPosixFilePermissions(linkTarget, perms);
> 134: else
> 135: Files.setPosixFilePermissions(source, perms);
Should this be expanded to cover the permissions of the directory containing the source file, that's the case where the access(2) call may fail because the directory can't be updated.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15501#discussion_r1328061248
PR Review Comment: https://git.openjdk.org/jdk/pull/15501#discussion_r1328061472
More information about the nio-dev
mailing list