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).

I think this is okay but would be good if @dbalek could comment.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/31646#pullrequestreview-4625266818

Reply via email to