desruisseaux commented on PR #242:
URL:
https://github.com/apache/maven-clean-plugin/pull/242#issuecomment-2766421255
JUnit test failures in `CleanMojoTest.testFollowLinksWithWindowsJunction`,
which is executed only on Windows. The failed assertion (line 262) is:
```java
file = testDir.resolve("org-dir", "file.txt");
// (…snip…)
assertTrue(Files.exists(file));
```
I would need a Windows machine for debugging. But maybe it is related to the
following code in the previous version, that I didn't reproduced since
following symbolic links became delegated to `FileVisitor`:
```java
private boolean isSymbolicLink(Path path) throws IOException {
BasicFileAttributes attrs = Files.readAttributes(path,
BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
// MCLEAN-93: NTFS junctions have isDirectory() and isOther() attributes
set
return attrs.isSymbolicLink() || (attrs.isDirectory() &&
attrs.isOther());
}
```
It was used as below in the `delete` method of previous version:
```java
final boolean isSymlink = isSymbolicLink(file);
Path canonical = followSymlinks ? file : getCanonicalPath(file);
if (followSymlinks || !isSymlink) {
String prefix = !pathname.isEmpty() ? pathname + File.separatorChar : "";
try (Stream<Path> children = Files.list(canonical)) {
// File deleted here.
}
}
```
Will attempt to reproduce that by launching a new `FileVisitor` when a
Windows NTFS junction is detected.
--
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]