RFR: 8376700: java/nio/file/DirectoryStream/SecureDS.java fails AtomicMoveNotSupportedException
Brian Burkhalter
bpb at openjdk.org
Thu Jan 29 18:52:04 UTC 2026
On Thu, 29 Jan 2026 13:11:10 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
>
> Before this PR, if the jtreg work directory and the /tmp directory locate in different linux volume or disk partition, test will report fails "java.nio.file.AtomicMoveNotSupportedException: file -> file: Invalid cross-device link". The linux syscall `rename()` doesn't support rename file across different volume, so I think the AtomicMoveNotSupportedException is not a JVM bug.
>
> This PR try to catch the AtomicMoveNotSupportedException and throw a SkippedException rather report fails. And split this test as two tests, one test for the default temporary directory '/tmp', another test for current jtreg work directory, this will make sure at least one test run non-skipped.
test/jdk/java/nio/file/DirectoryStream/SecureDS.java line 24:
> 22: */
> 23:
> 24: /* @test id=tmp
Instead of using IDs, it might be better to convert this test to JUnit 5 and use a `ValueSource` but not for this PR.
test/jdk/java/nio/file/DirectoryStream/SecureDS.java line 333:
> 331: delete(dir1);
> 332: delete(dir2);
> 333: stream1.close();
These stream `close()` calls could be eliminated by putting lines 266-269 into a `try()` block.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29487#discussion_r2743034729
PR Review Comment: https://git.openjdk.org/jdk/pull/29487#discussion_r2743027714
More information about the nio-dev
mailing list