[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] [Commented] (IO-850) DeletingPathVisitor always fails to delete a dir when symbolic link targ
From:       "Gary D. Gregory (Jira)" <jira () apache ! org>
Date:       2024-04-29 12:30:00
Message-ID: JIRA.13573640.1711616292000.46135.1714393800023 () Atlassian ! JIRA
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/IO-850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17841974#comment-17841974 \
] 

Gary D. Gregory commented on IO-850:
------------------------------------

Note that *2.16.1* is available.


> DeletingPathVisitor always fails to delete a dir when symbolic link target is \
>                 deleted before the link itself
> ------------------------------------------------------------------------------------------------------------
>  
> Key: IO-850
> URL: https://issues.apache.org/jira/browse/IO-850
> Project: Commons IO
> Issue Type: Bug
> Affects Versions: 2.15.1
> Reporter: Johan Compagner
> Priority: Major
> 
> DeletingPathVisitor doesn't give us an option for the SimplePathVisitor superclass \
> visitFileFailedFunction property (that constructor also exposed to the intermediate \
> class CountingPathVisitor is not used/exposed in the DeletingPathVisitor class) So \
> i can't use that but the DeletingPathVisitor should use that, because i can't \
> delete a certain directory if you have something like this: 
> parentdir:
> adir
> symboliclinkpointingtoadir
> 
> if that happens and i call this Files.walkFileTree(path, \
> DeletingPathVisitor.withLongCounters()); on the parent dir and it first deletes \
> "adir"   then it will completely fail to delete that parentdir (or clean the parent \
> dir) this is because Files will try to open the directory stream of that \
> "symboliclinkpointingtoadir" and that will fail because the "adir" is already gone. \
> so its now an invalid symbolic link. The the Files walkFileTree implementation does \
> call visitFileFailed but that is competely not implemented in the \
> DeletingPathVisitor and i have no means of also adding it to it. i think \
> DeletingPathVisitor should just do what i now do in my own implementation: 
> 
> {code:java}
> public FileVisitResult visitFileFailed(Path file, IOException exc) throws \
> IOException {
> Files.deleteIfExists(file);
> return FileVisitResult.CONTINUE;
> }
> 
> {code}
> just try to delete that file and be done with it (this works fine)
> now it bombs out because that IOException is something like "FileNotFound"  
> and if if i call it again and again on that dir (so "adir" is already gone) the \
> DeletingPathVisitor is never able to delete/clean that parent dir it always bombs \
> out. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic