[
https://issues.apache.org/jira/browse/HADOOP-771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496987
]
Doug Cutting commented on HADOOP-771:
-------------------------------------
There were a number of things that could have prevented this. First, I'm told
this was triggered by a buggy script parser that parsed 'rm<space><space>foo'
as 'rm(""); foo();'. Fixing that would avoid this. Second, the script
execution engine should have used Hadoop's Trash feature, so that deletions go
through an intermediate directory. Third, rm("") shouldn't delete one's home
directory but instead throw an exception. And, finally, fourth, if we
distinguished between 'rm' and 'rmr', this might not have happened, but there's
a good chance that the script would have instead contained
'rmr<space><space>foo', and it still would have happened. So I think
distinguishing between recursive and non-recursive file deletion is the weakest
defense against this. It might not be a bad thing. Hadoop's own FsShell
already makes this distinction. Perhaps Pig's scripting language should too,
and perhaps Hadoop's APIs should even make this distinction. But I'd give the
first three fixes much higher priority.
> Namenode should return error when trying to delete non-empty directory
> ----------------------------------------------------------------------
>
> Key: HADOOP-771
> URL: https://issues.apache.org/jira/browse/HADOOP-771
> Project: Hadoop
> Issue Type: Improvement
> Components: dfs
> Affects Versions: 0.8.0
> Environment: all
> Reporter: Milind Bhandarkar
> Assigned To: Sameer Paranjpye
>
> Currently, the namenode.delete() method allows recursive deletion of a
> directory. That is, even a non-empty directory could be deleted using
> namenode.delete(). To avoid costly programmer errors, the namenode should not
> remove the non-empty directories in this method. Recursively deleting
> directory should either be performed with listPaths() followed by a delete()
> for every path, or with a specific namenode method such as deleteRecursive().
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.