RFR: 8316000: File.setExecutable silently fails if file does not exist
Brian Burkhalter
bpb at openjdk.org
Thu Sep 14 18:06:39 UTC 2023
On Tue, 12 Sep 2023 06:27:42 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> src/java.base/windows/native/libjava/WinNTFileSystem_md.c line 479:
>>
>>> 477: if (access == java_io_FileSystem_ACCESS_READ ||
>>> 478: access == java_io_FileSystem_ACCESS_EXECUTE) {
>>> 479: return _waccess(pathbuf, 0) == 0 ? enable : JNI_FALSE;
>>
>> Here `enable` is returned for backward compatibility, but per the specification it seems that `JNI_TRUE` should be returned instead.
>
> I don't think this is right, at least it doesn't work with ACLs and file system security so it can't test if the file is executable. Also I have a concern about mixing win32 and C runtime functions here. The main issue with these setXXX methods is that don't map to DOS file attributes or ACL based security so they will need to fail for some cases.
If this code does not interact with ACL-based security, then it's not clear to me that there's anything to be done here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15673#discussion_r1326342392
More information about the core-libs-dev
mailing list