slachiewicz opened a new pull request, #433: URL: https://github.com/apache/maven-shared-utils/pull/433
`copyFile(File, File)` checked `source.exists()` before its symbolic-link branch, and `File.exists()` follows links, so a link whose target is missing was rejected as a missing file. The link branch now runs first. Two smaller gaps in the same path surfaced while testing: the link branch did not create the destination directory the way the regular-file path does, and the filtering overload then tried to copy POSIX permissions onto a dangling link, which follows the link and fails. Both are handled in this change. The two tests follow the scenarios from #110 by @kwin: a dangling link, and a relative link copied into another directory where its target does not resolve. Both are skipped on Windows like the other symlink tests here. `copyFile` is deprecated in favour of `Files.copy` with `NOFOLLOW_LINKS`, but consumers on the 3.x line still call it, so the fix is worth having. Fixes #306. Verified: `mvn -B verify` on JDK 17 -> Tests run: 793, Failures: 0, Errors: 0; on master the dangling-link test fails with `IOException: File .../dangling does not exist`. *This change was created with AI assistance.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
