[
https://issues.apache.org/jira/browse/HADOOP-12718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15647270#comment-15647270
]
Steve Loughran commented on HADOOP-12718:
-----------------------------------------
Looking at this patch. I think I'd prefer it if the tests (a) looked for a
constant string declared in {{FSExceptionMessages}}, rather than "permission
denied". Tests look for strings are always so, so brittle. And we should be
looking at a consistent error message for all those documentation and support
call issues.
I think the asserts could also include the full text
{code}
private void assertPermissionDenied(String text){
assertTrue(text + " does not contain " + FSExceptionMessages.NO_PERMISSION,
text.contains(FSExceptionMessages.NO_PERMISSION)
}
One thing to consider —and I don't think there's a right or wrong here— is
whether to make the exception an {{java.nio.file.AccessDeniedException}}, or a
{{org.apache.hadoop.fs.PathPermissionException}}. Both of these separate out
the path for analysis later.
I've just checked S3AFileSystem; there we through the
{{AccessDeniedException}}; I don't know if that's good —or should it switch to
{{org.apache.hadoop.fs.PathPermissionException}}.
That's really a separate issue; I'd go through the blobstores and make them
consistent if we ever chose one exception & message.
> 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
> Labels: supportability
> Attachments: HADOOP-12718.001.patch, HADOOP-12718.002.patch,
> HADOOP-12718.003.patch, HADOOP-12718.004.patch, HADOOP-12718.005.patch,
> HADOOP-12718.006.patch, HADOOP-12718.007.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]