On Tue, 9 Jun 2026 19:11:21 GMT, Shiv Shah <[email protected]> wrote:
> FileUtils.copyDirectory() used Files.copy() for all entries including
> directories. When the destination is an existing directory (like PWD),
> Files.copy with REPLACE_EXISTING replaces the directory inode, corrupting it.
> Fixed by using Files.createDirectories() for directory entries and
> Files.copy() only for files. Added test verifying copyDirectory to PWD works
> correctly.
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
test/lib/jdk/test/lib/util/FileUtils.java line 395:
> 393: try {
> 394: Path destPath =
> dst.resolve(src.relativize(sourcePath));
> 395: if (Files.isDirectory(sourcePath)) {
Maybe better with below?
if (Files.isDirectory(sourcePath, LinkOption.NOFOLLOW_LINKS)) {
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31444#discussion_r3388252856