[
https://issues.apache.org/jira/browse/IO-702?focusedWorklogId=536766&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-536766
]
ASF GitHub Bot logged work on IO-702:
-------------------------------------
Author: ASF GitHub Bot
Created on: 16/Jan/21 10:12
Start Date: 16/Jan/21 10:12
Worklog Time Spent: 10m
Work Description: boris-unckel edited a comment on pull request #187:
URL: https://github.com/apache/commons-io/pull/187#issuecomment-761536421
@garydgregory
Now it fails again in deleteDirectory (which is not the cause)
`Error:
org.apache.commons.io.FileUtilsDeleteDirectoryLinuxTestCase.testDeleteInvalidLinks
Time elapsed: 0.003 s <<< ERROR!
java.nio.file.DirectoryNotEmptyException:
/tmp/junit16834268871756684963/realParentDirC
at
java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:247)
at
java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
at java.base/java.nio.file.Files.delete(Files.java:1141)
at org.apache.commons.io.FileUtils.delete(FileUtils.java:1170)
at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1189)
at
org.apache.commons.io.FileUtilsDeleteDirectoryBaseTestCase.testDeleteInvalidLinks(FileUtilsDeleteDirectoryBaseTestCase.java:216)`
IMO This stacktrace is misleading because originally forceDelete fails to
delete the broken link. It's in the DeletingPathVisitor.visitFile:
For the broken link "linkToB" Files.exists(file, linkOptions) returns false.
For regular links and regular files it returns true.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 536766)
Time Spent: 2h (was: 1h 50m)
> FileUtils.forceDelete does not delete invalid links
> ---------------------------------------------------
>
> Key: IO-702
> URL: https://issues.apache.org/jira/browse/IO-702
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.8.0
> Reporter: Boris Unckel
> Priority: Critical
> Time Spent: 2h
> Remaining Estimate: 0h
>
> The current implementation of FileUtils.forceDelete does not delete invalid
> links. Invalid links means one pointing to a non existing directory. This is
> _not related_ to the intended behaviour to _keep the destination_ of the link.
> The FileUtils.cleanDirectory is based on forceDelete but does not check the
> result. FileUtils.cleanDirectory assumes "no exception" means "directory is
> clean".
> FileUtils.deleteDirectory fails with "directory not empty".
> Testcase result (will provide that)
> {code:java}
> java.nio.file.DirectoryNotEmptyException:
> /tmp/junit4962570063696933090/realParentDirC
> at
> java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:246)
> at
> java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
> at java.base/java.nio.file.Files.delete(Files.java:1146)
> at org.apache.commons.io.FileUtils.delete(FileUtils.java:1173)
> at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1192)
> at
> org.apache.commons.io.FileUtilsDeleteDirectoryBaseTestCase.testDeleteInvalidLinks(FileUtilsDeleteDirectoryBaseTestCase.java:216)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)