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

Eli Collins commented on HADOOP-6585:
-------------------------------------

The original symlinks change made FileStatus#isDir return false for symlinks 
because that seemed logical, but Sanjay pointed out in HADOOP-6421:
bq. I missed that this breaks compatibility in a subtle way: Negation of 
FileStatus#isDir() is normally used to see if the target is a file. This will 
now break if the target happens to be symlink.  
I assumed that in addition to deprecating FileStatus#isDir we need to preserve 
the old behavior that !isDir implies a file so that clients that use FileStatus 
and this common idiom that were written before symlinks won't break when 
symlinks are introduced, though these clients are going to break anyway (though 
perhaps less frequently) because they will see symlinks as directories since 
they were only written to check isDir. Therefore I propose that we *do not* 
modify the isDir behavior in this change (ie it returns trues iff the 
FileStatus represents a directory) and we just deprecate it. I'll update the 
patch.

> Add FileStatus#isDirectory and isFile
> -------------------------------------
>
>                 Key: HADOOP-6585
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6585
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: fs
>    Affects Versions: 0.21.0, 0.22.0
>            Reporter: Eli Collins
>            Assignee: Eli Collins
>            Priority: Blocker
>             Fix For: 0.21.0, 0.22.0
>
>         Attachments: hadoop-6585-1.patch, hadoop-6585-2.patch, 
> hadoop-6585-3.patch
>
>
> Per Sanjay's suggestion in HADOOP-6421 let's deprecate FileStatus#isDir() and 
> add isDirectory() and isFile() to compliment isSymlink. Currently clients 
> assume !isDir() implies a file, which is no longer true with symlinks. I'll 
> file a separate jira to change the various uses of !isDir() to be isFile() or 
> isFile() or isSymlink() as appropriate.

-- 
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