[ http://issues.apache.org/jira/browse/HADOOP-281?page=comments#action_12421706 ] Konstantin Shvachko commented on HADOOP-281: --------------------------------------------
I think addNode() is a good place to check whether the parent is a directory. mkdirs() does not need to check all parents in the path, just the last one, since all other parents have already been checked before. I agree with Arun, the return value of mkdirs() should be checked every time it is called to make sure the directories were actually created, including FileUtil copy methods. For mkdirs() I would let the FileNotFoundException exception thrown by addNode() go through, rather than catching it and returning boolean, so that whoever calls mkdirs() could decide what to do. But there might be different opinions on that, and this will require more code changes. > dfs.FSDirectory.mkdirs can create sub-directories of a file! > ------------------------------------------------------------ > > Key: HADOOP-281 > URL: http://issues.apache.org/jira/browse/HADOOP-281 > Project: Hadoop > Issue Type: Bug > Affects Versions: 0.3.1 > Reporter: Sameer Paranjpye > Fix For: 0.5.0 > > Attachments: addNode.patch, mkdirs.patch, TestDFSMkdirs.java > > > dfs.FSDirectory.mkdirs will merrily adds children to a directory tree node > without checking whether it represents a directory. So it is possible to > create a subdirectories of a file. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
