RFR: 8368846: java/io/File/createTempFile/TargetDirectory fails when run by root user [v2]
Francesco Andreuzzi
fandreuzzi at openjdk.org
Fri Oct 10 00:42:41 UTC 2025
On Wed, 8 Oct 2025 23:26:41 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Francesco Andreuzzi has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>>
>> - review
>> - Merge branch 'master' into JDK-8368846
>> - nn
>> - cc
>> - convert to junit and skip
>
> test/jdk/java/io/File/createTempFile/TargetDirectory.java line 29:
>
>> 27: * @summary Verify directory parameter behavior in File.createTempFile(String,String,File)
>> 28: * @library /test/lib
>> 29: * @run junit/othervm TargetDirectory
>
> Is `othervm` needed here?
Not really, fixed
> test/jdk/java/io/File/createTempFile/TargetDirectory.java line 50:
>
>> 48: import jdk.test.lib.Platform;
>> 49:
>> 50: import static org.junit.jupiter.api.Assertions.*;
>
> I think you can dispense with the wild card at line 50 by doing:
>
> import static org.junit.jupiter.api.Assertions.assertThrows;
> import static org.junit.jupiter.api.Assertions.assertTrue;
Fixed
> test/jdk/java/io/File/createTempFile/TargetDirectory.java line 54:
>
>> 52: class TargetDirectory {
>> 53:
>> 54: @TempDir
>
> In my testing I saw this output for each of the four sub-tests:
>
> INFO: Skipping cleanup of temp dir [...] for field TargetDirectory.tempDir due to CleanupMode.NEVER.
>
> Should this have `CleanupMode.ALWAYS`? In the old version of the test there were explcit calls to `File.delete`.
Fixed, thanks
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27542#discussion_r2418247261
PR Review Comment: https://git.openjdk.org/jdk/pull/27542#discussion_r2418248157
PR Review Comment: https://git.openjdk.org/jdk/pull/27542#discussion_r2418248031
More information about the core-libs-dev
mailing list