RFR: 8356127: (fs) UnixFileSystemProvider.implDelete could save a syscall in some cases
Alan Bateman
alanb at openjdk.org
Thu May 8 07:16:54 UTC 2025
On Wed, 7 May 2025 21:44:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Modify `UnixFileSystemProvider.implDelete` to attempt first to delete the file using `unlink` and, if that fails, fall back to using `rmdir` if the file is a directory.
I think this will need to be predicated on a capability (UnixNativeDispatcher.SUPPORTS_xxx) so that it only unconditionally attempts unlink on Linux or other operating systems that document EISDIR. The risk with the proposed change is that unlink will unlink a non-empty directory, e.g. macOS with super-user.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25107#issuecomment-2862022855
More information about the nio-dev
mailing list