On 21/02/2018 12:23, Michal Vala wrote:
Hi,
I'm trying to investigate failure of JImageExtractTest on Windows.
Failing method is testExtractToReadOnlyDir, issue is simple. It is
trying to extract jimage to read-only directory and it must fail.
AFAIK it is not possible to create read-only directory. I tried set
rights programaticaly from java, manually from windows explorer and
windows cmd. Without any success. It effectively just deny access from
explorer and cmd.
Is there any Windows expert who can confirm this or suggest solution?
Only solution I've found is to write something to some mounted ISO
image, which is not an option here.
In case this will be confirmed I suggest to skip this single test on
Windows.
I don't have time to detail this just now but you can specify a DACL (as
a FileAttribute<List<AclEntry>>) to Files.createDirectory so that the
directory is created with an initial DACL that denies access.
Alternatively, you can change the DACL of an existing directory. Yes, a
bit complicated to setup. I don't think it would be too much of a
surprise for this sub-test to only execute on platforms that support
POSIX file permissions (I think some of the tests check this already).
-Alan