hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-9972) new APIs for listStatus and globStatus to deal with symlinks
Date Fri, 20 Sep 2013 18:07:53 GMT

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

Colin Patrick McCabe commented on HADOOP-9972:
----------------------------------------------

Hmm.  We could have a convenience method called {{listLinkStatus}} which just called into
{{listStatus}} with the correct {{PathOptions}}.  I sort of lean towards fewer APIs rather
than more, but maybe it makes sense.

Shell globbing doesn't ignore all errors, btw.
{code}
cmccabe@keter:~/mydir> mkdir a
cmccabe@keter:~/mydir> mkdir b
cmccabe@keter:~/mydir> touch a/c
cmccabe@keter:~/mydir> touch b/c
cmccabe@keter:~/mydir> sudo chmod 000 b
root's password:
cmccabe@keter:~/mydir> ls */c
a/c
cmccabe@keter:~/mydir> ls b/c
ls: cannot access b/c: Permission denied
cmccabe@keter:~/mydir> ls
a  b
cmccabe@keter:~/mydir> ls *
a:
c
ls: cannot open directory b: Permission denied
{code}

It's interesting that it ignores the error in the case of {{ls */c}}, but not in the case
of {{ls *}}.  Hadoop's shell would abort (and give no results) in both of those cases, which
I think is suboptimal.
                
> new APIs for listStatus and globStatus to deal with symlinks
> ------------------------------------------------------------
>
>                 Key: HADOOP-9972
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9972
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: fs
>    Affects Versions: 2.1.1-beta
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>
> Based on the discussion in HADOOP-9912, we need new APIs for FileSystem to deal with
symlinks.  The issue is that code has been written which is incompatible with the existence
of things which are not files or directories.  For example,
> there is a lot of code out there that looks at FileStatus#isFile, and
> if it returns false, assumes that what it is looking at is a
> directory.  In the case of a symlink, this assumption is incorrect.
> It seems reasonable to make the default behavior of {{FileSystem#listStatus}} and {{FileSystem#globStatus}}
be fully resolving symlinks, and ignoring dangling ones.  This will prevent incompatibility
with existing MR jobs and other HDFS users.  We should also add new versions of listStatus
and globStatus that allow new, symlink-aware code to deal with symlinks as symlinks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message