RFR: 8322881: java/nio/file/Files/CopyMoveVariations.java fails with AccessDeniedException due to permissions of files in /tmp [v4]

Brian Burkhalter bpb at openjdk.org
Thu Feb 22 17:34:54 UTC 2024


On Thu, 22 Feb 2024 06:25:08 GMT, yaqsun <duke at openjdk.org> wrote:

>> testcase: java/nio/file/Files/CopyMoveVariations.java
>> 
>> Method createTempFile() creates "/tmp/file*" that it causes file copy permission issue when running through jtreg.
>> 
>> The method call `Files.move(source, target, options)` by Regular User causes AccessDeniedException due to ` /tmp/file*` is created when running through jtreg.
>> 
>> Create files for method "createTempFile()" passing in the current path(jtreg_test_jdk_java_nio_file_Files_CopyMoveVariations_java/scratch or JTwork/scratch).
>
> yaqsun has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8322881: Method createTempFile() causes file copy permission issue when running through jtreg

test/jdk/java/nio/file/Files/CopyMoveVariations.java line 2:

> 1: /*
> 2:  * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.

The copyright needs to be `2023, 2024`, not just `2024`.

test/jdk/java/nio/file/Files/CopyMoveVariations.java line 75:

> 73:         Path tmp = null;
> 74:         try {
> 75:             tmp = Files.createTempFile(Path.of("."), "this", "that");

Could you change `tmp` to be a constant, for example

    private static final Path CURRENT_DIR;

(or `CWD`) and change `current` to be `CURRENT_DIR`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17235#discussion_r1499615498
PR Review Comment: https://git.openjdk.org/jdk/pull/17235#discussion_r1499618552


More information about the nio-dev mailing list