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

John Zhuge commented on HADOOP-12718:
-------------------------------------

[~cnaude] Good point on that the patch alters {{FileSystem#listStatus}} 
interface to throw a new exception {{AccessDeniedException}}. If we'd keep the 
patch, we need to make sure all callers can handle the new exception.

On the other hand, nothing indicates {{listStatus}} can return {{null}} and 
some callers do not test {{null}} before use. See examples below. IMHO, 
{{listStatus}} should return empty list instead of {{null}}. This probably 
needs a separate jira to either change {{RawLocalFileSystem#listStatus}} not to 
return null or fix the callers. 

AbstractContractGetFileStatusTest#testListStatusEmptyDirectory:
{code}
    assertEquals("ls on an empty directory not of length 0", 0,
        fs.listStatus(subfolder).length);
{code}

ChecksumFileSystem#copyToLocalFile:
{code}
      FileStatus[] srcs = listStatus(src);
      for (FileStatus srcFile : srcs) {
{code}

SimpleCopyLIsting#getFileStatus:
{code}
      FileStatus[] fileStatuses = fileSystem.listStatus(path);
      if (excludeList != null && excludeList.size() > 0) {
        ArrayList<FileStatus> fileStatusList = new ArrayList<>();
        for(FileStatus status : fileStatuses) {
{code}

> Incorrect error message by fs -put local dir without permission
> ---------------------------------------------------------------
>
>                 Key: HADOOP-12718
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12718
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: John Zhuge
>            Assignee: John Zhuge
>            Priority: Minor
>              Labels: supportability
>             Fix For: 2.8.0
>
>         Attachments: HADOOP-12718.001.patch, HADOOP-12718.002.patch, 
> TestFsShellCopyPermission-output.001.txt, 
> TestFsShellCopyPermission-output.002.txt, TestFsShellCopyPermission.001.patch
>
>
> When the user doesn't have access permission to the local directory, the 
> "hadoop fs -put" command prints a confusing error message "No such file or 
> directory".
> {noformat}
> $ whoami
> systest
> $ cd /home/systest
> $ ls -ld .
> drwx------. 4 systest systest 4096 Jan 13 14:21 .
> $ mkdir d1
> $ sudo -u hdfs hadoop fs -put d1 /tmp
> put: `d1': No such file or directory
> {noformat}
> It will be more informative if the message is:
> {noformat}
> put: d1 (Permission denied)
> {noformat}
> If the source is a local file, the error message is ok:
> {noformat}
> put: f1 (Permission denied)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to