On Tue, 23 Jun 2026 23:13:41 GMT, Ashay Rane <[email protected]> wrote:

> Before this patch, the test in `testExtractToReadOnlyDir()`, which
> validates whether making jimage extract to a read-only directory results
> in a failure, denied creating files but it did not deny creating
> subdirectories.  Although this does make jimage fail (and consequently,
> make the test pass), this isn't completely correct for two reasons.
> 
> First, the test invocation ends up writing a series of empty
> subdirectories, when in reality we don't want the destination directory
> to be modified at all.  Second, and more importantly, this leaves these
> directories in a state where Cygwin cannot remove them (see JBS issue
> for more details).
> 
> This patch fixes the problem by adding `APPEND_DATA` to the deny list,
> thus prohibiting the principal running the test from creating both files
> as well as directories.  This effectively sidesteps the issue of leaving
> broken directories on disk.
> 
> See
> https://learn.microsoft.com/en-us/windows/win32/fileio/file-access-rights-constants
> for details about the file permissions, reproduced in part below:
> 
>> FILE_WRITE_DATA: For a directory object, the right to create a file in
> the directory.
>>
>> FILE_APPEND_DATA: For a directory object, the right to create a
> subdirectory.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: be40b6bc
Author:    Ashay Rane <[email protected]>
Committer: Dušan Bálek <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/be40b6bcdab37368ea3c769e575b36e290d0c6a1
Stats:     3 lines in 1 file changed: 1 ins; 0 del; 2 mod

8387188: JImageExtractTest.java test should deny APPEND_DATA ACL in 
`testExtractToReadOnlyDir`

Reviewed-by: alanb, dbalek

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

PR: https://git.openjdk.org/jdk/pull/31646

Reply via email to