[ 
https://issues.apache.org/jira/browse/HADOOP-6536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832133#action_12832133
 ] 

Ravi Gummadi commented on HADOOP-6536:
--------------------------------------

One more issue.

Currently FileUtil.fullyDelete(myDir) comes out stopping deletion of other 
files/directories if it is unable to delete a file/dir(say because of not 
having permissions to delete that file/dir) anywhere under myDir. This is 
because we return from method if the recursive call "if(!fullyDelete()) {return 
false;}" fails at any level of recursion.

Shouldn't it continue with deletion of other files/dirs continuing in the for 
loop instead of returning false here ? We can just set a boolean to false in 
this if() and can continue the for loop sothat return value of fullyDelete() is 
correct always.

For example, if we have myDir/subdir1/file1, myDir/subdir2/file2 and if 
fullyDelete() tries to delete file1 first and could not  delete it(because 
subDir1 has nonwritable permissions), then fullyDelete() currently comes out 
without deleting file2 and subdir2.

I guess fullyDelete() should delete as many files as possible(similar to 'rm 
-rf').

Thoughts ?

> FileUtil.fullyDelete(dir) behavior is not defined when we pass a symlink as 
> the argument
> ----------------------------------------------------------------------------------------
>
>                 Key: HADOOP-6536
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6536
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>            Reporter: Amareshwari Sriramadasu
>             Fix For: 0.22.0
>
>
> FileUtil.fullyDelete(dir) deletes contents of sym-linked directory when we 
> pass a symlink. If this is the behavior, it should be documented as so. 
> Or it should be changed not to delete the contents of the sym-linked 
> directory.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to